-
Notifications
You must be signed in to change notification settings - Fork 0
/
LoginTest.java
56 lines (42 loc) · 1.55 KB
/
LoginTest.java
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
package tests;
import java.time.Duration;
import org.testng.Assert;
import org.testng.annotations.Test;
import pages.HomePage;
import pages.LoginPage;
import pages.UserRegisterationPage;
public class LoginTest extends TestBase {
HomePage homeObject;
UserRegisterationPage registerObject;
LoginPage loginObject;
// fill required fields data
String email ="ahmedsssa870@gmail.com";
String Password ="123456789";
@Test(priority=1,alwaysRun=true)
public void UserLoginSuccessfully()
{
// Go to home page in oscar website
homeObject=new HomePage(driver);
homeObject.ClickLoginLink();
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(5));
// Go to login page in oscar website
loginObject=new LoginPage(driver);
loginObject.UserLogin(email, Password);
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(5));
//Go to your profile page
loginObject.clickProfileLink();
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(5));
//Verify Name from profile data is displayed
Assert.assertTrue(loginObject.verifyName.getText().contains("ahmedali"));
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(5));
}
// logout from profile page
@Test(priority = 2,dependsOnMethods= {"UserLoginSuccessfully"})
public void LoginedUserCanLogout()
{
loginObject.userLogout();
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(5));
loginObject.clickProfileLink();
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
}
}