WIP: Playwright with shared repo, compared with master#236
Conversation
…t-plugin-todo into feat/adding-playwright-e2e
…suresh-git/mattermost-plugin-todo into feat/adding-playwright-e2e
…t-plugin-todo into feat/adding-playwright-e2e
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #236 +/- ##
======================================
Coverage 6.42% 6.42%
======================================
Files 11 11
Lines 1712 1712
======================================
Hits 110 110
Misses 1594 1594
Partials 8 8 ☔ View full report in Codecov by Sentry. |
hanzei
left a comment
There was a problem hiding this comment.
That is amazing work 🚀 Thank you @mickmister, and an even bigger thanks to @rahulsuresh-git!
Does it make sense to re-use the actions from https://github.com/mattermost/actions? That could help keeping the code DRY.
|
|
||
| env: | ||
| TERM: xterm | ||
| GO_VERSION: 1.19.6 |
There was a problem hiding this comment.
The rest of CI uses go1.21. (mattermost/actions#13) Should the same version be used here?
| # cache: "npm" | ||
| # cache-dependency-path: webapp/package-lock.json |
There was a problem hiding this comment.
Is this needed any longer? Having a cache would be nice.
There was a problem hiding this comment.
Note that we were having issues with this block, where the package-lock.json file itself was being cached, so if you pushed a commit that changed that file, CI didn't end up using the new file
| # - name: ci/checkout-mattermost-monorepo | ||
| # uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | ||
| # with: | ||
| # path: ../mattermost | ||
| # repository: mattermost/mattermost |
| [submodule "e2e/playwright/mattermost-plugin-e2e-test-utils"] | ||
| path = e2e/playwright/mattermost-plugin-e2e-test-utils | ||
| url = https://github.com/mattermosttest/mattermost-plugin-e2e-test-utils.git |
There was a problem hiding this comment.
I don't love seeing a submodule getting used here. It adds a lot of complexity. Are there simpler approaches that you considered?
There was a problem hiding this comment.
@hanzei Yes the other two options I've considered is referencing through npm, and just duplicating the code. I definitely don't want to go down the route of duplicating the code. Publishing to npm or referencing as a git-based node dependency is probably what we will end up doing.
The submodule approach was the quickest way that required no hassling with npm. Even if I didn't end up running into an issue with npm, I didn't want that to get in the way when trying this out. A git-based npm dependency wouldn't be much different as far as "use this commit", but I agree the submodule is not as turnkey as referencing a git-based dependency
| [submodule "e2e/playwright/mattermost-plugin-e2e-test-utils"] | ||
| path = e2e/playwright/mattermost-plugin-e2e-test-utils | ||
| url = https://github.com/mattermosttest/mattermost-plugin-e2e-test-utils.git |
There was a problem hiding this comment.
Should the repo be under the Mattermost org? mattermosttest is only used for GitHub API testing.
There was a problem hiding this comment.
@hanzei Yes this was just the easiest way for me to have it somewhere other than my personal account. Since it is specifically related to Mattermost, and I was directly referencing it in a Mattermost project as a dependency, I sided to put it there for now. It's mainly a proof of concept to test out sharing code, and figuring out exactly which code should be shared etc.
There was a problem hiding this comment.
Is there something we can generalize from this file and move into https://github.com/mattermost/actions?
There was a problem hiding this comment.
Yes, I want to "get it right" first though. I don't think we should merge two PRs from two different repos before moving this to the actions repo
| @@ -1 +1 @@ | |||
| 16.13.1 | |||
| 16.20.2 No newline at end of file | |||
|
I shall be addressing the comments in the coming days. Thanks! |
saturninoabril
left a comment
There was a problem hiding this comment.
Thanks @mickmister! Overall looks good to me. Left few non-blocking comments.
I'll ask for @mvitale1989 review for his inputs.
| - 10080:10080 | ||
| - 10110:10110 | ||
| - 10025:10025 | ||
| elasticsearch: |
There was a problem hiding this comment.
Do minio and elasticsearch to be used during testing? If not, maybe these can be removed?
|
|
||
| ports: | ||
| - 8065:8065 | ||
| - 4000:4000 |
There was a problem hiding this comment.
Does port 4000 needs to be exposed?
| - name: ci/checkout-mattermost-monorepo | ||
| run: | | ||
| git clone https://github.com/mattermost/mattermost.git ../mattermost | ||
|
|
||
| - name: ci/setup-node-for-mattermost-monorepo |
There was a problem hiding this comment.
Maybe drop monorepo in name? Same in other instances.
|
@saturninoabril Note that much of the code being used here is in a separate repo mattermost-community/mattermost-plugin-e2e-test-utils#1, currently being referenced through git submodule |
|
Apologies for the late review, I have little experience with git submodules but have no objection in trying out the approach. I see it working fine among the PR status checks. |
Summary
This PR is built off of Playwright PR #228, and is pointing to master. This PR uses a submodule defined at mattermost-community/mattermost-plugin-e2e-test-utils#1 to centralize the Playwright bootstrapping code.
PR comparing to open Playwright PR #235
Ticket Link