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
mickmister
left a comment
There was a problem hiding this comment.
Thanks for addressing the concerns on the other PRs @rahulsuresh-git 👍
This is looking good, just a few comments for discussion
| // 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.
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.
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.
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.
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.
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.
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:
The following PRs have been combined into this single PR.
All comments in the original PRs are addressed here.