Skip to content

Commit

Permalink
updated test, dependencies and github action
Browse files Browse the repository at this point in the history
  • Loading branch information
anandbagmar committed Feb 27, 2024
1 parent 1ea7a7b commit e9b176c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ jobs:
java-version: '11'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@3b1b3b9a2104c2b47fbae53f3938079c00c9bb87
uses: gradle/gradle-build-action@29c0906b64b8fc82467890bfb7a0a7ef34bda89e
with:
arguments: build --refresh-dependencies -x test
12 changes: 9 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
ext {
gradleVersion = '8.6'
junitVersion = '5.10.2'
applitoolsVersion = '5.66.6'
applitoolsVersion = '5.66.7'
}
repositories {
mavenLocal()
Expand All @@ -32,7 +32,13 @@ dependencies {

static def getCurrentDatestamp() {
Date today = new Date()
SimpleDateFormat df = new SimpleDateFormat("MM-dd-yyyy")
SimpleDateFormat df = new SimpleDateFormat("dd-MMM")
return df.format(today)
}

static def getMonth() {
Date today = new Date()
SimpleDateFormat df = new SimpleDateFormat("MMM-yyyy")
return df.format(today)
}

Expand All @@ -42,7 +48,7 @@ static def getCurrentTimestamp() {
return df.format(today)
}

project.ext.logDir = "${rootDir}/reports/" + getCurrentDatestamp() + "/" + getCurrentTimestamp() as GStringImpl
project.ext.logDir = "${rootDir}/reports/" + getMonth() + "/" + getCurrentDatestamp() + "/" + getCurrentTimestamp() as GStringImpl

test {
doFirst {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ public void beforeMethod(TestInfo testInfo) {
eyes.setApiKey(APPLITOOLS_API_KEY);
eyes.setBatch(batch);
eyes.setLogHandler(new StdoutLogHandler(true));
eyes.setForceFullPageScreenshot(false);
eyes.setForceFullPageScreenshot(true);
eyes.setStitchMode(StitchMode.CSS);
eyes.setMatchLevel(MatchLevel.LAYOUT2);
eyes.setMatchLevel(MatchLevel.STRICT);
eyes.setIsDisabled(false);
eyes.setSaveNewTests(false);
eyes.addProperty("username", userName);
Expand Down Expand Up @@ -81,12 +81,18 @@ void seleniumEyesTest() {
for (int stepNumber = 0; stepNumber < counter; stepNumber++) {
By linkText = By.linkText("?diff1");
driver.findElement(linkText).click();
eyes.check("linkText", Target.region(linkText).matchLevel(MatchLevel.LAYOUT2));
eyes.check("click-" + stepNumber, Target.window().fully().layout(By.xpath("//span[contains(@class,'random-number')]")));
eyes.check("linkText",
Target.region(linkText).matchLevel(MatchLevel.LAYOUT2));
eyes.check("click-" + stepNumber,
Target.window().fully(false)
.layout(By.xpath("//span[contains(@class,'random-number')]")));
}
((JavascriptExecutor) driver).executeScript("document.querySelector(\".section.button-section\").id=\"clickButton\" ");
driver.findElement(By.id("clickButton")).click();
eyes.checkWindow("After click");
eyes.check("combo", Target.window().fully().layout(By.xpath("//p[contains(text(), 'Applitools')]"), By.xpath("//span[contains(@class,'random-number')]")));
eyes.check("combo", Target.window().fully()
.layout(
By.xpath("//p[contains(text(), 'Applitools')]"),
By.xpath("//span[contains(@class,'random-number')]")));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ public void beforeMethod(TestInfo testInfo) {
config.setMatchLevel(MatchLevel.STRICT);
config.addProperty("username", userName);
// Add browsers with different viewports
config.addBrowser(800, 600, BrowserType.CHROME);
config.addBrowser(700, 500, BrowserType.FIREFOX);
config.addBrowser(1400, 1000, BrowserType.CHROME);
config.addBrowser(1200, 1024, BrowserType.FIREFOX);
// config.addBrowser(700, 500, BrowserType.FIREFOX_ONE_VERSION_BACK);
// config.addBrowser(1024, 768, BrowserType.EDGE_CHROMIUM);
// config.addBrowser(1024, 768, BrowserType.EDGE_CHROMIUM_ONE_VERSION_BACK);
Expand Down

0 comments on commit e9b176c

Please sign in to comment.