From 42df526966cce30353564838638ee3bb742a77c8 Mon Sep 17 00:00:00 2001 From: Serafym Tuhai Date: Tue, 27 Dec 2022 15:11:43 +0200 Subject: [PATCH] add tests on delete phone number --- .../customerSmoke/CreateCustomerTest.java | 18 ++++++++++++++++++ .../customerSmoke/CustomerEditMenuTest.java | 19 +++++++++++++++++++ .../server/msa/ui/utils/EntityPrototypes.java | 7 +++++++ 3 files changed, 44 insertions(+) diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/CreateCustomerTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/CreateCustomerTest.java index 50aac8de11..0f1ee5ac58 100644 --- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/CreateCustomerTest.java +++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/CreateCustomerTest.java @@ -114,6 +114,24 @@ public class CreateCustomerTest extends AbstractDriverBaseTest { Assert.assertEquals(customerPage.getCustomerCity(), text); } + @Test(priority = 20, groups = "smoke") + @Description + public void createCustomerAddAndRemovePhoneNumber() { + String customerName = ENTITY_NAME; + String number = "12015550123"; + + sideBarMenuView.customerBtn().click(); + customerPage.plusBtn().click(); + customerPage.titleFieldAddEntityView().sendKeys(customerName); + customerPage.phoneNumberAddEntityView().sendKeys(number); + customerPage.phoneNumberAddEntityView().clear(); + customerPage.addBtnC().click(); + this.customerName = customerName; + customerPage.entity(customerName).click(); + + Assert.assertEquals(customerPage.phoneNumberEntityView().getAttribute("value"), ""); + } + @Test(priority = 20, groups = "smoke") @Description public void createCustomerWithoutName() { diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/CustomerEditMenuTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/CustomerEditMenuTest.java index 66a5bd5004..778cd69dc6 100644 --- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/CustomerEditMenuTest.java +++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/CustomerEditMenuTest.java @@ -16,6 +16,7 @@ package org.thingsboard.server.msa.ui.tests.customerSmoke; import io.qameta.allure.Description; +import org.openqa.selenium.Keys; import org.testng.Assert; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; @@ -240,6 +241,24 @@ public class CustomerEditMenuTest extends AbstractDriverBaseTest { Assert.assertTrue(customerPage.phoneNumberEntityView().getAttribute("value").contains(number)); } + @Test(priority = 20, groups = "smoke") + @Description + public void deletePhoneNumber() { + String customerName = ENTITY_NAME; + String number = "+12015550123"; + testRestClient.postCustomer(defaultCustomerPrototype(customerName, number)); + this.customerName = customerName; + + sideBarMenuView.customerBtn().click(); + customerPage.entity(customerName).click(); + customerPage.editPencilBtn().click(); + customerPage.phoneNumberEntityView().click(); + customerPage.phoneNumberEntityView().sendKeys(Keys.CONTROL + "A" + Keys.BACK_SPACE); + customerPage.doneBtnEditView().click(); + + Assert.assertEquals(customerPage.phoneNumberEntityView().getAttribute("value"), ""); + } + @Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "incorrectPhoneNumber") @Description public void addIncorrectPhoneNumber(String number) { diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/utils/EntityPrototypes.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/utils/EntityPrototypes.java index 5fcfe8f4f9..1398a2ca44 100644 --- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/utils/EntityPrototypes.java +++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/utils/EntityPrototypes.java @@ -26,6 +26,13 @@ public class EntityPrototypes { return customer; } + public static Customer defaultCustomerPrototype(String entityName, String phoneNumber){ + Customer customer = new Customer(); + customer.setTitle(entityName); + customer.setPhone(phoneNumber); + return customer; + } + public static RuleChain defaultRuleChainPrototype(String entityName){ RuleChain ruleChain = new RuleChain(); ruleChain.setName(entityName);