Skip to content

Commit

Permalink
Demo configurations for distributed testing
Browse files Browse the repository at this point in the history
  • Loading branch information
wakaleo committed Dec 22, 2023
1 parent f1e3a0e commit 3ed6744
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 65 deletions.
44 changes: 36 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<serenity.version>4.0.15</serenity.version>
<serenity.version>4.0.30</serenity.version>
<encoding>UTF-8</encoding>
<serenity.test.root></serenity.test.root>
<tags></tags>
Expand Down Expand Up @@ -82,12 +82,6 @@
<version>5.10.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-saucelabs</artifactId>
<version>${serenity.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
Expand All @@ -97,7 +91,11 @@
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.22.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.opentest4j</groupId>
<artifactId>opentest4j</artifactId>
<version>1.2.0</version>
</dependency>
</dependencies>
<build>
Expand Down Expand Up @@ -179,6 +177,36 @@
<webdriver.base.url>http://localhost:8080/angularjs/#/</webdriver.base.url>
</properties>
</profile>
<profile>
<id>browserstack</id>
<dependencies>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-browserstack</artifactId>
<version>${serenity.version}</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>lambdatest</id>
<dependencies>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-lambdatest</artifactId>
<version>${serenity.version}</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>saucelabs</id>
<dependencies>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-saucelabs</artifactId>
<version>${serenity.version}</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>failing</id>
<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package net.serenitybdd.demos.todos.pageobjects.steps;

import net.serenitybdd.core.steps.UIInteractions;
import net.serenitybdd.demos.todos.pageobjects.model.TodoStatus;
import net.serenitybdd.demos.todos.pageobjects.model.TodoStatusFilter;
import net.serenitybdd.demos.todos.pageobjects.pages.TodoListPage;
import net.thucydides.model.ThucydidesSystemProperty;
import net.serenitybdd.annotations.Step;
import net.thucydides.model.util.EnvironmentVariables;
import org.assertj.core.api.Assertions;
import org.assertj.core.api.SoftAssertions;

import static java.util.Arrays.asList;
import static net.serenitybdd.demos.todos.pageobjects.model.TodoStatus.Active;
Expand Down Expand Up @@ -108,7 +111,6 @@ public void should_see_that_that_following_item_is_marked_as_active(String item)

@Step
public void should_see_that_the_number_of_items_left_is(int expected) {

assertThat(todoListPage.numberOfItemsLeft(), is(expected));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
import org.junit.platform.suite.api.Suite;

import static io.cucumber.junit.platform.engine.Constants.PLUGIN_PROPERTY_NAME;
import static io.cucumber.junit.platform.engine.Constants.FILTER_TAGS_PROPERTY_NAME;

@Suite
@IncludeEngines("cucumber")
@SelectClasspathResource("/features")
//@ConfigurationParameter(key = FILTER_TAGS_PROPERTY_NAME, value = "@current")
@ConfigurationParameter(key = PLUGIN_PROPERTY_NAME,
value = "io.cucumber.core.plugin.SerenityReporterParallel,pretty,timeline:target/test-results/timeline")
public class CucumberTestSuite {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package net.serenitybdd.demos.todos.cucumber.steps;public class BrowserCustomisation {
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@
@filtering
Feature: Filtering todos

In order to make me feel **a sense of accomplishment**
In order to make me feel a sense of accomplishment
As a forgetful person
I want to be to _view all of things I have completed_

Scenario: View only the completed items
Given that Jane has a todo list containing Buy some milk, Walk the dog
And she completes the task called "Walk the dog"
When she filters her list to show only Completed tasks
Then her todo list should contain Walk the dog
I want to be to view all of things I have completed

Scenario Outline: Viewing the items by status
Given that Jane has a todo list containing <tasks>
Expand Down
8 changes: 4 additions & 4 deletions src/test/resources/junit-platform.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ junit.jupiter.execution.parallel.enabled=true
junit.jupiter.execution.parallel.config.strategy=fixed
junit.jupiter.execution.parallel.mode.default = concurrent
junit.jupiter.execution.parallel.mode.classes.default = concurrent
junit.jupiter.execution.parallel.config.fixed.parallelism=4
junit.jupiter.execution.parallel.config.fixed.max-pool-size=4
junit.jupiter.execution.parallel.config.fixed.parallelism=5
junit.jupiter.execution.parallel.config.fixed.max-pool-size=5

#
# Required to run Serenity Cucumber tests with JUnit 5 if you don't define this plugin in your runner class
Expand Down Expand Up @@ -33,8 +33,8 @@ junit.jupiter.execution.parallel.config.fixed.max-pool-size=4
#----------------------------------------------------------
cucumber.execution.parallel.enabled=true
cucumber.execution.parallel.config.strategy=fixed
cucumber.execution.parallel.config.fixed.parallelism=4
cucumber.execution.parallel.config.fixed.max-pool-size=4
cucumber.execution.parallel.config.fixed.parallelism=5
cucumber.execution.parallel.config.fixed.max-pool-size=5
cucumber.plugin=io.cucumber.core.plugin.SerenityReporterParallel,pretty,timeline:target/test-results/timeline


67 changes: 23 additions & 44 deletions src/test/resources/serenity.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ serenity {
#
# Report on test durations
report.test.durations = true
take.screenshots=FOR_FAILURES
# Store HTML source for each page
# (can be: ALWAYS, FAILURES or NEVER)
// store.html = FAILURES
Expand All @@ -34,7 +35,7 @@ serenity {
// Default page configuration
home.page = "http://todomvc.com/examples/angularjs/#/"

environment = browserstack
environment = "prod,chrome"
environments {
local {
home.page = "http://localhost:8080/angularjs/#/"
Expand Down Expand Up @@ -75,7 +76,6 @@ environments {
acceptInsecureCerts = true
unhandledPromptBehavior = "dismiss"
strictFileInteractability = true

"moz:firefoxOptions" {
args = ["-headless"],
prefs {
Expand All @@ -86,37 +86,8 @@ environments {
}
}
}
lambdatest {
home.page = "http://todomvc.com/examples/angularjs/#/"
#
# You define the Lambdatest credentials either in the LT_USERNAME and LT_ACCESS_KEY environment variables, or by
# setting the following properties:
#
# lt.user = your.username
# lt.key = your.access.key
#
# You can also override the Lambdatest grid url by setting the following property.
# lt.grid="hub.lambdatest.com"
webdriver {
driver = remote
remote.url = "https://"${LT_USERNAME}":"${LT_ACCESS_KEY}"@hub.lambdatest.com/wd/hub"
capabilities {
browserName = "chrome"
"goog:chromeOptions" {
args = ["test-type", "no-sandbox", "ignore-certificate-errors", "--window-size=1000,800",
"incognito", "disable-infobars", "disable-gpu", "disable-default-apps", "disable-popup-blocking"]
}
"LT:options" {
platformName = "Windows 10"
}
}
}
}
browserstack {
home.page = "http://todomvc.com/examples/angularjs/#/"
#
# You define the BrowserStack credentials either in the BROWSERSTACK_USER and BROWSERSTACK_KEY environment variables
#
webdriver {
driver = "remote"
remote.url = "https://"${BROWSERSTACK_USER}":"${BROWSERSTACK_KEY}"@hub.browserstack.com/wd/hub"
Expand All @@ -129,29 +100,20 @@ environments {
"bstack:options" {
os = "Windows"
osVersion = "11"
browserVersion = "latest"
local = false
resolution = "1920x1200"
seleniumVersion = "4.6.0"
video = true
idleTimeout = 600
}
"goog:chromeOptions" {
args = ["test-type", "no-sandbox", "ignore-certificate-errors", "--window-size=1000,800",
"incognito", "disable-infobars", "disable-gpu", "disable-default-apps", "disable-popup-blocking"]
}
}
}
}
saucelabs {
home.page = "http://todomvc.com/examples/angularjs/#/"
#
# You define the BrowserStack credentials either in the BROWSERSTACK_USER and BROWSERSTACK_KEY environment variables, or by
# setting the following properties:
#
# browserstack.user = your.username
# browserstack.key = your.access.key
#
webdriver {
driver = "remote"
remote.url = "https://"${SAUCE_USERNAME}":"${SAUCE_ACCESS_KEY}"@ondemand.us-west-1.saucelabs.com:443/wd/hub"

platformName = "Windows 11"
capabilities {
browserName = "Chrome"
Expand All @@ -165,4 +127,21 @@ environments {
}
}
}
lambdatest {
home.page = "http://todomvc.com/examples/angularjs/#/"
webdriver {
driver = remote
remote.url = "https://"${LT_USERNAME}":"${LT_ACCESS_KEY}"@hub.lambdatest.com/wd/hub"
capabilities {
browserName = "chrome"
"goog:chromeOptions" {
args = ["test-type", "no-sandbox", "ignore-certificate-errors", "--window-size=1000,800",
"incognito", "disable-infobars", "disable-gpu", "disable-default-apps", "disable-popup-blocking"]
}
"LT:options" {
platformName = "Monterey"
}
}
}
}
}

0 comments on commit 3ed6744

Please sign in to comment.