diff --git a/src/ui/public/chrome/api/controls.js b/src/ui/public/chrome/api/controls.js
index 771a995474a45..5a99fa0f3b433 100644
--- a/src/ui/public/chrome/api/controls.js
+++ b/src/ui/public/chrome/api/controls.js
@@ -11,14 +11,20 @@ export default function (chrome, internals) {
* determines if the Kibana chrome should be displayed
*/
- let def = true;
- internals.setVisibleDefault = (_def) => def = Boolean(_def);
+ let permanentlyHideChrome = false;
+ internals.permanentlyHideChrome = () => {
+ permanentlyHideChrome = true;
+ internals.visible = false;
+ };
/**
* @param {boolean} display - should the chrome be displayed
* @return {chrome}
*/
chrome.setVisible = function (display) {
+ if (permanentlyHideChrome) {
+ return chrome;
+ }
internals.visible = Boolean(display);
return chrome;
};
@@ -27,7 +33,7 @@ export default function (chrome, internals) {
* @return {boolean} - display state of the chrome
*/
chrome.getVisible = function () {
- if (_.isUndefined(internals.visible)) return def;
+ if (_.isUndefined(internals.visible)) return !permanentlyHideChrome;
return internals.visible;
};
}
diff --git a/src/ui/public/chrome/directives/kbn_chrome.html b/src/ui/public/chrome/directives/kbn_chrome.html
index 6aaa3bc54ee6a..1d6a34e84bfd6 100644
--- a/src/ui/public/chrome/directives/kbn_chrome.html
+++ b/src/ui/public/chrome/directives/kbn_chrome.html
@@ -1,6 +1,7 @@
{
+ it('hides the chrome', async () => {
+ let isChromeVisible = await PageObjects.common.isChromeVisible();
+ expect(isChromeVisible).to.be(true);
+
+ const currentUrl = await remote.getCurrentUrl();
+ const newUrl = currentUrl + '&embed=true';
+ // Embed parameter only works on a hard refresh.
+ const useTimeStamp = true;
+ await remote.get(newUrl.toString(), useTimeStamp);
+
+ await retry.try(async () => {
+ isChromeVisible = await PageObjects.common.isChromeVisible();
+ expect(isChromeVisible).to.be(false);
+ });
+ });
+
+ after(async function () {
+ console.log('showing chrome again');
+ const currentUrl = await remote.getCurrentUrl();
+ const newUrl = currentUrl.replace('&embed=true', '');
+ // First use the timestamp to cause a hard refresh so the new embed parameter works correctly.
+ let useTimeStamp = true;
+ await remote.get(newUrl.toString(), useTimeStamp);
+ // Then get rid of the timestamp so the rest of the tests work with state and app switching.
+ useTimeStamp = false;
+ await remote.get(newUrl.toString(), useTimeStamp);
+ });
+ });
+
describe('add new visualization link', () => {
it('adds a new visualization', async () => {
await PageObjects.dashboard.clickAddVisualization();
diff --git a/test/functional/page_objects/common_page.js b/test/functional/page_objects/common_page.js
index 56714a95b3047..7e093da521a86 100644
--- a/test/functional/page_objects/common_page.js
+++ b/test/functional/page_objects/common_page.js
@@ -257,7 +257,9 @@ export function CommonPageProvider({ getService, getPageObjects }) {
}
async isChromeVisible() {
- return await testSubjects.exists('kibanaChrome');
+ const globalNavShown = await testSubjects.exists('globalNav');
+ const topNavShown = await testSubjects.exists('top-nav');
+ return globalNavShown && topNavShown;
}
async waitForTopNavToBeVisible() {