-
Notifications
You must be signed in to change notification settings - Fork 7
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
RFC: support global playwright.config.js|ts
for browser checks
#806
Comments
playwright.config.js|ts
for browser checks (draft)playwright.config.js|ts
for browser checks (draft)
playwright.config.js|ts
for browser checks (draft)playwright.config.js|ts
for browser checks
Thank you for the RFC! Hope we can keep the ball rolling here. I have posted on the community Slack and wanted to share my use case: As part of the authentication strategy, in order to avoid having to go to an email provider to retrieve the link for accepting an invite link, I copy the URL by pressing on a button. In order for that to work on Chromium-based browsers, I need to be able to pass in the permissions flag to allow the navigator clipboard events for read/write contextOptions: {
// chromium-specific permissions
permissions: ['clipboard-read', 'clipboard-write'],
} if (browserName === 'chromium' || browserName === 'webkit') {
link = await page.evaluate(() => navigator.clipboard.readText());
} Not providing the additional flags causes the following error: Error: page.evaluate: DOMException: Read permission denied. I agree that supporting |
@malinskibeniamin sorry for the late reply. I'm not sure how your clipboard example relates to projects, but I'm ok with keeping it here. |
Thanks! I meant that having the ability to customise projects property for checkly will allow me to pass a flag that enables asserting against clipboard events, making certain tests easier to write. |
Hi all, we just release a beta for this. It does not support all configuration options yet, but is already very usable. Check the full changelog here |
Hi @tnolet, I checked your new version. But we need auth.setup.ts|js. Because for my use case my every page is accessible only if the user is logged in other wise not .so i cant run auth test using checkly. so can u guys please provide that. Its will be a better improvement. |
@thareekanvarm we are aware of this and as we mentioned in the changelog we will work on this for the GA release. |
Hey – any workarounds for storageState? |
@MrRio Hey James, sadly not really. The solution we want to have has some nasty intersections with security and sandboxing related issues. Think reading and writing anything to disk and Checkly persisting that. We had hoped to ship support earlier, but we had to shift platforms (Lambda to managed EKS) which brought some extra complexity. Long story short: We are still working on it and we want to make it happen ASAP. |
Playwright recommends delegating a lot of settings to the per project global
playwright.config.js
file. We currently do not support this for legacy reasons. We should support this and enable users to leverage the options it gives them.Core use cases
Based on feedback from users we found the following two use cases to be core:
use
options to set defaults for viewports, headers etc.User journey
npx checkly test
and the CLI prints out that it has detected and is using theplaywright.config.ts
playwright.config.ts
can't be parsed (syntax errors, unsupported dependencies etc.) we print an error before running the test command.Commands
This addition impacts the
test
anddeploy
commands. For both commands we add two flags:--pwt-config-file
: an optional path to define the config file. Defaults toplaywright.config.ts
and if not foundplaywright.config.js
--use-pwt-config
: a boolean value whether to use the config at all. Defaultfalse
. Later we can default it totrue
if stable.Supported options
global config
This is the stock global config file created on initialising a PWT repo with all the extra advanced options added.
testDir
fullyParallel
forbidOnly
retries
workers
reporter
testMatch
testIgnore
outputDir
globalSetup
globalTeardown
timeout
use
expect
projects
webServer
global expect config
See https://playwright.dev/docs/test-configuration#expect-options
timeout
toHaveScreenshot
toMatchSnapshot
use config
See https://playwright.dev/docs/test-use-options
baseURL
storageState
colorScheme
geolocation
locale
permissions
timezoneId
viewport
deviceScaleFactor
hasTouch
isMobile
javaScriptEnabled
extraHTTPHeaders
httpCredentials
ignoreHTTPSErrors
offline
proxy
screenshot
trace
video
actionTimeout
navigationTimeout
browserName
channel
headless
testIdAttribute
launchOptions
connectOptions
contextOptions
projects config
Supporting the
projects
option is important as it is the recommended way to set up any sufficiently complex PWT codebase.See https://playwright.dev/docs/test-projects
The trickiest one here is the
testMatch
option, as we do want to support matching on setup files, but not other.spec.ts
files as due to our runtime we do not have access to allspec.ts
files on each check run.name
use
teardown
storageState
dependencies
timeout
expect
retries
metadata
testMatch
fullyParallel
grep
grepInvert
testIgnore
testDir
outputDir
snapshotDir
snapshotPathTemplate
Implementation details
globalSetup
references a file. We need to parse that file, its dependency tree and check for unsupported dependencies. We need to then rollup and bundle these files as we do for all other dependencies.testMatch
inside a project, typically asetup
project, can reference a file. We need to also rollup that file and its dependencies.storageState
can be defined by the user anywhere on the filesystem. We need to handle any errors there and allow the Checkly backend to (re)create that file tree at runtime.Shortcut link
No response
Additional resources
No response
The text was updated successfully, but these errors were encountered: