-
-
Notifications
You must be signed in to change notification settings - Fork 521
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
154 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Smoke Tests (Chrome) | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 # Update to v2 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v2 # Update to v2 | ||
with: | ||
distribution: 'temurin' # 'temurin' distribution provides OpenJ9 builds of the OpenJDK | ||
java-version: '17' | ||
|
||
- name: Cache the Maven packages to speed up build | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.m2 | ||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-m2 | ||
|
||
|
||
- name: Install Chrome for Testing and its driver | ||
run: | | ||
npm i puppeteer | ||
npx @puppeteer/browsers install chrome@stable | ||
- name: Snapshot Build | ||
run: mvn clean install -T4 -DskipTests | ||
|
||
- name: Smoke Tests | ||
env: | ||
JIRA_USERNAME: ${{ secrets.JIRA_USERNAME }} | ||
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} | ||
JIRA_WEBSERVICE_URL: ${{ secrets.JIRA_WEBSERVICE_URL }} | ||
BROWSERSTACK_KEY: ${{ secrets.BROWSERSTACK_KEY }} | ||
BROWSERSTACK_USER: ${{ secrets.BROWSERSTACK_USER }} | ||
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} | ||
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} | ||
LT_USERNAME: ${{ secrets.LT_USERNAME }} | ||
LT_ACCESS_KEY: ${{ secrets.LT_ACCESS_KEY }} | ||
run: cd serenity-smoketests && mvn verify -Denvironment=edge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...nity-smoketests/src/test/java/net/serenitybdd/demos/todos/cucumber/CucumberTestSuite.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package net.serenitybdd.demos.todos.cucumber; | ||
|
||
import org.junit.platform.suite.api.*; | ||
|
||
import static io.cucumber.junit.platform.engine.Constants.PLUGIN_PROPERTY_NAME; | ||
|
||
@Suite | ||
@IncludeEngines("cucumber") | ||
@SelectClasspathResource("features") | ||
@ConfigurationParameter(key = PLUGIN_PROPERTY_NAME, value = "io.cucumber.core.plugin.SerenityReporterParallel,pretty,timeline:build/test-results/timeline") | ||
public class CucumberTestSuite { | ||
|
||
} |
53 changes: 53 additions & 0 deletions
53
...ty-smoketests/src/test/java/net/serenitybdd/demos/todos/cucumber/TodoStepDefinitions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package net.serenitybdd.demos.todos.cucumber; | ||
|
||
import io.cucumber.java.Before; | ||
import io.cucumber.java.ParameterType; | ||
import io.cucumber.java.en.Given; | ||
import io.cucumber.java.en.Then; | ||
import io.cucumber.java.en.When; | ||
import net.serenitybdd.screenplay.Actor; | ||
import net.serenitybdd.screenplay.actions.Enter; | ||
import net.serenitybdd.screenplay.actions.Open; | ||
import net.serenitybdd.screenplay.actors.OnStage; | ||
import net.serenitybdd.screenplay.actors.OnlineCast; | ||
import net.serenitybdd.screenplay.questions.Text; | ||
import org.openqa.selenium.Keys; | ||
|
||
import java.util.List; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class TodoStepDefinitions { | ||
|
||
@Before | ||
public void setTheStage() { | ||
OnStage.setTheStage(new OnlineCast()); | ||
} | ||
|
||
@ParameterType(".*") | ||
public Actor actor(String actorName) { | ||
return OnStage.theActorCalled(actorName); | ||
} | ||
|
||
@Given("{actor} starts with an empty list") | ||
public void stats_with_an_empty_list(Actor actor) { | ||
actor.attemptsTo( | ||
Open.url("https://todomvc.com/examples/react/dist/") | ||
); | ||
} | ||
|
||
@When("{actor} adds {string} to his list") | ||
public void he_adds_to_his_list(Actor actor, String item) { | ||
actor.attemptsTo( | ||
Enter.theValue(item).into(".new-todo").thenHit(Keys.RETURN) | ||
); | ||
} | ||
|
||
@Then("the todo list should contain the following items:") | ||
public void the_todo_list_should_contain(List<String> expectedItems) { | ||
Actor currentActor = OnStage.theActorInTheSpotlight(); | ||
var todos = currentActor.asksFor(Text.ofEach(".todo-list li")); | ||
assertThat(todos).containsExactlyElementsOf(expectedItems); | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
serenity-smoketests/src/test/resources/features/todomvc/add_new_items.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Feature: Add new items | ||
|
||
Scenario: Add items to an empty list | ||
Given Toby starts with an empty list | ||
When he adds "Buy some milk" to his list | ||
Then the todo list should contain the following items: | ||
| Buy some milk | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters