-
Notifications
You must be signed in to change notification settings - Fork 47
/
ImageTests.java
66 lines (56 loc) · 1.88 KB
/
ImageTests.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
package io.github.epam.html.tests.elements.common;
import com.epam.jdi.light.elements.composite.WebPage;
import io.github.epam.TestsInit;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import static com.epam.jdi.light.elements.common.Alerts.acceptAlert;
import static com.epam.jdi.light.elements.common.Alerts.getAlertText;
import static io.github.com.StaticSite.html5Page;
import static io.github.com.pages.HtmlElementsPage.jdiLogo;
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.is;
import static org.testng.Assert.assertEquals;
/**
* Created by Roman Iovlev on 19.08.2019
* Email: roman.iovlev.jdi@gmail.com; Skype: roman.iovlev
*/
public class ImageTests implements TestsInit {
@BeforeMethod
public void before() {
shouldBeLoggedIn();
html5Page.shouldBeOpened();
}
String text = "https://jdi-testing.github.io/jdi-light/images/jdi-logo.jpg";
@Test
public void getSrcTest() {
assertEquals(jdiLogo.src(), text);
}
@Test
public void getAltTest() {
assertEquals(jdiLogo.alt(), "Jdi Logo 2");
}
@Test
public void clickTest() {
jdiLogo.click();
assertEquals(getAlertText(), "JDI Logo");
acceptAlert();
}
@Test
public void isValidationTest() {
WebPage.refresh();
jdiLogo.is().src(containsString("jdi-logo.jpg"));
jdiLogo.is().alt(is("Jdi Logo 2"));
jdiLogo.assertThat().height(is(100));
jdiLogo.assertThat().width(is(101));
}
@Test
public void assertValidationTest() {
jdiLogo.assertThat().alt(is("Jdi Logo 2"));
}
@Test
public void baseValidationTest() {
baseValidation(jdiLogo);
}
}