fix flaky profiles tests (check if profiles dropdown is closed)

This commit is contained in:
Seraphym-Tuhai 2023-05-02 15:26:54 +03:00
parent a1967865a9
commit 53b1f03a49
2 changed files with 15 additions and 5 deletions

View File

@ -27,7 +27,7 @@ public class SideBarMenuViewElements extends AbstractBasePage {
private static final String RULE_CHAINS_BTN = "//mat-toolbar//a[@href='/ruleChains']";
private static final String CUSTOMER_BTN = "//mat-toolbar//a[@href='/customers']";
private static final String DASHBOARD_BTN = "//mat-toolbar//a[@href='/dashboards']";
private static final String PROFILES_BTN = "//mat-toolbar//mat-icon[text()='badge']/ancestor::tb-menu-toggle";
private static final String PROFILES_DROPDOWN = "//mat-toolbar//mat-icon[text()='badge']/ancestor::a//span[contains(@class,'pull-right')]";
private static final String DEVICE_PROFILE_BTN = "//mat-toolbar//a[@href='/profiles/deviceProfiles']";
private static final String ASSET_PROFILE_BTN = "//mat-toolbar//a[@href='/profiles/assetProfiles']";
private static final String ALARMS_BTN = "//mat-toolbar//a[@href='/alarms']";
@ -52,8 +52,8 @@ public class SideBarMenuViewElements extends AbstractBasePage {
return waitUntilElementToBeClickable(DASHBOARD_BTN);
}
public WebElement profilesBtn() {
return waitUntilElementToBeClickable(PROFILES_BTN);
public WebElement profilesDropdown() {
return waitUntilElementToBeClickable(PROFILES_DROPDOWN);
}
public WebElement deviceProfileBtn() {

View File

@ -24,12 +24,12 @@ public class SideBarMenuViewHelper extends SideBarMenuViewElements {
}
public void openDeviceProfiles() {
profilesBtn().click();
openProfilesDropDown();
deviceProfileBtn().click();
}
public void openAssetProfiles() {
profilesBtn().click();
openProfilesDropDown();
assetProfileBtn().click();
}
@ -54,10 +54,20 @@ public class SideBarMenuViewHelper extends SideBarMenuViewElements {
}
}
public void openProfilesDropDown() {
if (profilesIsClose()) {
profilesDropdown().click();
}
}
public boolean entitiesDropdownIsClose() {
return dropdownIsClose(entitiesDropdown());
}
public boolean profilesIsClose() {
return dropdownIsClose(profilesDropdown());
}
private boolean dropdownIsClose(WebElement dropdown) {
return !dropdown.getAttribute("class").contains("tb-toggled");
}