-
Notifications
You must be signed in to change notification settings - Fork 177
WIP: Playwright tests with shared repo #713
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,16 @@ | ||
| name: Playwright Tests | ||
| on: | ||
| schedule: | ||
| - cron: "0 0 * * *" | ||
| workflow_run: | ||
| workflows: ["ci"] | ||
| types: | ||
| - completed | ||
| push: | ||
| branches: | ||
| - master | ||
| tags: | ||
| - "v*" | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| env: | ||
| TERM: xterm | ||
| GO_VERSION: 1.19.6 | ||
| NODE_VERSION: 16.15.0 | ||
| GO_VERSION: 1.21 | ||
|
|
||
| jobs: | ||
| playwright-run: | ||
|
|
@@ -98,6 +98,8 @@ jobs: | |
| steps: | ||
| - name: ci/checkout-repo | ||
| uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | ||
| with: | ||
| submodules: 'true' | ||
|
|
||
| - name: ci/setup-go | ||
| uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0 | ||
|
|
@@ -109,8 +111,8 @@ jobs: | |
| uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 | ||
| with: | ||
| node-version-file: ".nvmrc" | ||
| cache: "npm" | ||
| cache-dependency-path: webapp/package-lock.json | ||
| # cache: "npm" | ||
| # cache-dependency-path: webapp/package-lock.json | ||
|
|
||
| - name: ci/create-admin-user | ||
| run: | | ||
|
|
@@ -119,7 +121,8 @@ jobs: | |
|
|
||
| - name: ci/install-go-dependencies | ||
| run: go mod tidy | ||
| - name: ci/install-npm-dependencies | ||
|
|
||
| - name: ci/install-plugin-webapp-deps | ||
| run: cd webapp && npm ci | ||
|
|
||
| - name: ci/build-and-install-plugin | ||
|
|
@@ -128,45 +131,69 @@ jobs: | |
| PLUGIN_E2E_MOCK_OAUTH_SERVER_URL: http://172.17.0.1:8080 | ||
| E2E_TESTING: true | ||
|
|
||
| - name: ci/setup-node | ||
| # - name: ci/checkout-mattermost-monorepo | ||
| # uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | ||
| # with: | ||
| # path: ../mattermost | ||
| # repository: mattermost/mattermost | ||
|
|
||
| - name: ci/checkout-mattermost-monorepo | ||
| run: | | ||
| git clone https://github.com/mattermost/mattermost.git ../mattermost | ||
|
Comment on lines
+140
to
+142
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if the version should be opt-in here. Otherwise changes on
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @hanzei This is intentional to have it always use master, though I think we could have two workflows if we also want a pinned version, like we did with the Apps plugin.
The main thing that was breaking things in the plugin e2e tests related to the monorepo where the Playwright helpers that the e2e tests were using, like If the plugin e2e test fails because a behavior change in the webapp's functionality, I think we would want to see the test failure to see if it's something we need to address. If this does cause an issue, we'll handle it on a case-by-case basis. To solve the issue of the helpers changing paths etc., the plan is to have these helpers intended to be used by plugin e2e tests defined in a separate repo, currently housed at mattermost-community/mattermost-plugin-e2e-test-utils#1
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
👍 for using the same pattern as the Apps plugin (Release on PR, master on master) |
||
|
|
||
| - name: ci/setup-node-for-mattermost-monorepo | ||
| uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 | ||
| with: | ||
| node-version: "16" | ||
| cache: "npm" | ||
| cache-dependency-path: e2e/playwright/package-lock.json | ||
| node-version-file: "../mattermost/.nvmrc" | ||
|
|
||
| - name: ci/install-mattermost-monorepo-webapp-deps | ||
| run: | | ||
| cd ../mattermost/webapp | ||
| npm i | ||
|
|
||
| - name: ci/install-tests-deps | ||
| - name: ci/install-mattermost-monorepo-playwright-deps | ||
| run: | | ||
| cd e2e/playwright | ||
| ./setup-environment | ||
| cd ../mattermost/e2e-tests/playwright | ||
| npm i | ||
| npx playwright install --with-deps | ||
|
|
||
| - name: ci/setup-node-for-mattermost-plugin | ||
| uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 | ||
| with: | ||
| node-version-file: ".nvmrc" | ||
|
|
||
| - name: ci/install-plugin-playwright-deps | ||
| run: | | ||
| cd e2e/playwright/mattermost-plugin-e2e-test-utils | ||
| npm i | ||
|
|
||
| - name: ci/tsc | ||
| run: | | ||
| cd e2e/playwright | ||
| cd e2e/playwright/mattermost-plugin-e2e-test-utils | ||
| npm run tsc | ||
|
|
||
| - name: ci/lint | ||
| run: | | ||
| cd e2e/playwright | ||
| npm run lint | ||
| # - name: ci/lint | ||
| # run: | | ||
| # cd e2e/playwright | ||
| # npm run lint | ||
|
|
||
| - name: ci/run-playwright-tests | ||
| run: | | ||
| cd e2e/playwright | ||
| cd e2e/playwright/mattermost-plugin-e2e-test-utils | ||
| npm run test-ci | ||
| env: | ||
| PLUGIN_E2E_MOCK_OAUTH_TOKEN: ${{ secrets.MM_GITHUB_PLUGIN_E2E_TOKEN }} | ||
| PLUGIN_E2E_MOCK_OAUTH_TOKEN: faketoken | ||
| PW_BASE_URL: ${{ env.MM_SERVICESETTINGS_SITEURL }} | ||
|
|
||
| - name: ci/move-artifacts | ||
| if: success() || failure() | ||
| run: | | ||
| cd e2e/playwright | ||
| cd e2e/playwright/mattermost-plugin-e2e-test-utils | ||
| mkdir results | ||
| mv playwright-report results | ||
|
|
||
| - uses: actions/upload-artifact@v3 | ||
| if: success() || failure() | ||
| with: | ||
| name: test-results | ||
| path: e2e/playwright/results | ||
| path: e2e/playwright/mattermost-plugin-e2e-test-utils/results | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 14.21.1 | ||
| 16.13.1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ import { | |
| getBotTagFromPost, | ||
| getPostAuthor, | ||
| } from '../../support/components/post'; | ||
| import {postMessage} from '../../mattermost-plugin-e2e-test-utils/support/utils'; | ||
|
|
||
| const mmGithubHandle = 'MM-Github-Plugin'; | ||
|
|
||
|
|
@@ -32,14 +33,14 @@ export default { | |
| const c = new pages.ChannelsPage(page); | ||
|
|
||
| // # Run comand | ||
| await c.postMessage('/github me'); | ||
| await c.sendMessage(); | ||
| await postMessage('/github me', page); | ||
| // await c.sendMessage(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove? |
||
|
|
||
| // # Wait for new messages to ensure the last post is the one we want | ||
| await waitForNewMessages(page); | ||
|
|
||
| // # Get last post | ||
| const post = await c.getLastPost(); | ||
| const post = await c.centerView.getLastPost(); | ||
| const postId = await post.getId(); | ||
|
|
||
| // * Verify that message is sent by the github bot | ||
|
|
@@ -77,14 +78,14 @@ export default { | |
| const c = new pages.ChannelsPage(page); | ||
|
|
||
| // # Run comand | ||
| await c.postMessage('/github me'); | ||
| await c.sendMessage(); | ||
| await postMessage('/github me', page); | ||
| // await c.sendMessage(); | ||
|
|
||
| // # Wait for new messages to ensure the last post is the one we want | ||
| await waitForNewMessages(page); | ||
|
|
||
| // # Get last post | ||
| const post = await c.getLastPost(); | ||
| const post = await c.centerView.getLastPost(); | ||
| const postId = await post.getId(); | ||
|
|
||
| // * Verify that message is sent by the github bot | ||
|
|
@@ -116,14 +117,14 @@ export default { | |
| const c = new pages.ChannelsPage(page); | ||
|
|
||
| // # Run comand | ||
| await c.postMessage('/github me'); | ||
| await c.sendMessage(); | ||
| await postMessage('/github me', page); | ||
| // await c.sendMessage(); | ||
|
|
||
| // # Wait for new messages to ensure the last post is the one we want | ||
| await waitForNewMessages(page); | ||
|
|
||
| // # Get last post | ||
| const post = await c.getLastPost(); | ||
| const post = await c.centerView.getLastPost(); | ||
| const postId = await post.getId(); | ||
|
|
||
| // * Verify that message is sent by the github bot | ||
|
|
||
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.
Why did this get removed?