-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
ask-the-documents
: Add CI testing
#3250
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { defineConfig, devices } from "@playwright/test"; | ||
|
||
const WASP_RUN_MODE = process.env.WASP_RUN_MODE ?? "dev"; | ||
const WASP_CLI_CMD = process.env.WASP_CLI_CMD ?? "wasp-cli"; | ||
|
||
/** | ||
* Read environment variables from file. | ||
* https://github.com/motdotla/dotenv | ||
*/ | ||
// require('dotenv').config(); | ||
|
||
/** | ||
* See https://playwright.dev/docs/test-configuration. | ||
*/ | ||
export default defineConfig({ | ||
testDir: "./tests", | ||
/* Run tests in files in parallel */ | ||
fullyParallel: true, | ||
/* Fail the build on CI if you accidentally left test.only in the source code. */ | ||
forbidOnly: !!process.env.CI, | ||
/* Retry on CI only */ | ||
retries: process.env.CI ? 2 : 0, | ||
/* Opt out of parallel tests on CI. */ | ||
workers: process.env.CI ? 1 : undefined, | ||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ | ||
reporter: process.env.CI ? "dot" : "list", | ||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ | ||
use: { | ||
/* Base URL to use in actions like `await page.goto('/')`. */ | ||
baseURL: "http://localhost:3000", | ||
|
||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ | ||
trace: "on-first-retry", | ||
}, | ||
|
||
projects: [ | ||
{ | ||
name: "chromium", | ||
use: { ...devices["Desktop Chrome"] }, | ||
}, | ||
/* Test against mobile viewports. */ | ||
{ | ||
name: "Mobile Chrome", | ||
use: { ...devices["Pixel 5"] }, | ||
}, | ||
], | ||
|
||
/* Run your local dev server before starting the tests */ | ||
webServer: { | ||
command: `run-wasp-app ${WASP_RUN_MODE} --path-to-app=../ --wasp-cli-cmd=${WASP_CLI_CMD} --db-image pgvector/pgvector:pg17`, | ||
|
||
// Wait for the backend to start | ||
url: "http://localhost:3001", | ||
reuseExistingServer: !process.env.CI, | ||
timeout: 180 * 1000, | ||
gracefulShutdown: { signal: "SIGTERM", timeout: 500 }, | ||
}, | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { expect, test } from "@playwright/test"; | ||
|
||
test.describe("loads successfully", () => { | ||
test.describe.configure({ mode: "serial" }); | ||
|
||
test("shows the search bar", async ({ page }) => { | ||
await page.goto("/"); | ||
await page.waitForSelector("input[type='search']"); | ||
await expect(page.locator("input[type='search']")).toBeVisible(); | ||
}); | ||
Comment on lines
+6
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What would need to happen for us to be able to test:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we'd need either some framework-level way of mocking external services, or come up with a solution to MitM the HTTP connections. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh yeah, it's either mock the whole Google flow or actually log in which might be problematic due to some anti-bot measures. Hm, so MitM sounds the most reliable way of it to me 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's encode this in a existing or a new issue and link back to this file / PR. I think this is enough for now 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
}); |
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Nice