[MM-39852] Setup docker image to run in CI for E2E (#1946)
* [MM-39852] Setup docker image to run in CI for E2E * Setup remote docker * Install docker * Trying this * And this * how about this * this * Okay this * dis one * sdfsagsdags * Now? * aaaaaaa * asdasdasd * i am dumb * blank * Please work * Lint fix * Forgot to update a couple things * OOPS * Testing something since this one is still failing * Trying robotjs instead * test * Remove stop docker * Try without the admin user (since apparently turning off admin notices didn't work) * Remove console statement Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
@@ -27,55 +27,59 @@ const electronBinaryPath = (() => {
|
||||
const userDataDir = path.join(sourceRootDir, 'e2e/testUserData/');
|
||||
const configFilePath = path.join(userDataDir, 'config.json');
|
||||
const boundsInfoPath = path.join(userDataDir, 'bounds-info.json');
|
||||
const mattermostURL = 'http://example.com/';
|
||||
const exampleURL = 'http://example.com/';
|
||||
const mattermostURL = 'http://localhost:8065/';
|
||||
|
||||
const exampleTeam = {
|
||||
name: 'example',
|
||||
url: exampleURL,
|
||||
order: 0,
|
||||
tabs: [
|
||||
{
|
||||
name: 'TAB_MESSAGING',
|
||||
order: 0,
|
||||
isOpen: true,
|
||||
},
|
||||
{
|
||||
name: 'TAB_FOCALBOARD',
|
||||
order: 1,
|
||||
isOpen: true,
|
||||
},
|
||||
{
|
||||
name: 'TAB_PLAYBOOKS',
|
||||
order: 2,
|
||||
isOpen: true,
|
||||
},
|
||||
],
|
||||
lastActiveTab: 0,
|
||||
};
|
||||
const githubTeam = {
|
||||
name: 'github',
|
||||
url: 'https://github.com/',
|
||||
order: 1,
|
||||
tabs: [
|
||||
{
|
||||
name: 'TAB_MESSAGING',
|
||||
order: 0,
|
||||
isOpen: true,
|
||||
},
|
||||
{
|
||||
name: 'TAB_FOCALBOARD',
|
||||
order: 1,
|
||||
isOpen: true,
|
||||
},
|
||||
{
|
||||
name: 'TAB_PLAYBOOKS',
|
||||
order: 2,
|
||||
isOpen: true,
|
||||
},
|
||||
],
|
||||
lastActiveTab: 0,
|
||||
};
|
||||
|
||||
const demoConfig = {
|
||||
version: 3,
|
||||
teams: [{
|
||||
name: 'example',
|
||||
url: mattermostURL,
|
||||
order: 0,
|
||||
tabs: [
|
||||
{
|
||||
name: 'TAB_MESSAGING',
|
||||
order: 0,
|
||||
isOpen: true,
|
||||
},
|
||||
{
|
||||
name: 'TAB_FOCALBOARD',
|
||||
order: 1,
|
||||
isOpen: true,
|
||||
},
|
||||
{
|
||||
name: 'TAB_PLAYBOOKS',
|
||||
order: 2,
|
||||
isOpen: true,
|
||||
},
|
||||
],
|
||||
lastActiveTab: 0,
|
||||
}, {
|
||||
name: 'github',
|
||||
url: 'https://github.com/',
|
||||
order: 1,
|
||||
tabs: [
|
||||
{
|
||||
name: 'TAB_MESSAGING',
|
||||
order: 0,
|
||||
isOpen: true,
|
||||
},
|
||||
{
|
||||
name: 'TAB_FOCALBOARD',
|
||||
order: 1,
|
||||
isOpen: true,
|
||||
},
|
||||
{
|
||||
name: 'TAB_PLAYBOOKS',
|
||||
order: 2,
|
||||
isOpen: true,
|
||||
},
|
||||
],
|
||||
lastActiveTab: 0,
|
||||
}],
|
||||
teams: [exampleTeam, githubTeam],
|
||||
showTrayIcon: false,
|
||||
trayIconTheme: 'light',
|
||||
minimizeToTray: false,
|
||||
@@ -93,13 +97,23 @@ const demoConfig = {
|
||||
spellCheckerLocales: [],
|
||||
};
|
||||
|
||||
const demoMattermostConfig = {
|
||||
...demoConfig,
|
||||
teams: [{
|
||||
...exampleTeam,
|
||||
url: mattermostURL,
|
||||
}, githubTeam],
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
sourceRootDir,
|
||||
configFilePath,
|
||||
userDataDir,
|
||||
boundsInfoPath,
|
||||
exampleURL,
|
||||
mattermostURL,
|
||||
demoConfig,
|
||||
demoMattermostConfig,
|
||||
|
||||
cleanTestConfig() {
|
||||
[configFilePath, boundsInfoPath].forEach((file) => {
|
||||
@@ -171,6 +185,15 @@ module.exports = {
|
||||
return map;
|
||||
},
|
||||
|
||||
async loginToMattermost(window) {
|
||||
await window.waitForSelector('#loginId');
|
||||
await window.waitForSelector('#loginPassword');
|
||||
await window.waitForSelector('#loginButton');
|
||||
await window.type('#loginId', 'user-1');
|
||||
await window.type('#loginPassword', 'SampleUs@r-1');
|
||||
await window.click('#loginButton');
|
||||
},
|
||||
|
||||
addClientCommands(client) {
|
||||
client.addCommand('loadSettingsPage', function async() {
|
||||
ipcRenderer.send(SHOW_SETTINGS_WINDOW);
|
||||
|
@@ -71,7 +71,7 @@ describe('menu_bar/dropdown', function desc() {
|
||||
const mainWindow = await this.app.firstWindow();
|
||||
const browserWindow = await this.app.browserWindow(mainWindow);
|
||||
|
||||
let firstViewIsAttached = await browserWindow.evaluate((window, url) => Boolean(window.getBrowserViews().find((view) => view.webContents.getURL() === url)), env.mattermostURL);
|
||||
let firstViewIsAttached = await browserWindow.evaluate((window, url) => Boolean(window.getBrowserViews().find((view) => view.webContents.getURL() === url)), env.exampleURL);
|
||||
firstViewIsAttached.should.be.true;
|
||||
let secondViewIsAttached = await browserWindow.evaluate((window) => Boolean(window.getBrowserViews().find((view) => view.webContents.getURL() === 'https://github.com/')));
|
||||
secondViewIsAttached.should.be.false;
|
||||
@@ -81,7 +81,7 @@ describe('menu_bar/dropdown', function desc() {
|
||||
await mainView.click('.TeamDropdownButton');
|
||||
await dropdownView.click('.TeamDropdown button.TeamDropdown__button:nth-child(2)');
|
||||
|
||||
firstViewIsAttached = await browserWindow.evaluate((window, url) => Boolean(window.getBrowserViews().find((view) => view.webContents.getURL() === url)), env.mattermostURL);
|
||||
firstViewIsAttached = await browserWindow.evaluate((window, url) => Boolean(window.getBrowserViews().find((view) => view.webContents.getURL() === url)), env.exampleURL);
|
||||
firstViewIsAttached.should.be.false;
|
||||
secondViewIsAttached = await browserWindow.evaluate((window) => Boolean(window.getBrowserViews().find((view) => view.webContents.getURL() === 'https://github.com/')));
|
||||
secondViewIsAttached.should.be.true;
|
||||
|
@@ -23,7 +23,7 @@ async function setupPromise(window, id) {
|
||||
describe('mattermost', function desc() {
|
||||
this.timeout(30000);
|
||||
|
||||
const config = env.demoConfig;
|
||||
const config = env.demoMattermostConfig;
|
||||
|
||||
beforeEach(async () => {
|
||||
env.cleanDataDir();
|
||||
@@ -41,14 +41,14 @@ describe('mattermost', function desc() {
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: enable when we have a server to test against
|
||||
it.skip('MM-T813 Control+F should focus the search bar in Mattermost', async () => {
|
||||
it('MM-T813 Control+F should focus the search bar in Mattermost', async () => {
|
||||
const loadingScreen = this.app.windows().find((window) => window.url().includes('loadingScreen'));
|
||||
await loadingScreen.waitForSelector('.LoadingScreen', {state: 'hidden'});
|
||||
const firstServer = this.serverMap[`${config.teams[0].name}___TAB_MESSAGING`].win;
|
||||
await env.loginToMattermost(firstServer);
|
||||
await firstServer.waitForSelector('#searchBox');
|
||||
await firstServer.press('body', process.platform === 'darwin' ? 'Meta+F' : 'Control+F');
|
||||
robot.keyTap('f', [process.platform === 'darwin' ? 'command' : 'control']);
|
||||
await asyncSleep(500);
|
||||
const isFocused = await firstServer.$eval('#searchBox', (el) => el === document.activeElement);
|
||||
isFocused.should.be.true;
|
||||
const text = await firstServer.inputValue('#searchBox');
|
||||
|
@@ -47,7 +47,7 @@ describe('EditServerModal', function desc() {
|
||||
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
|
||||
savedConfig.teams.should.deep.contain({
|
||||
name: 'example',
|
||||
url: env.mattermostURL,
|
||||
url: env.exampleURL,
|
||||
order: 0,
|
||||
tabs: [
|
||||
{
|
||||
@@ -79,7 +79,7 @@ describe('EditServerModal', function desc() {
|
||||
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
|
||||
savedConfig.teams.should.deep.contain({
|
||||
name: 'example',
|
||||
url: env.mattermostURL,
|
||||
url: env.exampleURL,
|
||||
order: 0,
|
||||
tabs: [
|
||||
{
|
||||
@@ -119,7 +119,7 @@ describe('EditServerModal', function desc() {
|
||||
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
|
||||
savedConfig.teams.should.not.deep.contain({
|
||||
name: 'example',
|
||||
url: env.mattermostURL,
|
||||
url: env.exampleURL,
|
||||
order: 0,
|
||||
tabs: [
|
||||
{
|
||||
@@ -142,7 +142,7 @@ describe('EditServerModal', function desc() {
|
||||
});
|
||||
savedConfig.teams.should.deep.contain({
|
||||
name: 'NewTestTeam',
|
||||
url: env.mattermostURL,
|
||||
url: env.exampleURL,
|
||||
order: 0,
|
||||
tabs: [
|
||||
{
|
||||
@@ -175,7 +175,7 @@ describe('EditServerModal', function desc() {
|
||||
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
|
||||
savedConfig.teams.should.not.deep.contain({
|
||||
name: 'example',
|
||||
url: env.mattermostURL,
|
||||
url: env.exampleURL,
|
||||
order: 0,
|
||||
tabs: [
|
||||
{
|
||||
@@ -233,7 +233,7 @@ describe('EditServerModal', function desc() {
|
||||
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
|
||||
savedConfig.teams.should.not.deep.contain({
|
||||
name: 'example',
|
||||
url: env.mattermostURL,
|
||||
url: env.exampleURL,
|
||||
order: 0,
|
||||
tabs: [
|
||||
{
|
||||
|
@@ -70,7 +70,10 @@ describe('RemoveServerModal', function desc() {
|
||||
});
|
||||
|
||||
it('MM-T4390_4 should disappear on click background', async () => {
|
||||
await removeServerView.click('.modal', {position: {x: 20, y: 20}});
|
||||
// ignore any target closed error
|
||||
try {
|
||||
await removeServerView.click('.modal', {position: {x: 20, y: 20}});
|
||||
} catch {} // eslint-disable-line no-empty
|
||||
await asyncSleep(1000);
|
||||
const existing = Boolean(await this.app.windows().find((window) => window.url().includes('removeServer')));
|
||||
existing.should.be.false;
|
||||
|
@@ -41,6 +41,7 @@ describe('Settings', function desc() {
|
||||
predicate: (window) => window.url().includes('settings'),
|
||||
});
|
||||
await settingsWindow.waitForSelector('.settingsPage.container');
|
||||
await settingsWindow.waitForSelector('#inputAutoStart');
|
||||
const existing = await settingsWindow.isVisible('#inputAutoStart');
|
||||
existing.should.equal(expected);
|
||||
});
|
||||
@@ -56,6 +57,7 @@ describe('Settings', function desc() {
|
||||
predicate: (window) => window.url().includes('settings'),
|
||||
});
|
||||
await settingsWindow.waitForSelector('.settingsPage.container');
|
||||
await settingsWindow.waitForSelector('#inputShowTrayIcon');
|
||||
const existing = await settingsWindow.isVisible('#inputShowTrayIcon');
|
||||
existing.should.equal(expected);
|
||||
});
|
||||
|
@@ -60,7 +60,7 @@ describe('config', function desc() {
|
||||
const Config = require('../../../src/common/config').Config;
|
||||
const newConfig = new Config(env.configFilePath);
|
||||
const oldConfig = {
|
||||
url: env.mattermostURL,
|
||||
url: env.exampleURL,
|
||||
};
|
||||
fs.writeFileSync(env.configFilePath, JSON.stringify(oldConfig));
|
||||
this.app = await env.getApp();
|
||||
|
Reference in New Issue
Block a user