add tests on delete phone number

This commit is contained in:
Serafym Tuhai 2022-12-27 15:11:43 +02:00
parent a0091c632a
commit 42df526966
3 changed files with 44 additions and 0 deletions

View File

@ -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() {

View File

@ -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) {

View File

@ -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);