Browse Source

add tests on delete several device profiles

pull/7897/head
Seraphym-Tuhai 4 years ago
parent
commit
eadc48efe4
  1. 18
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/ProfilesPageHelper.java
  2. 1
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/CreateDeviceProfileImportTest.java
  3. 1
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/CreateDeviceProfileTest.java
  4. 84
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/DeleteSeveralDeviceProfilesTest.java
  5. 22
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/MakeDeviceProfileDefaultTest.java

18
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/ProfilesPageHelper.java

@ -1,12 +1,12 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -18,6 +18,7 @@ package org.thingsboard.server.msa.ui.pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.testng.Assert;
public class ProfilesPageHelper extends ProfilesPageElements {
public ProfilesPageHelper(WebDriver driver) {
@ -131,5 +132,14 @@ public class ProfilesPageHelper extends ProfilesPageElements {
public void sortByNameDown() {
doubleClick(sortByNameBtn());
}
public boolean profileIsNotPresent(String name) {
return elementsIsNotPresent(getEntity(name));
}
public void assertCheckBoxIsNotDisplayed(String name) {
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("(//mat-checkbox)[2]")));
Assert.assertFalse(driver.findElement(By.xpath(getCheckbox(name))).isDisplayed());
}
}

1
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/CreateDeviceProfileImportTest.java

@ -42,7 +42,6 @@ public class CreateDeviceProfileImportTest extends AbstractDriverBaseTest {
private final String absolutePathToFileImportTxt = getClass().getClassLoader().getResource(IMPORT_TXT_FILE_NAME).getPath();
private String name;
@BeforeMethod
public void login() {
openLocalhost();

1
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/CreateDeviceProfileTest.java

@ -41,7 +41,6 @@ public class CreateDeviceProfileTest extends AbstractDriverBaseTest {
private ProfilesPageHelper profilesPage;
private String name;
@BeforeMethod
public void login() {
openLocalhost();

84
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/DeleteSeveralDeviceProfilesTest.java

@ -0,0 +1,84 @@
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke;
import io.qameta.allure.Description;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
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 static org.thingsboard.server.msa.ui.utils.Const.*;
import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultDeviceProfile;
public class DeleteSeveralDeviceProfilesTest extends AbstractDriverBaseTest {
private SideBarMenuViewHelper sideBarMenuView;
private ProfilesPageHelper profilesPage;
@BeforeMethod
public void login() {
openLocalhost();
new LoginPageHelper(driver).authorizationTenant();
testRestClient.login(TENANT_EMAIL, TENANT_PASSWORD);
sideBarMenuView = new SideBarMenuViewHelper(driver);
profilesPage = new ProfilesPageHelper(driver);
}
@Test(priority = 10, groups = "smoke")
@Description
public void canDeleteSeveralDeviceProfilesByTopBtn() {
String name1 = ENTITY_NAME + "1";
String name2 = ENTITY_NAME + "2";
testRestClient.postDeviceProfile(defaultDeviceProfile(name1));
testRestClient.postDeviceProfile(defaultDeviceProfile(name2));
sideBarMenuView.openDeviceProfiles();
profilesPage.clickOnCheckBoxes(2);
profilesPage.deleteSelectedBtn().click();
profilesPage.warningPopUpYesBtn().click();
profilesPage.refreshBtn().click();
Assert.assertTrue(profilesPage.profileIsNotPresent(name1));
Assert.assertTrue(profilesPage.profileIsNotPresent(name2));
}
@Test(priority = 10, groups = "smoke")
@Description
public void selectAllDeviceProfiles() {
sideBarMenuView.openDeviceProfiles();
profilesPage.selectAllCheckBox().click();
profilesPage.deleteSelectedBtn().click();
Assert.assertNotNull(profilesPage.warningPopUpTitle());
Assert.assertTrue(profilesPage.warningPopUpTitle().isDisplayed());
Assert.assertTrue(profilesPage.warningPopUpTitle().getText().contains(String.valueOf(profilesPage.markCheckbox().size())));
}
@Test(priority = 20, groups = "smoke")
@Description
public void removeDefaultDeviceProfile() {
sideBarMenuView.openDeviceProfiles();
profilesPage.selectAllCheckBox().click();
profilesPage.assertCheckBoxIsNotDisplayed("default");
Assert.assertFalse(profilesPage.deleteBtn("default").isEnabled());
}
@Test(priority = 30, groups = "smoke")
@Description
public void deleteSeveralDeviceProfilesByTopBtnWithoutRefresh() {
String name1 = ENTITY_NAME + "1";
String name2 = ENTITY_NAME + "2";
testRestClient.postDeviceProfile(defaultDeviceProfile(name1));
testRestClient.postDeviceProfile(defaultDeviceProfile(name2));
sideBarMenuView.openDeviceProfiles();
profilesPage.clickOnCheckBoxes(2);
profilesPage.deleteSelectedBtn().click();
profilesPage.warningPopUpYesBtn().click();
Assert.assertTrue(profilesPage.profileIsNotPresent(name1));
Assert.assertTrue(profilesPage.profileIsNotPresent(name2));
}
}

22
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/MakeDeviceProfileDefaultTest.java

@ -1,3 +1,18 @@
/**
* Copyright © 2016-2022 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke;
import io.qameta.allure.Description;
@ -27,14 +42,13 @@ public class MakeDeviceProfileDefaultTest extends AbstractDriverBaseTest {
}
@AfterMethod
public void delete() {
public void makeProfileDefault() {
testRestClient.setDefaultDeviceProfile(getDeviceProfileByName("default").getId());
}
@Test(priority = 10, groups = "smoke")
@Description
public void makeRuleChainRootByRightCornerBtn() {
public void makeDeviceProfileDefaultByRightCornerBtn() {
sideBarMenuView.openDeviceProfiles();
profilesPage.setProfileName();
String profile = profilesPage.getProfileName();
@ -46,7 +60,7 @@ public class MakeDeviceProfileDefaultTest extends AbstractDriverBaseTest {
@Test(priority = 20, groups = "smoke")
@Description
public void makeRuleChainRootFromView() {
public void makeDeviceProfileDefaultFromView() {
sideBarMenuView.openDeviceProfiles();
profilesPage.setProfileName();
String profile = profilesPage.getProfileName();

Loading…
Cancel
Save