-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Functional tests for the Getting Started page #11850
Changes from all commits
d56e3e0
a1a450b
2e30345
6d53363
25b8e04
b7bad51
e52932b
5089559
8ba24c3
649d885
1dfdef3
9cb122a
0807666
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
export function GettingStartedPageProvider({ getService }) { | ||
export function GettingStartedPageProvider({ getService, getPageObjects }) { | ||
|
||
const log = getService('log'); | ||
const retry = getService('retry'); | ||
const testSubjects = getService('testSubjects'); | ||
|
||
const PageObjects = getPageObjects(['common']); | ||
|
||
class GettingStartedPage { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this even an instantiated class? I'm not seeing any local state or anything. All the methods just call static methods, or instance methods off already instantiated objects. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure TBH. I was following the pattern already established with other page objects. If we want to change this pattern I suggest we open a new issue for doing it across the board for all page objects and then fix it there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chrisronline created #11863 |
||
async doesContainerExist() { | ||
return await testSubjects.exists('gettingStartedContainer'); | ||
|
@@ -18,6 +20,11 @@ export function GettingStartedPageProvider({ getService }) { | |
} | ||
}); | ||
} | ||
|
||
async navigateTo() { | ||
log.debug('Navigating directly to Getting Started page'); | ||
await PageObjects.common.navigateToUrl('settings', 'kibana/getting_started'); | ||
} | ||
} | ||
|
||
return new GettingStartedPage(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have a test that ensures the navigation is displayed properly when the user manually navigates to the Getting Starting page from the Management page?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this as part of 5351e61.