Skip to content

Commit

Permalink
Kibana home page tests (elastic#15098) (elastic#15964)
Browse files Browse the repository at this point in the history
Couple of tests to make sure Kibana home page isn't breaking.
  • Loading branch information
bhavyarm authored Jan 10, 2018
1 parent a817517 commit 1dea44c
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/core_plugins/kibana/public/home/components/synopsis.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ export function Synopsis({ description, iconUrl, title, url }) {
}

return (
<a href={url} className="kuiLink synopsis">
<a
href={url}
className="kuiLink synopsis"
data-test-subj={`homeSynopsisLink${title.toLowerCase()}`}
>
<KuiFlexGroup>
<KuiFlexItem grow={false}>{img}</KuiFlexItem>
<KuiFlexItem className="synopsisContent">
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/chrome/directives/global_nav/global_nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<!-- Logo -->
<div class="global-nav__logo">
<a href="{{ getHref('/app/kibana#/home') }}">
<a href="{{ getHref('/app/kibana#/home') }}" data-test-subj="kibanaLogo">
<li
ng-if="!logoBrand && !smallLogoBrand"
aria-label="{{ appTitle }} Logo"
Expand Down
24 changes: 24 additions & 0 deletions test/functional/apps/home/_home.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import expect from 'expect.js';


export default function ({ getService, getPageObjects }) {
const remote = getService('remote');
const PageObjects = getPageObjects(['common', 'home']);

describe('Kibana takes you home', function describeIndexTests() {

it('clicking on kibana logo should take you to home page', async ()=> {
await PageObjects.common.navigateToApp('settings');
await PageObjects.home.clickKibanaIcon();
const url = await remote.getCurrentUrl();
expect(url.includes('/app/kibana#/home')).to.be(true);
});

it('clicking on console on homepage should take you to console app', async ()=> {
await PageObjects.home.clickSynopsis('console');
const url = await remote.getCurrentUrl();
expect(url.includes('/app/kibana#/dev_tools/console?_g=()')).to.be(true);
});

});
}
11 changes: 11 additions & 0 deletions test/functional/apps/home/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default function ({ getService, loadTestFile }) {
const remote = getService('remote');

describe('homepage app', function () {
before(function () {
return remote.setWindowSize(1200, 800);
});

loadTestFile(require.resolve('./_home'));
});
}
3 changes: 3 additions & 0 deletions test/functional/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
ContextPageProvider,
DiscoverPageProvider,
HeaderPageProvider,
HomePageProvider,
DashboardPageProvider,
VisualizePageProvider,
SettingsPageProvider,
Expand Down Expand Up @@ -35,6 +36,7 @@ export default async function ({ readConfigFile }) {
require.resolve('./apps/context'),
require.resolve('./apps/dashboard'),
require.resolve('./apps/discover'),
require.resolve('./apps/home'),
require.resolve('./apps/management'),
require.resolve('./apps/status_page'),
require.resolve('./apps/timelion'),
Expand All @@ -48,6 +50,7 @@ export default async function ({ readConfigFile }) {
context: ContextPageProvider,
discover: DiscoverPageProvider,
header: HeaderPageProvider,
home: HomePageProvider,
dashboard: DashboardPageProvider,
visualize: VisualizePageProvider,
settings: SettingsPageProvider,
Expand Down
19 changes: 19 additions & 0 deletions test/functional/page_objects/home_page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

export function HomePageProvider({ getService }) {
const testSubjects = getService('testSubjects');
//const PageObjects = getPageObjects(['common', 'header']);
class HomePage {

async clickKibanaIcon() {
await testSubjects.click('kibanaLogo');
}

async clickSynopsis(title) {
await testSubjects.click(`homeSynopsisLink${title}`);
}


}

return new HomePage();
}
1 change: 1 addition & 0 deletions test/functional/page_objects/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export { ShieldPageProvider } from './shield_page';
export { ContextPageProvider } from './context_page';
export { DiscoverPageProvider } from './discover_page';
export { HeaderPageProvider } from './header_page';
export { HomePageProvider } from './home_page';
export { DashboardPageProvider } from './dashboard_page';
export { VisualizePageProvider } from './visualize_page';
export { SettingsPageProvider } from './settings_page';
Expand Down

0 comments on commit 1dea44c

Please sign in to comment.