- Notifications
You must be signed in to change notification settings - Fork928
chore: skip global.setup if first user already exists#12930
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
treat test as a setup, rather than a test
site/package.json Outdated
"//": "If we are in a coder workspace, use the `ui-port` to allow opening remotely. If native, use the default app. It's generally a bit smoother to use.", | ||
"playwright:test-ui": "playwright test --config=e2e/playwright.config.ts --ui $([[ \"$CODER\" == \"true\" ]] && echo --ui-port=7500 --ui-host=0.0.0.0)", |
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.
@aslilac This works on local or in coder.
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.
why not just set these flags all the time? they're harmless options and seem like they should always work.
site/e2e/api.ts Outdated
export const setupApiCalls = async (page: Page) => { | ||
const token = await findSessionToken(page); | ||
API.setSessionToken(token); | ||
export const setupApiCalls = async (page: Page, unauthenticated?: boolean) => { |
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.
having aboolean
as an optional argument is almost always a bad idea imo, because from the call sitesetupApiCalls(page, true)
is incredibly vague. it should either be on an options object, or ideally imo, it would just gracefully do nothing if there is no token, and not take any additional params.
try { const token = await findSessionToken(page); API.setSessionToken(token);} catch {}
site/package.json Outdated
"//": "If we are in a coder workspace, use the `ui-port` to allow opening remotely. If native, use the default app. It's generally a bit smoother to use.", | ||
"playwright:test-ui": "playwright test --config=e2e/playwright.config.ts --ui $([[ \"$CODER\" == \"true\" ]] && echo --ui-port=7500 --ui-host=0.0.0.0)", |
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.
why not just set these flags all the time? they're harmless options and seem like they should always work.
site/package.json Outdated
@@ -16,6 +16,8 @@ | |||
"lint:types": "tsc -p .", | |||
"playwright:install": "playwright install --with-deps chromium", | |||
"playwright:test": "playwright test --config=e2e/playwright.config.ts", | |||
"//": "If we are in a coder workspace, use the `ui-port` to allow opening remotely. If native, use the default app. It's generally a bit smoother to use.", |
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.
pls no, I hate these hacky "json comments" 😭
Running |
but this weird interpolation is only in the
...or...
which are identical, except the explicit port and host. I don't get why we wouldn't just want those to be explicit all the time. |
I'm not saying we should add all the |
Ah. If you run |
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Kayla Washburn-Love <mckayla@hey.com>
Uh oh!
There was an error while loading.Please reload this page.
Treat
global.setup.ts
as a setup, rather than a test. This allows running in--ui
mode and running tests more than once.All tests currently share the same Coder instance. When running in UI mode, it allows running tests by choice. This should emulate the same behavior as running them as 1 set.
If you run a test more than once, it would have to be able to handle that, given it would run the same test in the same coderd state.
Since this is for debugging, I think that is ok for now.
Screencast.from.2024-04-10.15-56-28.webm