-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(e2e): make some assertions asynchronous
- Refactors some tests in onboarding.spec.ts using `browser.waitUntil` to reduce flakiness - These assertions will now poll for the result instead of failing immediately - Simulates Radicle installation in the onboarding process by renaming the node home directory - Extracts common queries, actions, and assertions to helper files Signed-off-by: Zacharias Fragkiadakis <zacfragkiadakis@gmail.com>
- Loading branch information
Showing
5 changed files
with
125 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { Workbench } from 'wdio-vscode-service' | ||
|
||
/** | ||
* Opens the Radicle view container in the sidebar, by clicking the radicle button in the | ||
* activity bar. | ||
*/ | ||
export async function openRadicleViewContainer(workbench: Workbench) { | ||
const activityBar = workbench.getActivityBar() | ||
await activityBar.wait() | ||
|
||
const radicleViewControl = await activityBar.getViewControl('Radicle') | ||
await radicleViewControl?.wait() | ||
|
||
await radicleViewControl?.openView() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { browser } from '@wdio/globals' | ||
import type { Workbench } from 'wdio-vscode-service' | ||
|
||
/** | ||
* Asserts that the CLI Commands and Patches sections are visible in the sidebar. This is | ||
* considered the default state when the workspace is open with a git and rad initialized | ||
* repository. | ||
*/ | ||
export async function expectCliCommandsAndPatchesToBeVisible(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 { } | ||
|
||
return sectionsFound | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type { Workbench } from 'wdio-vscode-service' | ||
|
||
/** | ||
* Retrieves the welcome text content from the first section in the sidebar view. | ||
* | ||
* @example await getFirstWelcomeViewText(workbench) // ["Welcome to Radicle!", "Get started by ..."] | ||
* | ||
* @returns The text content found as an array of strings split by newlines. If no content is | ||
* found, an empty array. | ||
*/ | ||
export async function getFirstWelcomeViewText(workbench: Workbench) { | ||
const sidebarView = workbench.getSideBar().getContent() | ||
await sidebarView.wait() | ||
|
||
const welcomeText = | ||
(await ( | ||
await (await sidebarView.getSections())[0]?.findWelcomeContent() | ||
)?.getTextSections()) ?? [] | ||
|
||
return welcomeText | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters