fix(functional-test): update failing new user test with metrics

Because:

* We are aiming to make stage and prod deployments all green.

This commit:

* Updates test to follow new standards introduced in PR#16739 and remove events causing duplication and/or flakiness.

Closes FXA-8447
This commit is contained in:
Meghan Sardesai 2024-05-12 16:02:23 -07:00
Родитель 4b01dd7f30
Коммит 33e8af36f7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 9A46BEBC2E8A3934
1 изменённых файлов: 29 добавлений и 9 удалений

Просмотреть файл

@ -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);
});
});
});