Move all E2E dependencies into its own folder, run from there (#3068)
* Move all E2E dependencies into its own folder, run from there * Run flaky-tests from E2E folder * This should work better * Fix E2E test for Linux * Fix for Windows, fix lint
This commit is contained in:
11
e2e/babel.config.js
Normal file
11
e2e/babel.config.js
Normal file
@@ -0,0 +1,11 @@
|
||||
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
module.exports = (api) => {
|
||||
api.cache.forever();
|
||||
return {
|
||||
presets: [
|
||||
'@babel/typescript',
|
||||
],
|
||||
};
|
||||
};
|
@@ -11,10 +11,9 @@ const chai = require('chai');
|
||||
const {ipcRenderer} = require('electron');
|
||||
const {_electron: electron} = require('playwright');
|
||||
const ps = require('ps-node');
|
||||
const {SHOW_SETTINGS_WINDOW} = require('src/common/communication');
|
||||
|
||||
const {asyncSleep, mkDirAsync, rmDirAsync, unlinkAsync} = require('./utils');
|
||||
|
||||
const {SHOW_SETTINGS_WINDOW} = require('../../src/common/communication');
|
||||
chai.should();
|
||||
|
||||
const sourceRootDir = path.join(__dirname, '../..');
|
||||
@@ -218,7 +217,7 @@ module.exports = {
|
||||
RESOURCES_PATH: userDataDir,
|
||||
},
|
||||
executablePath: electronBinaryPath,
|
||||
args: [`${path.join(sourceRootDir, 'dist')}`, `--user-data-dir=${userDataDir}`, '--disable-dev-mode', '--no-sandbox', ...args],
|
||||
args: [`${path.join(sourceRootDir, 'e2e/dist')}`, `--user-data-dir=${userDataDir}`, '--disable-dev-mode', '--no-sandbox', ...args],
|
||||
};
|
||||
|
||||
// if (process.env.MM_DEBUG_SETTINGS) {
|
||||
|
4725
e2e/package-lock.json
generated
Normal file
4725
e2e/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
39
e2e/package.json
Normal file
39
e2e/package.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "desktop-e2e",
|
||||
"version": "1.0.0",
|
||||
"description": "E2E tests for the Desktop App",
|
||||
"main": "dist/e2e_bundle.js",
|
||||
"scripts": {
|
||||
"clean": "rm -rf dist/ mochawesome-report/ node_modules/ testUserData/",
|
||||
"run": "npm run build && npm run test",
|
||||
"build": "webpack-cli --config webpack.config.js",
|
||||
"build:performance": "webpack-cli --config webpack.config.performance.js",
|
||||
"test": "electron-mocha --reporter mochawesome dist/e2e_bundle.js",
|
||||
"test:performance": "electron-mocha --reporter json --reporter-option output=./performance/perf-test-report.json dist/e2e_bundle.js",
|
||||
"send-report": "node ./save_report.js",
|
||||
"postinstall": "cross-env CL='/std:c++17' electron-rebuild -m ./node_modules/robotjs"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/mattermost/desktop.git"
|
||||
},
|
||||
"author": "Mattermost, Inc. <feedback@mattermost.com>",
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/mattermost/desktop/issues"
|
||||
},
|
||||
"homepage": "https://github.com/mattermost/desktop#readme",
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-s3": "3.445.0",
|
||||
"@aws-sdk/lib-storage": "3.445.0",
|
||||
"@electron/rebuild": "3.6.0",
|
||||
"axios": "1.6.7",
|
||||
"chai": "4.3.6",
|
||||
"electron-mocha": "12.2.0",
|
||||
"mochawesome": "7.1.3",
|
||||
"playwright": "1.42.0",
|
||||
"ps-node": "0.1.6",
|
||||
"recursive-readdir": "2.2.3",
|
||||
"robotjs": "0.6.0"
|
||||
}
|
||||
}
|
@@ -5,8 +5,8 @@
|
||||
const fs = require('fs');
|
||||
|
||||
const robot = require('robotjs');
|
||||
const {SHOW_SETTINGS_WINDOW} = require('src/common/communication');
|
||||
|
||||
const {SHOW_SETTINGS_WINDOW} = require('../../src/common/communication');
|
||||
const env = require('../modules/environment');
|
||||
const {asyncSleep} = require('../modules/utils');
|
||||
|
||||
|
@@ -5,6 +5,7 @@
|
||||
const fs = require('fs');
|
||||
|
||||
const {clipboard} = require('electron');
|
||||
const robot = require('robotjs');
|
||||
|
||||
const env = require('../../modules/environment');
|
||||
const {asyncSleep} = require('../../modules/utils');
|
||||
@@ -38,7 +39,17 @@ describe('copylink', function desc() {
|
||||
await env.loginToMattermost(firstServer);
|
||||
await firstServer.waitForSelector('#sidebarItem_town-square');
|
||||
await firstServer.click('#sidebarItem_town-square', {button: 'right'});
|
||||
await firstServer.click('li.SidebarChannel.expanded.active > span > nav > div');
|
||||
switch (process.platform) {
|
||||
case 'linux':
|
||||
case 'win32':
|
||||
robot.keyTap('down');
|
||||
robot.keyTap('down');
|
||||
break;
|
||||
case 'darwin':
|
||||
robot.keyTap('c');
|
||||
break;
|
||||
}
|
||||
robot.keyTap('enter');
|
||||
await firstServer.click('#sidebarItem_town-square');
|
||||
await firstServer.click('#post_textbox');
|
||||
const clipboardText = clipboard.readText();
|
||||
|
@@ -6,7 +6,8 @@
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
const {SHOW_SETTINGS_WINDOW} = require('../../src/common/communication');
|
||||
const {SHOW_SETTINGS_WINDOW} = require('src/common/communication');
|
||||
|
||||
const env = require('../modules/environment');
|
||||
const {asyncSleep} = require('../modules/utils');
|
||||
|
||||
|
@@ -6,8 +6,8 @@
|
||||
const fs = require('fs');
|
||||
|
||||
const robot = require('robotjs');
|
||||
const {SHOW_SETTINGS_WINDOW} = require('src/common/communication');
|
||||
|
||||
const {SHOW_SETTINGS_WINDOW} = require('../../../src/common/communication');
|
||||
const env = require('../../modules/environment');
|
||||
const {asyncSleep} = require('../../modules/utils');
|
||||
|
||||
|
@@ -58,7 +58,7 @@ describe('config', function desc() {
|
||||
});
|
||||
|
||||
it('MM-T4402 should upgrade v0 config file', async () => {
|
||||
const Config = require('../../../src/common/config').Config;
|
||||
const Config = require('src/common/config').Config;
|
||||
const newConfig = new Config(env.configFilePath);
|
||||
const oldConfig = {
|
||||
url: env.exampleURL,
|
||||
|
@@ -2,7 +2,7 @@
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
const MOCHAWESOME_REPORT_DIR = './mochawesome-report';
|
||||
const PERFORMANCE_REPORT_DIR = './e2e/performance';
|
||||
const PERFORMANCE_REPORT_DIR = './performance';
|
||||
|
||||
module.exports = {
|
||||
MOCHAWESOME_REPORT_DIR,
|
||||
|
56
e2e/webpack.config.js
Normal file
56
e2e/webpack.config.js
Normal file
@@ -0,0 +1,56 @@
|
||||
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
const path = require('path');
|
||||
|
||||
const glob = require('glob');
|
||||
const webpack = require('webpack');
|
||||
|
||||
module.exports = {
|
||||
mode: 'development',
|
||||
entry: {
|
||||
e2e: glob.sync('./specs/**/*.js'),
|
||||
},
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist/'),
|
||||
filename: '[name]_bundle.js',
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({__IS_MAC_APP_STORE__: false}),
|
||||
],
|
||||
externals: {
|
||||
electron: 'require("electron")',
|
||||
fs: 'require("fs")',
|
||||
ws: 'require("ws")',
|
||||
child_process: 'require("child_process")',
|
||||
dns: 'require("dns")',
|
||||
http2: 'require("http2")',
|
||||
net: 'require("net")',
|
||||
repl: 'require("repl")',
|
||||
tls: 'require("tls")',
|
||||
playwright: 'require("playwright")',
|
||||
robotjs: 'require("robotjs")',
|
||||
},
|
||||
module: {
|
||||
rules: [{
|
||||
test: /\.(js|ts)?$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'babel-loader',
|
||||
}],
|
||||
},
|
||||
node: {
|
||||
__filename: false,
|
||||
__dirname: false,
|
||||
},
|
||||
target: 'node',
|
||||
resolve: {
|
||||
modules: [
|
||||
'node_modules',
|
||||
'../src',
|
||||
],
|
||||
alias: {
|
||||
src: path.resolve(__dirname, '../src'),
|
||||
},
|
||||
extensions: ['.ts', '.js'],
|
||||
},
|
||||
};
|
13
e2e/webpack.config.performance.js
Normal file
13
e2e/webpack.config.performance.js
Normal file
@@ -0,0 +1,13 @@
|
||||
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
const glob = require('glob');
|
||||
const {merge} = require('webpack-merge');
|
||||
|
||||
const test = require('./webpack.config.test');
|
||||
|
||||
module.exports = merge(test, {
|
||||
entry: {
|
||||
e2e: glob.sync('./e2e/performance/**/*.test.js'),
|
||||
},
|
||||
});
|
Reference in New Issue
Block a user