test:MM-T1308 Check that external links dont open in the app (#1982)
This commit is contained in:

committed by
GitHub

parent
f7e2743b7e
commit
6682425587
46
e2e/specs/relative_url/relative_url.test.js
Normal file
46
e2e/specs/relative_url/relative_url.test.js
Normal file
@@ -0,0 +1,46 @@
|
||||
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
const {expect} = require('chai');
|
||||
|
||||
const env = require('../../modules/environment');
|
||||
const {asyncSleep} = require('../../modules/utils');
|
||||
|
||||
describe('copylink', function desc() {
|
||||
this.timeout(30000);
|
||||
|
||||
const config = env.demoMattermostConfig;
|
||||
|
||||
beforeEach(async () => {
|
||||
env.cleanDataDir();
|
||||
env.createTestUserDataDir();
|
||||
env.cleanTestConfig();
|
||||
fs.writeFileSync(env.configFilePath, JSON.stringify(config));
|
||||
await asyncSleep(1000);
|
||||
this.app = await env.getApp();
|
||||
this.serverMap = await env.getServerMap(this.app);
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
if (this.app) {
|
||||
await this.app.close();
|
||||
}
|
||||
});
|
||||
|
||||
it('MM-T1308 Check that external links dont open in the app', 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('#sidebarItem_suscipit-4');
|
||||
await firstServer.click('#sidebarItem_suscipit-4');
|
||||
await firstServer.click('#post_textbox');
|
||||
await firstServer.fill('#post_textbox', 'https://electronjs.org/apps/mattermost');
|
||||
await firstServer.press('#post_textbox', 'Enter');
|
||||
const newPageWindow = this.app.windows().find((window) => window.url().includes('apps/mattermost'));
|
||||
expect(newPageWindow === undefined);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user