diff --git a/packages/functional-tests/tests/subscription-tests/subscription.spec.ts b/packages/functional-tests/tests/subscription-tests/subscription.spec.ts index 4703e80185..57e8ee9379 100644 --- a/packages/functional-tests/tests/subscription-tests/subscription.spec.ts +++ b/packages/functional-tests/tests/subscription-tests/subscription.spec.ts @@ -219,21 +219,24 @@ test.describe('severity-2 #smoke', () => { }); test('New user checkout URL to have RP-provided flow params, acquisition params & verify funnel metrics', async ({ - pages: { settings, relier, page, subscribe }, + target, + pages: { settings, relier, page, login, subscribe }, + testAccountTracker, }, { project }) => { - test.fixme(true, 'Fix required as of 2023/10/09 (see FXA-8447).'); test.skip( project.name === 'production', 'test plan not available in prod' ); - const metricsObserver = new MetricsObserver(subscribe); - metricsObserver.startTracking(); + await signInAccount(target, page, login, testAccountTracker); await settings.goto(); await settings.signOut(); - await relier.goto(); + const metricsObserver = new MetricsObserver(subscribe); + metricsObserver.startTracking(); + + await relier.goto(); const subscribeUrl = await relier.getUrl(); expect(subscribeUrl, 'Subscribe button has no href.').toBeTruthy(); @@ -273,10 +276,27 @@ test.describe('severity-2 #smoke', () => { 'amplitude.subPaySetup.submit', 'amplitude.subPaySetup.success', ]; - const actualEventTypes = metricsObserver.rawEvents.map((event) => { - return event.type; - }); - expect(actualEventTypes).toMatchObject(expectedEventTypes); + + // Added as part of FXA-8447 + // Get record of only "without-account" and subPaySetup event types + const actualEventTypes = metricsObserver.rawEvents + .map((event) => { + if ( + event.checkoutType === 'without-account' && + event.type.startsWith('amplitude.subPaySetup') + ) { + return event.type; + } + }) + .filter(Boolean); + + // Added as part of FXA-8447 + // Compares the tail of both arrays in the event of duplicate initial view events + expect( + actualEventTypes.slice( + actualEventTypes.length - expectedEventTypes.length + ) + ).toMatchObject(expectedEventTypes); }); }); });