1
1
package testRunners ;
2
2
3
+ import jdk .jshell .execution .Util ;
4
+ import org .json .simple .parser .ParseException ;
5
+ import org .openqa .selenium .By ;
3
6
import org .testng .Assert ;
4
7
import org .testng .annotations .BeforeTest ;
5
8
import org .testng .annotations .Test ;
8
11
import setup .Setup ;
9
12
import utils .Utils ;
10
13
14
+ import java .io .IOException ;
15
+
11
16
public class TallyTestRunner extends Setup {
12
- public String customerName = Utils .randomCustomerName ();
13
- public String supplierName = Utils .randomCustomerName ();
14
17
@ BeforeTest
15
18
public void register () {
16
19
RegistrationScreen rScreen = new RegistrationScreen (driver );
@@ -19,38 +22,70 @@ public void register() {
19
22
rScreen .insertShopNameAndClickButton (Utils .randomShopName ());
20
23
}
21
24
@ Test (priority = 1 , description = "Create Customer with only name and phone" )
22
- public void addCustomerWithNameAndPhone () {
25
+ public void addCustomerWithNameAndPhone () throws Exception {
23
26
TallyScreen tScreen = new TallyScreen (driver );
24
- String confirmationMessage = tScreen .addCustomerWithNameAndPhone (customerName ,Utils .randomPhoneNumber ());
27
+ String customerName = Utils .randomCustomerName ();
28
+ String customerPhoneNumber = Utils .randomPhoneNumber ();
29
+ String confirmationMessage = tScreen .addCustomerWithNameAndPhone (customerName , customerPhoneNumber );
25
30
String [] arrOfStr = confirmationMessage .split ("-" );
26
31
String [] bangla = new String []{"কে টালিতে যোগ করা হয়েছে।" };
27
32
// String bangla1 = "কে টালিতে যোগ করা হয়েছে।";
28
33
// String rawString = "Entwickeln Sie mit Vergnügen";
29
34
// ByteBuffer buffer = StandardCharsets.UTF_8.encode(rawString);
30
35
31
36
// String utf8EncodedString = StandardCharsets.UTF_8.decode(buffer).toString();
32
- System .out .println ("actual " +confirmationMessage );
37
+ // System.out.println("actual "+confirmationMessage);
33
38
// String expected = "\"" + name + "\"- " + " কে টালিতে যোগ করা হয়েছে।";
34
- System .out .println ("after splitting " + arrOfStr [1 ]);
35
- System .out .println ("bangla " + bangla [0 ].getClass ().getName ());
36
- Assert .assertTrue (confirmationMessage .contains (arrOfStr [1 ]));
39
+ // System.out.println("after splitting "+ arrOfStr[1]);
40
+ // System.out.println("bangla "+ bangla[0].getClass().getName());
41
+ Utils .saveJsonList (customerPhoneNumber , customerName ,"customers" );
42
+ // Assert.assertTrue(confirmationMessage.contains(arrOfStr[1]));
37
43
}
38
- @ Test (priority = 2 , description = "Create customer with all the input along with date and image" )
44
+ @ Test (priority = 2 , enabled = false , description = "Create customer with all the input along with date and image" )
39
45
public void addCustomerFromContactBookWithAllInput () {
40
46
TallyScreen tScreen = new TallyScreen (driver );
41
47
String confirmationMessage = tScreen .addCustomerFromContactBookWithAllInput ();
42
48
System .out .println (confirmationMessage );
43
49
}
44
50
@ Test (priority = 3 , description = "Create supplier with only name and phone" )
45
- public void addSupplierWithNameAndPhone () {
51
+ public void addSupplierWithNameAndPhone () throws Exception {
46
52
TallyScreen tScreen = new TallyScreen (driver );
47
- String confirmationMessage = tScreen .addSupplierWithNameAndPhone (supplierName , Utils .randomPhoneNumber ());
53
+ String supplierName = Utils .randomCustomerName ();
54
+ String supplierPhoneNumber = Utils .randomPhoneNumber ();
55
+ String confirmationMessage = tScreen .addSupplierWithNameAndPhone (supplierName , supplierPhoneNumber );
56
+ Utils .saveJsonList (supplierPhoneNumber , supplierName ,"customers" );
48
57
System .out .println (confirmationMessage );
49
58
}
50
- @ Test (priority = 4 , description = "Create supplier with all the input along with date and image" )
59
+ @ Test (priority = 4 , enabled = false , description = "Create supplier with all the input along with date and image" )
51
60
public void addSupplierFromContactBookWithAllInput () {
52
61
TallyScreen tScreen = new TallyScreen (driver );
53
62
String confirmationMessage = tScreen .addSupplierFromContactBookWithAllInput ();
54
63
System .out .println (confirmationMessage );
55
64
}
65
+ @ Test (priority = 5 , description = "Loop through customer list and print out length of data" )
66
+ public void loopThroughCustomerData () {
67
+ TallyScreen tScreen = new TallyScreen (driver );
68
+ int actualTotalCustomerLength = tScreen .objectCustomerDetailsContainer .size ();
69
+ System .out .println ("Customer length " + actualTotalCustomerLength );
70
+ // Assert.assertEquals(actualTotalCustomerLength, 2);
71
+ }
72
+ @ Test (priority = 6 , description = "Search for the last customer" )
73
+ public void searchForLastCustomer () throws IOException , ParseException , InterruptedException {
74
+ TallyScreen tScreen = new TallyScreen (driver );
75
+ int customerFound = tScreen .searchLastAddedCustomer (Utils .getLastAddedCustomerName ("customers" ));
76
+ System .out .println ("Customer found " + customerFound );
77
+ // Assert.assertEquals(customerFound, 1);
78
+ }
79
+ @ Test (priority = 7 , description = "Close eye Button and check that all numbers ar hidden" )
80
+ public void closeEyeButton () throws IOException , ParseException , InterruptedException {
81
+ TallyScreen tScreen = new TallyScreen (driver );
82
+ String totalPabo = tScreen .closeEyeButton ();
83
+ Assert .assertEquals (totalPabo , "- - -" );
84
+ }
85
+ @ Test (priority = 8 , description = "Add filter for Showing only customer" )
86
+ public void addFilterOnlyCustomer () throws IOException , ParseException , InterruptedException {
87
+ TallyScreen tScreen = new TallyScreen (driver );
88
+ int customerFound = tScreen .addFilter ();
89
+ System .out .println ("Customer found " + customerFound );
90
+ }
56
91
}
0 commit comments