-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creating configs to be able to run on all browsers, concurrently
- Loading branch information
Showing
16 changed files
with
255 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
wd-sauce-bindings/src/test/java/org/example/BaselineTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package org.example; | ||
|
||
public class BaselineTest { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.example; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
public class DiffTest extends SauceVisualBaseTest { | ||
|
||
@Test | ||
public void forceDiff() { | ||
homePage.setWithBugs(true); | ||
homePage.open(); | ||
visual().check("DiffTest - Before Login"); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
wd-sauce-bindings/src/test/java/org/example/IgnoreRegionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.example; | ||
|
||
import com.saucelabs.visual.Options; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class IgnoreRegionTest extends SauceVisualBaseTest { | ||
@Test | ||
void checkHomePage() { | ||
Options options = new Options(); | ||
options.setIgnoreElements(driver.findElements(homePage.getLogoLink())); | ||
visual().check("IgnoreRegionTest - Home Page", options); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,51 +2,47 @@ | |
|
||
import com.saucelabs.visual.Options; | ||
import org.example.pageobjects.ContactPage; | ||
import org.example.pageobjects.DashboardPage; | ||
import org.example.pageobjects.LoginPage; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class NavigateTest extends SauceVisualBaseTest { | ||
|
||
private final String adminLogin = "[email protected]"; | ||
private final String customerLogin = "[email protected]"; | ||
private final String customer2Login = "[email protected]"; | ||
private final String password = "welcome01"; | ||
|
||
public class ParallelTest extends SauceVisualBaseTest { | ||
@Test | ||
void checkLoginPage() { | ||
void checkHomePage() { | ||
Options options = new Options(); | ||
options.setIgnoreElements(driver.findElements(homePage.getLogoLink())); | ||
visual().check("Home Page - Before Login", options); | ||
LoginPage loginPage = homePage.navigateToLogin(); | ||
loginPage.login(adminLogin, password); | ||
|
||
visual().check("After Login", options); | ||
visual().check("Initial Home Page", options); | ||
} | ||
|
||
@Test | ||
void checkContactPage() { | ||
void checkReturnToHomePage() { | ||
Options options = new Options(); | ||
options.setIgnoreElements(driver.findElements(homePage.getLogoLink())); | ||
visual().check("Home Page", options); | ||
visual().check("Home Page Before", options); | ||
ContactPage contactPage = homePage.navigateToContactPage(); | ||
visual().check("Contact Page", options); | ||
contactPage.navigateToHome(); | ||
visual().check("Contact Page After", options); | ||
} | ||
|
||
@Test | ||
void checkReturnToHomePage() { | ||
void checkDashboardPage() { | ||
Options options = new Options(); | ||
options.setIgnoreElements(driver.findElements(homePage.getLogoLink())); | ||
visual().check("Home Page Before", options); | ||
ContactPage contactPage = homePage.navigateToContactPage(); | ||
visual().check("Contact Page", options); | ||
contactPage.navigateToHome(); | ||
visual().check("Contact Page After", options); | ||
visual().check("Home Page - Before Login", options); | ||
LoginPage loginPage = homePage.navigateToLogin(); | ||
DashboardPage dashboardPage = loginPage.loginAdmin(); | ||
options.setIgnoreElements(dashboardPage.getIgnoreRegions()); | ||
visual().check("Dashboard Page", options); | ||
} | ||
|
||
@Test | ||
void checkHomePage() { | ||
void checkContactPage() { | ||
Options options = new Options(); | ||
options.setIgnoreElements(driver.findElements(homePage.getLogoLink())); | ||
visual().check("Initial Home Page", options); | ||
visual().check("Home Page", options); | ||
ContactPage contactPage = homePage.navigateToContactPage(); | ||
visual().check("Contact Page", options); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
wd-sauce-bindings/src/test/java/org/example/config/ChromeTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.example.config; | ||
|
||
import com.saucelabs.saucebindings.options.SauceOptions; | ||
import org.example.ParallelTest; | ||
|
||
public class ChromeTests extends ParallelTest { | ||
@Override | ||
public SauceOptions createSauceOptions() { | ||
return SauceOptions.chrome().build(); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
wd-sauce-bindings/src/test/java/org/example/config/EdgeTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.example.config; | ||
|
||
import com.saucelabs.saucebindings.options.SauceOptions; | ||
import org.example.ParallelTest; | ||
|
||
public class EdgeTests extends ParallelTest { | ||
@Override | ||
public SauceOptions createSauceOptions() { | ||
return SauceOptions.edge().build(); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
wd-sauce-bindings/src/test/java/org/example/config/FirefoxTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.example.config; | ||
|
||
import com.saucelabs.saucebindings.options.SauceOptions; | ||
import org.example.ParallelTest; | ||
|
||
public class FirefoxTests extends ParallelTest { | ||
@Override | ||
public SauceOptions createSauceOptions() { return SauceOptions.firefox().build(); } | ||
} |
11 changes: 11 additions & 0 deletions
11
wd-sauce-bindings/src/test/java/org/example/config/SafariTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.example.config; | ||
|
||
import com.saucelabs.saucebindings.options.SauceOptions; | ||
import org.example.ParallelTest; | ||
|
||
public class SafariTests extends ParallelTest { | ||
@Override | ||
public SauceOptions createSauceOptions() { | ||
return SauceOptions.safari().build(); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
wd-sauce-bindings/src/test/java/org/example/pageobjects/AccountPage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.example.pageobjects; | ||
|
||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.WebElement; | ||
|
||
import java.util.List; | ||
|
||
public class AccountPage extends BasePage { | ||
public AccountPage(WebDriver driver) { | ||
super(driver); | ||
} | ||
|
||
@Override | ||
protected String getUrlPath() { | ||
return "account"; | ||
} | ||
|
||
@Override | ||
protected void sync() { | ||
|
||
} | ||
|
||
@Override | ||
public List<WebElement> getIgnoreRegions() { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
wd-sauce-bindings/src/test/java/org/example/pageobjects/ContactPage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
wd-sauce-bindings/src/test/java/org/example/pageobjects/DashboardPage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.example.pageobjects; | ||
|
||
import lombok.val; | ||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.ui.ExpectedConditions; | ||
import org.openqa.selenium.support.ui.WebDriverWait; | ||
|
||
import java.time.Duration; | ||
import java.util.List; | ||
|
||
public class DashboardPage extends BasePage { | ||
public DashboardPage(WebDriver driver) { | ||
super(driver); | ||
} | ||
|
||
@Override | ||
protected String getUrlPath() { | ||
return "admin/dashboard"; | ||
} | ||
|
||
@Override | ||
protected void sync() { | ||
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10)); | ||
wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.cssSelector(".chartjs-render-monitor"))); | ||
} | ||
|
||
@Override | ||
public List<WebElement> getIgnoreRegions() { | ||
return driver.findElements(By.cssSelector(".chartjs-render-monitor")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.