diff --git a/extensions/amp-consent/0.1/test-e2e/test-amp-consent-client-side.js b/extensions/amp-consent/0.1/test-e2e/test-amp-consent-client-side.js index 778c9507b126..f6040156529e 100644 --- a/extensions/amp-consent/0.1/test-e2e/test-amp-consent-client-side.js +++ b/extensions/amp-consent/0.1/test-e2e/test-amp-consent-client-side.js @@ -20,6 +20,7 @@ import { verifyElementsBuilt, verifyPromptsHidden, } from './common'; +import sleep from 'sleep-promise'; describes.endtoend( 'amp-consent', @@ -36,7 +37,7 @@ describes.endtoend( controller = env.controller; }); - it.skip('should work with client side decision', async () => { + it('should work with client side decision', async () => { resetAllElements(); const currentUrl = await controller.getCurrentUrl(); @@ -95,7 +96,9 @@ describes.endtoend( 'postPromptUi': false, }); - // Check the analytics request consentState + // Check the analytics request consentState. Wait for 1 second for the + // request to arrive to avoid flaky test. + await sleep(3000); await expect( 'http://localhost:8000/amp4test/request-bank/e2e/deposit/tracking?consentState=sufficient' ).to.have.been.sent; diff --git a/extensions/amp-consent/0.1/test-e2e/test-amp-consent-server-side.js b/extensions/amp-consent/0.1/test-e2e/test-amp-consent-server-side.js index 93ab36fa16a4..798d8f2d4023 100644 --- a/extensions/amp-consent/0.1/test-e2e/test-amp-consent-server-side.js +++ b/extensions/amp-consent/0.1/test-e2e/test-amp-consent-server-side.js @@ -20,6 +20,7 @@ import { verifyElementsBuilt, verifyPromptsHidden, } from './common'; +import sleep from 'sleep-promise'; describes.endtoend( 'amp-consent', @@ -36,8 +37,7 @@ describes.endtoend( controller = env.controller; }); - //TODO (micajuineho): Unskip flaky test - it.skip('should respect server side decision and persist it', async () => { + it('should respect server side decision and persist it', async () => { resetAllElements(); const currentUrl = await controller.getCurrentUrl(); @@ -79,7 +79,9 @@ describes.endtoend( 'postPromptUi': false, }); - // Check the analytics request consentState + // Check the analytics request consentState. Wait for 1 second for the + // request to arrive to avoid flaky test. + await sleep(3000); await expect( 'http://localhost:8000/amp4test/request-bank/e2e/deposit/tracking?consentState=insufficient' ).to.have.been.sent;