File tree Expand file tree Collapse file tree 5 files changed +84
-1
lines changed Expand file tree Collapse file tree 5 files changed +84
-1
lines changed Original file line number Diff line number Diff line change @@ -3,12 +3,14 @@ import { BasePage } from "../pages/BasePage";
33import { LoginPage } from "../pages/LoginPage" ;
44import { RegistrationPage } from "../pages/RegistrationPage" ;
55import { ProductPage } from "../pages/ProductPage" ;
6+ import { CheckoutPage } from "../pages/CheckoutPage" ;
67
78type MyFixtures = {
89 basePage : BasePage ;
910 loginPage : LoginPage ;
1011 registrationPage : RegistrationPage ;
1112 productPage : ProductPage ;
13+ checkoutPage : CheckoutPage ;
1214 //add more types here
1315} ;
1416
@@ -25,5 +27,8 @@ export const test = base.extend<MyFixtures>({
2527 productPage : async ( { page } , use ) => {
2628 await use ( new ProductPage ( page ) ) ;
2729 } ,
30+ checkoutPage : async ( { page } , use ) => {
31+ await use ( new CheckoutPage ( page ) ) ;
32+ } ,
2833 //define others similarly
2934} ) ;
Original file line number Diff line number Diff line change 1+ import { Page , Locator , expect } from "@playwright/test" ;
2+
3+ export class CheckoutPage {
4+ readonly page : Page ;
5+ //TODO: Define locators for checkout page elements here
6+
7+ constructor ( page : Page ) {
8+ this . page = page ;
9+ }
10+
11+ // Add methods for checkout page interactions as needed
12+ }
Original file line number Diff line number Diff line change 1- @wip
1+ @addToCart
22Feature : Add items to shopping cart
33
44 As a user
Original file line number Diff line number Diff line change 1+ @checkout
2+ Feature : Checkout
3+ Given the user is on the homepage
4+
5+ Scenario Outline : Verify user can checkout successfully
6+ When the user selects a product "Thor Hammer"
7+ And the user clicks add to cart button
8+ And user clicks shopping cart icon
9+ And user click proceed to checkout button
10+ And user logs in
11+ And user click proceed to checkout button
12+ And user fills in the shipping address details and click proceeds to checkout button
13+ And user select payment method <"payment-method">
14+ And user enters valid payment details for <"payment-method">
15+ And user clicks confirm button
16+ Then user should see an order confirmation message
17+
18+ Examples :
19+ | payment -method |
20+ | Bank Transfer |
21+ | Cash on Delivery |
22+ | Credit Card |
23+ | Buy Now Pay Later |
24+ | Gift Card |
25+
26+ #TODO Scenario with logged in user before adding to cart
27+ #TODO Scenario with continuing as guest user
Original file line number Diff line number Diff line change 1+ import { Given , When , Then } from "@cucumber/cucumber" ;
2+
3+ When ( "user clicks shopping cart icon" , async function ( ) {
4+
5+ } ) ;
6+
7+ When ( "user click proceed to checkout button" , async function ( ) {
8+
9+ } ) ;
10+
11+ When ( "user logs in" , async function ( ) {
12+
13+ } ) ;
14+
15+ When (
16+ "user fills in the shipping address details and click proceeds to checkout button" ,
17+ async function ( ) {
18+
19+ }
20+ ) ;
21+
22+ When ( "user select payment method <{string}>" , async function ( string ) {
23+
24+ } ) ;
25+
26+ When (
27+ "user enters valid payment details for <{string}>" ,
28+ async function ( string ) {
29+ =
30+ }
31+ ) ;
32+
33+ When ( "user clicks confirm button" , async function ( ) {
34+
35+ } ) ;
36+
37+ Then ( "user should see an order confirmation message" , async function ( ) {
38+
39+ } ) ;
You can’t perform that action at this time.
0 commit comments