-
Notifications
You must be signed in to change notification settings - Fork 47
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
base: angular_rework_development
Are you sure you want to change the base?
[WIP]4987+4988: Angular select class implementation and refactoring tests #5096
Conversation
|
||
public class Select extends UIBaseElement<SelectAssert> implements HasPlaceholder, IClickable { | ||
|
||
@JDIAction |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а зачем переопределение в таком виде? так и будет работать
7e0a70f
to
5535a81
Compare
3ad2d56
to
e099e7c
Compare
} | ||
|
||
@JDIAction("Is '{name}' disabled") | ||
public boolean disabled() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Condition is different
- 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() { |
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) { |
There was a problem hiding this comment.
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'))]"; |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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: "; |
There was a problem hiding this comment.
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
No description provided.