-
Notifications
You must be signed in to change notification settings - Fork 47
/
CheckboxTests.java
82 lines (71 loc) · 2.45 KB
/
CheckboxTests.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
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
package io.github.epam.html.tests.elements.common;
import io.github.epam.TestsInit;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import static com.epam.jdi.light.elements.base.Conditions.*;
import static io.github.com.StaticSite.html5Page;
import static io.github.com.pages.HtmlElementsPage.acceptConditions;
import static io.github.epam.html.tests.elements.BaseValidations.baseValidation;
import static io.github.epam.html.tests.site.steps.States.shouldBeLoggedIn;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalToIgnoringCase;
import static org.testng.Assert.*;
/**
* Created by Roman Iovlev on 19.08.2019
* Email: roman.iovlev.jdi@gmail.com; Skype: roman.iovlev
*/
public class CheckboxTests implements TestsInit {
final String label = "Accept terms and conditions";
@BeforeMethod
public void before() {
shouldBeLoggedIn();
html5Page.shouldBeOpened();
acceptConditions.check();
}
@Test
public void getLabelTextTest() {
assertEquals(acceptConditions.labelText(), label);
}
@Test
public void checkTest() {
acceptConditions.check();
assertTrue(acceptConditions.isSelected());
}
@Test
public void uncheckTest() {
acceptConditions.uncheck();
assertFalse(acceptConditions.isSelected());
}
@Test
public void clickTest() {
assertTrue(acceptConditions.isSelected());
acceptConditions.click();
assertFalse(acceptConditions.isSelected());
}
@Test
public void isValidationTest() {
acceptConditions.is().selected();
acceptConditions.click();
acceptConditions.is().deselected().and().enabled().and().displayed();
}
@Test
public void shouldValidationTest() {
acceptConditions.shouldBe(displayed, and(selected));
acceptConditions.click();
acceptConditions.shouldBe(not(selected), and(not(hidden)));
}
@Test
public void labelTest() {
assertEquals(acceptConditions.label().getText(), label);
acceptConditions.label().is().text(containsString("terms and conditions"));
acceptConditions.label().is().text(equalToIgnoringCase("accept terms and conditions"));
}
@Test
public void assertValidationTest() {
acceptConditions.assertThat().selected();
}
@Test
public void baseValidationTest() {
baseValidation(acceptConditions);
}
}