Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
samuel.cheng committed Sep 28, 2024
0 parents commit fda8b61
Show file tree
Hide file tree
Showing 284 changed files with 4,496 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
44 changes: 44 additions & 0 deletions .features-gen/features/staking-simulator.feature.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/** Generated from: features/staking-simulator.feature */
import { test } from "playwright-bdd";

test.describe("MEME Staking Simulator", () => {

test("Verify Initial Stake Display without Wallet Connection", async ({ Given, page, Then }) => {
await Given("I open the MEME Staking page", null, { page });
await Then("I should see the stake value as \"69,696.69\" and steaks per week value on the basis of stake multiplier which should be \"1x\"", null, { page });
});

test("Verify STAKES and STAKES / WEEK value on change of STAKE(Min)", async ({ Given, page, When, Then }) => {
await Given("I open the MEME Staking page", null, { page });
await When("I enter \"123\" into the stake input field", null, { page });
await Then("I should see the stake value as \"123\" and steaks per week value on the basis of stake multiplier which should be \"1x\"", null, { page });
});

test("Verify STAKES MAX button to make Maximum STAKES", async ({ Given, page, When, Then }) => {
await Given("I open the MEME Staking page", null, { page });
await When("I click on MAX button");
await Then("I should see the stake value as \"6900000\" and steaks per week value on the basis of stake multiplier which should be \"1x\"", null, { page });
});

test("Verify STAKES Slider", async ({ Given, page, When, Then }) => {
await Given("I open the MEME Staking page", null, { page });
await When("I move slider by \"80\"%");
await Then("I should see the stake value as \"5520000\" and steaks per week value on the basis of stake multiplier which should be \"1x\"", null, { page });
});

});

// == technical section ==

test.use({
$test: ({}, use) => use(test),
$uri: ({}, use) => use("features/staking-simulator.feature"),
$bddFileMeta: ({}, use) => use(bddFileMeta),
});

const bddFileMeta = {
"Verify Initial Stake Display without Wallet Connection": {"pickleLocation":"3:3"},
"Verify STAKES and STAKES / WEEK value on change of STAKE(Min)": {"pickleLocation":"7:3"},
"Verify STAKES MAX button to make Maximum STAKES": {"pickleLocation":"12:3"},
"Verify STAKES Slider": {"pickleLocation":"17:3"},
};
35 changes: 35 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Playwright Tests
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Install winston Loggers
run: npm install winston
- name: Install Allure commandline
run: npm install --save-dev allure-commandline
- name: Run Playwright tests
run: npx bddgen && npx playwright test
- name: Generate Allure results
run: npx allure generate ./allure-results -o ./allure-report
- name: Generate Allure report
run: npx allure generate allure-results --clean -o allure-report
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: allure-report
path: allure-report/
retention-days: 30
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/playwright-cucumber.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

125 changes: 125 additions & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Stakeland Playwright BDD Automation Framework

This repository contains an automated testing framework using Playwright, Cucumber BDD, and the Page Object Model (POM) design pattern. It is used to automate end-to-end tests for the Staking Simulator application.

## Prerequisites
Before running the tests, ensure that the following are installed on your system:

Node.js (v14+)
NPM
Playwright dependencies (Playwright will handle browser downloads)
Installation
Clone this repository:

bash
```
git clone https://github.com/your-repo/stakeland-playwright.git
```

Navigate to the project directory:

bash
```
cd stakeland-playwright
```

Install the required Node.js dependencies:

bash
```
npm install
```

## Workflow Diagram

![img.png](img.png)

## Project Structure
The project is organized into the following main directories:

````
Copy code
|-- features/ # Cucumber feature files
| |-- staking-simulator.feature # Contains test scenarios for staking simulator
|
|-- pages/ # Page Object Model (POM) classes for different pages
| |-- staking-simulator.js # Staking simulator page object
|
|-- steps/ # Step definitions for Cucumber scenarios
| |-- staking-simulator.js # Step definitions for staking simulator
|
|-- utils/ # Utility classes and helper functions
| |-- helpers.js # Common utility functions
|
|-- playwright-report/ # Playwright HTML test reports
| |-- report.html # Latest HTML report for test execution
|
|-- test-results/ # JSON results of the last test run
| |-- .last-run.json # JSON output from last test execution
|
|-- playwright.config.js # Playwright configuration file
|
|-- package.json # Project dependencies and scripts
````

## Key Files
- `staking-simulator.feature`: Cucumber feature file containing scenarios for the staking simulator.
- `staking-simulator.js` (Pages): Implements the Page Object Model pattern for interacting with elements on the staking simulator page.
- `staking-simulator.js` (Steps): Contains Cucumber step definitions mapped to the scenarios in the feature file.
- `playwright.config.js`: Configures the Playwright environment for browser settings, timeouts, and reports.


## Running the Tests
You can execute the Playwright tests using the following NPM scripts defined in `package.json`.

### Run All Tests
bash
````
npx bddgen && npx playwright test
````

### Run Tests in Headed Mode
To run tests with the browser UI, use the following command:

bash
````
npx bddgen && npx playwright test --headed
````

### Generate and View Report
After running the tests, Generate Allure Results:

bash
````
npx allure generate ./allure-results -o ./allure-report
````

and to Generate Allure Report:

bash
````
npx allure generate allure-results --clean -o allure-report
````

To View Allure Report:

`/allure-report/index.html`

### Configuration
#### Playwright Configuration
The Playwright configuration file (`playwright.config.js`) allows you to customize the testing environment, including:

- Browsers: Choose between Chromium, Firefox, or WebKit.
- Headless Mode: Run tests in headless mode or with UI.
- Timeouts: Set global and per-test timeouts.
- Reports: Generate test reports in different formats (e.g., HTML, JSON).

## Cucumber Options
Cucumber options like the location of feature files and the format for test results are defined in the step definition files and the Playwright config.

## Continuous Integration
This project includes a sample GitHub Actions workflow file (`.github/workflows/playwright.yml`) for continuous integration.

## Running Tests in CI
1. Push your changes to the repository.
2. GitHub Actions will automatically trigger the Playwright tests as defined in the workflow.
2 changes: 2 additions & 0 deletions allure-report/app.js

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions allure-report/data/attachments/18e741b6f70a192e.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{"level":"info","message":"https://www.stakeland.com/ Website Visited","timestamp":"2024-09-28T16:16:14.961Z"}
{"level":"info","message":"Clicked Skip Button","timestamp":"2024-09-28T16:16:16.033Z"}
{"level":"info","message":"Clicked Dialog Close Button","timestamp":"2024-09-28T16:16:17.115Z"}
{"level":"info","message":"stake Amount Input Locator visible","timestamp":"2024-09-28T16:16:20.147Z"}
{"level":"info","message":"multiplier visible","timestamp":"2024-09-28T16:16:20.153Z"}
{"level":"info","message":"stake Amount Input visible","timestamp":"2024-09-28T16:16:20.156Z"}
{"level":"info","message":"initial Wasted visible","timestamp":"2024-09-28T16:16:20.161Z"}
{"level":"info","message":"current Stakes Value visible","timestamp":"2024-09-28T16:16:20.174Z"}
{"level":"info","message":"current STEAKS / WEEK Value visible","timestamp":"2024-09-28T16:16:20.187Z"}
8 changes: 8 additions & 0 deletions allure-report/data/attachments/1a615b60b57ad44b.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{"level":"info","message":"https://www.stakeland.com/ Website Visited","timestamp":"2024-09-28T16:16:07.874Z"}
{"level":"info","message":"Clicked Skip Button","timestamp":"2024-09-28T16:16:08.940Z"}
{"level":"info","message":"Clicked Dialog Close Button","timestamp":"2024-09-28T16:16:10.056Z"}
{"level":"info","message":"multiplier visible","timestamp":"2024-09-28T16:16:11.068Z"}
{"level":"info","message":"stake Amount Input visible","timestamp":"2024-09-28T16:16:11.075Z"}
{"level":"info","message":"initial Wasted visible","timestamp":"2024-09-28T16:16:11.089Z"}
{"level":"info","message":"current Stakes Value visible","timestamp":"2024-09-28T16:16:11.182Z"}
{"level":"info","message":"current STEAKS / WEEK Value visible","timestamp":"2024-09-28T16:16:11.270Z"}
9 changes: 9 additions & 0 deletions allure-report/data/attachments/1d0bc1614d49b16d.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{"level":"info","message":"https://www.stakeland.com/ Website Visited","timestamp":"2024-09-28T16:08:36.488Z"}
{"level":"info","message":"Clicked Skip Button","timestamp":"2024-09-28T16:08:37.612Z"}
{"level":"info","message":"Clicked Dialog Close Button","timestamp":"2024-09-28T16:08:38.735Z"}
{"level":"info","message":"Clicked MAX","timestamp":"2024-09-28T16:08:40.786Z"}
{"level":"info","message":"multiplier visible","timestamp":"2024-09-28T16:08:40.794Z"}
{"level":"info","message":"stake Amount Input visible","timestamp":"2024-09-28T16:08:40.798Z"}
{"level":"info","message":"initial Wasted visible","timestamp":"2024-09-28T16:08:40.810Z"}
{"level":"info","message":"current Stakes Value visible","timestamp":"2024-09-28T16:08:40.891Z"}
{"level":"info","message":"current STEAKS / WEEK Value visible","timestamp":"2024-09-28T16:08:40.974Z"}
9 changes: 9 additions & 0 deletions allure-report/data/attachments/2990e4f187e37ed5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{"level":"info","message":"https://www.stakeland.com/ Website Visited","timestamp":"2024-09-28T16:16:21.741Z"}
{"level":"info","message":"Clicked Skip Button","timestamp":"2024-09-28T16:16:22.844Z"}
{"level":"info","message":"Clicked Dialog Close Button","timestamp":"2024-09-28T16:16:23.917Z"}
{"level":"info","message":"Clicked MAX","timestamp":"2024-09-28T16:16:25.967Z"}
{"level":"info","message":"multiplier visible","timestamp":"2024-09-28T16:16:25.974Z"}
{"level":"info","message":"stake Amount Input visible","timestamp":"2024-09-28T16:16:25.979Z"}
{"level":"info","message":"initial Wasted visible","timestamp":"2024-09-28T16:16:25.983Z"}
{"level":"info","message":"current Stakes Value visible","timestamp":"2024-09-28T16:16:26.011Z"}
{"level":"info","message":"current STEAKS / WEEK Value visible","timestamp":"2024-09-28T16:16:26.035Z"}
9 changes: 9 additions & 0 deletions allure-report/data/attachments/2d3892c54bb84132.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{"level":"info","message":"https://www.stakeland.com/ Website Visited","timestamp":"2024-09-28T16:08:29.288Z"}
{"level":"info","message":"Clicked Skip Button","timestamp":"2024-09-28T16:08:30.403Z"}
{"level":"info","message":"Clicked Dialog Close Button","timestamp":"2024-09-28T16:08:31.485Z"}
{"level":"info","message":"stake Amount Input Locator visible","timestamp":"2024-09-28T16:08:34.507Z"}
{"level":"info","message":"multiplier visible","timestamp":"2024-09-28T16:08:34.515Z"}
{"level":"info","message":"stake Amount Input visible","timestamp":"2024-09-28T16:08:34.518Z"}
{"level":"info","message":"initial Wasted visible","timestamp":"2024-09-28T16:08:34.526Z"}
{"level":"info","message":"current Stakes Value visible","timestamp":"2024-09-28T16:08:34.538Z"}
{"level":"info","message":"current STEAKS / WEEK Value visible","timestamp":"2024-09-28T16:08:34.552Z"}
9 changes: 9 additions & 0 deletions allure-report/data/attachments/3281a1302e35e501.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{"level":"info","message":"https://www.stakeland.com/ Website Visited","timestamp":"2024-09-28T16:08:35.140Z"}
{"level":"info","message":"Clicked Skip Button","timestamp":"2024-09-28T16:08:36.198Z"}
{"level":"info","message":"Clicked Dialog Close Button","timestamp":"2024-09-28T16:08:37.305Z"}
{"level":"info","message":"Slider Moved to 80%","timestamp":"2024-09-28T16:08:40.384Z"}
{"level":"info","message":"multiplier visible","timestamp":"2024-09-28T16:08:40.388Z"}
{"level":"info","message":"stake Amount Input visible","timestamp":"2024-09-28T16:08:40.392Z"}
{"level":"info","message":"initial Wasted visible","timestamp":"2024-09-28T16:08:40.401Z"}
{"level":"info","message":"current Stakes Value visible","timestamp":"2024-09-28T16:08:40.484Z"}
{"level":"info","message":"current STEAKS / WEEK Value visible","timestamp":"2024-09-28T16:08:40.575Z"}
9 changes: 9 additions & 0 deletions allure-report/data/attachments/3d4c70139992cb81.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{"level":"info","message":"https://www.stakeland.com/ Website Visited","timestamp":"2024-09-28T16:08:35.317Z"}
{"level":"info","message":"Clicked Skip Button","timestamp":"2024-09-28T16:08:36.397Z"}
{"level":"info","message":"Clicked Dialog Close Button","timestamp":"2024-09-28T16:08:37.567Z"}
{"level":"info","message":"stake Amount Input Locator visible","timestamp":"2024-09-28T16:08:40.600Z"}
{"level":"info","message":"multiplier visible","timestamp":"2024-09-28T16:08:40.607Z"}
{"level":"info","message":"stake Amount Input visible","timestamp":"2024-09-28T16:08:40.612Z"}
{"level":"info","message":"initial Wasted visible","timestamp":"2024-09-28T16:08:40.623Z"}
{"level":"info","message":"current Stakes Value visible","timestamp":"2024-09-28T16:08:40.660Z"}
{"level":"info","message":"current STEAKS / WEEK Value visible","timestamp":"2024-09-28T16:08:40.693Z"}
9 changes: 9 additions & 0 deletions allure-report/data/attachments/3e5de4c37a53d11e.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{"level":"info","message":"https://www.stakeland.com/ Website Visited","timestamp":"2024-09-28T16:16:21.933Z"}
{"level":"info","message":"Clicked Skip Button","timestamp":"2024-09-28T16:16:23.027Z"}
{"level":"info","message":"Clicked Dialog Close Button","timestamp":"2024-09-28T16:16:24.102Z"}
{"level":"info","message":"stake Amount Input Locator visible","timestamp":"2024-09-28T16:16:27.120Z"}
{"level":"info","message":"multiplier visible","timestamp":"2024-09-28T16:16:27.126Z"}
{"level":"info","message":"stake Amount Input visible","timestamp":"2024-09-28T16:16:27.129Z"}
{"level":"info","message":"initial Wasted visible","timestamp":"2024-09-28T16:16:27.133Z"}
{"level":"info","message":"current Stakes Value visible","timestamp":"2024-09-28T16:16:27.144Z"}
{"level":"info","message":"current STEAKS / WEEK Value visible","timestamp":"2024-09-28T16:16:27.152Z"}
9 changes: 9 additions & 0 deletions allure-report/data/attachments/4fbdbb706f9f100d.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{"level":"info","message":"https://www.stakeland.com/ Website Visited","timestamp":"2024-09-28T16:16:20.650Z"}
{"level":"info","message":"Clicked Skip Button","timestamp":"2024-09-28T16:16:21.819Z"}
{"level":"info","message":"Clicked Dialog Close Button","timestamp":"2024-09-28T16:16:22.909Z"}
{"level":"info","message":"Slider Moved to 80%","timestamp":"2024-09-28T16:16:25.987Z"}
{"level":"info","message":"multiplier visible","timestamp":"2024-09-28T16:16:25.995Z"}
{"level":"info","message":"stake Amount Input visible","timestamp":"2024-09-28T16:16:25.998Z"}
{"level":"info","message":"initial Wasted visible","timestamp":"2024-09-28T16:16:26.004Z"}
{"level":"info","message":"current Stakes Value visible","timestamp":"2024-09-28T16:16:26.039Z"}
{"level":"info","message":"current STEAKS / WEEK Value visible","timestamp":"2024-09-28T16:16:26.065Z"}
8 changes: 8 additions & 0 deletions allure-report/data/attachments/513a73f164ac21ce.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{"level":"info","message":"https://www.stakeland.com/ Website Visited","timestamp":"2024-09-28T16:08:37.831Z"}
{"level":"info","message":"Clicked Skip Button","timestamp":"2024-09-28T16:08:38.904Z"}
{"level":"info","message":"Clicked Dialog Close Button","timestamp":"2024-09-28T16:08:39.981Z"}
{"level":"info","message":"multiplier visible","timestamp":"2024-09-28T16:08:40.991Z"}
{"level":"info","message":"stake Amount Input visible","timestamp":"2024-09-28T16:08:40.994Z"}
{"level":"info","message":"initial Wasted visible","timestamp":"2024-09-28T16:08:40.998Z"}
{"level":"info","message":"current Stakes Value visible","timestamp":"2024-09-28T16:08:41.037Z"}
{"level":"info","message":"current STEAKS / WEEK Value visible","timestamp":"2024-09-28T16:08:41.066Z"}
9 changes: 9 additions & 0 deletions allure-report/data/attachments/5699723d5e75e88d.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{"level":"info","message":"https://www.stakeland.com/ Website Visited","timestamp":"2024-09-28T16:08:37.820Z"}
{"level":"info","message":"Clicked Skip Button","timestamp":"2024-09-28T16:08:38.894Z"}
{"level":"info","message":"Clicked Dialog Close Button","timestamp":"2024-09-28T16:08:39.982Z"}
{"level":"info","message":"stake Amount Input Locator visible","timestamp":"2024-09-28T16:08:43.008Z"}
{"level":"info","message":"multiplier visible","timestamp":"2024-09-28T16:08:43.028Z"}
{"level":"info","message":"stake Amount Input visible","timestamp":"2024-09-28T16:08:43.059Z"}
{"level":"info","message":"initial Wasted visible","timestamp":"2024-09-28T16:08:43.071Z"}
{"level":"info","message":"current Stakes Value visible","timestamp":"2024-09-28T16:08:43.104Z"}
{"level":"info","message":"current STEAKS / WEEK Value visible","timestamp":"2024-09-28T16:08:43.123Z"}
9 changes: 9 additions & 0 deletions allure-report/data/attachments/5923b9cd5b1c3c83.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{"level":"info","message":"https://www.stakeland.com/ Website Visited","timestamp":"2024-09-28T16:16:06.184Z"}
{"level":"info","message":"Clicked Skip Button","timestamp":"2024-09-28T16:16:07.329Z"}
{"level":"info","message":"Clicked Dialog Close Button","timestamp":"2024-09-28T16:16:08.399Z"}
{"level":"info","message":"Clicked MAX","timestamp":"2024-09-28T16:16:10.454Z"}
{"level":"info","message":"multiplier visible","timestamp":"2024-09-28T16:16:10.464Z"}
{"level":"info","message":"stake Amount Input visible","timestamp":"2024-09-28T16:16:10.467Z"}
{"level":"info","message":"initial Wasted visible","timestamp":"2024-09-28T16:16:10.472Z"}
{"level":"info","message":"current Stakes Value visible","timestamp":"2024-09-28T16:16:10.502Z"}
{"level":"info","message":"current STEAKS / WEEK Value visible","timestamp":"2024-09-28T16:16:10.530Z"}
9 changes: 9 additions & 0 deletions allure-report/data/attachments/5b55f48078e802a5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{"level":"info","message":"https://www.stakeland.com/ Website Visited","timestamp":"2024-09-28T16:08:43.482Z"}
{"level":"info","message":"Clicked Skip Button","timestamp":"2024-09-28T16:08:44.577Z"}
{"level":"info","message":"Clicked Dialog Close Button","timestamp":"2024-09-28T16:08:45.675Z"}
{"level":"info","message":"Slider Moved to 80%","timestamp":"2024-09-28T16:08:48.774Z"}
{"level":"info","message":"multiplier visible","timestamp":"2024-09-28T16:08:48.781Z"}
{"level":"info","message":"stake Amount Input visible","timestamp":"2024-09-28T16:08:48.784Z"}
{"level":"info","message":"initial Wasted visible","timestamp":"2024-09-28T16:08:48.788Z"}
{"level":"info","message":"current Stakes Value visible","timestamp":"2024-09-28T16:08:48.819Z"}
{"level":"info","message":"current STEAKS / WEEK Value visible","timestamp":"2024-09-28T16:08:48.848Z"}
Loading

0 comments on commit fda8b61

Please sign in to comment.