|
14 | 14 |
|
15 | 15 | public class TallyTestRunner extends Setup {
|
16 | 16 | Dotenv dotenv = Dotenv.load();
|
| 17 | + |
17 | 18 | @BeforeTest
|
18 | 19 | public void register() {
|
19 | 20 | RegistrationScreen rScreen = new RegistrationScreen(driver);
|
20 | 21 | rScreen.insertPhoneAndClickButton(Utils.randomPhoneNumber());
|
21 | 22 | rScreen.insertOtpAndClickButton(driver);
|
22 | 23 | rScreen.insertShopNameAndClickButton(Utils.randomShopName());
|
23 | 24 | }
|
| 25 | + |
24 | 26 | @Test(priority = 1, description = "Create Customer with only name and phone")
|
25 | 27 | public void addCustomerWithNameAndPhone() throws Exception {
|
26 | 28 | TallyScreen tScreen = new TallyScreen(driver);
|
27 | 29 | String customerName = Utils.randomCustomerName();
|
28 | 30 | // String customerPhoneNumber = Utils.randomPhoneNumber();
|
29 | 31 | String customerPhoneNumber = "01571761196";
|
30 | 32 | String confirmationMessage = tScreen.addCustomerWithNameAndPhone(customerName, customerPhoneNumber);
|
31 |
| - Utils.saveJsonList(customerPhoneNumber, customerName,"customers"); |
| 33 | + Utils.saveJsonList(customerPhoneNumber, customerName, "customers"); |
32 | 34 | System.out.println("add customer " + dotenv.get("PARTIAL_TEXT_AFTER_CREATING_CUSTOMER_OR_SUPPLIER"));
|
33 | 35 | Assert.assertTrue(confirmationMessage.contains(dotenv.get("PARTIAL_TEXT_AFTER_CREATING_CUSTOMER_OR_SUPPLIER")));
|
34 | 36 | }
|
| 37 | + |
35 | 38 | @Test(priority = 2, description = "Create customer with all the input along with date and image")
|
36 |
| - public void addCustomerFromContactBookWithAllInput() { |
| 39 | + public void addCustomerFromContactBookWithAllInput() throws InterruptedException { |
37 | 40 | TallyScreen tScreen = new TallyScreen(driver);
|
38 | 41 | String confirmationMessage = tScreen.addCustomerFromContactBookWithAllInput("12");
|
39 | 42 | Assert.assertTrue(confirmationMessage.contains(dotenv.get("PARTIAL_TEXT_AFTER_CREATING_CUSTOMER_OR_SUPPLIER")));
|
40 | 43 | }
|
| 44 | + |
41 | 45 | @Test(priority = 3, description = "Create supplier with only name and phone")
|
42 | 46 | public void addSupplierWithNameAndPhone() throws Exception {
|
43 | 47 | TallyScreen tScreen = new TallyScreen(driver);
|
44 | 48 | String supplierName = Utils.randomCustomerName();
|
45 | 49 | String supplierPhoneNumber = Utils.randomPhoneNumber();
|
46 | 50 | String confirmationMessage = tScreen.addSupplierWithNameAndPhone(supplierName, supplierPhoneNumber);
|
47 |
| - Utils.saveJsonList(supplierPhoneNumber, supplierName,"customers"); |
| 51 | + Utils.saveJsonList(supplierPhoneNumber, supplierName, "customers"); |
48 | 52 | Assert.assertTrue(confirmationMessage.contains(dotenv.get("PARTIAL_TEXT_AFTER_CREATING_CUSTOMER_OR_SUPPLIER")));
|
49 | 53 | }
|
| 54 | + |
50 | 55 | @Test(priority = 4, description = "Create supplier with all the input along with date and image")
|
51 | 56 | public void addSupplierFromContactBookWithAllInput() {
|
52 | 57 | TallyScreen tScreen = new TallyScreen(driver);
|
53 | 58 | String confirmationMessage = tScreen.addSupplierFromContactBookWithAllInput("11");
|
54 | 59 | Assert.assertTrue(confirmationMessage.contains(dotenv.get("PARTIAL_TEXT_AFTER_CREATING_CUSTOMER_OR_SUPPLIER")));
|
55 | 60 | }
|
| 61 | + |
56 | 62 | @Test(priority = 5, description = "Loop through customer list and print out length of data")
|
57 | 63 | public void loopThroughCustomerData() {
|
58 | 64 | TallyScreen tScreen = new TallyScreen(driver);
|
59 | 65 | int actualTotalCustomerLength = tScreen.objectCustomerDetailsContainer.size();
|
60 | 66 | System.out.println("Customer length " + actualTotalCustomerLength);
|
61 | 67 | Assert.assertEquals(actualTotalCustomerLength, 4);
|
62 | 68 | }
|
| 69 | + |
63 | 70 | @Test(priority = 6, description = "Edit PELAM of first customer from the customer list")
|
64 | 71 | public void editFirstCustomerPelam() {
|
65 | 72 | TallyScreen tScreen = new TallyScreen(driver);
|
66 | 73 | String confirmationMessage = tScreen.editFirstCustomerPelam("12");
|
67 | 74 | Assert.assertTrue(confirmationMessage.contains(dotenv.get("TEXT_AFTER_UPDATING_PELAM_DILAM")));
|
68 | 75 | }
|
| 76 | + |
69 | 77 | @Test(priority = 7, description = "Update first customer name from the customer list")
|
70 | 78 | public void editFirstCustomerName() throws InterruptedException {
|
71 | 79 | TallyScreen tScreen = new TallyScreen(driver);
|
72 | 80 | String confirmationMessage = tScreen.editFirstCustomerName(Utils.randomCustomerName());
|
73 | 81 | Assert.assertTrue(confirmationMessage.contains(dotenv.get("TEXT_AFTER_UPDATING_NAME_OR_MOBILE_OF_CUSTOMER_OR_SUPPLIER")));
|
74 | 82 | }
|
| 83 | + |
75 | 84 | @Test(priority = 8, description = "Search for the last customer added in the customer list")
|
76 | 85 | public void searchForLastAddedCustomer() throws IOException, ParseException, InterruptedException {
|
77 | 86 | TallyScreen tScreen = new TallyScreen(driver);
|
78 | 87 | int customerFound = tScreen.searchLastAddedCustomer(Utils.getLastAddedCustomerName("customers"));
|
79 | 88 | Assert.assertEquals(customerFound, 1);
|
80 | 89 | }
|
| 90 | + |
81 | 91 | @Test(priority = 9, description = "Close eye Button and check that all numbers ar hidden")
|
82 | 92 | public void closeEyeButton() throws InterruptedException {
|
83 | 93 | TallyScreen tScreen = new TallyScreen(driver);
|
84 | 94 | String totalPabo = tScreen.closeEyeButton();
|
85 | 95 | Assert.assertEquals(totalPabo, dotenv.get("TEXT_AFTER_CLOSING_EYE_BUTTON"));
|
86 | 96 | }
|
| 97 | + |
87 | 98 | @Test(priority = 10, description = "Add filter for Showing only customer")
|
88 | 99 | public void addFilterOnlyCustomer() throws InterruptedException {
|
89 | 100 | TallyScreen tScreen = new TallyScreen(driver);
|
90 | 101 | int customerFound = tScreen.addFilter();
|
91 | 102 | Assert.assertEquals(customerFound, 2);
|
92 | 103 | }
|
| 104 | + |
93 | 105 | @Test(priority = 11, description = "Tagada pathai to customers")
|
94 | 106 | public void tagadaPathai() {
|
95 | 107 | TallyScreen tScreen = new TallyScreen(driver);
|
96 | 108 | String confirmationMessage = tScreen.tagadaPathai();
|
97 | 109 | Assert.assertTrue(confirmationMessage.contains(dotenv.get("TEXT_AFTER_SENDING_TAGADA_MESSAGE")));
|
98 | 110 | }
|
| 111 | + |
99 | 112 | @Test(priority = 12, description = "Delete Last customer from the list")
|
100 | 113 | public void deleteLastCustomer() throws InterruptedException {
|
101 | 114 | TallyScreen tScreen = new TallyScreen(driver);
|
102 | 115 | String confirmationMessage = tScreen.deleteLastCustomer();
|
103 | 116 | Assert.assertTrue(confirmationMessage.contains(dotenv.get("PARTIAL_TEXT_AFTER_DELETING_CUSTOMER_OR_SUPPLIER")));
|
104 | 117 | }
|
| 118 | + |
105 | 119 | @Test(priority = 13, description = "If Nischit button enabled with sending invalid customer name when creating customers")
|
106 | 120 | public void isNischitButtonEnabledWhenCreatingCustomer() throws InterruptedException {
|
107 | 121 | TallyScreen tScreen = new TallyScreen(driver);
|
108 | 122 | boolean isBtnEnabled = tScreen.isNischitButtonEnabledWhenCreatingCustomer("hh");
|
109 | 123 | Assert.assertFalse(isBtnEnabled);
|
110 | 124 | }
|
| 125 | + |
111 | 126 | @Test(priority = 14, description = "If Poroborti button enabled with sending invalid customer name when updating customers info")
|
112 | 127 | public void isPorobortiButtonEnabledWhenEditingCustomerInfo() throws InterruptedException {
|
113 | 128 | TallyScreen tScreen = new TallyScreen(driver);
|
|
0 commit comments