E2E/Playwright: Upgrade playwright/dependencies and test server config (#26464)

* chore: upgrade playwright and test server config

* add post install script

* update config types

* fix visual test
Этот коммит содержится в:
Saturnino Abril
2024-03-19 08:09:25 +08:00
коммит произвёл GitHub
родитель 297135c5b4
Коммит 53471c7e8c
14 изменённых файлов: 705 добавлений и 502 удалений

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

@@ -136,7 +136,10 @@ export default class Client extends Client4 {
// Variable to hold cache
const clients: Record<string, ClientCache> = {};
async function makeClient(userRequest?: UserRequest, useCache = true): Promise<ClientCache> {
async function makeClient(
userRequest?: UserRequest,
opts: {useCache?: boolean; skipLog?: boolean} = {useCache: true, skipLog: false},
): Promise<ClientCache> {
const client = new Client();
client.setUrl(testConfig.baseURL);
@@ -146,22 +149,24 @@ async function makeClient(userRequest?: UserRequest, useCache = true): Promise<C
}
const cacheKey = userRequest.username + userRequest.password;
if (useCache && clients[cacheKey] != null) {
if (opts?.useCache && clients[cacheKey] != null) {
return clients[cacheKey];
}
const userProfile = await client.login(userRequest.username, userRequest.password);
const user = {...userProfile, password: userRequest.password};
if (useCache) {
if (opts?.useCache) {
clients[cacheKey] = {client, user};
}
return {client, user};
} catch (err) {
// log an error for debugging
// eslint-disable-next-line no-console
console.log('makeClient', err);
if (!opts?.skipLog) {
// log an error for debugging
// eslint-disable-next-line no-console
console.log('makeClient', err);
}
return {client, user: null};
}
}

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

@@ -75,7 +75,7 @@ const onPremServerConfig = (): Partial<TestAdminConfig> => {
};
// Should be based only from the generated default config from ./server via "make config-reset"
// Based on v9.5 server
// Based on v9.7 server
const defaultServerConfig: AdminConfig = {
ServiceSettings: {
SiteURL: '',
@@ -101,6 +101,7 @@ const defaultServerConfig: AdminConfig = {
EnableOAuthServiceProvider: true,
EnableIncomingWebhooks: true,
EnableOutgoingWebhooks: true,
EnableOutgoingOAuthConnections: false,
EnableCommands: true,
OutgoingIntegrationRequestsTimeout: 30,
EnablePostUsernameOverride: false,
@@ -700,6 +701,7 @@ const defaultServerConfig: AdminConfig = {
CWSURL: 'https://customers.mattermost.com',
CWSAPIURL: 'https://portal.internal.prod.cloud.mattermost.com',
CWSMock: false,
Disable: false,
},
FeatureFlags: {
TestFeature: 'off',
@@ -720,7 +722,8 @@ const defaultServerConfig: AdminConfig = {
CloudIPFiltering: false,
ConsumePostHook: false,
CloudAnnualRenewals: false,
OutgoingOAuthConnections: false,
CloudDedicatedExportUI: false,
WebSocketEventScope: false,
},
ImportSettings: {
Directory: './import',

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

@@ -92,11 +92,14 @@ export async function initSetup({
}
}
export async function getAdminClient() {
const {client: adminClient, user: adminUser} = await makeClient({
username: testConfig.adminUsername,
password: testConfig.adminPassword,
});
export async function getAdminClient(opts: {skipLog: boolean} = {skipLog: false}) {
const {client: adminClient, user: adminUser} = await makeClient(
{
username: testConfig.adminUsername,
password: testConfig.adminPassword,
},
opts,
);
return {adminClient, adminUser};
}