-
Notifications
You must be signed in to change notification settings - Fork 357
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: env variable config and automatic setServerAddress [TESTENG-49] #9582
Conversation
✅ Deploy Preview for determined-ui ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
webui/react/playwright.config.ts
Outdated
|
||
const serverAddess = process.env.PW_SERVER_ADDRESS; | ||
if (serverAddess === undefined) { | ||
throw new Error('Expected PW_SERVER_ADDRESS to be set.'); | ||
throw new Error(`Expected PW_SERVER_ADDRESS to be set. ${JSON.stringify(process.env)}`); |
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.
circle automatically hides sensitive things
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9582 +/- ##
==========================================
- Coverage 49.86% 45.27% -4.60%
==========================================
Files 1247 923 -324
Lines 162287 121954 -40333
Branches 2888 2887 -1
==========================================
- Hits 80931 55216 -25715
+ Misses 81185 66567 -14618
Partials 171 171
Flags with carried forward coverage won't be shown. Click here to find out more. |
await use(dev); | ||
}, | ||
devSetup: [ |
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.
now we automatically use a dev command on the UI for each page we get (every test). the dev command is set to local storage
986cc2e
to
43db0a6
Compare
}); | ||
await this.browserContext.addCookies(state.cookies); | ||
const token = JSON.stringify(await this.getBearerToken(true)); | ||
await page.evaluate((token) => localStorage.setItem('global/auth-token', token), token); |
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.
this was the magic i needed
webui/react/src/e2e/utils/envVars.ts
Outdated
} | ||
|
||
export function apiUrl(): string { | ||
return process.env.PW_BACKEND_SERVER_ADDRESS ?? webServerUrl(); |
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.
@djanicekpach @johnkim-det can you help me reconsider this environment variable name? maybe like this?
PW_BASE_URL="http://localhost:3000/"
PW_SERVER_ADDRESS="http://latest-main.determined.ai:8080/"
PW_USER_NAME="..."
PW_PASSWORD="..."
PW_DET_PATH="/Users/jcomins/miniconda3/envs/det/bin/det"
where PW_SERVER_ADDRESS
would be optional, so this would also work
PW_BASE_URL="http://localhost:3000"
PW_USER_NAME="admin"
PW_PASSWORD=""
PW_DET_PATH="/Users/jcomins/miniconda3/envs/det/bin/det"
do these names look good to you?
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 saw PW_DET_MASTER
in code and I thought that name was good. Is that included?
I don't love PW_BASE_URL
, but it matches playwright's config so I'm ok with it.
import { defineConfig, devices } from '@playwright/test'; | ||
import * as dotenv from 'dotenv'; | ||
|
||
dotenv.config(); | ||
dotenv.config({ path: path.resolve(__dirname, '.env') }); |
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.
@johnkim-det can you try .env
with this change?
a08cd71
to
cf9f024
Compare
webui/react/src/e2e/utils/envVars.ts
Outdated
} | ||
|
||
export function apiUrl(): string { | ||
return process.env.PW_BACKEND_SERVER_ADDRESS ?? webServerUrl(); |
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 saw PW_DET_MASTER
in code and I thought that name was good. Is that included?
I don't love PW_BASE_URL
, but it matches playwright's config so I'm ok with it.
cf9f024
to
78b3c2a
Compare
78b3c2a
to
c19df87
Compare
Ticket
TESTENG-49
Description
autouse dev setserveradress
move env var config to a file
rename env vars, check the readme
Test Plan
Checklist
docs/release-notes/
See Release Note for details.