@@ -31,7 +31,9 @@ test.describe('Portal', () => {
3131 // check that offer was added in the offer list screen
3232 await sharedPage . goto ( '/ghost' ) ;
3333 await sharedPage . getByRole ( 'navigation' ) . getByRole ( 'link' , { name : 'Settings' } ) . click ( ) ;
34- await expect ( await sharedPage . getByTestId ( 'offers' ) ) . toContainText ( offerName ) ;
34+ await sharedPage . getByTestId ( 'offers' ) . getByRole ( 'button' , { name : 'Manage offers' } ) . click ( ) ;
35+ await expect ( sharedPage . getByTestId ( 'offers-modal' ) ) . toContainText ( offerName ) ;
36+ await sharedPage . getByTestId ( 'offers-modal' ) . getByRole ( 'button' , { name : 'Close' } ) . click ( ) ;
3537
3638 await sharedPage . goto ( offerLink ) ;
3739
@@ -79,9 +81,9 @@ test.describe('Portal', () => {
7981
8082 // // Ensure the offer redemption count was bumped
8183 await sharedPage . goto ( '/ghost/#/settings/offers' ) ;
82- // await sharedPage.locator('.gh-nav a[href="#/ offers/"]' ).click();
83- const locator = await sharedPage . locator ( `[data-test- offer=" ${ offerName } "]` ) ;
84- await expect ( locator ) . toContainText ( '1 redemption ' ) ;
84+ await sharedPage . getByTestId ( 'offers' ) . getByRole ( 'button' , { name : 'Manage offers' } ) . click ( ) ;
85+ const offerRow = sharedPage . getByTestId ( ' offer-item' ) . filter ( { hasText : offerName } ) ;
86+ await expect ( offerRow ) . toContainText ( '1' ) ;
8587 } ) ;
8688
8789 test ( 'Creates and uses a one-time discount Offer' , async ( { sharedPage} ) => {
@@ -108,9 +110,9 @@ test.describe('Portal', () => {
108110 // check that offer was added in the offer list screen
109111 await sharedPage . goto ( '/ghost' ) ;
110112 await sharedPage . getByRole ( 'navigation' ) . getByRole ( 'link' , { name : 'Settings' } ) . click ( ) ;
111- await expect ( sharedPage . getByTestId ( 'offers' ) ) . toContainText ( offerName ) ;
112- // open offer details page
113- // await sharedPage.locator(`[data-test-offer="${offerName}"] a`).first( ).click();
113+ await sharedPage . getByTestId ( 'offers' ) . getByRole ( 'button' , { name : 'Manage offers' } ) . click ( ) ;
114+ await expect ( sharedPage . getByTestId ( 'offers-modal' ) ) . toContainText ( offerName ) ;
115+ await sharedPage . getByTestId ( 'offers-modal' ) . getByRole ( 'button' , { name : 'Close' } ) . click ( ) ;
114116
115117 // fetch offer url from portal settings and open it
116118 await sharedPage . goto ( offerLink ) ;
@@ -185,7 +187,9 @@ test.describe('Portal', () => {
185187
186188 await sharedPage . goto ( '/ghost' ) ;
187189 await sharedPage . getByRole ( 'navigation' ) . getByRole ( 'link' , { name : 'Settings' } ) . click ( ) ;
188- await expect ( await sharedPage . getByTestId ( 'offers' ) ) . toContainText ( offerName ) ;
190+ await sharedPage . getByTestId ( 'offers' ) . getByRole ( 'button' , { name : 'Manage offers' } ) . click ( ) ;
191+ await expect ( sharedPage . getByTestId ( 'offers-modal' ) ) . toContainText ( offerName ) ;
192+ await sharedPage . getByTestId ( 'offers-modal' ) . getByRole ( 'button' , { name : 'Close' } ) . click ( ) ;
189193
190194 await sharedPage . goto ( offerLink ) ;
191195
@@ -260,7 +264,9 @@ test.describe('Portal', () => {
260264 // check that offer was added in the offer list screen
261265 await sharedPage . goto ( '/ghost' ) ;
262266 await sharedPage . getByRole ( 'navigation' ) . getByRole ( 'link' , { name : 'Settings' } ) . click ( ) ;
263- await expect ( sharedPage . getByTestId ( 'offers' ) ) . toContainText ( offerName ) ;
267+ await sharedPage . getByTestId ( 'offers' ) . getByRole ( 'button' , { name : 'Manage offers' } ) . click ( ) ;
268+ await expect ( sharedPage . getByTestId ( 'offers-modal' ) ) . toContainText ( offerName ) ;
269+ await sharedPage . getByTestId ( 'offers-modal' ) . getByRole ( 'button' , { name : 'Close' } ) . click ( ) ;
264270
265271 await sharedPage . goto ( offerLink ) ;
266272
0 commit comments