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

bdd version update #3250 #2

Open
wants to merge 19 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
89 changes: 37 additions & 52 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -1,86 +1,71 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java CI with Maven
name: Run tests
env:
ALLURE_VERSION: "2.10.0"
SUREFIRE_ARGS: "--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED"

on:
push:
branches: [ master ]
branches:
- master

pull_request:
branches: [ master ]
branches:
- master
repository_dispatch:
types:
- webhook

jobs:
build:
name: Tests on JDK
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
strategy:
max-parallel: 1
fail-fast: false
matrix:
java: [ 8, 9, 10, 11, 12, 13, 14, 15 ] # doesn't work on 16
java: [ 8, 11, 13, 14, 15, 17, 18 ]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'zulu'
java-package: jdk
cache: 'maven'

- name: Build with Maven
id: build
run: mvn install -DskipTests -ntp
- name: Set parameters for AspectJ
id: aspect_j_params
if: ${{ matrix.java > 15 }}
run: |
echo "ASPECT_ARGS=-Daspectj.args="\"$SUREFIRE_ARGS\" >> $GITHUB_ENV

- name: Start Selenoid
uses: n-ton4/selenoid-github-action@master
id: start-selenoid
if: github.event_name == 'pull_request' && success()
with:
version: 1.10.1
args: -limit 4
browsers: chrome:92.0
last-versions: 1
- name: Set parameters for AspectJ
id: aspect_j_params_empty
if: ${{ matrix.java < 16 }}
run: |
echo "ASPECT_ARGS=-Daspectj.args=''" >> $GITHUB_ENV

- name: Check Selenoid has been started
run: curl http://localhost:4444/status
if: github.event_name == 'pull_request' && success()
- name: Build with Maven
id: build
run: mvn clean install -DskipTests -ntp

- name: Tests
id: ftests
timeout-minutes: 10
if: github.event_name == 'pull_request' && success()
run: mvn test -Pci -ntp

- name: Get Allure history
uses: actions/checkout@v2
id: allure-setup
id: functests
timeout-minutes: 15
continue-on-error: true
if: github.event_name == 'pull_request' && failure()
with:
ref: gh-pages
path: gh-pages
run: mvn test -ntp ${{ env.ASPECT_ARGS }} --fail-at-end

- name: Generate Allure report
uses: simple-elf/allure-report-action@master
if: github.event_name == 'pull_request' && always()
with:
allure_results: target/allure-results
allure_report: target/allure-report
allure_history: allure-history

- name: Upload Allure report
uses: actions/upload-artifact@master
if: github.event_name == 'pull_request' && failure()
with:
name: Allure report
path: target/allure-report

- name: Deploy Allure report to Github Pages
if: github.event_name == 'pull_request' && always()
uses: peaceiris/actions-gh-pages@v2
env:
PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: allure-history
- name: Check tests are passed
if: ${{ steps.functests.outcome != 'success' }}
run: |
echo Tests result: ${{ steps.functests.outcome }}
exit 1
44 changes: 0 additions & 44 deletions .travis.yml

This file was deleted.

59 changes: 49 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,26 @@
<driver>chrome</driver>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jetty.version>9.4.12.RC2</jetty.version>
<aspectj.version>1.9.6</aspectj.version>
<allure.maven>2.10.0</allure.maven>
<jdi.version>1.3.14</jdi.version>
<aspectj.version>1.9.7</aspectj.version>
<allure.maven>2.11.2</allure.maven>
<jdi.version>RELEASE</jdi.version>
<log4j2.version>2.19.0</log4j2.version>
<remote.url/>
<!-- - -add-opens java.base/java.lang=ALL-UNNAMED needed for java 16+-->
<aspectj.args></aspectj.args>
</properties>

<profiles>
<profile>
<id>ci</id>
<properties>
<remote.url>http://localhost:4444/wd/hub</remote.url>
<!--<remote.url>http://localhost:4444/wd/hub</remote.url>-->
</properties>
</profile>
<profile>
<id>jdk16</id>
<properties>
<aspectj.args>--add-opens java.base/java.lang=ALL-UNNAMED</aspectj.args>
</properties>
</profile>
</profiles>
Expand All @@ -36,16 +45,46 @@
<version>${jdi.version}</version>
</dependency>

<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>7.10.1</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
<version>7.10.1</version>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-cucumber-jvm</artifactId>
<version>RELEASE</version>
<artifactId>allure-cucumber7-jvm</artifactId>
<version>2.20.1</version>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-java-commons</artifactId>
<version>2.20.1</version>
</dependency>

<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.6</version>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>${log4j2.version}</version>
</dependency>
</dependencies>

Expand Down Expand Up @@ -87,8 +126,8 @@
<configuration>
<testFailureIgnore>false</testFailureIgnore>
<argLine>
${aspectj.args}
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
-Dcucumber.options="--plugin io.qameta.allure.cucumberjvm.AllureCucumberJvm"
</argLine>
<systemProperties>
<property>
Expand Down
23 changes: 23 additions & 0 deletions src/test/java/cucumberTests/Hooks.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cucumberTests;

import com.epam.jdi.light.driver.WebDriverFactory;
import com.epam.jdi.light.elements.composite.Form;
import com.epam.jdi.light.elements.composite.WebPage;
import cucumberTests.data.User;
import io.cucumber.java.Before;
import io.cucumber.java.After;

import static com.epam.jdi.light.elements.init.UIFactory.$;

public class Hooks {
@Before
public static void setUp() {
WebPage.openUrl("https://jdi-testing.github.io/jdi-light/");
$("img#user-icon").click();
new Form<User>().submit(new User().set(u -> { u.name = "Roman"; u.password = "Jdi1234"; }));
}
@After
public static void shutDown() {
WebDriverFactory.quit();
}
}
23 changes: 4 additions & 19 deletions src/test/java/cucumberTests/TestRunner.java
Original file line number Diff line number Diff line change
@@ -1,32 +1,17 @@
package cucumberTests;

import com.epam.jdi.light.driver.WebDriverFactory;
import com.epam.jdi.light.elements.composite.Form;
import com.epam.jdi.light.elements.composite.WebPage;
import cucumberTests.data.User;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import io.cucumber.junit.CucumberOptions;
import io.cucumber.junit.Cucumber;
import org.junit.runner.RunWith;

import static com.epam.jdi.light.elements.init.UIFactory.*;

@RunWith(Cucumber.class)
@CucumberOptions(
features = "classpath:features"
, glue = {"com.epam.jdi.bdd", "cucumberTests"}
, plugin = "io.qameta.allure.cucumber7jvm.AllureCucumber7Jvm"
// , tags = {"@names"}
)
public class TestRunner {
@BeforeClass
public static void setUp() {
WebPage.openUrl("https://jdi-testing.github.io/jdi-light/");
$("img#user-icon").click();
new Form<User>().submit(new User().set(u -> { u.name = "Roman"; u.password = "Jdi1234"; }));
}
@AfterClass
public static void shutDown() {
WebDriverFactory.quit();
}

}
2 changes: 1 addition & 1 deletion src/test/java/cucumberTests/data/User.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cucumberTests.data;


import com.epam.jdi.tools.DataClass;
import com.jdiai.tools.DataClass;

public class User extends DataClass<User> {
public String name = "Roman";
Expand Down
1 change: 1 addition & 0 deletions src/test/resources/chrome.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
arguments=--no-sandbox --headless --disable-dev-shm-usage --disable-gpu
4 changes: 0 additions & 4 deletions src/test/resources/test.properties
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
driver=${driver}
#driver.version=2.23
timeout.wait.element=10
domain=https://jdi-testing.github.io/jdi-light/
page.check.after.open=NONE
smart.locators=#%s;[ui=%s]
smart.locator=#%s
log.level=INFO
json.test.data=/json/test/data
json.page.objects=/json/page/objects
driver.remote.url=${remote.url}
# NEW_PAGE | EVERY_PAGE
#element.search.strategy=strict | soft | visible, multiple | any, single
#assert.type=soft | strict

#page.load.strategy=normal
#browser.size=MAXIMIZE | 1024x762
#browser.kill=afterAndBefore | after | before
#drivers.folder=C:\\Selenium
#log.message.format=short | full
#demo.mode=false | true
#demo.delay=2
Expand Down