-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathTestCase.java
More file actions
44 lines (37 loc) · 1.79 KB
/
Copy pathTestCase.java
File metadata and controls
44 lines (37 loc) · 1.79 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
import io.github.bonigarcia.wdm.WebDriverManager;
import org.junit.jupiter.api.*;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class TestCase {
WebDriver driver;
@BeforeEach
public void beforeEach() {
driver = WebDriverManager.chromedriver().create();
}
@Test
public void myTestCase() {
driver.get("https://applitools.com/helloworld/");
WebElement numbers = driver.findElement(By.cssSelector("span.primary"));
WebElement button = driver.findElement(By.cssSelector("div.section:nth-child(3) > button:nth-child(1)"));
WebElement titleH = driver.findElement(By.cssSelector("div.fancy:nth-child(1) > span:nth-child(1)"));
WebElement titleD = driver.findElement(By.cssSelector("div.fancy:nth-child(1) > span:nth-child(11)"));
Assertions.assertEquals(numbers.isDisplayed(), true);
Assertions.assertEquals(numbers.getText(), "123456");
Assertions.assertEquals(numbers.getCssValue("color"), "rgba(78, 90, 99, 1)");
Assertions.assertEquals(button.isDisplayed(), true);
Assertions.assertEquals(button.getText(), "Click me!");
Assertions.assertEquals(button.getCssValue("color"), "rgba(255, 255, 255, 1)");
Assertions.assertEquals(titleH.isDisplayed(), true);
Assertions.assertEquals(titleH.getText(), "H");
Assertions.assertEquals(titleH.getCssValue("color"), "rgba(255, 0, 0, 1)");
Assertions.assertEquals(titleD.isDisplayed(), true);
Assertions.assertEquals(titleD.getText(), "D");
Assertions.assertEquals(titleD.getCssValue("color"), "rgba(70, 0, 255, 1)");`
}
@AfterEach
public void afterEach() {
driver.close();
}
}