-
Notifications
You must be signed in to change notification settings - Fork 32
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
Create Plugin: Extend the playwright config file #1495
base: main
Are you sure you want to change the base?
Conversation
Hello! 👋 This repository uses Auto for releasing packages using PR labels. ✨ This PR can be merged but will not trigger a new release. To trigger a new release add the |
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'm a bit sceptical to this. This will make it a little harder to overview and edit the Playwright config for plugin developers. And to my knowledge, Playwright don't offer any abstraction to merge configs (the way for example Webpack does with [https://www.npmjs.com/package/webpack-merge]).
Now that we're soon to release the new create-plugin update cmd that allows us to safely manipulate files outside the .config dir, is this really necessary? cc @jackw who initially raised this issue.
Merging the configs isn't a problem since playwright expects the default object exposed from that file to be the config. So you can use what ever merge util you want to merge multiple configs. But I agree with your thoughts regarding the migrations. However, it might not be easy to migrate a file that is changed by the user. So moving the base to |
As others have also pointed out we can rely on spreading these configs but I believe Playwright does have some concept of merging configs via defineConfig which can take multiple configs. e.g. However, the playwright team decided that the projects property should override which would result in needing to do:
Whilst it was originally designed for webpack, webpack-merge isn't webpack specific. You can use it for any config including playwrights:
Within create-plugin, we have the concept of "put default configs in .config directory and extend in files in root of project" and I opened the issue to align our playwright config with this concept. I also agree with @mckn that even with migrations it's much easier to update a file in the .config directory as we consider them ours and document in the files and in our docs website that touching them is a bad idea. |
@@ -0,0 +1,53 @@ | |||
import type { PluginOptions } from '@grafana/plugin-e2e'; |
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.
import type { PluginOptions } from '@grafana/plugin-e2e'; | |
/* | |
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️ | |
* | |
* In order to extend the configuration follow the steps in | |
* https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-playwright-config | |
*/ | |
import type { PluginOptions } from '@grafana/plugin-e2e'; |
If we decide to do this I think we should update the docs site in this PR too with instructions.
}, | ||
], | ||
|
||
} as PlaywrightTestConfig<PluginOptions>; |
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.
Not sure this is necessary. I think you can export the defineConfig<PluginOptions>({})
in this file then use defineConfig
again in the root.
What this PR does / why we need it:
This PR move the existing playwright config to
./config
, this will make updating the default playwright config easier.Which issue(s) this PR fixes:
Closes #1366
Special notes for your reviewer:
The way the docs are written right now is still applicable to the new playwright config that extends the one from
./config
therefore they were not modified.