diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OtherPageElements.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OtherPageElements.java index ba81eae8f2..a70aae9fd1 100644 --- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OtherPageElements.java +++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OtherPageElements.java @@ -34,7 +34,7 @@ public class OtherPageElements extends AbstractBasePage { private static final String WARNING_DELETE_POPUP_YES = "//tb-confirm-dialog//button[2]"; private static final String WARNING_DELETE_POPUP_TITLE = "//tb-confirm-dialog/h2"; private static final String REFRESH_BTN = "//mat-icon[contains(text(),'refresh')]/.."; - private static final String HELP_BTN = "//mat-icon[contains(text(),'help')]/.."; + private static final String HELP_BTN = "//mat-icon[contains(text(),'help')]/ancestor::button"; private static final String CHECKBOX = "//mat-row//span[contains(text(),'%s')]/../..//mat-checkbox"; private static final String CHECKBOXES = "//tbody//mat-checkbox"; private static final String DELETE_SELECTED_BTN = "//span[contains(text(),'selected')]//..//mat-icon/../.."; diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/CreateDeviceProfileImportTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/CreateDeviceProfileImportTest.java index 540b8581a8..421b8ed2c4 100644 --- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/CreateDeviceProfileImportTest.java +++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/CreateDeviceProfileImportTest.java @@ -9,12 +9,13 @@ import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest; import org.thingsboard.server.msa.ui.pages.LoginPageHelper; import org.thingsboard.server.msa.ui.pages.ProfilesPageHelper; import org.thingsboard.server.msa.ui.pages.SideBarMenuViewHelper; +import org.thingsboard.server.msa.ui.utils.EntityPrototypes; import static org.thingsboard.server.msa.ui.utils.Const.EMPTY_IMPORT_MESSAGE; -import static org.thingsboard.server.msa.ui.utils.Const.ENTITY_NAME; import static org.thingsboard.server.msa.ui.utils.Const.IMPORT_DEVICE_PROFILE_FILE_NAME; import static org.thingsboard.server.msa.ui.utils.Const.IMPORT_DEVICE_PROFILE_NAME; import static org.thingsboard.server.msa.ui.utils.Const.IMPORT_TXT_FILE_NAME; +import static org.thingsboard.server.msa.ui.utils.Const.SAME_NAME_WARNING_DEVICE_PROFILE_MESSAGE; import static org.thingsboard.server.msa.ui.utils.Const.TENANT_EMAIL; import static org.thingsboard.server.msa.ui.utils.Const.TENANT_PASSWORD; @@ -82,16 +83,29 @@ public class CreateDeviceProfileImportTest extends AbstractDriverBaseTest { @Test public void importDeviceProfileWithSameName() { - String name = ENTITY_NAME; - testRestClient.postDeviceProfile() + String name = IMPORT_DEVICE_PROFILE_NAME; + testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name)); + this.name = name; sideBarMenuView.openDeviceProfiles(); profilesPage.openImportDeviceProfileView(); profilesPage.browseFile().sendKeys(absolutePathToFileImportDeviceProfile); profilesPage.importBrowseFileBtn().click(); - this.name = IMPORT_DEVICE_PROFILE_NAME; profilesPage.refreshBtn().click(); + Assert.assertNotNull(profilesPage.warningMessage()); + Assert.assertTrue(profilesPage.warningMessage().isDisplayed()); + Assert.assertEquals(profilesPage.warningMessage().getText(), SAME_NAME_WARNING_DEVICE_PROFILE_MESSAGE); + } + + @Test + public void importDeviceProfileWithoutRefresh() { + sideBarMenuView.openDeviceProfiles(); + profilesPage.openImportDeviceProfileView(); + profilesPage.browseFile().sendKeys(absolutePathToFileImportDeviceProfile); + profilesPage.importBrowseFileBtn().click(); + name = IMPORT_DEVICE_PROFILE_NAME; + Assert.assertNotNull(profilesPage.entity(IMPORT_DEVICE_PROFILE_NAME)); Assert.assertTrue(profilesPage.entity(IMPORT_DEVICE_PROFILE_NAME).isDisplayed()); }