From 33c3e761432b9411d4a2c97b069d660d0648be84 Mon Sep 17 00:00:00 2001 From: David de Kloet <122978264+dskloetd@users.noreply.github.com> Date: Thu, 5 Sep 2024 16:31:19 +0200 Subject: [PATCH 01/16] Wait for navigation after staking first neuron (#5409) # Motivation Before you have your first neuron, you can't navigate to the neurons page. So the first neuron is staked from the staking page and if successful, you automatically navigate to the neurons page. This caused some flakiness in e2e tests when we try to navigate back after staking the first neuron, but before the redirect happens. To make this more consistent we should wait for the redirect to happen before returning from `stakeFirstNnsNeuron`. Since this happens from `StakingPo`, we can't wait for `NnsNeuronsPo` to be present but we can at least wait for `StakingPo` to be absent. # Changes Wait for `StakingPo` to be absent after staking the first NNS neuron. # Tests On my local machine, `e2e/proposals.spec.ts` was failing consistently without this change and passed with this change. # Todos - [ ] Add entry to changelog (if necessary). not necessary --- frontend/src/tests/page-objects/Staking.page-object.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/src/tests/page-objects/Staking.page-object.ts b/frontend/src/tests/page-objects/Staking.page-object.ts index 8127df231a2..fe16d39640a 100644 --- a/frontend/src/tests/page-objects/Staking.page-object.ts +++ b/frontend/src/tests/page-objects/Staking.page-object.ts @@ -48,6 +48,8 @@ export class StakingPo extends BasePageObject { await nnsRow.getStakeButtonPo().click(); const modal = this.getNnsStakeNeuronModalPo(); await modal.stake({ amount, dissolveDelayDays }); + // After staking the first neuron, we get redirected to the neurons page. + await this.waitForAbsent(); } async stakeFirstSnsNeuron({ From af83107cf38515183132a11e6c86929d171a3ff5 Mon Sep 17 00:00:00 2001 From: David de Kloet <122978264+dskloetd@users.noreply.github.com> Date: Thu, 5 Sep 2024 17:23:59 +0200 Subject: [PATCH 02/16] Stop loading neurons in NnsProposals (#5408) # Motivation There used to be a checkbox on the `NnsProposals` page to only show proposals that you can vote on. This applied a filter on `list_proposals` to only load proposals with ballots matching your neurons. For this reason we needed to reload the proposals when your neurons changed. But we no longer have this checkbox (we have the actionable proposals tab instead) so we no longer need: 1. load neurons in `NnsProposals` 2. reload proposals when the neurons change # Changes 1. Stop loading neurons in `NnsProposals`. 2. Stop listening to `definedNeuronsStore` to reload proposals. # Tests 1. With the reloading on neurons removed, the tests no longer hit the debounce, so instead we use an unresolved promise to test the skeleton cards and the spinner. 2. Two tests were setting `proposalsFiltersStore` immediate after rendering the component, for no apparently reason. This was causing proposals to be reloaded, making the test more complicated. I've removed the unnecessary setting of `proposalsFiltersStore`. 3. I added a separate test to test that proposals are reloaded when the `proposalsFiltersStore` is set. 4. Remove a work-around which is no longer necessary from `NnsProposalListPo.waitForContentLoaded`. 5. `NnsProposalListPo.waitForContentLoaded` was actually broken because the `.waitForAbsent()` calls weren't awaited. This wasn't noticed because the 1 second delay was enough for the content to load, but fixing the `waitForContentLoaded` method exposed that we were waiting for `NnsProposalListPo` on the actionable proposals page which does not have `NnsProposalListPo`. So I removed this wait from `neurons.spec.ts` and `proposals.spec.ts`. # Todos - [ ] Add entry to changelog (if necessary). not necessary --- frontend/src/lib/pages/NnsProposals.svelte | 16 +-- frontend/src/tests/e2e/neurons.spec.ts | 1 - frontend/src/tests/e2e/proposals.spec.ts | 3 +- .../src/tests/lib/pages/NnsProposals.spec.ts | 102 +++++++++++++----- .../NnsProposalList.page-object.ts | 11 +- .../src/tests/workflows/NnsProposals.spec.ts | 18 ---- 6 files changed, 78 insertions(+), 73 deletions(-) diff --git a/frontend/src/lib/pages/NnsProposals.svelte b/frontend/src/lib/pages/NnsProposals.svelte index 9a08a7daa11..d58cde159ee 100644 --- a/frontend/src/lib/pages/NnsProposals.svelte +++ b/frontend/src/lib/pages/NnsProposals.svelte @@ -1,17 +1,14 @@