Skip to content

Commit dd83fea

Browse files
Merge pull request #190 from elgentos/gitlab-main
Sync gitlab-main to main
2 parents 8a351e3 + a8077aa commit dd83fea

File tree

4 files changed

+24
-12
lines changed

4 files changed

+24
-12
lines changed

tests/config/element-identifiers.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@
118118
"remove": "Remove",
119119
"shippingAddressRadioLocator": "#shipping-details input[type='radio']",
120120
"shippingMethodFixedLabel": "Fixed",
121-
"shippingMethodTableRateLabel": "Table Rate"
121+
"shippingMethodTableRateLabel": "Table Rate",
122+
"shippingPriceText": "Shipping & Handling (Flat Rate - Fixed)",
123+
"taxPriceText": "Tax"
122124
},
123125
"comparePage": {
124126
"removeCompareLabel": "Remove Product",
@@ -156,6 +158,10 @@
156158
"customerOverviewPage": {
157159
"tableSearchFieldLabel": "Search by keyword"
158160
},
161+
"financial" : {
162+
"subTotal": "Subtotal",
163+
"grandTotal": "Grand Total"
164+
},
159165
"footerPage": {
160166
"footerLocator": ".page-footer",
161167
"currencyIdentifier": "#currency-heading",
@@ -174,6 +180,7 @@
174180
"genericPriceSymbol": "$",
175181
"genericSaveButtonLabel": "Save",
176182
"genericSubmitButtonLabel": "Submit",
183+
"headerLocator": "#header",
177184
"loadingSpinnerLocator": "#container .spinner",
178185
"messageLocator": "div.message",
179186
"removeLabel": "Remove",
@@ -216,6 +223,7 @@
216223
"wishListButtonLabel" : "My Wish List"
217224
},
218225
"miniCart": {
226+
"cartDrawerLocator": "#cart-drawer-title",
219227
"checkOutButtonLabel": "Checkout",
220228
"editProductIconLabel": "Edit product",
221229
"minicartButtonLocator": "#menu-cart-icon",

tests/poms/frontend/checkout.page.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,14 @@ class CheckoutPage extends MagewireUtils {
3434
this.showDiscountFormButton = this.page.getByRole('button', {name: UIReference.checkout.openDiscountFormLabel});
3535
this.placeOrderButton = this.page.getByRole('button', { name: UIReference.checkout.placeOrderButtonLabel });
3636
this.continueShoppingButton = this.page.getByRole('link', { name: UIReference.checkout.continueShoppingLabel });
37-
this.subtotalElement = page.getByText('Subtotal $');
38-
this.shippingElement = page.getByText('Shipping & Handling (Flat Rate - Fixed) $');
39-
this.taxElement = page.getByText('Tax $');
40-
this.grandTotalElement = page.getByText('Grand Total $');
37+
// this.subtotalElement = page.getByText('Subtotal $');
38+
this.subtotalElement = page.getByText(`${UIReference.financial.subTotal} ${UIReference.general.genericPriceSymbol}`);
39+
// this.shippingElement = page.getByText('Shipping & Handling (Flat Rate - Fixed) $');
40+
this.shippingElement = page.getByText(`${UIReference.checkout.shippingPriceText} ${UIReference.general.genericPriceSymbol}`);
41+
// this.taxElement = page.getByText('Tax $');
42+
this.taxElement = page.getByText(`${UIReference.checkout.taxPriceText} ${UIReference.general.genericPriceSymbol}`);
43+
// this.grandTotalElement = page.getByText('Grand Total $');
44+
this.grandTotalElement = page.getByText(`${UIReference.financial.grandTotal} ${UIReference.general.genericPriceSymbol}`);
4145
this.paymentMethodOptionCreditCard = this.page.getByLabel(UIReference.checkout.paymentOptionCreditCardLabel);
4246
this.paymentMethodOptionPaypal = this.page.getByLabel(UIReference.checkout.paymentOptionPaypalLabel);
4347
this.creditCardNumberField = this.page.getByLabel(UIReference.checkout.creditCardNumberLabel);
@@ -218,7 +222,7 @@ class CheckoutPage extends MagewireUtils {
218222
// await this.page.getByLabel('Country').selectOption('US');
219223
const country = faker.helpers.arrayElement(inputValues.addressCountries);
220224
const countrySelectorField = this.page.getByLabel(UIReference.newAddress.countryLabel);
221-
const stateInputField = this.page.getByRole('textbox', { name: 'State/Province' });
225+
const stateInputField = this.page.getByRole('textbox', { name: UIReference.newAddress.provinceSelectLabel });
222226
const stateSelectorField = stateInputField.filter({ hasText: UIReference.newAddress.provinceSelectFilterLabel });
223227

224228

tests/poms/frontend/contact.page.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class ContactPage {
1414
constructor(page: Page){
1515
this.page = page;
1616
this.nameField = this.page.getByLabel(UIReference.credentials.nameFieldLabel);
17-
this.emailField = this.page.getByPlaceholder('Email', { exact: true });
17+
this.emailField = this.page.getByPlaceholder(UIReference.credentials.emailFieldLabel, { exact: true });
1818
this.messageField = this.page.locator(UIReference.contactPage.messageFieldSelector);
1919
this.sendFormButton = this.page.getByRole('button', { name: UIReference.general.genericSubmitButtonLabel });
2020
}
@@ -39,4 +39,4 @@ class ContactPage {
3939
}
4040
}
4141

42-
export default ContactPage;
42+
export default ContactPage;

tests/poms/frontend/mainmenu.page.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class MainMenuPage {
2020

2121
constructor(page: Page) {
2222
this.page = page;
23-
this.mainMenuElement = page.locator('#header');
23+
this.mainMenuElement = page.locator(UIReference.general.headerLocator);
2424
this.mainMenuAccountButton = this.mainMenuElement.getByRole('button', { name: UIReference.mainMenu.myAccountButtonLabel });
2525
this.mainMenuMiniCartButton = this.mainMenuElement.getByLabel(UIReference.mainMenu.miniCartLabel);
2626
this.mainMenuMyAccountItem = this.mainMenuElement.getByTitle(UIReference.mainMenu.myAccountButtonLabel);
@@ -165,7 +165,7 @@ class MainMenuPage {
165165
// By adding 'force', we can bypass the 'aria-disabled' tag.
166166
await this.mainMenuMiniCartButton.click({force: true});
167167

168-
let miniCartDrawer = this.page.locator("#cart-drawer-title");
168+
let miniCartDrawer = this.page.locator(UIReference.miniCart.cartDrawerLocator);
169169
await expect(miniCartDrawer.getByText(outcomeMarker.miniCart.miniCartTitle)).toBeVisible();
170170
}
171171

@@ -199,8 +199,8 @@ class MainMenuPage {
199199
await this.mainMenuLogoutItem.click();
200200

201201
//assertions: notification that user is logged out & logout button no longer visible
202-
await expect(this.page.getByText(outcomeMarker.logout.logoutConfirmationText, { exact: true })).toBeVisible();
203-
await expect(this.mainMenuLogoutItem).toBeHidden();
202+
await expect(this.page.getByText(outcomeMarker.logout.logoutConfirmationText, { exact: true }), "Message shown that confirms you're logged out").toBeVisible();
203+
await expect(this.mainMenuLogoutItem, `Log out button is no longer visible`).toBeHidden();
204204
}
205205
}
206206

0 commit comments

Comments
 (0)