Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP]4987+4988: Angular select class implementation and refactoring tests #5096

Open
wants to merge 4 commits into
base: angular_rework_development
Choose a base branch
from

Conversation

b14ckster
Copy link
Contributor

No description provided.


public class Select extends UIBaseElement<SelectAssert> implements HasPlaceholder, IClickable {

@JDIAction
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JDIAction должны быть с текстовым описанием


@JDIAction
public void expand() {
click();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а если элемент уже открыт, то клик по нему приведет не к открытию


@JDIAction
public String role() {
return core().getAttribute("name");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

дублирует предыдущий


@JDIAction
public String name() {
return core().getAttribute("name");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

какой смысл проверять name?

}

@Override
public void click() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а зачем переопределение в таком виде? так и будет работать

@MayaElf MayaElf requested a review from vklonin October 18, 2023 11:14
@MayaElf MayaElf self-assigned this Oct 18, 2023
@MayaElf MayaElf changed the title 4987+4988: Angular select class implementation and refactoring tests [WIP]4987+4988: Angular select class implementation and refactoring tests Oct 18, 2023
@MayaElf MayaElf force-pushed the angular_select_implementation branch from 7e0a70f to 5535a81 Compare October 18, 2023 12:39
@MayaElf MayaElf removed their assignment Nov 9, 2023
@kmikheeva kmikheeva self-assigned this Nov 14, 2023
}

@JDIAction("Is '{name}' disabled")
public boolean disabled() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Condition is different
  2. Enabled should be overrided

}

protected UIElement toggle() {
return new UIElement(By.xpath(format(toggle,
this.core().locator.printLocator().replace(smartSharp, "")
.replace(cssSharp, "").replace("'", ""))));
}

@JDIAction("Get '{name}' name")
public String name() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not need this method

import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.hasItems;

public class SelectAssert extends UIAssert<SelectAssert, MaterialSelector> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public class SelectAssert extends UIAssert<SelectAssert, MaterialSelector> {
public class MaterialSelectAssert extends UIAssert<MaterialSelectAssert, MaterialSelector> {

return selected(getEnumValue(option));
}

public <T extends Enum<?>> SelectAssert value(final T option) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is near to impossible to guess that value means that there is an option with this value, it should be selected value

public class MaterialSelector extends UIBaseElement<MaterialSelectorAssert> implements HasLabel {
public String toggle = "//*[@id='%s']//div[contains(@class,'mat-select-arrow')][not(contains(@class, 'wrapper'))]";
public class MaterialSelector extends UIBaseElement<SelectAssert> implements HasLabel {
public String toggle = "//*[@id='%s']//div[contains(@class,'mat-mdc-select-arrow')][not(contains(@class, 'wrapper'))]";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Locators should be much more simple, without id and other things

public void multipleSelect(int... indexes) {
WebList options = getOptions();
for (int index : indexes) {
options.get(index).click();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the value is already selected, click will unselect it

public void multipleSelect(String... values) {
WebList options = getOptions();
for (String str : values) {
options.get(str).click();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the value is already selected, click will unselect it

@JDIAction("Select '{0}' in '{name}'")
public void select(int index) {
WebList options = getOptions();
options.get(index).click();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the value is already selected, click will unselect it

public void select(String value) {
if (value == null) return;
WebList options = getOptions();
options.get(value).click();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the value is already selected, click will unselect it

public class MaterialSelector extends UIBaseElement<MaterialSelectorAssert> implements HasLabel {
public String toggle = "//*[@id='%s']//div[contains(@class,'mat-select-arrow')][not(contains(@class, 'wrapper'))]";
public class MaterialSelector extends UIBaseElement<SelectAssert> implements HasLabel {
public String toggle = "//*[@id='%s']//div[contains(@class,'mat-mdc-select-arrow')][not(contains(@class, 'wrapper'))]";
public String hintLocator = "//*[@id='%s']/ancestor::mat-form-field//mat-hint";
public String errorLocator = "//*[@id='%s']/ancestor::mat-form-field//mat-error";
public String smart = "smart: ";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dropdown id not need to get selected value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tests refactoring: select element Create class implementing angular element Select
5 participants