Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] hide top nav menu in full screen mode of maps and dashboard (#41672) #41731

Merged
merged 1 commit into from
Jul 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
>
<!-- Local nav. -->
<kbn-top-nav-v2
ng-show="chrome.getVisible()"
app-name="'dashboard'"
config="topNavMenu"

Expand Down
6 changes: 3 additions & 3 deletions test/functional/apps/dashboard/embed_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function ({ getService, getPageObjects }) {
});

it('hides the chrome', async () => {
let isChromeVisible = await PageObjects.common.isChromeVisible();
const isChromeVisible = await PageObjects.common.isChromeVisible();
expect(isChromeVisible).to.be(true);

const currentUrl = await browser.getCurrentUrl();
Expand All @@ -40,8 +40,8 @@ export default function ({ getService, getPageObjects }) {
await browser.get(newUrl.toString(), useTimeStamp);

await retry.try(async () => {
isChromeVisible = await PageObjects.common.isChromeVisible();
expect(isChromeVisible).to.be(false);
const isChromeHidden = await PageObjects.common.isChromeHidden();
expect(isChromeHidden).to.be(true);
});
});

Expand Down
6 changes: 3 additions & 3 deletions test/functional/apps/dashboard/full_screen_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ export default function ({ getService, getPageObjects }) {
});

it('hides the chrome', async () => {
let isChromeVisible = await PageObjects.common.isChromeVisible();
const isChromeVisible = await PageObjects.common.isChromeVisible();
expect(isChromeVisible).to.be(true);

await PageObjects.dashboard.clickFullScreenMode();

await retry.try(async () => {
isChromeVisible = await PageObjects.common.isChromeVisible();
expect(isChromeVisible).to.be(false);
const isChromeHidden = await PageObjects.common.isChromeHidden();
expect(isChromeHidden).to.be(true);
});
});

Expand Down
6 changes: 6 additions & 0 deletions test/functional/page_objects/common_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,12 @@ export function CommonPageProvider({ getService, getPageObjects }) {
return globalNavShown && topNavShown;
}

async isChromeHidden() {
const globalNavShown = await globalNav.exists();
const topNavShown = await testSubjects.exists('top-nav');
return !globalNavShown && !topNavShown;
}

async waitForTopNavToBeVisible() {
await retry.try(async () => {
const isNavVisible = await testSubjects.exists('top-nav');
Expand Down
1 change: 1 addition & 0 deletions x-pack/legacy/plugins/maps/public/angular/map.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<div id="maps-top-nav">
<div>
<kbn-top-nav-v2
ng-show="chrome.getVisible()"
app-name="'maps'"
config="topNavMenu"
show-search-bar="chrome.getVisible()"
Expand Down
52 changes: 52 additions & 0 deletions x-pack/test/functional/apps/maps/full_screen_mode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import expect from '@kbn/expect';

export default function ({ getService, getPageObjects }) {
const PageObjects = getPageObjects(['maps', 'common']);
const browser = getService('browser');
const retry = getService('retry');

describe('full screen mode', () => {
before(async () => {
await PageObjects.maps.openNewMap();
});

it('full screen button should exist', async () => {
const exists = await PageObjects.maps.fullScreenModeMenuItemExists();
expect(exists).to.be(true);
});

it('hides the chrome', async () => {
const isChromeVisible = await PageObjects.common.isChromeVisible();
expect(isChromeVisible).to.be(true);

await PageObjects.maps.clickFullScreenMode();

await retry.try(async () => {
const isChromeHidden = await PageObjects.common.isChromeHidden();
expect(isChromeHidden).to.be(true);
});
});

it('displays exit full screen logo button', async () => {
const exists = await PageObjects.maps.exitFullScreenLogoButtonExists();
expect(exists).to.be(true);
});

it('exits when the text button is clicked on', async () => {
const logoButton = await PageObjects.maps.getExitFullScreenLogoButton();
await browser.moveMouseTo(logoButton);
await PageObjects.maps.clickExitFullScreenTextButton();

await retry.try(async () => {
const isChromeVisible = await PageObjects.common.isChromeVisible();
expect(isChromeVisible).to.be(true);
});
});
});
}
1 change: 1 addition & 0 deletions x-pack/test/functional/apps/maps/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export default function ({ loadTestFile, getService }) {
loadTestFile(require.resolve('./sample_data'));
loadTestFile(require.resolve('./feature_controls/maps_security'));
loadTestFile(require.resolve('./feature_controls/maps_spaces'));
loadTestFile(require.resolve('./full_screen_mode'));
});

describe('', function () {
Expand Down
21 changes: 21 additions & 0 deletions x-pack/test/functional/page_objects/gis_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,27 @@ export function GisPageProvider({ getService, getPageObjects }) {
return await testSubjects.getVisibleText(`layerErrorMessage`);
}

async fullScreenModeMenuItemExists() {
return await testSubjects.exists('mapsFullScreenMode');
}

async clickFullScreenMode() {
log.debug(`clickFullScreenMode`);
await testSubjects.click('mapsFullScreenMode');
}

async exitFullScreenLogoButtonExists() {
return await testSubjects.exists('exitFullScreenModeLogo');
}

async getExitFullScreenLogoButton() {
return await testSubjects.find('exitFullScreenModeLogo');
}

async clickExitFullScreenTextButton() {
await testSubjects.click('exitFullScreenModeText');
}

async openInspectorMapView() {
await inspector.openInspectorView('inspectorViewChooserMap');
}
Expand Down