-
Notifications
You must be signed in to change notification settings - Fork 929
feat: Initial E2E test framework for v2 #288
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
470d06d
Add playwright dependency
bryphe-coder ab81ef9
Add initial playwright command to run against development server
bryphe-coder 7c970b5
feat: Initial E2E framework
bryphe-coder 853a2b9
Merge main
bryphe-coder 2b0f0cb
Add test/e2e job
bryphe-coder 78ceb9c
Add test/e2e job
bryphe-coder 5243dea
Merge branch 'main' into bryphe/feat/initial-e2e-tests
bryphe-coder 5eb9314
Use coderd directly, create initial user in setup script
bryphe-coder 8fc553a
Ignore e2e tests from jest
bryphe-coder 1b0e0d3
Fix typo
bryphe-coder f39f59a
Consolidate test_results/test-results
bryphe-coder 0428a62
Add junit reporter for DataDog
bryphe-coder 94c7684
Fix junit path
bryphe-coder dfe0c7c
Upload E2E test results to DataDog
bryphe-coder 8af7d02
Formatting
bryphe-coder 18f21da
Fix lint issues
bryphe-coder bcef4ac
Fix unit test DataDog uploads
bryphe-coder 91bda34
Clean up globalSetup
bryphe-coder 08dc699
Fix upload of E2E datadog reports
bryphe-coder b8cc80f
Add 'category' for classifying tests in datadog (unit, integration, e2e)
bryphe-coder a88a722
Remove coverage collection from E2E folder
bryphe-coder 4bad40e
Run e2e on all platforms
bryphe-coder 3b0b4cd
Try running on mac/ubuntu for now
bryphe-coder 15a9a11
Experiment: Unblock windows e2e tests
bryphe-coder 081c9cf
Revert "Experiment: Unblock windows e2e tests"
bryphe-coder 439c13b
Revert change to test/js
bryphe-coder d7f9257
Add link back to Windows issue
bryphe-coder 5eedfbe
Merge branch 'main' into bryphe/feat/initial-e2e-tests
bryphe-coder 7381ca2
Consolidate test-results/test_results in .gitignore
bryphe-coder d3c8e50
Update site/.eslintignore
bryphe-coder e66c685
Switch to using const vs function
bryphe-coder bee5e25
Merge branch 'bryphe/feat/initial-e2e-tests' of github.com:coder/code…
bryphe-coder 66b7d60
Refactor use email, password, username to constants
bryphe-coder 7c568de
Expand POM model
bryphe-coder 41a4516
Fix broken import
bryphe-coder 7997a16
Merge branch 'main' into bryphe/feat/initial-e2e-tests
kylecarbs fae6b3f
Push functionality up to BasePOM API
bryphe-coder 787213c
Merge branch 'main' into bryphe/feat/initial-e2e-tests
bryphe-coder 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
Refactor use email, password, username to constants
- Loading branch information
commit 66b7d60eab475fca883d2f9a35d9036295050b4c
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Default credentials and user for running tests | ||
export const username = "admin" | ||
export const password = "password" | ||
export const organization = "acme-crop" | ||
export const email = "[email protected]" |
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,4 +1,5 @@ | ||
import { FullConfig, request } from "@playwright/test" | ||
import { email, username, password, organization } from "./constants" | ||
|
||
const globalSetup = async (config: FullConfig): Promise<void> => { | ||
// Grab the 'baseURL' from the webserver (`coderd`) | ||
|
@@ -12,10 +13,10 @@ const globalSetup = async (config: FullConfig): Promise<void> => { | |
// Create initial user | ||
await context.post("/api/v2/user", { | ||
data: { | ||
email: "[email protected]", | ||
username: "admin", | ||
password: "password", | ||
organization: "acme-corp", | ||
email, | ||
username, | ||
password, | ||
organization, | ||
}, | ||
}) | ||
} | ||
|
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,12 +1,13 @@ | ||
import { test } from "@playwright/test" | ||
import { SignInPage } from "../pom" | ||
import { email, password } from "../constants" | ||
|
||
test("Login takes user to /projects", async ({ page, baseURL }) => { | ||
await page.goto(baseURL + "/", { waitUntil: "networkidle" }) | ||
|
||
// Log-in with the default credentials we set up in the development server | ||
const signInPage = new SignInPage(page) | ||
await signInPage.submitBuiltInAuthentication("[email protected]", "password") | ||
await signInPage.submitBuiltInAuthentication(email, password) | ||
|
||
await page.waitForNavigation({ url: baseURL + "/projects", waitUntil: "networkidle" }) | ||
|
||
|
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.
Interesting that unpacking the
baseURL
works here since it didn't in v1 - good sign! I believe you can avoid doing the string concatenation here though if you defineurl
in the POM.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.
Yep! The v1 E2E tests use a special (external) address to point to the server under test (picked up from
RUNTIME_CONFIG
: https://github.com/coder/m/blob/833f23892c4802bfcdf9b39c86f415a1dc70a3b2/product/coder/e2e/configuration/runtime.ts#L18)With these tests - using the
webServer
automatically populates thebaseURL
which is convenient.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.
Good point - we have some more utilities in the POM layer in v1, I brought them over (ie,
BasePOM
) here in this change: 7c568deIt's a little bit awkward - since I'm passing both the
baseURL
andpage
into the POM's - let me know if you were thinking of a different approach!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.
Implemented @vapurrmaid 's suggestions which help improve this in: fae6b3f - I'll merge what we have so the test is in place for the NextJS -> Webpack changes, but happy to iterate on it more
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.
@bryphe-coder I'm definitely in favor of this merging sooner than later for iteration, it's in a really good starting spot!