[MM-46535] Fix E2E tests for reporting purposes (#2236)
This commit is contained in:
@@ -11,38 +11,47 @@ const {asyncSleep} = require('../../modules/utils');
|
||||
describe('header', function desc() {
|
||||
this.timeout(30000);
|
||||
|
||||
beforeEach(async () => {
|
||||
env.createTestUserDataDir();
|
||||
env.cleanTestConfig();
|
||||
});
|
||||
describe('MM-T2637 Double-Clicking on the header should minimize/maximize the app', async () => {
|
||||
let header;
|
||||
let browserWindow;
|
||||
let initialBounds;
|
||||
|
||||
afterEach(async () => {
|
||||
if (this.app) {
|
||||
try {
|
||||
await this.app.close();
|
||||
// eslint-disable-next-line no-empty
|
||||
} catch (err) {}
|
||||
}
|
||||
await env.clearElectronInstances();
|
||||
});
|
||||
before(async () => {
|
||||
env.createTestUserDataDir();
|
||||
env.cleanTestConfig();
|
||||
initialBounds = {x: 0, y: 0, width: 800, height: 400, maximized: false};
|
||||
fs.writeFileSync(env.boundsInfoPath, JSON.stringify(initialBounds));
|
||||
this.app = await env.getApp();
|
||||
const mainWindow = await this.app.windows().find((window) => window.url().includes('index'));
|
||||
browserWindow = await this.app.browserWindow(mainWindow);
|
||||
header = await mainWindow.locator('div.topBar');
|
||||
});
|
||||
|
||||
it('MM-T2637 Double-Clicking on the header should minimize/maximize the app', async () => {
|
||||
const initialBounds = {x: 0, y: 0, width: 800, height: 400, maximized: false};
|
||||
fs.writeFileSync(env.boundsInfoPath, JSON.stringify(initialBounds));
|
||||
this.app = await env.getApp();
|
||||
const mainWindow = await this.app.windows().find((window) => window.url().includes('index'));
|
||||
const browserWindow = await this.app.browserWindow(mainWindow);
|
||||
const header = await mainWindow.locator('div.topBar');
|
||||
const headerBounds = await header.boundingBox();
|
||||
await header.dblclick({position: {x: headerBounds.width / 2, y: headerBounds.y / 2}});
|
||||
await asyncSleep(1000);
|
||||
const isMaximized = await browserWindow.evaluate((window) => window.isMaximized());
|
||||
isMaximized.should.be.equal(true);
|
||||
const maximizedHeaderBounds = await header.boundingBox();
|
||||
await header.dblclick({position: {x: maximizedHeaderBounds.width / 2, y: maximizedHeaderBounds.y / 2}});
|
||||
await asyncSleep(1000);
|
||||
const revertedBounds = await browserWindow.evaluate((window) => window.getContentBounds());
|
||||
revertedBounds.height.should.be.equal(initialBounds.height);
|
||||
revertedBounds.width.should.be.equal(initialBounds.width);
|
||||
after(async () => {
|
||||
if (this.app) {
|
||||
try {
|
||||
await this.app.close();
|
||||
// eslint-disable-next-line no-empty
|
||||
} catch (err) {}
|
||||
}
|
||||
await env.clearElectronInstances();
|
||||
});
|
||||
|
||||
it('MM-T2637_1 should maximize on double-clicking the header', async () => {
|
||||
const headerBounds = await header.boundingBox();
|
||||
await header.dblclick({position: {x: headerBounds.width / 2, y: headerBounds.y / 2}});
|
||||
await asyncSleep(1000);
|
||||
const isMaximized = await browserWindow.evaluate((window) => window.isMaximized());
|
||||
isMaximized.should.be.equal(true);
|
||||
});
|
||||
|
||||
it('MM-T2637_2 should restore on double-clicking the header when maximized', async () => {
|
||||
const maximizedHeaderBounds = await header.boundingBox();
|
||||
await header.dblclick({position: {x: maximizedHeaderBounds.width / 2, y: maximizedHeaderBounds.y / 2}});
|
||||
await asyncSleep(1000);
|
||||
const revertedBounds = await browserWindow.evaluate((window) => window.getContentBounds());
|
||||
revertedBounds.height.should.be.equal(initialBounds.height);
|
||||
revertedBounds.width.should.be.equal(initialBounds.width);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user