puppeteer tests: Try to diagnose/fix unsubscribe flakes.

Doing these in a loop may help us figure out whether the
flakes are somehow related to the initial conditions when
we run the test vs. some race that can happen later in the
loop.

I add the console statements mostly to facilitate debugging,
but they appear to actually reduce the problem, as the code
comments indicate.
This commit is contained in:
Steve Howell 2022-03-18 14:08:51 +00:00 committed by Steve Howell
parent a5ec78c6ab
commit db5f39c506
1 changed files with 16 additions and 8 deletions

View File

@ -69,14 +69,22 @@ async function test_subscription_button(page: Page): Promise<void> {
// We assume Venice is already subscribed, so the first line here
// should happen immediately.
button = await subscribed();
await button!.click();
button = await unsubscribed();
await button!.click();
button = await subscribed();
await button!.click();
button = await unsubscribed();
await button!.click();
button = await subscribed();
// Toggle subscriptions several times. This test code has been known
// to flake, so we add console statements. It appears that the console
// statements help prevent the flake, which is probably caused by some
// subtle race condition. We will hopefully diagnose the root cause of
// the flake, but I am confident that the test will mostly catch actual
// bugs in the real code, so as long as the console.info statements help
// here, we should just leave them in.
for (let i = 0; i < 10; i += 1) {
console.info(`\n unsubscribe/subscribe loop ${i}\n\n`);
await button!.click();
button = await unsubscribed();
await button!.click();
button = await subscribed();
console.info(`\n end loop ${i}\n\n`);
}
}
async function click_create_new_stream(page: Page): Promise<void> {