Этот коммит содержится в:
Mario Vitale
2023-03-27 16:28:42 +02:00
родитель da7a6825ce
Коммит ba6b97fb62
1142 изменённых файлов: 44 добавлений и 44 удалений

30
e2e-tests/cypress/tests/support/client.js Обычный файл
Просмотреть файл

@@ -0,0 +1,30 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {getAdminAccount} from './env';
import {E2EClient} from './client-impl';
const clients = {};
async function makeClient({user = getAdminAccount(), useCache = true} = {}) {
const cacheKey = user.username + user.password;
if (useCache && clients[cacheKey] != null) {
return clients[cacheKey];
}
const client = new E2EClient();
const baseUrl = Cypress.config('baseUrl');
client.setUrl(baseUrl);
await client.login(user.username, user.password);
if (useCache) {
clients[cacheKey] = client;
}
return client;
}
Cypress.Commands.add('makeClient', makeClient);