-
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
base: main
Are you sure you want to change the base?
Conversation
65d319d
to
1046eb8
Compare
1046eb8
to
800e371
Compare
46b1f43
to
5a28f5e
Compare
0cecdcf
to
974327c
Compare
Signed-off-by: Zacharias Fragkiadakis <zacfragkiadakis@gmail.com>
- 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>
Signed-off-by: Zacharias Fragkiadakis <zacfragkiadakis@gmail.com>
fb82cd9
to
a62b0b6
Compare
c29da1e
to
c1b8f16
Compare
- adds tests for the "path to rad binary" setting - adds cleanup logic to the onboarding suite - updates config to run onboarding and settings suites sequentially - updates e2e ci workflow to ensure both platforms run regardless of each other's outcome Signed-off-by: Zacharias Fragkiadakis <zacfragkiadakis@gmail.com>
- Adds test for the "path to node home" setting - Allows skipping tests based on platform by including `@skip{platform}CI` in the test name Signed-off-by: Zacharias Fragkiadakis <zacfragkiadakis@gmail.com>
- Sets "waitFor" timeout globally - Extracts some functions to helper files - Generally cleans up the test suite Signed-off-by: Zacharias Fragkiadakis <zacfragkiadakis@gmail.com>
747f07b
to
b79dae5
Compare
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.
EDIT: Oh w8, reviewed wrong PR. I'll get to this one next, soz!
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.
see above
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.
I still need to have a second look, particularly for the details of the logic in settings.spec.ts
, but for now some early comments.
In addition to the inline ones, I want to address a couple more general ones:
- regarding changing setting values, I wonder if we take into account (and if we should, if not) the debounce that seems to be between setting changing the input field's value and it "registering". Perhaps we could "blur" the focus instead of waiting which seems to trigger registering of the new value instantly.
- if running (a subset, as previously discussed) of the e2e tests locally is now safe, i.e. won't impact local setup, we should revisit restoring the npm script
test:e2e
inside the top-level script "test".
@@ -45,13 +59,15 @@ export const config: Options.Testrunner = { | |||
}, | |||
], | |||
logLevel: 'warn', | |||
waitforTimeout: 10000, | |||
waitforTimeout: 20000, |
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.
What prompted this increase? Is it possible to apply it per case as needed instead?
specs: [ | ||
['./specs/onboarding.spec.ts', './specs/settings.spec.ts'], | ||
'./specs/**/!(onboarding|settings).spec.ts', | ||
], |
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.
I roughly sketched this for you to consider if we could/should use in order to have a single point of definition for those specs that need to be in specific order and also help not forget to keep those array entries in sync as specs get added/removed.
/**
* Add to this list any paths to spec files requiring to run in a specific order.
*/
const orderedSpecPaths = ['./specs/onboarding.spec.ts', './specs/settings.spec.ts']
const specsToExcludeFromGlob = orderedSpecPaths
.map(specPath => specPath.split('/').pop()?.replace('.spec.ts', ''))
;[
orderedSpecPaths,
`./specs/**/!(${specsToExcludeFromGlob.join('|')}).spec.ts`,
]
Feel free to adjust as needed or outright skip if you think it would be best to keep it WET (instead of DRY but more engineered and restrictive).
Either way please ensure that we're using (here and everywhere else as needed) the OS-agnostic nodejs separator imported from node:path
, so that our code is more likely to run on windows (or at worst have less tech debt when the need comes to officially support it).
|
||
// This functionality does not seem to work | ||
// eslint-disable-next-line max-len | ||
it.skip('recognizes if the directory is created *after* the setting is updated', async () => { |
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.
it.skip('recognizes if the directory is created *after* the setting is updated', async () => { | |
it.skip('recognizes if the directory is created *after* the setting is set', async () => { |
Minor copy improvement. At least for my brain, makes the case description a tad easier to parse.
|
||
// This functionality does not seem to work | ||
// eslint-disable-next-line max-len | ||
it.skip('recognizes if the directory is created *after* the setting is updated', async () => { |
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.
it.skip('recognizes if the directory is created *after* the setting is updated', async () => { | |
it.skip('recognizes if the directory is created *after* the setting is updated', async () => { |
Minor copy improvement. At least for my brain, makes the case description a tad easier to parse.
import type { OutputView, Workbench } from 'wdio-vscode-service' | ||
|
||
/** | ||
* Asserts the output view contains the expected text. |
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.
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 comment
The 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)).
pathToRadBinarySetting = await settings.findSetting( | ||
'Path To Rad Binary', | ||
'Radicle', | ||
'Advanced', | ||
) |
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.
Is it possible to refer to each setting by its identifier instead? It would make for less brittle referencing. Ids are defined in package.json, e.g. here it would be radicle.advanced.pathToRadBinary
.
If you use the above in the settings search you'll get the single expected result
If you'd want to go all in you could even search for @id:radicle.advanced.pathToRadBinary
, but I fail to see how prepending the @id
makes any material difference.
Same for all instances of this.
await $`rm -rf ${tempNodeHomePath}` | ||
}) | ||
|
||
// This functionality does not seem to work |
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.
When you find bugs while testing (which is great!!), it's best to create an issue instead, list the repro steps in there which by definition you know, and use a better comment here like e.g.:
// This functionality does not seem to work | |
// TODO: unskip when bug #xyz covered by this case is fixed |
/** | ||
* In Linux CI: | ||
* - The extension is having issues resolving the correct node home directory (RAD_HOME). | ||
* - Even when node home is set explicitly in the settings, the extension incorrectly reports it | ||
* as non-authenticated. | ||
*/ | ||
// eslint-disable-next-line max-len | ||
describe('VS Code, when updating the "Path to Radicle to Node Home" setting, @skipLinuxCI', () => { |
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.
Skipping tests, especially on Linux CI, along with the whole setup that comes to support this on the runner level is both hacky and and risky.
These various odd issues we've been having on the environment level smell to me that we need to look upwards to sniff out the root cause (e.g. in e2e-testing.yaml, or wdio config, or investigate CLI bug with the maintainers, ...?) or it will keep forcing more hacks down our throats.
At the very least, here could we at least source the value of RAD_HOME
alternatively e.g. with rad self --home
and remove all those @skipLinuxCI
markers and related supporting logic?
Prerequisite #162
Notes:
RAD_HOME
env var)