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

Rtc 2020 poc #12

Open
wants to merge 6 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
26 changes: 26 additions & 0 deletions .github/workflows/atda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: ATDA Pipeline

on:
push:
branches:
- rtc_2020_poc
- rtc_2020
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Run acceptance tests
env:
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
run: mvn test
1 change: 1 addition & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 20 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M4</version>
<configuration>
<parallel>all</parallel>
<threadCount>10</threadCount>
<parallel>all</parallel>
</configuration>
</plugin>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -30,6 +20,15 @@
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M4</version>
<configuration>
<parallel>all</parallel>
<threadCount>100</threadCount>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
Expand All @@ -38,13 +37,23 @@
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>com.saucelabs</groupId>
<artifactId>sauce_bindings</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</project>
Binary file removed resources/chromedriver
Binary file not shown.
2 changes: 0 additions & 2 deletions selenium.java.iml

This file was deleted.

47 changes: 0 additions & 47 deletions src/test/java/atda/AcceptanceTestDrivenAutomationTest.java

This file was deleted.

15 changes: 0 additions & 15 deletions src/test/java/atda/BasePage.java

This file was deleted.

27 changes: 0 additions & 27 deletions src/test/java/atda/LoginPage.java

This file was deleted.

17 changes: 0 additions & 17 deletions src/test/java/atda/ProductsPage.java

This file was deleted.

11 changes: 11 additions & 0 deletions src/test/java/com/atda/BasePage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.atda;

import org.openqa.selenium.WebDriver;

public class BasePage {
public WebDriver driver;

public BasePage(WebDriver driver) {
this.driver = driver;
}
}
41 changes: 41 additions & 0 deletions src/test/java/com/atda/ProductsFeatureTests.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.atda;

import com.saucelabs.saucebindings.SauceSession;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.WebDriver;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class ProductsFeatureTests {
private WebDriver driver;
private SauceSession session;
private ProductsPage productsPage;

@Before
public void setUp() {
session = new SauceSession();
driver = session.start();
productsPage = new ProductsPage(driver);
}

@After
public void tearDown() {
session.stop(true);
}

@Test
public void shouldOpen() {
productsPage.open();
assertTrue(productsPage.isLoaded());
}

@Test
public void canAddItemToCart() {
productsPage.open();
productsPage.addItemToCart();
assertEquals(1, new ShoppingCart(driver).itemCount());
}
}
23 changes: 23 additions & 0 deletions src/test/java/com/atda/ProductsPage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.atda;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

public class ProductsPage extends BasePage{
public ProductsPage(WebDriver driver) {
super(driver);
}

public void open() {
driver.navigate().to("https://www.saucedemo.com/inventory.html");
}

public boolean isLoaded() {
return driver.findElement(By.id("inventory_filter_container")).
isDisplayed();
}

public void addItemToCart() {
driver.findElement(By.className("btn_inventory")).click();
}
}
15 changes: 15 additions & 0 deletions src/test/java/com/atda/ShoppingCart.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.atda;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

public class ShoppingCart extends BasePage {
public ShoppingCart(WebDriver driver) {
super(driver);
}

public int itemCount() {
return Integer.parseInt(
driver.findElement(By.className("shopping_cart_badge")).getText());
}
}