-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test(e2e): settings tests #167
Open
QZera
wants to merge
6
commits into
main
Choose a base branch
from
feat/settings-e2e-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3b0d52c
test(e2e): write tests for more onboarding screens
QZera 481d626
test(e2e): make some assertions asynchronous
QZera adf2a6d
refactor(e2e): rename and enhance standard sidebar views assertion
QZera fb9fdd4
test(e2e): write tests for "path to rad binary" setting
QZera 88d7fbe
test(e2e): write tests for "path to node home" setting
QZera b79dae5
refactor(e2e): clean up settings test suite
QZera File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,33 @@ | ||
import type { Workbench } from 'wdio-vscode-service' | ||
import { Key } from 'webdriverio' | ||
|
||
export async function clearInput(input: WebdriverIO.Element) { | ||
// Focus the input, sometimes clicking doesn't work | ||
await input.setValue('') | ||
await browser.keys([Key.Ctrl, 'a']) | ||
await browser.keys(Key.Backspace) | ||
} | ||
|
||
/** | ||
* 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() | ||
} | ||
|
||
export async function closeRadicleViewContainer(workbench: Workbench) { | ||
const activityBar = workbench.getActivityBar() | ||
await activityBar.wait() | ||
|
||
const radicleViewControl = await activityBar.getViewControl('Radicle') | ||
await radicleViewControl?.wait() | ||
|
||
await radicleViewControl?.closeView() | ||
} |
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,48 @@ | ||
import { browser } from '@wdio/globals' | ||
import type { OutputView, Workbench } from 'wdio-vscode-service' | ||
|
||
/** | ||
* Asserts the output view contains the expected text. | ||
*/ | ||
export async function expectOutputToContain(outputView: OutputView, expected: string) { | ||
await browser.waitUntil( | ||
async () => { | ||
/** | ||
* The text in the output console is split by newlines, which can be affected by the size | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly to previous comment, Console (Panel) is another different piece of UI. Best here to use the term Output Panel or Output Channel (depending on if you prefer pointing to the representational or the model part of the UX (semantics can get complex, I know)). |
||
* of the window. To avoid this, we join the text into a single string. | ||
*/ | ||
const joinedText = (await outputView.getText()).join('') | ||
|
||
return joinedText.includes(expected) | ||
}, | ||
{ | ||
timeoutMsg: `expected the output text to contain "${expected}"`, | ||
}, | ||
) | ||
} | ||
|
||
/** | ||
* 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 expectStandardSidebarViewsToBeVisible(workbench: Workbench) { | ||
const sidebarView = workbench.getSideBar().getContent() | ||
await sidebarView.wait() | ||
|
||
await browser.waitUntil( | ||
async () => { | ||
try { | ||
await Promise.all([ | ||
sidebarView.getSection('CLI COMMANDS'), | ||
sidebarView.getSection('PATCHES'), | ||
]) | ||
|
||
return true | ||
} catch { | ||
return false | ||
} | ||
}, | ||
{ timeoutMsg: 'expected the standard sidebar views to be visible' }, | ||
) | ||
} |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idiomatic term for this piece of UI is "Output Panel". Best to use that term since the term View is semantically overloaded in the context of VS Code extension development and refers to a specific different entity, which may be misleading.
Myself, I often opt to use Title Case whenever I refer to such idiomatic terms to better hint at that attribute of theirs, though I mindfully often opt not to, when I'm trying to avoid unnecessary visual overload. It's a subtle thing, do as you prefer, just thought I'd mention it once. When in doubt it's better to not use any special casing as using it wrongly would actually make things worse.