Skip to content

Commit 281bc10

Browse files
Initial commit
1 parent 2936971 commit 281bc10

File tree

14 files changed

+4190
-0
lines changed

14 files changed

+4190
-0
lines changed

.github/workflows/playwright.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Playwright Tests
2+
on:
3+
push:
4+
branches: [ main, master ]
5+
pull_request:
6+
branches: [ main, master ]
7+
jobs:
8+
test:
9+
timeout-minutes: 60
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: lts/*
16+
- name: Install dependencies
17+
run: npm ci
18+
- name: Install Playwright Browsers
19+
run: npx playwright install --with-deps
20+
- name: Run Playwright tests
21+
run: npx playwright test
22+
- uses: actions/upload-artifact@v4
23+
if: ${{ !cancelled() }}
24+
with:
25+
name: playwright-report
26+
path: playwright-report/
27+
retention-days: 30

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
# Playwright
3+
node_modules/
4+
/test-results/
5+
/playwright-report/
6+
/blob-report/
7+
/playwright/.cache/
8+
/reports

cucumber.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
default: {
3+
requireModule: ["ts-node/register"],
4+
require: ["steps/**/*.ts", "support/**/*.ts"], // Load steps & hooks
5+
format: [
6+
"json:reports/cucumber_report.json", // Cucumber JSON report
7+
"html:reports/cucumber_report.html", // HTML report
8+
9+
],
10+
parallel: 4, // Run 4 scenarios in parallel
11+
},
12+
};
13+
14+

features/checkout.feature

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Feature: Checkout process in Sauce Demo
2+
As a user
3+
I want to complete the checkout process
4+
So that I can purchase items successfully
5+
6+
@positive
7+
Scenario Outline: Successful checkout
8+
Given I am logged into Sauce Demo
9+
When I add "<item>" to the cart
10+
And I proceed to checkout
11+
And I enter "<firstName>", "<lastName>", and "<postalCode>"
12+
And I confirm the order
13+
Then I should see the order confirmation
14+
15+
Examples:
16+
| item | firstName | lastName | postalCode |
17+
| Sauce Labs Bike Light | John | Doe | 12345 |
18+
19+
@negative
20+
Scenario Outline: Checkout fails with missing details
21+
Given I am logged into Sauce Demo
22+
When I add "<item>" to the cart
23+
And I proceed to checkout
24+
And I enter "<firstName>", "<lastName>", and "<postalCode>"
25+
And I confirm the order
26+
Then I should see an error message
27+
28+
Examples:
29+
| item | firstName | lastName | postalCode |
30+
| Sauce Labs Backpack | John | Doe | |
31+
| Sauce Labs T-Shirt | | Doe | 12345 |
32+
| Sauce Labs Onesie | John | | 12345 |

features/login.feature

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Feature: Login to Sauce Demo
2+
As a user
3+
I want to be able to log in with valid and invalid credentials
4+
So that I can access the inventory page or see an error message
5+
6+
@positive
7+
Scenario Outline: Successful Login
8+
Given I navigate to the Sauce Demo login page
9+
When I enter username "<username>" and password "<password>"
10+
And I click the login button
11+
Then I should see the products page
12+
13+
Examples:
14+
| username | password |
15+
| standard_user | secret_sauce |
16+
17+
@negative
18+
Scenario Outline: Unsuccessful Login
19+
Given I navigate to the Sauce Demo login page
20+
When I enter username "<username>" and password "<password>"
21+
And I click the login button
22+
Then I should see an error message "<error_message>"
23+
24+
Examples:
25+
| username | password | error_message |
26+
| invalid_user | wrong_pass | Epic sadface: Username and password do not match any user in this service |
27+
| | secret_sauce | Epic sadface: Username is required |
28+
| standard_user | | Epic sadface: Password is required |

0 commit comments

Comments
 (0)