-
Notifications
You must be signed in to change notification settings - Fork 0
/
DifferentDevices.groovy
56 lines (48 loc) · 1.61 KB
/
DifferentDevices.groovy
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 com.tests
import com.base.SelenideBaseTest
import com.base.pages.HomePage
import com.base.tools.ScreenshotFileNameEnum
import io.qameta.allure.Description
import io.qameta.allure.Feature
import org.openqa.selenium.By
import org.testng.annotations.Test
@Feature("Desktop/Tablet/Mobile full screenshot comparison")
class DifferentDevices extends SelenideBaseTest {
private int DIFF_PIXELS = 20
private static Set<By> ignoreElements() {
Set<By> setIgnoredElements = new HashSet<>()
setIgnoredElements.add(By.cssSelector(".CustomerRatings__content"))
setIgnoredElements.add(By.cssSelector(".LegalText__container"))
return setIgnoredElements
}
@Test
@Description("Run test on Desktop")
void desktop() {
new HomePage()
.openHomePage()
.compareFullScreenshotHomePage(
ScreenshotFileNameEnum.HomePageDesktop,
ignoreElements(),
DIFF_PIXELS)
}
@Test
@Description("Run test on Tablet emulator Ipad in Chrome")
void tablet() {
new HomePage()
.openHomePage()
.compareFullScreenshotHomePage(
ScreenshotFileNameEnum.HomePageTablet,
ignoreElements(),
DIFF_PIXELS)
}
@Test
@Description("Run test on Mobile emulator iPhone 7 in Chrome")
void mobile() {
new HomePage()
.openHomePage()
.compareFullScreenshotHomePage(
ScreenshotFileNameEnum.HomePageMobile,
ignoreElements(),
DIFF_PIXELS)
}
}