diff --git a/.github/workflows/smoketest_edge.yml b/.github/workflows/smoketest_edge.yml new file mode 100644 index 000000000..ee70ccaaa --- /dev/null +++ b/.github/workflows/smoketest_edge.yml @@ -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 diff --git a/serenity-smoketests/pom.xml b/serenity-smoketests/pom.xml index 398f53051..574cfa777 100644 --- a/serenity-smoketests/pom.xml +++ b/serenity-smoketests/pom.xml @@ -5,7 +5,7 @@ serenity-bdd net.serenity-bdd - 4.2.0-SNAPSHOT + 4.2.7-SNAPSHOT serenity-smoketests jar @@ -20,7 +20,19 @@ + 5.11.2 + 1.11.1 + + + + org.junit + junit-bom + ${junit-jupiter.version} + test + + + net.serenity-bdd @@ -47,6 +59,12 @@ serenity-cucumber ${project.version} + + net.serenity-bdd + serenity-junit5 + ${project.version} + test + net.serenity-bdd serenity-browserstack @@ -59,6 +77,23 @@ ${project.version} test + + + org.junit.platform + junit-platform-suite + test + + + org.junit.vintage + junit-vintage-engine + test + + + io.cucumber + cucumber-junit-platform-engine + 7.19.0 + test + org.slf4j slf4j-simple diff --git a/serenity-smoketests/src/test/java/net/serenitybdd/demos/todos/cucumber/CucumberTestSuite.java b/serenity-smoketests/src/test/java/net/serenitybdd/demos/todos/cucumber/CucumberTestSuite.java new file mode 100644 index 000000000..c4fdab55b --- /dev/null +++ b/serenity-smoketests/src/test/java/net/serenitybdd/demos/todos/cucumber/CucumberTestSuite.java @@ -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 { + +} diff --git a/serenity-smoketests/src/test/java/net/serenitybdd/demos/todos/cucumber/TodoStepDefinitions.java b/serenity-smoketests/src/test/java/net/serenitybdd/demos/todos/cucumber/TodoStepDefinitions.java new file mode 100644 index 000000000..9422d769b --- /dev/null +++ b/serenity-smoketests/src/test/java/net/serenitybdd/demos/todos/cucumber/TodoStepDefinitions.java @@ -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 expectedItems) { + Actor currentActor = OnStage.theActorInTheSpotlight(); + var todos = currentActor.asksFor(Text.ofEach(".todo-list li")); + assertThat(todos).containsExactlyElementsOf(expectedItems); + } + +} diff --git a/serenity-smoketests/src/test/resources/features/todomvc/add_new_items.feature b/serenity-smoketests/src/test/resources/features/todomvc/add_new_items.feature new file mode 100644 index 000000000..36acf817d --- /dev/null +++ b/serenity-smoketests/src/test/resources/features/todomvc/add_new_items.feature @@ -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 | \ No newline at end of file diff --git a/serenity-smoketests/src/test/resources/serenity.conf b/serenity-smoketests/src/test/resources/serenity.conf index 418d5b172..3fdf47909 100644 --- a/serenity-smoketests/src/test/resources/serenity.conf +++ b/serenity-smoketests/src/test/resources/serenity.conf @@ -17,18 +17,6 @@ serenity { home.page = "https://todo-app.serenity-js.org/#/" -//drivers { -// windows { -// webdriver.firefox.driver = src/test/resources/webdriver/windows/geckodriver.exe -// } -// mac { -// webdriver.firefox.driver = src/test/resources/webdriver/mac/geckodriver -// } -// linux { -// webdriver.firefox.driver = src/test/resources/webdriver/linux/geckodriver -// } -//} - environment = chrome environments {