-
Notifications
You must be signed in to change notification settings - Fork 246
chore(e2e, web, preferences): clean-up unnecessary env checks and build step injections; consolidate shared env / feature setting in e2e for both runtimes; clean-up ai tests and re-enable for web #7491
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
Closed
gribnoysup
wants to merge
21
commits into
main
from
fix-set-env-set-feature-mock-server-e2e-re-enable-tests
Closed
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
54e8f33
chore(atlas-service): make sure config takes env changes into account
gribnoysup 0b9ae60
chore(web): remove sandbox method from main bundle; remove unnecessar…
gribnoysup 64a1955
chore(generative-ai): use connectionInfo.atlasMetadata to branch url …
gribnoysup 1d9071b
chore(assistant): make sure assistant url is handled dynamically
gribnoysup 6d9006f
chore(e2e): make sure setFeature is consistently executed in web
gribnoysup da325db
chore(e2e): add setEnv behavior for desktop
gribnoysup 3f4d5cb
chore(e2e): correctly handle CORS in atlas mock backend; add mock for…
gribnoysup db8be89
chore(e2e): remove unnecessary env checks, consolidate shared env and…
gribnoysup ae28cf2
chore(e2e): clean up ai tests; re-enable for web
gribnoysup 5c04f65
chore(generative-ai): adjust tests for new method behavior
gribnoysup 555c565
chore(assistant): use a completely fake placeholder url instead of a …
gribnoysup 0334ce8
chore(assistant): adjust unit test
gribnoysup 84adb85
Merge remote-tracking branch 'origin/main' into fix-set-env-set-featu…
gribnoysup 7632d88
Merge branch 'main' into fix-set-env-set-feature-mock-server-e2e-re-e…
gribnoysup 113d620
chore(components, preferences): replace DISABLE_GUIDE_CUES env with p…
gribnoysup 3333565
Merge branch 'main' into fix-set-env-set-feature-mock-server-e2e-re-e…
gribnoysup 8a4d41a
chore(components): reomve disable_guide_cue env from tests
gribnoysup d4fda21
chore(e2e): consolidate common preferences setting in init
gribnoysup 1bbc5d6
chore(web, e2e): expose preferences fully, log changed value for debu…
gribnoysup eb3550b
fix(web-sandbox): use useCallback for setPreferencesAccess
gribnoysup dec7040
chore(web): remove unused dep
gribnoysup 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
35 changes: 28 additions & 7 deletions
35
packages/compass-e2e-tests/helpers/commands/get-feature.ts
This file contains hidden or 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 |
|---|---|---|
| @@ -1,16 +1,37 @@ | ||
| import type { CompassBrowser } from '../compass-browser'; | ||
| import type { UserPreferences } from 'compass-preferences-model'; | ||
| import { isTestingWeb } from '../test-runner-context'; | ||
|
|
||
| export async function getFeature<K extends keyof UserPreferences>( | ||
| browser: CompassBrowser, | ||
| name: K | ||
| ): Promise<UserPreferences[K]> { | ||
| return await browser.execute(async (_name) => { | ||
| return ( | ||
| // eslint-disable-next-line @typescript-eslint/no-require-imports | ||
| (await require('electron').ipcRenderer.invoke('compass:get-preferences'))[ | ||
| _name | ||
| ] | ||
| return (await getFeatures(browser))[name]; | ||
| } | ||
|
|
||
| export async function getFeatures( | ||
| browser: CompassBrowser | ||
| ): Promise<UserPreferences> { | ||
| if (isTestingWeb()) { | ||
| // When running in Compass web we cannot use the IPC to read the | ||
| // preferences so we use a global function | ||
| await browser.waitUntil(async () => { | ||
| return await browser.execute(() => { | ||
| return ( | ||
| Symbol.for('@compass-web-sandbox-preferences-access') in globalThis | ||
| ); | ||
| }); | ||
| }); | ||
| return await browser.execute(() => { | ||
| return (globalThis as any)[ | ||
| Symbol.for('@compass-web-sandbox-preferences-access') | ||
| ].getPreferences(); | ||
| }); | ||
| } | ||
| return await browser.execute(async () => { | ||
| // eslint-disable-next-line @typescript-eslint/no-require-imports | ||
| return await require('electron').ipcRenderer.invoke( | ||
| 'compass:get-preferences' | ||
| ); | ||
| }, name); | ||
| }); | ||
| } |
This file contains hidden or 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.
Should we just use a static string as the initial base URL? I'd be inclined to do that so that this actually fails loudly if for some reason we still end up reaching out to the original endpoint
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.
Yeah, not a bad idea! I was considering this, but wasn't totally sure. Will update 👍
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.
Done in 555c565