Skip to content

Commit fabe8f9

Browse files
committed
Fix test
1 parent ee4cbef commit fabe8f9

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

packages/template-retail-react-app/app/pages/cart/index.test.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,14 @@ test('Can remove item from the cart', async () => {
236236
expect(await screen.findByTestId('sf-cart-empty')).toBeInTheDocument()
237237
})
238238

239-
test.skip('Can apply and remove product-level coupon code with promotion', async () => {
239+
/*
240+
* Skipping this test for now. Signup flow works fine.
241+
* The signup function then calls self.login() which in turn calls getSkeletonCustomer().
242+
* Need to figure out a way to return mockRegisteredCustomer from getSkeletonCustomer().
243+
* getSkeletonCustomer() always returns `{ customerId: 'customer_id', authType: 'customer_type' }` for some reason
244+
* instead of the mockRegisteredCustomer.
245+
*/
246+
test('Can apply and remove product-level coupon code with promotion', async () => {
240247
renderWithProviders(<WrappedCart />)
241248
expect(await screen.findByTestId('sf-cart-container')).toBeInTheDocument()
242249

@@ -298,9 +305,9 @@ test.skip('Can apply and remove product-level coupon code with promotion', async
298305
}
299306

300307
// add coupon
301-
userEvent.click(screen.getByText('Do you have a promo code?'))
302-
userEvent.type(screen.getByLabelText('Promo Code'), 'MENSSUITS')
303-
userEvent.click(screen.getByText('Apply'))
308+
await userEvent.click(screen.getByText('Do you have a promo code?'))
309+
await userEvent.type(screen.getByLabelText('Promo Code'), 'MENSSUITS')
310+
await userEvent.click(screen.getByText('Apply'))
304311

305312
expect(await screen.findByText('Promotion applied')).toBeInTheDocument()
306313
expect(await screen.findByText(/MENSSUITS/i)).toBeInTheDocument()
@@ -311,7 +318,7 @@ test.skip('Can apply and remove product-level coupon code with promotion', async
311318
// remove coupon
312319
mockedBasketResponse = keysToCamel(mockBasketWithSuit)
313320
const orderSummary = screen.getByTestId('sf-order-summary')
314-
userEvent.click(within(orderSummary).getByText('Remove'))
321+
await userEvent.click(within(orderSummary).getByText('Remove'))
315322

316323
expect(await screen.findByText('Promotion removed')).toBeInTheDocument()
317324
expect(await screen.queryByText(/MENSSUITS/i)).not.toBeInTheDocument()

0 commit comments

Comments
 (0)