Skip to content
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
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

test(e2e): settings tests #167

wants to merge 6 commits into from

Conversation

QZera
Copy link
Collaborator

@QZera QZera commented Dec 1, 2024

Prerequisite #162

  • Tests the "Path to Rad Binary" and "Path to Node Home" extension settings

Notes:

  • The tests that verify that the extension recognizes paths that are created after the setting is updated are implemented but marked to be skipped by the runner. As discussed, this functionality should work but doesn't at the moment
  • The "Path to Node Home" tests are skipped on the Linux CI, as there seems to be an issue where the extension does not correctly pick up the initial node home path (from the RAD_HOME env var)

@QZera QZera force-pushed the feat/settings-e2e-tests branch 11 times, most recently from 65d319d to 1046eb8 Compare December 1, 2024 19:08
@QZera QZera changed the title Feat/settings e2e tests test(e2e): setting tests Dec 1, 2024
@QZera QZera force-pushed the feat/settings-e2e-tests branch from 1046eb8 to 800e371 Compare December 2, 2024 07:07
@QZera QZera force-pushed the feat/settings-e2e-tests branch 17 times, most recently from 46b1f43 to 5a28f5e Compare December 27, 2024 10:43
@QZera QZera force-pushed the feat/settings-e2e-tests branch 6 times, most recently from 0cecdcf to 974327c Compare December 30, 2024 18:03
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>
@QZera QZera force-pushed the feat/settings-e2e-tests branch 9 times, most recently from fb82cd9 to a62b0b6 Compare January 4, 2025 10:23
@QZera QZera changed the title test(e2e): setting tests test(e2e): settings tests Jan 6, 2025
@QZera QZera force-pushed the feat/settings-e2e-tests branch from c29da1e to c1b8f16 Compare January 6, 2025 10:08
QZera added 3 commits January 6, 2025 12:35
- 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>
@QZera QZera force-pushed the feat/settings-e2e-tests branch from 747f07b to b79dae5 Compare January 6, 2025 10:35
@QZera QZera marked this pull request as ready for review January 6, 2025 10:39
@QZera QZera requested a review from maninak January 6, 2025 10:39
@QZera QZera self-assigned this Jan 6, 2025
Copy link
Collaborator

@maninak maninak left a 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!

Copy link
Collaborator

@maninak maninak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

Copy link
Collaborator

@maninak maninak left a 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:

  1. 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.
  2. 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,
Copy link
Collaborator

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?

Comment on lines +38 to +41
specs: [
['./specs/onboarding.spec.ts', './specs/settings.spec.ts'],
'./specs/**/!(onboarding|settings).spec.ts',
],
Copy link
Collaborator

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 () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Collaborator

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
Copy link
Collaborator

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)).

Comment on lines +39 to +43
pathToRadBinarySetting = await settings.findSetting(
'Path To Rad Binary',
'Radicle',
'Advanced',
)
Copy link
Collaborator

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.

image

If you use the above in the settings search you'll get the single expected result
image

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
Copy link
Collaborator

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.:

Suggested change
// This functionality does not seem to work
// TODO: unskip when bug #xyz covered by this case is fixed

Comment on lines +91 to +98
/**
* 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', () => {
Copy link
Collaborator

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants