@@ -5,8 +5,8 @@ import {LoginPage} from './fixtures/login.page';
55import { CartPage } from './fixtures/cart.page' ;
66
77import slugs from './config/slugs.json' ;
8- import selectors from './config/selectors/selectors .json' ;
9- import verify from './config/expected/expected .json' ;
8+ import UIReference from './config/element-identifiers/element-identifiers .json' ;
9+ import outcomeMarker from './config/outcome-markers/outcome-markers .json' ;
1010
1111test . describe ( 'Cart functionalities (guest)' , ( ) => {
1212 /**
@@ -25,14 +25,14 @@ test.describe('Cart functionalities (guest)', () => {
2525 const productPage = new ProductPage ( page ) ;
2626
2727 await page . goto ( slugs . productpage . simpleProductSlug ) ;
28- await productPage . addSimpleProductToCart ( selectors . productPage . simpleProductTitle , slugs . productpage . simpleProductSlug ) ;
28+ await productPage . addSimpleProductToCart ( UIReference . productPage . simpleProductTitle , slugs . productpage . simpleProductSlug ) ;
2929 await mainMenu . openMiniCart ( ) ;
30- await expect ( page . getByText ( verify . miniCart . simpleProductInCartTitle ) ) . toBeVisible ( ) ;
30+ await expect ( page . getByText ( outcomeMarker . miniCart . simpleProductInCartTitle ) ) . toBeVisible ( ) ;
3131 await page . goto ( slugs . cartSlug ) ;
3232 } ) ;
3333
3434 test ( 'Product can be added to cart' , { tag : '@cart' , } , async ( { page} ) => {
35- await expect ( page . getByRole ( 'strong' ) . getByRole ( 'link' , { name : selectors . productPage . simpleProductTitle } ) , `Product is visible in cart` ) . toBeVisible ( ) ;
35+ await expect ( page . getByRole ( 'strong' ) . getByRole ( 'link' , { name : UIReference . productPage . simpleProductTitle } ) , `Product is visible in cart` ) . toBeVisible ( ) ;
3636 } ) ;
3737
3838 /**
@@ -46,7 +46,7 @@ test.describe('Cart functionalities (guest)', () => {
4646 await test . step ( 'Add another product to cart' , async ( ) => {
4747 const productpage = new ProductPage ( page ) ;
4848 await page . goto ( slugs . productpage . secondSimpleProductSlug ) ;
49- await productpage . addSimpleProductToCart ( selectors . productPage . secondSimpleProducTitle , slugs . productpage . secondSimpleProductSlug ) ;
49+ await productpage . addSimpleProductToCart ( UIReference . productPage . secondSimpleProducTitle , slugs . productpage . secondSimpleProductSlug ) ;
5050 } ) ;
5151
5252 await test . step ( 'Log in with account' , async ( ) => {
@@ -63,8 +63,8 @@ test.describe('Cart functionalities (guest)', () => {
6363 } ) ;
6464
6565 await page . goto ( slugs . cartSlug ) ;
66- await expect ( page . getByRole ( 'strong' ) . getByRole ( 'link' , { name : selectors . productPage . simpleProductTitle } ) , `${ selectors . productPage . simpleProductTitle } should still be in cart` ) . toBeVisible ( ) ;
67- await expect ( page . getByRole ( 'strong' ) . getByRole ( 'link' , { name : selectors . productPage . secondSimpleProducTitle } ) , `${ selectors . productPage . secondSimpleProducTitle } should still be in cart` ) . toBeVisible ( ) ;
66+ await expect ( page . getByRole ( 'strong' ) . getByRole ( 'link' , { name : UIReference . productPage . simpleProductTitle } ) , `${ UIReference . productPage . simpleProductTitle } should still be in cart` ) . toBeVisible ( ) ;
67+ await expect ( page . getByRole ( 'strong' ) . getByRole ( 'link' , { name : UIReference . productPage . secondSimpleProducTitle } ) , `${ UIReference . productPage . secondSimpleProducTitle } should still be in cart` ) . toBeVisible ( ) ;
6868 } ) ;
6969
7070 /** @feature Remove product from cart
@@ -77,7 +77,7 @@ test.describe('Cart functionalities (guest)', () => {
7777 */
7878 test ( 'Remove product from cart' , { tag : '@cart' , } , async ( { page} ) => {
7979 const cart = new CartPage ( page ) ;
80- await cart . removeProduct ( selectors . productPage . simpleProductTitle ) ;
80+ await cart . removeProduct ( UIReference . productPage . simpleProductTitle ) ;
8181 } ) ;
8282
8383 /**
@@ -172,11 +172,11 @@ test.describe('Price checking tests', () => {
172172 const productPage = new ProductPage ( page ) ;
173173 await page . goto ( slugs . productpage . simpleProductSlug ) ;
174174 // set quantity to 2 so we can see that the math works
175- await page . getByLabel ( selectors . productPage . quantityFieldLabel ) . fill ( '2' ) ;
175+ await page . getByLabel ( UIReference . productPage . quantityFieldLabel ) . fill ( '2' ) ;
176176
177- productPagePrice = await page . locator ( selectors . productPage . simpleProductPrice ) . innerText ( ) ;
178- productPageAmount = await page . getByLabel ( selectors . productPage . quantityFieldLabel ) . inputValue ( ) ;
179- await productPage . addSimpleProductToCart ( selectors . productPage . simpleProductTitle , slugs . productpage . simpleProductSlug , '2' ) ;
177+ productPagePrice = await page . locator ( UIReference . productPage . simpleProductPrice ) . innerText ( ) ;
178+ productPageAmount = await page . getByLabel ( UIReference . productPage . quantityFieldLabel ) . inputValue ( ) ;
179+ await productPage . addSimpleProductToCart ( UIReference . productPage . simpleProductTitle , slugs . productpage . simpleProductSlug , '2' ) ;
180180
181181 } ) ;
182182
@@ -185,7 +185,7 @@ test.describe('Price checking tests', () => {
185185 await page . waitForLoadState ( ) ;
186186
187187 // returns productPriceInCheckout and productQuantityInCheckout
188- checkoutProductDetails = await cart . getCheckoutValues ( selectors . productPage . simpleProductTitle , productPagePrice , productPageAmount ) ;
188+ checkoutProductDetails = await cart . getCheckoutValues ( UIReference . productPage . simpleProductTitle , productPagePrice , productPageAmount ) ;
189189 } ) ;
190190
191191 await test . step ( 'Step: Calculate and check expectations' , async ( ) => {
@@ -216,8 +216,8 @@ test.describe('Price checking tests', () => {
216216 // set quantity to 2 so we can see that the math works
217217 await page . getByLabel ( 'Quantity' ) . fill ( '2' ) ;
218218
219- productPagePrice = await page . locator ( selectors . productPage . simpleProductPrice ) . innerText ( ) ;
220- productPageAmount = await page . getByLabel ( selectors . productPage . quantityFieldLabel ) . inputValue ( ) ;
219+ productPagePrice = await page . locator ( UIReference . productPage . simpleProductPrice ) . innerText ( ) ;
220+ productPageAmount = await page . getByLabel ( UIReference . productPage . quantityFieldLabel ) . inputValue ( ) ;
221221 await productPage . addConfigurableProductToCart ( ) ;
222222
223223 } ) ;
@@ -227,7 +227,7 @@ test.describe('Price checking tests', () => {
227227 await page . waitForLoadState ( ) ;
228228
229229 // returns productPriceInCheckout and productQuantityInCheckout
230- checkoutProductDetails = await cart . getCheckoutValues ( selectors . productPage . configurableProductTitle , productPagePrice , productPageAmount ) ;
230+ checkoutProductDetails = await cart . getCheckoutValues ( UIReference . productPage . configurableProductTitle , productPagePrice , productPageAmount ) ;
231231 } ) ;
232232
233233 await test . step ( 'Step: Calculate and check expectations' , async ( ) => {
0 commit comments