Skip to content

Commit ca289fd

Browse files
authored
Playwright checkout page optional login possibility (#1011)
1 parent 42541ca commit ca289fd

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

tests/playwright/pages/CheckoutPage.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,17 @@ export class CheckoutPage {
9999
await this[method](email, password, register, screenshots)
100100
}
101101

102-
async checkoutDefault(email, password = false, register = false, screenshots = []) {
102+
async checkoutDefault(email = false, password = false, register = false, screenshots = []) {
103103
await this.gotoCheckout()
104104

105105
if (screenshots.includes('login')) {
106106
await expect(this.page).toHaveScreenshot({ fullPage: true })
107107
}
108108

109-
await this.login(email, password, register)
110-
await this.continue('credentials')
109+
if (email) {
110+
await this.login(email, password, register)
111+
await this.continue('credentials')
112+
}
111113

112114
if (screenshots.includes('credentials')) {
113115
await expect(this.page).toHaveScreenshot({ fullPage: true })
@@ -133,14 +135,17 @@ export class CheckoutPage {
133135
}
134136
}
135137

136-
async checkoutOnestep(email, password = false, register = false, screenshots = []) {
138+
async checkoutOnestep(email = false, password = false, register = false, screenshots = []) {
137139
await this.gotoCheckout()
138140

139141
if (screenshots.includes('login')) {
140142
await expect(this.page).toHaveScreenshot({ fullPage: true })
141143
}
142144

143-
await this.login(email, password, register)
145+
if (email) {
146+
await this.login(email, password, register)
147+
}
148+
144149
await this.shippingAddress()
145150
await this.shippingMethod()
146151
await this.paymentMethod()

0 commit comments

Comments
 (0)