From f9968e110ba0ad96013479e381d35a5be651421f Mon Sep 17 00:00:00 2001 From: David de Kloet Date: Thu, 21 Sep 2023 09:45:58 +0200 Subject: [PATCH] E2E: Work around flakiness loading proposals --- frontend/src/lib/pages/NnsProposals.svelte | 5 +++++ .../page-objects/NnsProposalList.page-object.ts | 13 +++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/frontend/src/lib/pages/NnsProposals.svelte b/frontend/src/lib/pages/NnsProposals.svelte index 7d77e56bb3d..2cb7ab59caf 100644 --- a/frontend/src/lib/pages/NnsProposals.svelte +++ b/frontend/src/lib/pages/NnsProposals.svelte @@ -128,6 +128,11 @@ debounceFindProposals?.(); }; + // Neurons and proposals are loaded at the same time. But once neurons are + // loaded, proposals are loaded again. So it's possible that the component + // goes back into loading state immediately after proposals are loaded. + // TODO: Fix NnsProposals to load proposals only once and remove the + // work-around from NnsProposalList.page-object.ts $: $definedNeuronsStore, applyFilter($proposalsFiltersStore); $: $authStore.identity, (() => proposalsFiltersStore.reload())(); diff --git a/frontend/src/tests/page-objects/NnsProposalList.page-object.ts b/frontend/src/tests/page-objects/NnsProposalList.page-object.ts index b3c4b59f00f..f6da7b89154 100644 --- a/frontend/src/tests/page-objects/NnsProposalList.page-object.ts +++ b/frontend/src/tests/page-objects/NnsProposalList.page-object.ts @@ -88,10 +88,15 @@ export class NnsProposalListPo extends BasePageObject { } async waitForContentLoaded(): Promise { - await Promise.race([ - this.getProposalCardPo().waitFor(), - this.waitFor("no-proposals-msg"), - ]); + this.getSkeletonCardPo().waitForAbsent(); + // The NnsProposals component loads neurons and proposals at the same time. + // But once neurons are loaded, it loads proposals again. So it's possible + // that the component goes back into loading state immediately after + // proposals are loaded. + // TODO: Fix NnsProposals to load proposals only once and remove the 2 lines + // below. + await new Promise((resolve) => setTimeout(resolve, 1000)); + this.getSkeletonCardPo().waitForAbsent(); } async getVisibleProposalIds(proposerNeuronId: string): Promise {