forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Functional tests for the Getting Started page (elastic#11850)
* Adding some more functionality to the Getting Started page object * Using optOut method from Getting Started page object * Adding functional tests for Getting Started page This set of tests specifically tests the scenarios under which a user should or should not get redirected to the Getting Started page * Adding log.debug message * Conforming to HTML style guide * Using new GettingStarted page object methods + opting out * Adding test for nav being shown * Removing unnecessary line * Navigate to Discover expecting to be redirected to the Getting Started page * Trying beforeEach instead of before * Remove LS data index + load empty kibana index * Removing unnecessary line * Fixing order of operations
- Loading branch information
1 parent
192b2ea
commit 099178a
Showing
5 changed files
with
95 additions
and
2 deletions.
There are no files selected for viewing
5 changes: 4 additions & 1 deletion
5
src/core_plugins/getting_started/public/components/getting_started/getting_started.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import expect from 'expect.js'; | ||
|
||
export default ({ getService, getPageObjects }) => { | ||
const kibanaServer = getService('kibanaServer'); | ||
const esArchiver = getService('esArchiver'); | ||
const remote = getService('remote'); | ||
const log = getService('log'); | ||
|
||
const PageObjects = getPageObjects(['common', 'gettingStarted']); | ||
|
||
describe('Getting Started page', () => { | ||
describe('when no index patterns exist', () => { | ||
beforeEach(async () => { | ||
// delete .kibana index and then wait for Kibana to re-create it | ||
await esArchiver.unload('logstash_functional'); | ||
await esArchiver.load('empty_kibana'); | ||
}); | ||
|
||
describe('when user has not opted out of Getting Started page', () => { | ||
beforeEach(async () => { | ||
// First, we navigate to *somewhere* in Kibana so the browser loads up Kibana. This allows us... | ||
await PageObjects.common.navigateToUrl('discover', ''); | ||
|
||
// ... to remove the Getting Started page opt-out flag from local storage for the Kibana domain | ||
await remote.deleteLocalStorageItem('kibana.isGettingStartedOptedOut'); | ||
}); | ||
|
||
it('redirects to the Getting Started page', async () => { | ||
await PageObjects.common.navigateToUrl('discover', ''); | ||
await PageObjects.common.waitUntilUrlIncludes('getting_started'); | ||
const isLoaded = await PageObjects.gettingStarted.doesContainerExist(); | ||
expect(isLoaded).to.be(true); | ||
}); | ||
}); | ||
|
||
describe('when user has opted out of Getting Started page', () => { | ||
beforeEach(async () => { | ||
await PageObjects.gettingStarted.optOut(); | ||
}); | ||
|
||
it('does not redirect to the Getting Started page', async () => { | ||
await PageObjects.common.navigateToUrl('discover', ''); | ||
const isLoaded = await PageObjects.gettingStarted.doesContainerExist(); | ||
expect(isLoaded).to.be(false); | ||
}); | ||
}); | ||
|
||
}); | ||
|
||
describe('when index patterns exist', () => { | ||
beforeEach(async () => { | ||
log.debug('load kibana index with default index pattern'); | ||
await esArchiver.load('discover'); | ||
await kibanaServer.uiSettings.replace({ | ||
'dateFormat:tz':'UTC', | ||
'defaultIndex':'logstash-*' | ||
}); | ||
}); | ||
|
||
it('does not redirect to the Getting Started page', async () => { | ||
await PageObjects.common.navigateToUrl('discover', ''); | ||
const isLoaded = await PageObjects.gettingStarted.doesContainerExist(); | ||
expect(isLoaded).to.be(false); | ||
}); | ||
|
||
describe('when a user directly navigates to the Getting Started page', () => { | ||
beforeEach(async () => { | ||
await PageObjects.gettingStarted.navigateTo(); | ||
}); | ||
|
||
it('the kibana chrome (which contains the global nav) is visible', async () => { | ||
const isChromeVisible = await PageObjects.common.isChromeVisible(); | ||
expect(isChromeVisible).to.be(true); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters