upgrade playwright dependencies, screenshots and tests (#29466)

Этот коммит содержится в:
Saturnino Abril
2024-12-04 19:52:18 +08:00
коммит произвёл GitHub
родитель 43d589be79
Коммит 90c0235c4b
37 изменённых файлов: 1333 добавлений и 1260 удалений

Просмотреть файл

@@ -64,7 +64,6 @@ export async function requestTrialLicense() {
users: 100,
});
} catch (error) {
// eslint-disable-next-line no-console
expect(error, 'Failed to request trial license').toBeFalsy();
throw error;
}

Просмотреть файл

@@ -81,7 +81,7 @@ const onPremServerConfig = (): Partial<TestAdminConfig> => {
};
// Should be based only from the generated default config from ./server via "make config-reset"
// Based on v10.2 server
// Based on v10.3 server
const defaultServerConfig: AdminConfig = {
ServiceSettings: {
SiteURL: '',
@@ -198,6 +198,7 @@ const defaultServerConfig: AdminConfig = {
RefreshPostStatsRunTime: '00:00',
MaximumPayloadSizeBytes: 300000,
MaximumURLLength: 2048,
ScheduledPosts: true,
},
TeamSettings: {
SiteName: 'Mattermost',
@@ -685,6 +686,9 @@ const defaultServerConfig: AdminConfig = {
'com.mattermost.nps': {
Enable: true,
},
'mattermost-ai': {
Enable: true,
},
playbooks: {
Enable: true,
},
@@ -724,6 +728,7 @@ const defaultServerConfig: AdminConfig = {
TestFeature: 'off',
TestBoolFeature: false,
EnableRemoteClusterService: false,
EnableSharedChannelsDMs: false,
AppsEnabled: false,
PermalinkPreviews: false,
NormalizeLdapDNs: false,
@@ -741,6 +746,7 @@ const defaultServerConfig: AdminConfig = {
WebSocketEventScope: true,
NotificationMonitoring: true,
ExperimentalAuditSettingsSystemConsoleUI: false,
ExperimentalCrossTeamSearch: false,
},
ImportSettings: {
Directory: './import',

Просмотреть файл

@@ -0,0 +1,36 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {expect, Locator} from '@playwright/test';
export default class SearchPopover {
readonly container: Locator;
readonly messagesButton;
readonly filesButton;
readonly searchInput;
readonly searchBoxClose;
readonly selectedSuggestion;
readonly searchHints;
constructor(container: Locator) {
this.container = container;
this.messagesButton = container.getByRole('button', {name: 'Messages'});
this.filesButton = container.getByRole('button', {name: 'Files'});
this.searchInput = container.getByLabel('Search messages');
this.searchBoxClose = container.getByTestId('searchBoxClose');
this.selectedSuggestion = container.locator('.suggestion--selected').locator('.suggestion-list__main');
this.searchHints = container.locator('#searchHints');
}
async toBeVisible() {
await expect(this.container).toBeVisible();
}
getSelectedSuggestion() {
return this.searchHints.locator('.suggestion--selected');
}
}
export {SearchPopover};

Просмотреть файл

@@ -43,6 +43,11 @@ export default class GlobalHeader {
await expect(this.searchBox).toBeVisible();
await this.searchBox.click();
}
async closeSearch() {
await expect(this.searchBox).toBeVisible();
await this.searchBox.getByTestId('input-clear').click();
}
}
export {GlobalHeader};

Просмотреть файл

@@ -13,6 +13,7 @@ import {FindChannelsModal} from './channels/find_channels_modal';
import {SettingsModal} from './channels/settings/settings_modal';
import {Footer} from './footer';
import {GlobalHeader} from './global_header';
import {SearchPopover} from './channels/search_popover';
import {MainHeader} from './main_header';
import {PostDotMenu} from './channels/post_dot_menu';
import {PostReminderMenu} from './channels/post_reminder_menu';
@@ -33,6 +34,7 @@ import {SystemUsersColumnToggleMenu} from './system_console/sections/system_user
const components = {
GlobalHeader,
SearchPopover,
ChannelsCenterView,
ChannelsSidebarLeft,
ChannelsSidebarRight,

Просмотреть файл

@@ -11,6 +11,7 @@ export default class ChannelsPage {
readonly page: Page;
readonly globalHeader;
readonly searchPopover;
readonly centerView;
readonly scheduledDraftDropdown;
readonly scheduledDraftModal;
@@ -33,6 +34,7 @@ export default class ChannelsPage {
// The main areas of the app
this.globalHeader = new components.GlobalHeader(page.locator('#global-header'));
this.searchPopover = new components.SearchPopover(page.locator('#searchPopover'));
this.centerView = new components.ChannelsCenterView(page.getByTestId('channel_view'));
this.sidebarLeft = new components.ChannelsSidebarLeft(page.locator('#SidebarContainer'));
this.sidebarRight = new components.ChannelsSidebarRight(page.locator('#sidebar-right'));

Просмотреть файл

@@ -31,7 +31,7 @@ export async function matchSnapshot(testInfo: TestInfo, testArgs: TestArgs, opti
if (testConfig.snapshotEnabled) {
// Visual test with built-in snapshot
const filename = testInfo.title.replace(illegalRe, '').replace(/\s/g, '-').trim().toLowerCase();
const filename = testInfo.title.trim().replace(illegalRe, '').replace(/\s/g, '-').trim().toLowerCase();
await expect(testArgs.page).toHaveScreenshot(`${filename}.png`, {fullPage: true, ...options});
}