From 983019b86c5eabce90b52f6feb5c8f9856839cbd Mon Sep 17 00:00:00 2001 From: Zacharias Fragkiadakis Date: Tue, 31 Dec 2024 10:14:42 +0200 Subject: [PATCH] refactor(e2e): rename and enhance standard sidebar views assertion Signed-off-by: Zacharias Fragkiadakis --- test/e2e/helpers/assertions.ts | 26 +++++++++++++++----------- test/e2e/specs/onboarding.spec.ts | 6 +++--- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/test/e2e/helpers/assertions.ts b/test/e2e/helpers/assertions.ts index a0ed5ba7..539d5c31 100644 --- a/test/e2e/helpers/assertions.ts +++ b/test/e2e/helpers/assertions.ts @@ -6,19 +6,23 @@ import type { Workbench } from 'wdio-vscode-service' * considered the default state when the workspace is open with a git and rad initialized * repository. */ -export async function expectCliCommandsAndPatchesToBeVisible(workbench: Workbench) { +export async function expectStandardSidebarViewsToBeVisible(workbench: Workbench) { const sidebarView = workbench.getSideBar().getContent() await sidebarView.wait() - await browser.waitUntil(async () => { - let sectionsFound = false - try { - await sidebarView.getSection('CLI COMMANDS') - await sidebarView.getSection('PATCHES') - sectionsFound = true - // eslint-disable-next-line prettier-vue/prettier - } catch { } + await browser.waitUntil( + async () => { + try { + await Promise.all([ + sidebarView.getSection('CLI COMMANDS'), + sidebarView.getSection('PATCHES'), + ]) - return sectionsFound - }) + return true + } catch { + return false + } + }, + { timeoutMsg: 'expected the standard sidebar views to be visible' }, + ) } diff --git a/test/e2e/specs/onboarding.spec.ts b/test/e2e/specs/onboarding.spec.ts index f2fb7dc0..5cd0bb4f 100644 --- a/test/e2e/specs/onboarding.spec.ts +++ b/test/e2e/specs/onboarding.spec.ts @@ -4,7 +4,7 @@ import type { Workbench } from 'wdio-vscode-service' import { $, cd } from 'zx' import type * as VsCode from 'vscode' import isEqual from 'lodash/isEqual' -import { expectCliCommandsAndPatchesToBeVisible } from '../helpers/assertions' +import { expectStandardSidebarViewsToBeVisible } from '../helpers/assertions' import { openRadicleViewContainer } from '../helpers/actions' import { getFirstWelcomeViewText } from '../helpers/queries' import { e2eTestDirPath, nodeHomePath } from '../constants/config' @@ -127,11 +127,11 @@ describe('Onboarding Flow', () => { }) }) - it('shows the CLI Commands and Patches sections', async () => { + it('shows the standard sidebar views', async () => { const sidebarView = workbench.getSideBar().getContent() await sidebarView.wait() - await expectCliCommandsAndPatchesToBeVisible(workbench) + await expectStandardSidebarViewsToBeVisible(workbench) }) }) })