astonishing-salesclerk-68668
04/06/2022, 6:14 PMnew MyPageObject
constructor to execute, I very much don't like. However, importing/exporting JSON objects in something like a myPageTestIds.js
so you can call myPageTestIds.locator
is great!gifted-tomato-54665
04/06/2022, 6:22 PMastonishing-salesclerk-68668
04/06/2022, 6:26 PMshoppingCartTestIds.js
that lives, really anywhere your team decides. Inside of it you might have
export const shoppingCartIds = {
checkoutButton: "locator",
itemsInCartTable: "locator",
paymentInformation: "locator",
}
then in your testCart.spec
file you can import shoppingCartIds from /path/to/shoppingCartTestIds.js
and use cy.get(shoppingCartIds.checkoutButton).click()
etcastonishing-salesclerk-68668
04/06/2022, 6:28 PMcompleteCheckout()
can be a function with several cy
actions. Of course in that scenario it would make more sense to name the file something like shoppingCartPage.js
or whatevergifted-tomato-54665
04/06/2022, 6:32 PM