Skip to content

poc for removing DesiredCaps #17

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
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 pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.1</version>
<version>3.11.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
94 changes: 94 additions & 0 deletions src/test/java/com/yourcompany/Tests/W3CTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package com.yourcompany.Tests;

import com.saucelabs.junit.Parallelized;
import com.yourcompany.Pages.GuineaPigPage;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;
import org.openqa.selenium.By;
import org.openqa.selenium.MutableCapabilities;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.edge.EdgeOptions;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.ie.InternetExplorerOptions;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.safari.SafariOptions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.Arrays;
import java.util.Collection;

import static org.junit.Assert.assertFalse;

@RunWith(Parallelized.class)
public class W3CTest {

private WebDriver driver;

/**
* Collection of data parametrizes tests, in this case
* using W3C compliant browsers (does not include Chrome here)
* @return
*/
@Parameters
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][] {
{new FirefoxOptions(), "latest", "Windows 10"},
{new FirefoxOptions(), "58.0", "OS X 10.12"},
{new EdgeOptions(), "latest", "Windows 10"},
{new SafariOptions(), "latest", "OS X 10.12"},
{new InternetExplorerOptions(), "latest", "Windows 7"},
});
}

@Parameter
public MutableCapabilities options;

@Parameter(1)
public String browserVersion;

@Parameter(2)
public String platformName;

@Before
public void setup() throws MalformedURLException {
String username = System.getenv("SAUCE_USERNAME");
String accesskey = System.getenv("SAUCE_ACCESS_KEY");

// condition particular capabilities as needed
options.setCapability("browserVersion", browserVersion);
options.setCapability("platformName", platformName);

MutableCapabilities sauceOptions = new MutableCapabilities();
sauceOptions.setCapability("seleniumVersion", "3.11.0");
sauceOptions.setCapability("name", "W3C");
sauceOptions.setCapability("build", "JUnit Case - Follow Link Test");

options.setCapability("sauce:options", sauceOptions);

driver = new RemoteWebDriver(new URL("https://" + username + ":" + accesskey + "@ondemand.saucelabs.com/wd/hub"), options);

}

@After
public void teardown(){
driver.quit();
}

@Test
public void followLinkTest(){
GuineaPigPage page = GuineaPigPage.visitPage(driver);

page.followLink();

assertFalse(page.isOnPage());
}
}