add tests on delete phone number

This commit is contained in:
Seraphym-Tuhai 2023-04-18 15:28:18 +03:00
parent a1e816ada4
commit 93bd595121
3 changed files with 50 additions and 2 deletions

View File

@ -196,4 +196,24 @@ public class CreateCustomerTest extends AbstractDriverBaseTest {
Assert.assertTrue(urlContains(urlPath), "URL contains " + urlPath);
}
}
@Epic("Customers smoke tests")
@Feature("Create customer")
@Test(groups = "smoke")
@Description("Go to customer documentation page")
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().sendKeys(Keys.CONTROL + "A" + Keys.BACK_SPACE);
customerPage.addBtnC().click();
this.customerName = customerName;
customerPage.entity(customerName).click();
Assert.assertTrue(customerPage.phoneNumberEntityView().getAttribute("value").isEmpty(), "Phone field is empty");
}
}

View File

@ -18,6 +18,7 @@ package org.thingsboard.server.msa.ui.tests.customerSmoke;
import io.qameta.allure.Description;
import io.qameta.allure.Epic;
import io.qameta.allure.Feature;
import org.openqa.selenium.Keys;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
@ -307,4 +308,24 @@ public class CustomerEditMenuTest extends AbstractDriverBaseTest {
Assert.assertEquals(customerPage.phoneNumberEntityView().getAttribute("value"), "+1" + number);
Assert.assertEquals(customerPage.emailEntityView().getAttribute("value"), email);
}
}
@Epic("Customers smoke tests")
@Feature("Edit customer")
@Test(groups = "smoke")
@Description("Delete phone number")
public void deletePhoneNumber() {
String customerName = ENTITY_NAME;
int number = 2015550123;
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.assertTrue(customerPage.phoneNumberEntityView().getAttribute("value").isEmpty(), "Phone field is empty");
}
}

View File

@ -43,6 +43,13 @@ public class EntityPrototypes {
return customer;
}
public static Customer defaultCustomerPrototype(String entityName, int number) {
Customer customer = new Customer();
customer.setTitle(entityName);
customer.setPhone("+1" + number);
return customer;
}
public static RuleChain defaultRuleChainPrototype(String entityName) {
RuleChain ruleChain = new RuleChain();
ruleChain.setName(entityName);