Repository navigation
Expand file tree
/
Copy pathSelenideTest.java
More file actions
108 lines (84 loc) · 3.94 KB
/
Copy pathSelenideTest.java
File metadata and controls
108 lines (84 loc) · 3.94 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
96
97
98
99
100
101
102
103
104
105
106
107
108
package selenide_test;
import com.codeborne.selenide.Configuration;
import org.openqa.selenium.By;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import static com.codeborne.selenide.Condition.appear;
import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Selenide.*;
public class SelenideTest {
@BeforeTest
public void beforeTest() {
System.out.println("BeforeTest");
}
@BeforeSuite(alwaysRun = true)
public void beforeSuite() {
Configuration.browser = "Chrome";
Configuration.startMaximized = true;
System.out.println("BeforeSuite");
}
@BeforeMethod(alwaysRun = true)
public void setup() {
System.out.println("BeforeMethod");
open("https://www.google.co.uk");
}
@Test(priority = 1, groups = {"login"})
public void test1() {
$(By.id("gb_70")).click();
$(By.xpath("//input[@type='email']")).click();
$(By.xpath("//input[@type='email']")).sendKeys("testing.testing2003@");
$(By.xpath("//div[@class='VfPpkd-RLmnJb']")).click();
$(By.xpath("//div[@class='o6cuMc']")).shouldHave(text("Введите адрес электронной почты или номер телефона."));
}
@Test(groups = {"login"}, dependsOnMethods = "test1")
public void automationTest2() {
$(By.id("gb_70")).click();
$(By.xpath("//input[@type='email']")).click();
$(By.xpath("//div[@class='VfPpkd-RLmnJb']")).click();
$(By.xpath("//div[@class='o6cuMc']")).shouldHave(text("Не удалось найти аккаунт Google"));
}
@Test(priority = 2, groups = {"login", "valid"})
public void automationTest3() {
$(By.id("gb_70")).click();
$(By.xpath("//input[@type='email']")).click();
$(By.xpath("//div[@class='VfPpkd-RLmnJb']")).click();
}
// @Test(groups = {"valid"},invocationCount = 3,threadPoolSize = 2)
@Test(groups = {"valid"})
public void automationTest4() {
$(By.id("gb_70")).click();
$(By.xpath("//button[@jsname='Cuz2Ue']")).click();
$(By.xpath("//div[@class='Y4dIwd']")).shouldHave(text("Укажите номер телефона или резервный адрес электронной почты"));
}
@Test(groups = {"valid"},description = "Make sure 'Images' label is shown under 'Google' logo")
public void automationTest5() {
$(By.xpath("//div[@class='FPdoLc tfB0Bf']//input[@class='RNmpXc']")).click();
$(By.id("logo")).shouldBe(appear);
}
@Test(groups = {"login"})
public void automationTest6() {
$(By.xpath("//a[@data-pid='2']")).click();
$(By.xpath("//div[@class='logo-subtext']")).shouldHave(text("Картинки"));
$(By.xpath("//span[@class='BwoPOe']")).shouldBe(appear);
$(By.xpath("//div[@jscontroller='MC8mtf']")).shouldBe(appear);
$(By.xpath("//div[@jscontroller='TJw5qb']")).click();
$(By.id("cjyo4e")).shouldBe(appear);
$(By.xpath("//a[@class='iOGqzf H4qWMc aXIg1b']")).shouldBe(appear);
}
@Test
public void automationTest7() {
$(By.xpath("//div[@class='gb_C gb_dd gb_i']")).click();
switchTo().frame($(By.xpath("//iframe[@role='presentation']")));
$(By.xpath("//div[@class='EHzcec eejsDc']")).shouldBe(appear);
$(By.xpath("//span[contains(text(),'Play')]")).click();
$(By.xpath("//div[@class='gb_pc']")).shouldBe(appear);
}
@Test
public void automationTest8() {
$(By.xpath("//div[@jscontroller='MC8mtf']")).click();
}
}