feat(e2e): playwright base setup#208
Conversation
5171cdb to
ecb428d
Compare
ecb428d to
c6a2375
Compare
hanzei
left a comment
There was a problem hiding this comment.
Great work @saturninoabril 🚀
Looking forward to more plugins with E2E tests!
|
|
||
| - name: ci/checkout-mattermost | ||
| run: | | ||
| git clone https://github.com/mattermost/mattermost.git ../mattermost |
There was a problem hiding this comment.
Should we use --depth here as well?
There was a problem hiding this comment.
Sure, I'll use the actions/checkout for consistency with the default depth and branch.
| env: | ||
| CI: true | ||
| NODE_OPTIONS: '--no-experimental-fetch' | ||
| PW_ENSURE_PLUGINS_INSTALLED: com.mattermost.plugin-starter-template |
There was a problem hiding this comment.
Can we extract the plugin ID programmatically?
There was a problem hiding this comment.
I suggest to do this manually. I'll add notes in addition to what files to edit in the README.
| @@ -0,0 +1 @@ | |||
| 20.11 | |||
There was a problem hiding this comment.
The webapp code of the plugin still used node 16. (https://github.com/mattermost/mattermost-plugin-starter-template/blob/master/.nvmrc#L1)
I'm hesitant that the use of different node versions will cause pain for developers. Can we align the two versions?
There was a problem hiding this comment.
It would be best to upgrade this matching the one being used at monorepo's webapp. However, I've seen issues in upgrading webapp's node version here and so it would be good to address separately.
Note that the Playwright from the monorepo uses a feature (native fetch) available from 18+ and so, use of outdated node 16 will not work.
I'll take a look at the options here.
| "printWidth": 120, | ||
| "singleQuote": true, | ||
| "tabWidth": 4 | ||
| } |
There was a problem hiding this comment.
0/5 should we use a global confirmation for all webapp node and not only the e2e code?
| @@ -0,0 +1 @@ | |||
| export const starterTemplatePluginId = 'com.mattermost.plugin-starter-template'; | |||
There was a problem hiding this comment.
Same question here. Can we extract the plugin ID?
There was a problem hiding this comment.
Same -- to do it manually with guides at the readme. This is base test only and will fail if not change.
| await systemConsolePage.page.getByRole('link', {name: 'Plugin Starter Template'}).click(); | ||
|
|
||
| // # Enable the plugin | ||
| await page.getByTestId('PluginSettings.PluginStates.com+mattermost+plugin-starter-template.Enabletrue').check(); |
| #!/bin/sh | ||
| echo "Clone mattermost" | ||
| cd ../../ | ||
| git clone --depth 1 https://github.com/mattermost/mattermost.git |
There was a problem hiding this comment.
What happens if a plugin dev runs the script a second time? Does git pull the latest changes?
There was a problem hiding this comment.
It will fail in cloning the repo (remain as is and will not pull the latest) with the following log but will continue until the end.
fatal: destination path 'mattermost' already exists and is not an empty directory.
There was a problem hiding this comment.
It would be nice if the script runs without an error and pulls the latest changes on a second run.
There was a problem hiding this comment.
I agree, but some may prefer to avoid introducing unintended changes to the work they're currently doing in the monorepo. This script is intended solely for the initial setup to help users get started quickly. For subsequent steps, they can choose how they want to update their setup once they're more familiar with the dependencies.
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
| if: success() || failure() | ||
| with: | ||
| name: test-results | ||
| path: e2e/results |
There was a problem hiding this comment.
I'll move this as a reusable workflow at https://github.com/mattermost/actions-workflows. With that, I'm putting reviews on hold for now.
|
GIthub clean up - this has been opened for a while, are we still doing this? |
|
Thanks Pavel, and closing this PR for now. |
Summary
This is mainly based from the awesome works by @rahulsuresh-git and @mickmister at mattermost-community/mattermost-plugin-todo#228. Thanks to both of you!
This plugin template is used to get started in developing plugins for Mattermost, and to make it easier for the developers to write E2E tests, this PR introduces the base setup for Playwright with reference from the
mattermostrepo (here), taking advantage of the patterns/models/setup readily available from there.