diff --git a/.gitignore b/.gitignore
index 9f97022..01d6fe8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
-target/
\ No newline at end of file
+target/
+.vscode
\ No newline at end of file
diff --git a/.gitpod.yml b/.gitpod.yml
index 551d56a..0151a33 100644
--- a/.gitpod.yml
+++ b/.gitpod.yml
@@ -1,6 +1,4 @@
-
-
# List the start up tasks. You can start them in parallel in multiple terminals. See https://www.gitpod.io/docs/config-start-tasks/
tasks:
- init: echo "Start Test"
- command: mvn verify -P single
+ command: mvn clean verify -Denvironment=lambdatest
diff --git a/README.md b/README.md
index c776008..ac20bf7 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,6 @@

-
Blog
⋅
@@ -20,33 +19,31 @@
-*Learn how to configure and run your Java automation testing scripts on LambdaTest platform using Serenity.*
+_Learn how to configure and run your Java automation testing scripts on LambdaTest platform using Serenity._
[
](https://accounts.lambdatest.com/register?utm_source=github&utm_medium=repo&utm_campaign=serenity-selenium-sample)
## Table Of Contents
-* [Pre-requisites](#pre-requisites)
-* [Run Your First Test](#run-your-first-test)
-* [Parallel Testing With Serenity](#run-your-parallel-tests-using-serenity)
-* [Local Testing With Serenity](#testing-locally-hosted-or-privately-hosted-projects)
+- [Pre-requisites](#pre-requisites)
+- [Run Your First Test](#run-your-first-test)
+- [Parallel Testing With Serenity](#run-your-parallel-tests-using-serenity)
+- [Local Testing With Serenity](#testing-locally-hosted-or-privately-hosted-projects)
## Pre-requisites
Before you can start performing Java automation testing with Serenity, you would need to:
-- Install the latest **Java development environment** i.e. **JDK 1.6 to JDK 1.8**.
-
-- Download the latest **Selenium Client** and its **WebDriver bindings** from the [official website](https://www.selenium.dev/downloads/). Latest versions of Selenium Client and WebDriver are ideal for running your automation script on LambdaTest Selenium cloud grid.
+- Install the latest **Java development environment**, and at least **JDK 11**.
- Install **Maven** which supports **JUnit** framework out of the box. **Maven** can be downloaded and installed following the steps from [the official website](https://maven.apache.org/). Maven can also be installed easily on **Linux/MacOS** using [Homebrew](https://brew.sh/) package manager.
### Cloning Repo And Installing Dependencies
-**Step 1:** Clone the LambdaTest’s Serenity-Selenium-Sample repository and navigate to the code directory as shown below:
+**Step 1:** Clone the Serenity-Selenium-Sample repository and navigate to the code directory as shown below:
```bash
-git clone https://github.com/LambdaTest/Serenity-Selenium-Sample
+git clone https://github.com/serenity-bdd/Serenity-Selenium-Sample.git
cd Serenity-Selenium-Sample
```
@@ -58,24 +55,28 @@ mvn versions:display-dependency-updates
### Setting Up Your Authentication
-Make sure you have your LambdaTest credentials with you to run test automation scripts. You can get these credentials from the [LambdaTest Automation Dashboard](https://automation.lambdatest.com/build?utm_source=github&utm_medium=repo&utm_campaign=serenity-selenium-sample) or by your [LambdaTest Profile](https://accounts.lambdatest.com/login?utm_source=github&utm_medium=repo&utm_campaign=serenity-selenium-sample).
+Make sure you have your LambdaTest credentials with you to run test automation scripts.
+You can get these credentials from the [LambdaTest Automation Dashboard](https://automation.lambdatest.com/build?utm_source=github&utm_medium=repo&utm_campaign=serenity-selenium-sample) or by your [LambdaTest Profile](https://accounts.lambdatest.com/login?utm_source=github&utm_medium=repo&utm_campaign=serenity-selenium-sample).
**Step 2:** Set LambdaTest **Username** and **Access Key** in environment variables.
-* For **Linux/macOS**:
-
+- For **Linux/macOS**:
+
```bash
- export LT_USERNAME="YOUR_USERNAME"
+ export LT_USERNAME="YOUR_USERNAME"
export LT_ACCESS_KEY="YOUR ACCESS KEY"
```
- * For **Windows**:
+
+ - For **Windows**:
+
```bash
- set LT_USERNAME="YOUR_USERNAME"
+ set LT_USERNAME="YOUR_USERNAME"
set LT_ACCESS_KEY="YOUR ACCESS KEY"
+ ```
## Run Your First Test
->**Test Scenario**: To run your first Serenity Test on LambdaTest Selenium Grid, let’s understand our test case scenario, the test case below checks for the word "**LambdaTest**" on Google and tests if the title of the resultant page is "**LambdaTest-Google Search**".
+> **Test Scenario**: To run your first Serenity Test on LambdaTest Selenium Grid, let’s understand our test case scenario, the test case below checks for the word "**LambdaTest**" on Google and tests if the title of the resultant page is "**LambdaTest-Google Search**".
```bash
Feature: Google's Search Functionality
@@ -85,7 +86,7 @@ Feature: Google's Search Functionality
Then I should see title "LambdaTest - Google Search"
```
-Following below is the `GooglePage.java` file for the above Test Case Scenario.
+The page object the `GooglePage.java` file for the above Test Case Scenario.
```java title="GooglePage.java"
package com.lambdatest.cucumber.pages;
@@ -95,7 +96,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import org.openqa.selenium.support.FindBy;
import net.serenitybdd.core.pages.WebElementFacade;
-import net.thucydides.core.annotations.DefaultUrl;
+import net.serenitybdd.annotations.DefaultUrl;
import net.thucydides.core.pages.PageObject;
@DefaultUrl("https://www.google.com/ncr")
@@ -110,7 +111,8 @@ public class GooglePage extends PageObject {
public void searchForString(String searchString) {
search.sendKeys(searchString);
}
- public void submitForm() throws Exception {
+
+ public void submitForm() throws Exception {
searchButton.click();
Thread.sleep(5000);
}
@@ -133,8 +135,8 @@ import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
-import net.thucydides.core.util.EnvironmentVariables;
-import net.thucydides.core.util.SystemEnvironmentVariables;
+import net.thucydides.model.environment.SystemEnvironmentVariables;
+import net.thucydides.model.util.EnvironmentVariables;
import net.thucydides.core.webdriver.DriverSource;
public class LambdaTestSerenityDriver implements DriverSource {
@@ -190,37 +192,12 @@ public class LambdaTestSerenityDriver implements DriverSource {
You can generate capabilities for your test requirements with the help of our inbuilt [Desired Capability Generator](https://www.lambdatest.com/capabilities-generator/?utm_source=github&utm_medium=repo&utm_campaign=serenity-selenium-sample).
-
### Executing the Test
**Step 3:** The tests can be executed in the terminal using the following command:
```bash
-mvn verify -P single
-```
-
-## Run Your Parallel Test Using Serenity
-
-
-To run parallel tests with Serenity, we will run **single.feature** test case in four different environments Chrome, Firefox, IE, and Safari.
-
-```java title="ParallelChromeTest.java"
-//Running Parallel Test On Chrome
-
-@RunWith(CucumberWithSerenity.class)
-@CucumberOptions(features = "src/test/resources/features/single.feature")
-public class ParallelChromeTest extends LambdaTestSerenityTest {
-}
-```
-
-Similarly we define the class for the remaining browsers.
-
-### Executing Parallel Tests Using Serenity
-
-To run parallel tests using Serenity, we would have to execute the below commands in the terminal:
-
-```bash
-mvn verify -P parallel
+mvn clean verify -Denvironment=lambdatest
```
## Testing Locally Hosted Or Privately Hosted Projects
@@ -232,9 +209,10 @@ Refer our [LambdaTest Tunnel documentation](https://www.lambdatest.com/support/d
Here’s how you can establish LambdaTest Tunnel.
Download the binary file of:
-* [LambdaTest Tunnel for Windows](https://downloads.lambdatest.com/tunnel/v3/windows/64bit/LT_Windows.zip)
-* [LambdaTest Tunnel for macOS](https://downloads.lambdatest.com/tunnel/v3/mac/64bit/LT_Mac.zip)
-* [LambdaTest Tunnel for Linux](https://downloads.lambdatest.com/tunnel/v3/linux/64bit/LT_Linux.zip)
+
+- [LambdaTest Tunnel for Windows](https://downloads.lambdatest.com/tunnel/v3/windows/64bit/LT_Windows.zip)
+- [LambdaTest Tunnel for macOS](https://downloads.lambdatest.com/tunnel/v3/mac/64bit/LT_Mac.zip)
+- [LambdaTest Tunnel for Linux](https://downloads.lambdatest.com/tunnel/v3/linux/64bit/LT_Linux.zip)
Open command prompt and navigate to the binary folder.
@@ -243,28 +221,29 @@ Run the following command:
```bash
LT -user {user’s login email} -key {user’s access key}
```
+
So if your user name is lambdatest@example.com and key is 123456, the command would be:
```bash
LT -user lambdatest@example.com -key 123456
```
+
Once you are able to connect **LambdaTest Tunnel** successfully, you would just have to pass on tunnel capabilities in the code shown below :
**Tunnel Capability**
```java
-DesiredCapabilities capabilities = new DesiredCapabilities();
+DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("tunnel", true);
```
## Documentation & Resources :books:
-
Visit the following links to learn more about LambdaTest's features, setup and tutorials around test automation, mobile app testing, responsive testing, and manual testing.
-* [LambdaTest Documentation](https://www.lambdatest.com/support/docs/?utm_source=github&utm_medium=repo&utm_campaign=serenity-selenium-sample)
-* [LambdaTest Blog](https://www.lambdatest.com/blog/?utm_source=github&utm_medium=repo&utm_campaign=serenity-selenium-sample)
-* [LambdaTest Learning Hub](https://www.lambdatest.com/learning-hub/?utm_source=github&utm_medium=repo&utm_campaign=serenity-selenium-sample)
+- [LambdaTest Documentation](https://www.lambdatest.com/support/docs/?utm_source=github&utm_medium=repo&utm_campaign=serenity-selenium-sample)
+- [LambdaTest Blog](https://www.lambdatest.com/blog/?utm_source=github&utm_medium=repo&utm_campaign=serenity-selenium-sample)
+- [LambdaTest Learning Hub](https://www.lambdatest.com/learning-hub/?utm_source=github&utm_medium=repo&utm_campaign=serenity-selenium-sample)
## LambdaTest Community :busts_in_silhouette:
@@ -272,31 +251,30 @@ The [LambdaTest Community](https://community.lambdatest.com/?utm_source=github&u
## What's New At LambdaTest ❓
-To stay updated with the latest features and product add-ons, visit [Changelog](https://changelog.lambdatest.com/)
-
+To stay updated with the latest features and product add-ons, visit [Changelog](https://changelog.lambdatest.com/)
+
## About LambdaTest
-[LambdaTest](https://www.lambdatest.com/?utm_source=github&utm_medium=repo&utm_campaign=serenity-selenium-sample) is a leading test execution and orchestration platform that is fast, reliable, scalable, and secure. It allows users to run both manual and automated testing of web and mobile apps across 3000+ different browsers, operating systems, and real device combinations. Using LambdaTest, businesses can ensure quicker developer feedback and hence achieve faster go to market. Over 500 enterprises and 1 Million + users across 130+ countries rely on LambdaTest for their testing needs.
+[LambdaTest](https://www.lambdatest.com/?utm_source=github&utm_medium=repo&utm_campaign=serenity-selenium-sample) is a leading test execution and orchestration platform that is fast, reliable, scalable, and secure. It allows users to run both manual and automated testing of web and mobile apps across 3000+ different browsers, operating systems, and real device combinations. Using LambdaTest, businesses can ensure quicker developer feedback and hence achieve faster go to market. Over 500 enterprises and 1 Million + users across 130+ countries rely on LambdaTest for their testing needs.
### Features
-* Run Selenium, Cypress, Puppeteer, Playwright, and Appium automation tests across 3000+ real desktop and mobile environments.
-* Real-time cross browser testing on 3000+ environments.
-* Test on Real device cloud
-* Blazing fast test automation with HyperExecute
-* Accelerate testing, shorten job times and get faster feedback on code changes with Test At Scale.
-* Smart Visual Regression Testing on cloud
-* 120+ third-party integrations with your favorite tool for CI/CD, Project Management, Codeless Automation, and more.
-* Automated Screenshot testing across multiple browsers in a single click.
-* Local testing of web and mobile apps.
-* Online Accessibility Testing across 3000+ desktop and mobile browsers, browser versions, and operating systems.
-* Geolocation testing of web and mobile apps across 53+ countries.
-* LT Browser - for responsive testing across 50+ pre-installed mobile, tablets, desktop, and laptop viewports
-
-
+- Run Selenium, Cypress, Puppeteer, Playwright, and Appium automation tests across 3000+ real desktop and mobile environments.
+- Real-time cross browser testing on 3000+ environments.
+- Test on Real device cloud
+- Blazing fast test automation with HyperExecute
+- Accelerate testing, shorten job times and get faster feedback on code changes with Test At Scale.
+- Smart Visual Regression Testing on cloud
+- 120+ third-party integrations with your favorite tool for CI/CD, Project Management, Codeless Automation, and more.
+- Automated Screenshot testing across multiple browsers in a single click.
+- Local testing of web and mobile apps.
+- Online Accessibility Testing across 3000+ desktop and mobile browsers, browser versions, and operating systems.
+- Geolocation testing of web and mobile apps across 53+ countries.
+- LT Browser - for responsive testing across 50+ pre-installed mobile, tablets, desktop, and laptop viewports
+
[
](https://accounts.lambdatest.com/register?utm_source=github&utm_medium=repo&utm_campaign=serenity-selenium-sample)
## We are here to help you :headphones:
-* Got a query? we are available 24x7 to help. [Contact Us](mailto:support@lambdatest.com)
-* For more info, visit - [LambdaTest](https://www.lambdatest.com/?utm_source=github&utm_medium=repo&utm_campaign=serenity-selenium-sample)
+- Got a query? we are available 24x7 to help. [Contact Us](mailto:support@lambdatest.com)
+- For more info, visit - [LambdaTest](https://www.lambdatest.com/?utm_source=github&utm_medium=repo&utm_campaign=serenity-selenium-sample)
diff --git a/pom.xml b/pom.xml
index 28531be..683738b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
Serenity LambdaTest Integration
- 1.8
+ 11
${java.version}
${java.version}
3.5.3
@@ -19,47 +19,16 @@
${java.version}
UTF-8
- 2.0.48
- 2.0.67
- 1.9.37
+ 4.0.30
3.0.0-M3
3.0.0-M3
3.0.0-M2
3.8.0
- 10.0.2
- 10.0.2
-
-
-
- serenity
- bintray
- http://dl.bintray.com/serenity/maven
-
-
-
-
- serenity
- bintray-plugins
- http://dl.bintray.com/serenity/maven
-
-
-
-
- org.eclipse.jetty
- jetty-io
- ${jetty-io.version}
-
-
-
- org.eclipse.jetty
- jetty-util
- ${jetty-util.version}
-
net.serenity-bdd
@@ -71,30 +40,20 @@
serenity-junit
${serenity.version}
-
- net.serenity-bdd
- serenity-rest-assured
- ${serenity.version}
-
net.serenity-bdd
serenity-cucumber
- ${serenity.cucumber.version}
+ ${serenity.version}
org.slf4j
slf4j-simple
- 1.6.1
-
-
- org.codehaus.groovy
- groovy-all
- 1.8.6
+ 2.0.7
junit
junit
- 4.13.1
+ 4.13.2
test
@@ -105,31 +64,13 @@
org.assertj
assertj-core
- 3.12.2
+ 3.25.1
test
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${maven-enforcer-plugin.version}
-
-
- enforce
-
-
-
-
-
-
- enforce
-
-
-
-
org.apache.maven.plugins
maven-surefire-plugin
@@ -154,8 +95,6 @@
com/lambdatest/cucumber/SingleTest.java
- true
- -Xmx1024m -XX:MaxPermSize=256m
@@ -189,54 +128,4 @@
-
-
-
- single
-
-
-
- maven-failsafe-plugin
- ${maven.failsafe-plugin.version}
-
-
- com/lambdatest/cucumber/SingleTest.java
-
- true
- -Xmx1024m -XX:MaxPermSize=256m
-
- single
- MY_TEST_SCHEMA_${surefire.forkNumber}
-
-
-
-
-
-
-
-
- parallel
-
-
-
- maven-failsafe-plugin
- ${maven.failsafe-plugin.version}
-
-
- com/lambdatest/cucumber/Parallel*.java
-
- classes
- 10
- 10
- true
- -Xmx1024m -XX:MaxPermSize=256m
-
- parallel_${surefire.forkNumber}
-
-
-
-
-
-
-
diff --git a/serenity.properties b/serenity.properties
index 0776de9..e69de29 100644
--- a/serenity.properties
+++ b/serenity.properties
@@ -1,48 +0,0 @@
-webdriver.driver = provided
-webdriver.provided.type = mydriver
-webdriver.provided.mydriver = com.lambdatest.LambdaTestSerenityDriver
-thucydides.driver.capabilities = mydriver
-
-serenity.extension.packages = com.lambdatest.extensions
-
-webdriver.timeouts.implicitlywait = 5000
-serenity.use.unique.browser = false
-serenity.dry.run=false
-#serenity.take.screenshots=AFTER_EACH_STEP
-
-lt.user=LT_USERNAME
-lt.key=LT_ACCESS_KEY
-lt.grid=hub.lambdatest.com
-
-#You can add more capability with a prefix 'lt_' as below
-#For example to use lt_network as true use below capability
-lt_build=Serenity-Selenium-Sample
-lt_debug=true
-lt_console=false
-lt_visual=false
-
-#You can add more capability with a prefix 'environment.{environment}.' as below
-#Check valid capabilities here - https://www.lambdatest.com/capabilities-generator/
-
-environment.single.browser=Chrome
-environment.single.browserVersion=latest
-environment.single.platform=Windows 10
-
-environment.parallel_1.browser=Chrome
-environment.parallel_1.browserVersion=latest
-environment.parallel_1.platform=Windows 10
-
-environment.parallel_2.browser=firefox
-environment.parallel_2.browserVersion=latest
-environment.parallel_2.platform=Windows 8.1
-
-environment.parallel_3.browser=Safari
-environment.parallel_3.browserVersion=latest
-environment.parallel_3.platform=MacOS Mojave
-
-environment.parallel_4.browser=Internet Explorer
-environment.parallel_4.browserVersion=latest
-environment.parallel_4.platform=Windows 7
-
-#environment.parallel_5.deviceName=Galaxy S10
-
diff --git a/src/test/java/com/lambdatest/LambdaTestSerenityDriver.java b/src/test/java/com/lambdatest/LambdaTestSerenityDriver.java
deleted file mode 100644
index ccc7673..0000000
--- a/src/test/java/com/lambdatest/LambdaTestSerenityDriver.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.lambdatest;
-
-import java.net.URL;
-import java.util.Iterator;
-
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.remote.DesiredCapabilities;
-import org.openqa.selenium.remote.RemoteWebDriver;
-
-import net.thucydides.core.util.EnvironmentVariables;
-import net.thucydides.core.util.SystemEnvironmentVariables;
-import net.thucydides.core.webdriver.DriverSource;
-
-public class LambdaTestSerenityDriver implements DriverSource {
-
- public WebDriver newDriver() {
- EnvironmentVariables environmentVariables = SystemEnvironmentVariables.createEnvironmentVariables();
-
- String username = System.getenv("LT_USERNAME");
- if (username == null) {
- username = (String) environmentVariables.getProperty("lt.user");
- }
-
- String accessKey = System.getenv("LT_ACCESS_KEY");
- if (accessKey == null) {
- accessKey = (String) environmentVariables.getProperty("lt.key");
- }
-
- String environment = System.getProperty("environment");
-
- DesiredCapabilities capabilities = new DesiredCapabilities();
- capabilities.setCapability("plugin","Serenity LambdaTest Plugin");
-
- Iterator it = environmentVariables.getKeys().iterator();
- while (it.hasNext()) {
- String key = (String) it.next();
-
- if (key.equals("lt.user") || key.equals("lt.key") || key.equals("lt.grid")) {
- continue;
- } else if (key.startsWith("lt_")) {
- capabilities.setCapability(key.replace("lt_", ""), environmentVariables.getProperty(key));
-
- } else if (environment != null && key.startsWith("environment." + environment)) {
-
- capabilities.setCapability(key.replace("environment." + environment + ".", ""),
- environmentVariables.getProperty(key));
- }
- }
-
- try {
- String url = "https://" + username + ":" + accessKey + "@" + environmentVariables.getProperty("lt.grid")
- + "/wd/hub";
- return new RemoteWebDriver(new URL(url), capabilities);
- } catch (Exception e) {
- System.out.println(e);
- return null;
- }
- }
-
- public boolean takesScreenshots() {
- return false;
- }
-}
diff --git a/src/test/java/com/lambdatest/LambdaTestSerenityTest.java b/src/test/java/com/lambdatest/LambdaTestSerenityTest.java
deleted file mode 100644
index e1d4b36..0000000
--- a/src/test/java/com/lambdatest/LambdaTestSerenityTest.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.lambdatest;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-public class LambdaTestSerenityTest {
-
- @BeforeClass
- public static void setUp() throws Exception {
- }
-
- @AfterClass
- public static void tearDown() throws Exception {
- }
-}
\ No newline at end of file
diff --git a/src/test/java/com/lambdatest/cucumber/ParallelChromeTest.java b/src/test/java/com/lambdatest/cucumber/ParallelChromeTest.java
deleted file mode 100644
index b01d49e..0000000
--- a/src/test/java/com/lambdatest/cucumber/ParallelChromeTest.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.lambdatest.cucumber;
-
-import com.lambdatest.LambdaTestSerenityTest;
-import cucumber.api.CucumberOptions;
-import net.serenitybdd.cucumber.CucumberWithSerenity;
-import org.junit.runner.RunWith;
-
-@RunWith(CucumberWithSerenity.class)
-@CucumberOptions(features = "src/test/resources/features/single.feature")
-public class ParallelChromeTest extends LambdaTestSerenityTest {
-}
diff --git a/src/test/java/com/lambdatest/cucumber/ParallelFirefoxTest.java b/src/test/java/com/lambdatest/cucumber/ParallelFirefoxTest.java
deleted file mode 100644
index 92ae9d8..0000000
--- a/src/test/java/com/lambdatest/cucumber/ParallelFirefoxTest.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.lambdatest.cucumber;
-
-import com.lambdatest.LambdaTestSerenityTest;
-import cucumber.api.CucumberOptions;
-import net.serenitybdd.cucumber.CucumberWithSerenity;
-import org.junit.runner.RunWith;
-
-@RunWith(CucumberWithSerenity.class)
-@CucumberOptions(features = "src/test/resources/features/single.feature")
-public class ParallelFirefoxTest extends LambdaTestSerenityTest {
-}
diff --git a/src/test/java/com/lambdatest/cucumber/ParallelIETest.java b/src/test/java/com/lambdatest/cucumber/ParallelIETest.java
deleted file mode 100644
index dcef87a..0000000
--- a/src/test/java/com/lambdatest/cucumber/ParallelIETest.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.lambdatest.cucumber;
-
-import com.lambdatest.LambdaTestSerenityTest;
-import cucumber.api.CucumberOptions;
-import net.serenitybdd.cucumber.CucumberWithSerenity;
-import org.junit.runner.RunWith;
-
-@RunWith(CucumberWithSerenity.class)
-@CucumberOptions(features = "src/test/resources/features/single.feature")
-public class ParallelIETest extends LambdaTestSerenityTest {
-}
diff --git a/src/test/java/com/lambdatest/cucumber/ParallelSafariTest.java b/src/test/java/com/lambdatest/cucumber/ParallelSafariTest.java
deleted file mode 100644
index 3467ea1..0000000
--- a/src/test/java/com/lambdatest/cucumber/ParallelSafariTest.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.lambdatest.cucumber;
-
-import com.lambdatest.LambdaTestSerenityTest;
-import cucumber.api.CucumberOptions;
-import net.serenitybdd.cucumber.CucumberWithSerenity;
-import org.junit.runner.RunWith;
-
-@RunWith(CucumberWithSerenity.class)
-@CucumberOptions(features = "src/test/resources/features/single.feature")
-public class ParallelSafariTest extends LambdaTestSerenityTest {
-}
diff --git a/src/test/java/com/lambdatest/cucumber/SingleTest.java b/src/test/java/com/lambdatest/cucumber/SingleTest.java
index 438abd4..07f34cd 100644
--- a/src/test/java/com/lambdatest/cucumber/SingleTest.java
+++ b/src/test/java/com/lambdatest/cucumber/SingleTest.java
@@ -1,11 +1,10 @@
package com.lambdatest.cucumber;
-import com.lambdatest.LambdaTestSerenityTest;
-import cucumber.api.CucumberOptions;
+import io.cucumber.junit.CucumberOptions;
import net.serenitybdd.cucumber.CucumberWithSerenity;
import org.junit.runner.RunWith;
@RunWith(CucumberWithSerenity.class)
-@CucumberOptions(features = "src/test/resources/features/single.feature")
-public class SingleTest extends LambdaTestSerenityTest {
+@CucumberOptions(features = "src/test/resources/features/a_simple_todo_app.feature")
+public class SingleTest {
}
diff --git a/src/test/java/com/lambdatest/cucumber/pages/TodoApp.java b/src/test/java/com/lambdatest/cucumber/pages/TodoApp.java
index bc54af9..1054904 100644
--- a/src/test/java/com/lambdatest/cucumber/pages/TodoApp.java
+++ b/src/test/java/com/lambdatest/cucumber/pages/TodoApp.java
@@ -1,38 +1,26 @@
package com.lambdatest.cucumber.pages;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import org.openqa.selenium.support.FindBy;
-
-import net.serenitybdd.core.pages.WebElementFacade;
-import net.thucydides.core.annotations.DefaultUrl;
+import net.serenitybdd.annotations.DefaultUrl;
import net.thucydides.core.pages.PageObject;
+import org.openqa.selenium.By;
+
+import java.util.List;
@DefaultUrl("https://lambdatest.github.io/sample-todo-app/")
public class TodoApp extends PageObject {
- @FindBy(name = "li1")
- WebElementFacade element1;
- @FindBy(name = "li2")
- WebElementFacade element2;
- @FindBy(id = "sampletodotext")
- WebElementFacade inputBox;
- @FindBy(id = "addbutton")
- WebElementFacade addButton;
- @FindBy(xpath = "/html/body/div/div/div/ul/li[6]/span")
- WebElementFacade newElement;
- public void clickOn() {
- element1.click();
- element2.click();
+ private final static By LIST_ITEMS = By.cssSelector("div[ng-app='sampleApp'] li");
+
+ public void addNewElement(String newItem) {
+ $("#sampletodotext").sendKeys(newItem);
+ $("#addbutton").click();
}
- public void addNewElement(String newElem) {
- inputBox.sendKeys(newElem);
- addButton.click();
+ public List listItems() {
+ return findAll(LIST_ITEMS).texts();
}
- public void assertEqual(String newString) {
- String text = newElement.getText();
- assertThat(newString).isEqualTo(text);
+ public int itemCount() {
+ return listItems().size();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/lambdatest/cucumber/steps/TodoAppSteps.java b/src/test/java/com/lambdatest/cucumber/steps/TodoAppSteps.java
index afe91a7..cbc3af4 100644
--- a/src/test/java/com/lambdatest/cucumber/steps/TodoAppSteps.java
+++ b/src/test/java/com/lambdatest/cucumber/steps/TodoAppSteps.java
@@ -1,27 +1,28 @@
package com.lambdatest.cucumber.steps;
import com.lambdatest.cucumber.pages.TodoApp;
+import io.cucumber.java.en.Given;
+import io.cucumber.java.en.Then;
+import io.cucumber.java.en.When;
-import cucumber.api.java.en.And;
-import cucumber.api.java.en.Then;
-import cucumber.api.java.en.When;
+import static org.assertj.core.api.Assertions.assertThat;
public class TodoAppSteps {
TodoApp todo;
- @When("^I click on checkboxes$")
- public void search_google_for() throws Throwable {
+ @Given("I have opened the app")
+ @When("I open the app")
+ public void iOpenTheApp() {
todo.open();
- todo.clickOn();
}
- @And("^I add new Element \"([^\"]*)\"$")
- public void thenSubmit(String newText) throws Throwable {
- todo.addNewElement(newText);
+ @When("I add new item {string}")
+ public void iAddNewItem(String item) {
+ todo.addNewElement(item);
}
- @Then("^I Compare the new added element text with \"([^\"]*)\"$")
- public void matchTitle(String matchElem) throws Throwable {
- todo.assertEqual(matchElem);
+ @Then("I should see {int} items")
+ public void iShouldSeeItems(int expectedItems) {
+ assertThat(todo.itemCount()).isEqualTo(expectedItems);
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/lambdatest/extensions/LambdaTestScenario.java b/src/test/java/com/lambdatest/extensions/LambdaTestScenario.java
deleted file mode 100644
index 93b39bd..0000000
--- a/src/test/java/com/lambdatest/extensions/LambdaTestScenario.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package com.lambdatest.extensions;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import org.apache.http.client.methods.HttpPatch;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.HttpClientBuilder;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.remote.DesiredCapabilities;
-
-import net.serenitybdd.core.webdriver.RemoteDriver;
-import net.serenitybdd.core.webdriver.enhancers.AfterAWebdriverScenario;
-import net.serenitybdd.core.webdriver.enhancers.BeforeAWebdriverScenario;
-import net.thucydides.core.model.TestOutcome;
-import net.thucydides.core.util.EnvironmentVariables;
-import net.thucydides.core.webdriver.SupportedWebDriver;
-
-public class LambdaTestScenario implements AfterAWebdriverScenario, BeforeAWebdriverScenario {
-
- @Override
- public void apply(EnvironmentVariables environmentVariables, TestOutcome testOutcome, WebDriver driver) {
-
- if ((driver == null) || (!RemoteDriver.isARemoteDriver(driver))) {
- return;
- }
-
- try {
- String sessionId = RemoteDriver.of(driver).getSessionId().toString();
-
- String username = System.getenv("LT_USERNAME");
- if (username == null) {
- username = (String) environmentVariables.getProperty("lt.user");
- }
-
- String accessKey = System.getenv("LT_ACCESS_KEY");
- if (accessKey == null) {
- accessKey = (String) environmentVariables.getProperty("lt.key");
- }
-
- String environment = System.getProperty("environment");
-
- URI uri = new URI("https://" + username + ":" + accessKey
- + "@api.lambdatest.com/automation/api/v1/sessions/" + sessionId);
- HttpPatch putRequest = new HttpPatch(uri);
-
- String result = "completed";
- if (testOutcome.isSuccess()) {
- result = "passed";
- } else if (testOutcome.isFailure() || testOutcome.isError() || testOutcome.isCompromised()) {
- result = "failed";
- }
-
- StringEntity entity;
-
- if (environment != null && environmentVariables.getKeys().contains(".name")) {
-
- entity = new StringEntity("{\"status_ind\":" + "\"" + result + "\"}");
- } else {
-
- entity = new StringEntity("{\"name\":\"" + testOutcome.getStoryTitle() + " - " + testOutcome.getTitle()
- + "\",\"status_ind\":" + "\"" + result + "\"}");
- }
-
- putRequest.setEntity(entity);
-
- HttpClientBuilder.create().build().execute(putRequest);
-
- } catch (URISyntaxException | IOException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public DesiredCapabilities apply(EnvironmentVariables environmentVariables, SupportedWebDriver driver,
- TestOutcome testOutcome, DesiredCapabilities capabilities) {
-
- capabilities.setCapability("name", testOutcome.getStoryTitle() + " - " + testOutcome.getTitle());
- return capabilities;
-
- }
-}
\ No newline at end of file
diff --git a/src/test/resources/features/a_simple_todo_app.feature b/src/test/resources/features/a_simple_todo_app.feature
new file mode 100644
index 0000000..bb936b9
--- /dev/null
+++ b/src/test/resources/features/a_simple_todo_app.feature
@@ -0,0 +1,12 @@
+Feature: A Simple Todo App
+
+ Rule: The app should initally contain 5 items
+ Scenario: Can see the default items
+ When I open the app
+ Then I should see 5 items
+
+ Rule: Users can add more items to the list
+ Scenario: Can add new items
+ Given I have opened the app
+ When I add new item "Complete LambdaTest Tutorial"
+ Then I should see 6 items
diff --git a/src/test/resources/serenity.conf b/src/test/resources/serenity.conf
new file mode 100644
index 0000000..0e4e187
--- /dev/null
+++ b/src/test/resources/serenity.conf
@@ -0,0 +1,32 @@
+# Default configuration
+serenity {
+ take.screenshots = FOR_FAILURES
+}
+
+# Configuration for local testing
+environments {
+ local {
+ webdriver.driver = chrome
+ webdriver.chrome.driver = "{local chrome driver path}"
+ headless.mode = false
+ chrome.switches = """--start-maximized;--test-type;--no-sandbox;--ignore-certificate-errors;
+ --disable-popup-blocking;--disable-default-apps;--disable-extensions-file-access-check;
+ --incognito;--disable-infobars;--disable-gpu"""
+ },
+
+ # Configuration for LambdaTest
+ lambdatest {
+ webdriver.driver = remote
+ webdriver.remote.url = "https://"${LT_USERNAME}":"${LT_ACCESS_KEY}"@hub.lambdatest.com/wd/hub"
+ # webdriver.remote.url = "http://127.0.0.1:4444" // Local grid
+ webdriver.remote.driver = chrome
+ serenity.take.screenshots = FOR_FAILURES
+ chrome.capabilities.browserName = "Chrome"
+ chrome.capabilities.acceptInsecureCerts = true
+ "chrome.capabilities.goog:chromeOptions.args" = ["--no-sandbox", "--disable-dev-shm-usage"]
+ "LT:options" {
+ platformName = "Windows 11"
+ build = "LT Serenity mac"
+ }
+ }
+}