MM-63669 E2E/Playwright: Move "e2e-tests/playwright/test" to "e2e-tests/playwright" folder (#30647)
* move "e2e-tests/playwright/test" to "e2e-tests/playwright/test" and expose "ensurePluginsLoaded" * add test setup, and expose ensurePluginsLoaded and ensureServerDeployment to pw
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
62753a1481
Коммит
a35a6d7a3a
@@ -0,0 +1,55 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {expect, test} from '@mattermost/playwright-lib';
|
||||
|
||||
test('MM-T5424 Find channel search returns only 50 results when there are more than 50 channels with similar names', async ({
|
||||
pw,
|
||||
}) => {
|
||||
const {adminClient, user, team} = await pw.initSetup();
|
||||
|
||||
const commonName = 'test_channel';
|
||||
|
||||
// # Create more than 50 channels with similar names
|
||||
const channelsRes = [];
|
||||
for (let i = 0; i < 100; i++) {
|
||||
let suffix = i.toString();
|
||||
if (i < 10) {
|
||||
suffix = `0${i}`;
|
||||
}
|
||||
const channel = pw.random.channel({
|
||||
teamId: team.id,
|
||||
name: `${commonName}_${suffix}`,
|
||||
displayName: `Test Channel ${suffix}`,
|
||||
});
|
||||
channelsRes.push(adminClient.createChannel(channel));
|
||||
}
|
||||
await Promise.all(channelsRes);
|
||||
|
||||
// # Log in a user in new browser context
|
||||
const {channelsPage} = await pw.testBrowser.login(user);
|
||||
|
||||
// # Visit a default channel page
|
||||
await channelsPage.goto();
|
||||
await channelsPage.toBeVisible();
|
||||
|
||||
// # Click on "Find channel" and type "test_channel"
|
||||
await channelsPage.sidebarLeft.findChannelButton.click();
|
||||
|
||||
await channelsPage.findChannelsModal.toBeVisible();
|
||||
await channelsPage.findChannelsModal.input.fill(commonName);
|
||||
|
||||
const limitCount = 50;
|
||||
|
||||
// # Only 50 results for similar name should be displayed.
|
||||
await expect(channelsPage.findChannelsModal.searchList).toHaveCount(limitCount);
|
||||
|
||||
for (let i = 0; i < limitCount; i++) {
|
||||
let suffix = i.toString();
|
||||
if (i < 10) {
|
||||
suffix = `0${i}`;
|
||||
}
|
||||
|
||||
await expect(channelsPage.findChannelsModal.container.getByTestId(`${commonName}_${suffix}`)).toBeVisible();
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,59 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {expect, test} from '@mattermost/playwright-lib';
|
||||
|
||||
test('Search box suggestion must be case insensitive', async ({pw}) => {
|
||||
const {user} = await pw.initSetup();
|
||||
|
||||
// # Log in a user in new browser context
|
||||
const {channelsPage} = await pw.testBrowser.login(user);
|
||||
|
||||
// # Visit a default channel page
|
||||
await channelsPage.goto();
|
||||
await channelsPage.toBeVisible();
|
||||
|
||||
// # Open the search UI
|
||||
await channelsPage.globalHeader.openSearch();
|
||||
|
||||
const searchWord = 'off';
|
||||
const searchOutput = 'In:off-topic';
|
||||
const channelName = 'Off-Topic';
|
||||
|
||||
// Should work as expected when using lowercase
|
||||
// # Type in lowercase "off" to search for the "Off-Topic" channel
|
||||
const {searchInput} = channelsPage.searchPopover;
|
||||
await searchInput.pressSequentially(`In:${searchWord}`);
|
||||
|
||||
// * The suggestion should be visible
|
||||
await expect(channelsPage.searchPopover.selectedSuggestion).toBeVisible();
|
||||
await expect(channelsPage.searchPopover.selectedSuggestion).toHaveText(channelName);
|
||||
|
||||
// # Press Enter to select the suggestion and another Enter to search
|
||||
await searchInput.press('Enter');
|
||||
await searchInput.press('Enter');
|
||||
|
||||
// * The search box should contain the selected suggestion
|
||||
await expect(channelsPage.globalHeader.searchBox.getByText(searchOutput, {exact: true})).toBeVisible();
|
||||
|
||||
// Should work as expected when using uppercase
|
||||
// # Open the search bar
|
||||
await channelsPage.globalHeader.openSearch();
|
||||
|
||||
// # Clear its content
|
||||
await channelsPage.searchPopover.clearIfPossible();
|
||||
|
||||
// # Type in uppercase "OFF" to search for the "Off-Topic" channel
|
||||
await searchInput.pressSequentially(`In:${searchWord.toUpperCase()}`);
|
||||
|
||||
// * The suggestion should be visible
|
||||
await expect(channelsPage.searchPopover.selectedSuggestion).toBeVisible();
|
||||
await expect(channelsPage.searchPopover.selectedSuggestion).toHaveText(channelName);
|
||||
|
||||
// # Press Enter to select the suggestion and another Enter to search
|
||||
await searchInput.press('Enter');
|
||||
await searchInput.press('Enter');
|
||||
|
||||
// * The search box should contain the selected suggestion
|
||||
await expect(channelsPage.globalHeader.searchBox.getByText(searchOutput, {exact: true})).toBeVisible();
|
||||
});
|
||||
@@ -0,0 +1,89 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {expect, test} from '@mattermost/playwright-lib';
|
||||
|
||||
test('team selector must show all my teams', async ({pw}) => {
|
||||
const {adminClient, user, team} = await pw.initSetup();
|
||||
|
||||
// # create 2 more teams and add the user to them
|
||||
const teams = [team];
|
||||
for (let i = 0; i < 2; i++) {
|
||||
const newTeam = await adminClient.createTeam(pw.random.team('team', 'Team', 'O', true));
|
||||
await adminClient.addUsersToTeam(newTeam.id, [user.id]);
|
||||
teams.push(newTeam);
|
||||
}
|
||||
|
||||
// # Log in a user in new browser context
|
||||
const {channelsPage} = await pw.testBrowser.login(user);
|
||||
|
||||
// # Visit a default channel page
|
||||
await channelsPage.goto(team.name);
|
||||
await channelsPage.toBeVisible();
|
||||
|
||||
// # Open the search UI
|
||||
await channelsPage.globalHeader.openSearch();
|
||||
|
||||
// * Check that the team selector is visible
|
||||
const page = channelsPage.page;
|
||||
await expect(page.getByTestId('searchTeamsSelectorMenuButton')).toBeVisible();
|
||||
|
||||
// # Click on the team selector
|
||||
await page.getByTestId('searchTeamsSelectorMenuButton').click();
|
||||
|
||||
// * Check that the team selector is visible
|
||||
const teamSelector = page.getByRole('menu', {name: 'Select team'});
|
||||
await expect(teamSelector).toBeVisible();
|
||||
// * Check that the team selector has the 3 teams
|
||||
teams.forEach(async (t) => {
|
||||
await expect(teamSelector.getByText(t.display_name)).toBeVisible();
|
||||
});
|
||||
// * Check that All teams is also visible
|
||||
await expect(teamSelector.getByText('All teams')).toBeVisible();
|
||||
// * No <input> should be visible in the menu
|
||||
await expect(teamSelector.getByLabel('Search teams')).not.toBeVisible();
|
||||
|
||||
// now create and join 3 more teams
|
||||
for (let i = 0; i < 3; i++) {
|
||||
const newTeam = await adminClient.createTeam(pw.random.team('team', 'Team', 'O', true));
|
||||
await adminClient.addUsersToTeam(newTeam.id, [user.id]);
|
||||
teams.push(newTeam);
|
||||
}
|
||||
|
||||
// refresh the page
|
||||
await channelsPage.goto(team.name);
|
||||
|
||||
// # Open the search UI
|
||||
await channelsPage.globalHeader.openSearch();
|
||||
|
||||
// # Click on the team selector
|
||||
await page.getByTestId('searchTeamsSelectorMenuButton').click();
|
||||
|
||||
// * Check that the team selector is visible
|
||||
await expect(teamSelector).toBeVisible();
|
||||
// * Check that the team selector has the 6 teams
|
||||
teams.forEach(async (t) => {
|
||||
await expect(teamSelector.getByText(t.display_name)).toBeVisible();
|
||||
});
|
||||
// * Check that All teams is also visible
|
||||
await expect(teamSelector.getByText('All teams')).toBeVisible();
|
||||
|
||||
// because there's more than 4 teams, the filter input should be visible
|
||||
await expect(teamSelector.getByLabel('Search teams')).toBeVisible();
|
||||
|
||||
// # Type the name of the first team
|
||||
await page.getByLabel('Search teams').fill(teams[3].display_name);
|
||||
|
||||
// * Check that the team selector is visible
|
||||
await expect(teamSelector).toBeVisible();
|
||||
|
||||
// * Noew team [0] and [3] should be visible - 0 is visible because it was currently selected.
|
||||
await expect(teamSelector.getByText(teams[0].display_name)).toBeVisible();
|
||||
await expect(teamSelector.getByText(teams[3].display_name)).toBeVisible();
|
||||
// * Check that All teams is also visible
|
||||
await expect(teamSelector.getByText('All teams')).toBeVisible();
|
||||
// * Check that the other teams are not visible
|
||||
teams.slice(1, 3).forEach(async (t) => {
|
||||
await expect(teamSelector.getByText(t.display_name)).not.toBeVisible();
|
||||
});
|
||||
});
|
||||
Ссылка в новой задаче
Block a user