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

test(e2e, playwright): added playwright e2e tests for /todo add, list and help commands #254

Open
wants to merge 24 commits into
base: master
Choose a base branch
from

Conversation

rahulsuresh-git
Copy link
Contributor

@rahulsuresh-git rahulsuresh-git commented May 19, 2024

Copy link
Contributor

@mickmister mickmister left a 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";
Copy link
Contributor

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}`;
Copy link
Contributor

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

Suggested change
return `${teamName}/messages/${botUsername}`;
return `${teamName}/messages/@${botUsername}`;

Comment on lines +16 to +24
postMessage,
} from "support/utils";

const botUserName = "todo";
let teamName = "";

test.beforeAll(async ({ pw }) => {
const { adminClient, adminUser } = await pw.getAdminClient();
if (adminUser === null) {
Copy link
Contributor

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

Comment on lines +90 to +93
await expect(post).toContainText(todoMessage);

// * Assert added todo is visible
await expect(post).toContainText(todoMessage);
Copy link
Contributor

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

Comment on lines +113 to +116
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);
Copy link
Contributor

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" });
Copy link
Contributor

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) => {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants