Skip to content
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

WIP: Playwright with shared repo, compared with master #236

Draft
wants to merge 44 commits into
base: master
Choose a base branch
from

Conversation

mickmister
Copy link
Contributor

@mickmister mickmister commented Nov 17, 2023

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

rahulsuresh-git and others added 30 commits November 1, 2023 10:04
@mickmister mickmister requested a review from larkox as a code owner November 17, 2023 03:53
@mickmister mickmister changed the title Playwright with shared repo, compared Playwright with shared repo, compared with master Nov 17, 2023
@codecov-commenter
Copy link

codecov-commenter commented Nov 17, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (1afeeb0) 6.42% compared to head (3c24235) 6.42%.

❗ Current head 3c24235 differs from pull request most recent head 7c41fa3. Consider uploading reports for the commit 7c41fa3 to get more accurate results

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.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@hanzei hanzei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

- master
tags:
- "v*"
pull_request:
workflow_dispatch:

env:
TERM: xterm
GO_VERSION: 1.19.6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of CI uses go1.21. (mattermost/actions#13) Should the same version be used here?

Comment on lines 114 to 115
# cache: "npm"
# cache-dependency-path: webapp/package-lock.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed any longer? Having a cache would be nice.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NVM, I just saw #233.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines 134 to 138
# - name: ci/checkout-mattermost-monorepo
# uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
# with:
# path: ../mattermost
# repository: mattermost/mattermost
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove?

Comment on lines +1 to +3
[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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love seeing a submodule getting used here. It adds a lot of complexity. Are there simpler approaches that you considered?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

Comment on lines +1 to +3
[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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the repo be under the Mattermost org? mattermosttest is only used for GitHub API testing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there something we can generalize from this file and move into https://github.com/mattermost/actions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

.nvmrc Outdated
@@ -1 +1 @@
16.13.1
16.20.2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Missing end of line

@rahulsuresh-git
Copy link
Contributor

I shall be addressing the comments in the coming days. Thanks!
cc: @hanzei @mickmister

@mickmister mickmister marked this pull request as draft November 20, 2023 02:07
@mickmister mickmister changed the title Playwright with shared repo, compared with master WIP: Playwright with shared repo, compared with master Nov 20, 2023
Copy link
Member

@saturninoabril saturninoabril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do minio and elasticsearch to be used during testing? If not, maybe these can be removed?


ports:
- 8065:8065
- 4000:4000
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does port 4000 needs to be exposed?

Comment on lines 140 to 144
- name: ci/checkout-mattermost-monorepo
run: |
git clone https://github.com/mattermost/mattermost.git ../mattermost

- name: ci/setup-node-for-mattermost-monorepo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe drop monorepo in name? Same in other instances.

@mickmister
Copy link
Contributor Author

@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

@mvitale1989
Copy link

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.
No additional comments from my side at this point, thanks Michael!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2: Dev Review Requires review by a core committer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants