-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathContactsPageTest.java
More file actions
95 lines (71 loc) · 2.31 KB
/
ContactsPageTest.java
File metadata and controls
95 lines (71 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
* @author Naveen Khunteta
*
*/
package com.crm.qa.testcases;
import java.io.IOException;
import org.apache.log4j.PropertyConfigurator;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.openqa.selenium.By;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.Select;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.testng.log4testng.Logger;
import com.crm.qa.base.TestBase;
import com.crm.qa.pages.ContactsPage;
import com.crm.qa.pages.HomePage;
import com.crm.qa.pages.LoginPage;
import com.crm.qa.util.TestUtil;
public class ContactsPageTest extends TestBase{
LoginPage loginPage;
HomePage homePage;
TestUtil testUtil;
ContactsPage contactsPage;
String sheetName = "contacts";
public ContactsPageTest(){
super();
}
@BeforeMethod
public void setUp() throws InterruptedException {
initialization();
testUtil = new TestUtil();
contactsPage = new ContactsPage();
loginPage = new LoginPage();
homePage = loginPage.login(prop.getProperty("username"), prop.getProperty("password"));
TestUtil.runTimeInfo("error", "login successful");
testUtil.switchToFrame();
contactsPage = homePage.clickOnContactsLink();
}
@Test(priority=1)
public void verifyContactsPageLabel(){
Assert.assertTrue(contactsPage.verifyContactsLabel(), "contacts label is missing on the page");
}
@Test(priority=2)
public void selectSingleContactsTest(){
contactsPage.selectContactsByName("test2 test2");
}
@Test(priority=3)
public void selectMultipleContactsTest(){
contactsPage.selectContactsByName("test2 test2");
contactsPage.selectContactsByName("Tom Peter");
}
@DataProvider
public Object[][] getCRMTestData(){
Object data[][] = TestUtil.getTestData(sheetName);
return data;
}
@Test(priority=4, dataProvider="getCRMTestData")
public void validateCreateNewContact(String title, String firstName, String lastName, String company){
homePage.clickOnNewContactLink();
//contactsPage.createNewContact("Mr.", "Tom", "Peter", "Google");
contactsPage.createNewContact(title, firstName, lastName, company);
}
@AfterMethod
public void tearDown(){
driver.quit();
}
}