-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gitlab 10: An error message should show in cart/checkout if an incorrect coupon code has been entered #32
base: main
Are you sure you want to change the base?
Conversation
*/ | ||
test('Add coupon code in cart',{ tag: ['@cart', '@coupon-code']}, async ({page}) => { | ||
const cart = new CartPage(page); | ||
let discountCode = process.env.DISCOUNT_CODE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shayfaber Should be MAGENTO_COUPON_CODE
let discountCode = process.env.DISCOUNT_CODE; | ||
|
||
if(!discountCode) { | ||
throw new Error(`discountCode appears to not be set in .env file. Value reported: ${discountCode}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shayfaber The discountCode
is the var for this function but it's more clear to report the env variable which is MAGENTO_COUPON_CODE
*/ | ||
test('Remove coupon code from cart',{ tag: ['@cart', '@coupon-code'] }, async ({page}) => { | ||
const cart = new CartPage(page); | ||
let discountCode = process.env.DISCOUNT_CODE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shayfaber See comments above. Same for this code, maybe also an idea to move this code to a function, because you have the same code twice now.
let discountCode = process.env.DISCOUNT_CODE; | ||
|
||
if(!discountCode) { | ||
throw new Error(`discountCode appears to not be set in .env file. Value reported: ${discountCode}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shayfaber See comments above.
* @then I should get a notification that the code did not work. | ||
*/ | ||
|
||
test('Using an invalid discountcode should give an error',{ tag: ['@cart', '@coupon-code'] }, async ({page}) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shayfaber For naming better to call if coupon code.
|
||
if(!discountCode) { | ||
throw new Error(`discountCode appears to not be set in .env file. Value reported: ${discountCode}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shayfaber See above.
*/ | ||
|
||
test('Using an invalid discountcode should give an error',{ tag: ['@checkout', '@coupon-code'] }, async ({page}) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shayfaber See above.
test('Using an invalid discountcode should give an error',{ tag: ['@checkout', '@coupon-code'] }, async ({page}) => { | ||
const checkout = new CheckoutPage(page); | ||
let wrongDiscountCode = "incorrect discount code"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shayfaber When used once, you don't have to push it to a var.
@@ -1,18 +1,63 @@ | |||
import {expect, type Locator, type Page} from '@playwright/test'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shayfaber Let's keep the naming everywhere 'coupon code' as Magento is also naming it that way.
@@ -51,4 +56,53 @@ export class CheckoutPage { | |||
await expect(this.continueShoppingButton, `Your order number is: ${orderNumber}`).toBeVisible(); | |||
return orderNumber; | |||
} | |||
|
|||
async applyDiscountCodeCheckout(code: string){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shayfaber Is there a reason this needs to be *Checkout? Or can we remove Checkout
from this function name? Because it is already called exported as CheckoutPage. So then it will be CheckoutPage->applyCouponCode.
No description provided.