Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cucumber.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
module.exports = {
default: `--require-module ts-node/register --require './steps/**/*.ts' --require './hooks/**/*.ts --format @cucumber/pretty-formatter`
default: `
--require-module ts-node/register
--require ./steps/**/*.ts
--require ./hooks/**/*.ts
--format progress
`
};
13 changes: 7 additions & 6 deletions features/login.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ Feature: Login Feature
Given I open the "https://www.saucedemo.com/" page

Scenario: Validate the login page title
# TODO: Fix this failing scenario
Then I should see the title "Labs Swag"

Scenario: Validate login error message
Then I will login as 'locked_out_user'
# TODO: Add a step to validate the error message received
When I login with username "standard_user"
Then I should be on the inventory page
And the page title should be "Swag Labs"

Scenario: Validate login error message
When I login with username "locked_out_user"
Then I should see the error message "Sorry, this user has been locked out."
10 changes: 5 additions & 5 deletions features/product.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ Feature: Product Feature

# Create a datatable to validate the Price (high to low) and Price (low to high) sort options (top-right) using a Scenario Outline
Scenario Outline: Validate product sort by price <sort>
Then I will login as 'standard_user'
# TODO: Sort the items by <sort>
# TODO: Validate all 6 items are sorted correctly by price
Examples:
When I login with username "standard_user"
When I sort products by "low to high"
Then prices should be sorted correctly
# Examples:
# TODO: extend the datatable to paramterize this test
| sort |
# | sort |
12 changes: 5 additions & 7 deletions features/purchase.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ Feature: Purchase Feature
Given I open the "https://www.saucedemo.com/" page

Scenario: Validate successful purchase text
Then I will login as 'standard_user'
When I login with username "standard_user"
Then I will add the backpack to the cart
# TODO: Select the cart (top-right)
# TODO: Select Checkout
# TODO: Fill in the First Name, Last Name, and Zip/Postal Code
# TODO: Select Continue
# TODO: Select Finish
# TODO: Validate the text 'Thank you for your order!'
Then I proceed to checkout
Then I fill in checkout info with "supriya" "keerthipati" "28277"
Then I complete the purchase
Then I should see the success message "Thank you for your order!"
19 changes: 8 additions & 11 deletions hooks/globalHooks.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import { After, Before, setDefaultTimeout } from "@cucumber/cucumber";
import { closeBrowser, initializeBrowser, initializePage } from "../playwrightUtilities";
import { Before, After } from '@cucumber/cucumber';
import { initBrowser, closeBrowser } from '../playwrightUtilities';

setDefaultTimeout(15000);
Before(async function () {
await initBrowser(); // initialize browser and page before any scenario
});

Before( async () => {
await initializeBrowser();
await initializePage();
})

After( async () => {
await closeBrowser();
})
After(async function () {
await closeBrowser(); // close browser after scenario
});
Loading
Loading