-
Notifications
You must be signed in to change notification settings - Fork 64
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
test(e2e, playwright): added playwright e2e tests for /todo add, list and help commands #254
base: master
Are you sure you want to change the base?
test(e2e, playwright): added playwright e2e tests for /todo add, list and help commands #254
Conversation
…sh-git/mattermost-plugin-todo into feat/todo-e2e-basic-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.
Thanks for addressing the concerns on the other PRs @rahulsuresh-git 👍
This is looking good, just a few comments for discussion
@@ -1,8 +1,19 @@ | |||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | |||
// See LICENSE.txt for license information. | |||
|
|||
import core from './todo_plugin.spec'; | |||
import {test} from "@e2e-support/test_fixture"; |
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 keep the styling of things as single quotes. I wonder why CI linting didn't catch these changes
}; | ||
|
||
export const getBotDMPageURL = async (teamName: string, botUsername: string) => { | ||
return `${teamName}/messages/${botUsername}`; |
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 think we need the @
symbol here right? Interesting how things are passing without this
return `${teamName}/messages/${botUsername}`; | |
return `${teamName}/messages/@${botUsername}`; |
postMessage, | ||
} from "support/utils"; | ||
|
||
const botUserName = "todo"; | ||
let teamName = ""; | ||
|
||
test.beforeAll(async ({ pw }) => { | ||
const { adminClient, adminUser } = await pw.getAdminClient(); | ||
if (adminUser === null) { |
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.
There's inconsistent indentation in this file. Another thing the linter should be noticing. I'm thinking we should converge on 4 spaces for indenting
await expect(post).toContainText(todoMessage); | ||
|
||
// * Assert added todo is visible | ||
await expect(post).toContainText(todoMessage); |
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.
These two lines are duplicated
await expect(post).toContainText(todoMessage); | ||
|
||
await expect(slash.getItemDescNth(0)).toHaveText('Available commands: list, add, pop, send, settings, help'); | ||
}); | ||
}); | ||
}, | ||
// * Assert added todo is visible | ||
await expect(post).toContainText(todoMessage); |
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.
Same here, two lines are duplicated
|
||
test.beforeEach(async ({ page }) => { | ||
const dmURL = await getBotDMPageURL(teamName, botUserName); | ||
await page.goto(dmURL, { waitUntil: "load" }); |
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'm thinking we should clear the bot DMs before each test, since we're using the same channel for each test. We can use the function defined here for this:
export const cleanUpBotDMs = async (client: Client4, userId: UserProfile['id'], botUsername: string) => { |
The following PRs have been combined into this single PR.
All comments in the original PRs are addressed here.