Skip to content

Commit

Permalink
Updated smoke tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wakaleo committed Oct 20, 2024
1 parent 8ebd386 commit a24b9ca
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 13 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/smoketest_edge.yml
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
37 changes: 36 additions & 1 deletion serenity-smoketests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>serenity-bdd</artifactId>
<groupId>net.serenity-bdd</groupId>
<version>4.2.0-SNAPSHOT</version>
<version>4.2.7-SNAPSHOT</version>
</parent>
<artifactId>serenity-smoketests</artifactId>
<packaging>jar</packaging>
Expand All @@ -20,7 +20,19 @@
<browserstack.browserName></browserstack.browserName>
<browserstack.browser></browserstack.browser>
<browserstack.version></browserstack.version>
<junit-jupiter.version>5.11.2</junit-jupiter.version>
<junit-platform-suite-api.version>1.11.1</junit-platform-suite-api.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>net.serenity-bdd</groupId>
Expand All @@ -47,6 +59,12 @@
<artifactId>serenity-cucumber</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-junit5</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-browserstack</artifactId>
Expand All @@ -59,6 +77,23 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<!-- JUNIT 5 DEPENDENCY-->
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-suite</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit-platform-engine</artifactId>
<version>7.19.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
Expand Down
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 {

}
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);
}

}
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 |
12 changes: 0 additions & 12 deletions serenity-smoketests/src/test/resources/serenity.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a24b9ca

Please sign in to comment.