-
Notifications
You must be signed in to change notification settings - Fork 150
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
Playwright suite on CI + me/todo/autocomplete specs #666
Conversation
|
||
import type {Page} from '@playwright/test'; | ||
|
||
import {ChannelsPage} from '@e2e-support/ui/pages'; | ||
import {UserProfile} from '@mattermost/types/users'; | ||
import Client4 from '@mattermost/client/client4'; | ||
|
||
const SCREENSHOTS_DIR = path.join(__dirname, '../screenshots'); | ||
export const waitForNewMessages = async (page: Page) => { | ||
await page.waitForTimeout(1000); |
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.
the smart wait for New-messages does not work (yet) in CI for some tests.
I'll research more, but I see some value in having green e2e until then.
@@ -0,0 +1,18 @@ | |||
{ | |||
"extends": [ | |||
"../../webapp/.eslintrc.json" |
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 tried to extend from mattermost-server/e2e-tests/.eslintrc.json but has no rules at all, and missed most of the points I wanted to cover. That's why I extended from plugin/webapp/.eslintrc.json
"plugins": ["import"], | ||
"parser": "@typescript-eslint/parser", | ||
"rules": { | ||
"import/no-unresolved": "off", |
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.
this shouldn't be here but fails with custom imports mapped in tsconfig.json
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.
Does this cause other issues with linting? e.g. something that has to do with the type that was imported. This may be caught by the typescript compiler instead, though CI is not running checks with tsc
in the e2e
folder
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.
Is this a problem only in CI? If so, I think we'll need to clone the webapp repo during linting
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.
added tsc to CI
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.
tsc/lint are done after cloning webapp repo in setup-environment. It happened on CI and locally
@mickmister I'd want to finish and merge this before I go through your create-issue PR. The main reason is that I've changed the structure a lot. I'd be willing to adapt your PR after merging this one if you want. |
build/setup.mk
Outdated
# Ensure that go is installed. Note that this is independent of whether or not a server is being | ||
# built, since the build script itself uses go. | ||
ifeq ($(GO),) | ||
$(error "go is not available: see https://golang.org/doc/install") | ||
endif | ||
|
||
# Ensure that the build tools are compiled. Go's caching makes this quick. | ||
$(shell cd build/manifest && $(GO) build -o ../bin/manifest) | ||
$(shell cd build/manifest && $(GO) build -buildvcs=false $(GO_BUILD_FLAGS) -o ../bin/manifest) |
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.
@mickmister, this comes from your changes, is it needed? what's the goal?
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.
This was originally to have the workflow runner be able to build the plugin in a docker container. This can be removed as that's not how we're running the tests.
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.
LGTM 🎉
.github/workflows/playwright.yml
Outdated
@@ -78,6 +78,7 @@ jobs: | |||
MM_SERVICESETTINGS_SITEURL: http://localhost:8065 | |||
MM_PLUGINSETTINGS_AUTOMATICPREPACKAGEDPLUGINS: false | |||
MM_ANNOUNCEMENTSETTINGS_ADMINNOTICESENABLED: false | |||
MM_SERVICESETTINGS_ENABLEONBOARDINGFLOW: false |
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.
Note that moving this logic here could make the test fail on a local machine I think
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.
it was already handled in patchConfig, removed from here
"plugins": ["import"], | ||
"parser": "@typescript-eslint/parser", | ||
"rules": { | ||
"import/no-unresolved": "off", |
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.
Is this a problem only in CI? If so, I think we'll need to clone the webapp repo during linting
build/setup.mk
Outdated
# Ensure that go is installed. Note that this is independent of whether or not a server is being | ||
# built, since the build script itself uses go. | ||
ifeq ($(GO),) | ||
$(error "go is not available: see https://golang.org/doc/install") | ||
endif | ||
|
||
# Ensure that the build tools are compiled. Go's caching makes this quick. | ||
$(shell cd build/manifest && $(GO) build -o ../bin/manifest) | ||
$(shell cd build/manifest && $(GO) build -buildvcs=false $(GO_BUILD_FLAGS) -o ../bin/manifest) |
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.
This was originally to have the workflow runner be able to build the plugin in a docker container. This can be removed as that's not how we're running the tests.
@@ -24,5 +27,6 @@ const app = makeOAuthServer({ | |||
|
|||
const port = process.env.OAUTH_SERVER_PORT || 8080; | |||
app.listen(port, () => { | |||
// eslint-disable-next-line no-console |
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.
We can probably just get rid of this file. It's used to stand up the oauth server separate from the tests, but it's not ever used like that
// * Assert suggestions are visible | ||
await slash.toBeVisible(); |
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.
This reads weird without expect
being on the same line
Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>
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.
LGTM 🎉
|
||
export default { | ||
connected: () => { | ||
test.describe('/github me', () => { |
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.
Is this test dependent on any other test to be able to complete the pre-requisite steps of connecting their github account? I am sorry, but I am not seeing any references here.
EDIT: I see the sequence of tests defined in test.list.ts file. This might just be a little confusing if we dont see this file or read the code. Should we update somewhere in Playwright README that the tests are executed in the order defined in e2e/playwright/tests/test.list.ts
file (or) do you think this is not required and is a standard Playwright practice of writing E2E tests?
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.
unfortunately, tests are dependent and ran serially in a specific order specified in test.list.ts
in the future, we will explore better approaches to prepare the entire env for each test, due to the complexity, the first full iteration is like this.
await expect(todo.getDesc(GithubRHSCategory.OPEN_PR)).toHaveText('You have 1 open pull requests:'); | ||
await expect(todo.getDesc(GithubRHSCategory.ASSIGNMENTS)).toHaveText('You have 19 assignments:'); | ||
await expect(todo.getDesc(GithubRHSCategory.REVIEW_PR)).toHaveText('You have 1 pull requests awaiting your review:'); | ||
await expect(todo.getDesc(GithubRHSCategory.UNREAD)).toHaveText('You have 1 unread messages:'); |
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.
Should we have these numbers defined in a separate file, so its easy to edit in future (if these value changes due to any other situations) and ensure assertions passes, instead of requiring the test to be updated in multiple places? What do you think?
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.
💯 to that, I'll add that change in my tests for sidebar/coutners since I need to use them too.
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.
Thanks @trilopin. The tests and it's dependencies looks great overall. Just left a few minor comments.
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.
Approving the changes based on previous comments and discussions. LGTM 🎉
* master: Playwright suite on CI + me/todo/autocomplete specs (#666)
Summary
Key points:
Still 1/5 on the way tests are structured (unconnected/connected/nosetup map). A record would be nice in the future.
Ticket Link
Fixes https://mattermost.atlassian.net/browse/MM-51379
Fixes https://mattermost.atlassian.net/browse/MM-51368