Skip to content

Commit

Permalink
refactor(e2e): rename and enhance standard sidebar views assertion
Browse files Browse the repository at this point in the history
Signed-off-by: Zacharias Fragkiadakis <zacfragkiadakis@gmail.com>
  • Loading branch information
QZera committed Dec 31, 2024
1 parent ba33585 commit 983019b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
26 changes: 15 additions & 11 deletions test/e2e/helpers/assertions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
)
}
6 changes: 3 additions & 3 deletions test/e2e/specs/onboarding.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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)
})
})
})
Expand Down

0 comments on commit 983019b

Please sign in to comment.