Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency com.saucelabs:saucebindings-testng to v1.5.0 #188

Merged
merged 2 commits into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/testng.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
env:
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
run: mvn test -pl selenium-testng-examples -X
run: mvn test -pl selenium-testng-examples
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<sauce.version>1.5.0</sauce.version>
<sauce_junit5.version>1.0.0</sauce_junit5.version>
<sauce_junit4.version>1.5.0</sauce_junit4.version>
<sauce_testng.version>1.0.0</sauce_testng.version>
<maven.surefire.version>3.0.0-M5</maven.surefire.version>
<sauce_testng.version>1.5.0</sauce_testng.version>
<maven.surefire.version>3.3.1</maven.surefire.version>
</properties>

<modules>
Expand Down
64 changes: 32 additions & 32 deletions selenium-testng-examples/pom.xml
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>demo-java</artifactId>
<groupId>com.saucelabs</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>demo-java</artifactId>
<groupId>com.saucelabs</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>selenium-testng-examples</artifactId>
<artifactId>selenium-testng-examples</artifactId>

<dependencies>
<dependency>
<groupId>com.saucelabs</groupId>
<artifactId>saucebindings-testng</artifactId>
<version>${sauce_testng.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>com.saucelabs</groupId>
<artifactId>saucebindings-testng</artifactId>
<version>${sauce_testng.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.version}</version>
<configuration>
<parallel>methods</parallel>
<threadCount>10</threadCount>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
</configuration>
</plugin>
</plugins>
</build>
</project>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.version}</version>
<configuration>
<parallel>methods</parallel>
<threadCount>10</threadCount>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,55 @@

import com.saucelabs.saucebindings.options.SauceOptions;
import com.saucelabs.saucebindings.testng.SauceParameterizedBaseTest;
import java.lang.reflect.Method;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import java.lang.reflect.Method;

/**
* Tests whoing how to run cross browser tests with TestNG Sauce Bindings jar when Parameterized.
*/
public class CrossBrowserPlatformTest extends SauceParameterizedBaseTest {
@DataProvider(name = "sauceBrowsers", parallel = true)
public static Object[][] sauceBrowserDataProvider() {
return new Object[][]{
// Uncomment the other data providers ONLY if you have the relevant Sauce VM concurrency
new Object[]{"chrome", "latest", "macOS 11.00"},
new Object[]{"firefox", "latest", "macOS 11.00"},
new Object[]{"chrome", "latest", "Windows 10"},
new Object[]{"firefox", "latest", "Windows 10"},
new Object[]{"chrome", "latest-1", "Windows 10"}
/*new Object[]{"firefox", "latest-1", "Windows 10"},
new Object[]{"safari", "12.0", "macOS 10.14"},
new Object[]{"MicrosoftEdge", "latest", "Windows 10"},
new Object[]{"firefox", "65.0", "Windows 10"},
new Object[]{"firefox", "64.0", "macOS 10.14"},
new Object[]{"firefox", "63.0", "macOS 10.13"},
new Object[]{"firefox", "62.0", "macOS 10.12"},
new Object[]{"firefox", "61.0", "macOS 10.13"},*/
};
}
@DataProvider(name = "sauceBrowsers", parallel = true)
public static Object[][] sauceBrowserDataProvider() {
return new Object[][] {
// Uncomment the other data providers ONLY if you have the relevant Sauce VM concurrency
new Object[] {"chrome", "latest", "macOS 13"},
new Object[] {"firefox", "latest", "macOS 13"},
new Object[] {"chrome", "latest", "Windows 10"},
new Object[] {"firefox", "latest", "Windows 10"},
new Object[] {"chrome", "latest-1", "Windows 10"}
/*
new Object[]{"firefox", "latest-1", "Windows 10"},
new Object[]{"safari", "12.0", "macOS 10.14"},
new Object[]{"MicrosoftEdge", "latest", "Windows 10"},
new Object[]{"firefox", "65.0", "Windows 10"},
new Object[]{"firefox", "64.0", "macOS 10.14"},
new Object[]{"firefox", "63.0", "macOS 10.13"},
new Object[]{"firefox", "62.0", "macOS 10.12"},
new Object[]{"firefox", "61.0", "macOS 10.13"},
*/
};
}

@Override
protected SauceOptions createSauceOptions(Method method, Object[] parameters) {
SauceOptions sauceOptions = new SauceOptions();
sauceOptions.setCapability("browserName", parameters[0]);
sauceOptions.setCapability("browserVersion", parameters[1]);
sauceOptions.setCapability("platformName", parameters[2]);
return sauceOptions;
}
@Override
protected SauceOptions createSauceOptions(Method method, Object[] parameters) {
SauceOptions sauceOptions = new SauceOptions();
sauceOptions.setCapability("browserName", parameters[0]);
sauceOptions.setCapability("browserVersion", parameters[1]);
sauceOptions.setCapability("platformName", parameters[2]);
return sauceOptions;
}

@Test(dataProvider = "sauceBrowsers")
public void testCase1(String browser, String browserVersion, String platformName) {
getDriver().navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", getDriver().getTitle());
}
@Test(dataProvider = "sauceBrowsers")
public void testCase1(String browser, String browserVersion, String platformName) {
getDriver().navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", getDriver().getTitle());
}

@Test(dataProvider = "sauceBrowsers")
public void testCase2(String browser, String browserVersion, String platformName) {
getDriver().navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", getDriver().getTitle());
}
@Test(dataProvider = "sauceBrowsers")
public void testCase2(String browser, String browserVersion, String platformName) {
getDriver().navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", getDriver().getTitle());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,67 +4,66 @@
import org.testng.Assert;
import org.testng.annotations.Test;

/**
* Tests for running a single browser in parallel.
*/
/** Tests for running a single browser in parallel. */
public class ParallelSingleBrowserTest extends SauceBaseTest {
@Test
public void testCase1() {
getDriver().navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", getDriver().getTitle());
}
@Test
public void testCase1() {
getDriver().navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", getDriver().getTitle());
}

@Test
public void testCase2() {
getDriver().navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", getDriver().getTitle());
}
@Test
public void testCase2() {

@Test
public void testCase3() {
getDriver().navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", getDriver().getTitle());
}
getDriver().navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", getDriver().getTitle());
}

@Test
public void testCase4() {
getDriver().navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", getDriver().getTitle());
}
@Test
public void testCase3() {
getDriver().navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", getDriver().getTitle());
}

@Test
public void testCase5() {
getDriver().navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", getDriver().getTitle());
}
@Test
public void testCase4() {
getDriver().navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", getDriver().getTitle());
}

@Test
public void testCase6() {
getDriver().navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", getDriver().getTitle());
}
@Test
public void testCase5() {
getDriver().navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", getDriver().getTitle());
}

@Test
public void testCase7() {
getDriver().navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", getDriver().getTitle());
}
@Test
public void testCase6() {
getDriver().navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", getDriver().getTitle());
}

@Test
public void testCase8() {
getDriver().navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", getDriver().getTitle());
}
@Test
public void testCase7() {
getDriver().navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", getDriver().getTitle());
}

@Test
public void testCase9() {
getDriver().navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", getDriver().getTitle());
}
@Test
public void testCase8() {
getDriver().navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", getDriver().getTitle());
}

@Test
public void testCase10() {
getDriver().navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", getDriver().getTitle());
}
@Test
public void testCase9() {
getDriver().navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", getDriver().getTitle());
}

@Test
public void testCase10() {
getDriver().navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", getDriver().getTitle());
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,26 @@

import java.lang.reflect.Method;

/**
* Example Tests for running with Sauce Bindings diriectly without test runner jar.
*/
/** Example Tests for running with Sauce Bindings directly without test runner jar. */
public class SauceBindingsTest {
protected SauceSession session;
protected RemoteWebDriver driver;
protected SauceSession session;
protected RemoteWebDriver driver;

@BeforeMethod
public void setup(Method method) {
SauceOptions options = SauceOptions.chrome().setName(method.getName()).build();
session = new SauceSession(options);
driver = session.start();
}
@BeforeMethod
public void setup(Method method) {
SauceOptions options = SauceOptions.chrome().setName(method.getName()).build();
session = new SauceSession(options);
driver = session.start();
}

@Test
public void correctTitle() {
driver.navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", driver.getTitle());
}
@Test
public void correctTitle() {
driver.navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", driver.getTitle());
}

@AfterMethod
public void teardown(ITestResult result) {
session.stop(result.isSuccess());
}
@AfterMethod
public void teardown(ITestResult result) {
session.stop(result.isSuccess());
}
}
Loading
Loading