Skip to content

Commit

Permalink
[Uptime] Improve UI tests and platform (elastic#46269)
Browse files Browse the repository at this point in the history
* Remove depdency on legacy interface.

* Remove custom interface, use common breadcrumb type.

* Add HTML template for app react entry point.

* Update app props.

* Add constant for react app entry point.

* Remove dependency on legacy capabilities provider.

* Delete legacy kibana framework adapter.

* Add New Platform adapter, reference in startup code.

* Remove dependency on legacy capabilities function.

* Delete reference to obsolete interface.

* Fix busted types in new adapter.

* Add new plugin class, delete old bootstrap code.

* Update routing/functional tests.

* Provide default for potentially-undefined value.

* run x-pack-ciGroup6 40 times

* Reinsert firefox skip tag.

* Update functional tests to work with newly-merged fixtures.

* Revert "run x-pack-ciGroup6 40 times"

This reverts commit ac3b1e4.
  • Loading branch information
justinkambic committed Oct 9, 2019
1 parent e96a9d9 commit 1afa93e
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 30 deletions.
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/uptime/common/constants/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
export const PLUGIN = {
APP_ROOT_ID: 'react-uptime-root',
ID: 'uptime',
ROUTER_BASE_NAME: '/app/uptime#/',
ROUTER_BASE_NAME: '/app/uptime',
LOCAL_STORAGE_KEY: 'xpack.uptime',
};
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/uptime/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const uptime = (kibana: any) =>
}),
main: 'plugins/uptime/app',
order: 8900,
url: '/app/uptime#/',
url: '/app/uptime/',
},
home: ['plugins/uptime/register_feature'],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export class Typeahead extends Component {
onClickOutside={this.onClickOutside}
style={{ position: 'relative' }}
>
<div style={{ position: 'relative' }}>
<div data-test-subj="xpack.uptime.filterBar" style={{ position: 'relative' }}>
<EuiFieldSearch
fullWidth
style={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ export const getKibanaFrameworkAdapter = (
);
const canSave = get(capabilities, 'uptime.save', false);
const props: UptimeAppProps = {
autocomplete,
basePath: basePath.get(),
canSave,
client: createApolloClient(`${basePath.get()}/api/uptime/graphql`, 'true'),
darkMode: core.uiSettings.get('theme:darkMode'),
autocomplete,
i18n,
isApmAvailable: apm,
isInfraAvailable: infrastructure,
Expand Down
21 changes: 10 additions & 11 deletions x-pack/legacy/plugins/uptime/public/uptime_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ export interface UptimeAppProps {

const Application = (props: UptimeAppProps) => {
const {
autocomplete,
basePath,
canSave,
client,
darkMode,
autocomplete,
i18n: i18nCore,
isApmAvailable,
isInfraAvailable,
Expand Down Expand Up @@ -169,24 +169,23 @@ const Application = (props: UptimeAppProps) => {
<EuiSpacer size="s" />
<Switch>
<Route
exact
path="/"
path="/monitor/:monitorId/:location?"
render={routerProps => (
<OverviewPage
basePath={basePath}
autocomplete={autocomplete}
logOverviewPageLoad={logOverviewPageLoad}
<MonitorPage
logMonitorPageLoad={logMonitorPageLoad}
query={client.query}
setBreadcrumbs={setBreadcrumbs}
{...routerProps}
/>
)}
/>
<Route
path="/monitor/:monitorId/:location?"
path="/"
render={routerProps => (
<MonitorPage
logMonitorPageLoad={logMonitorPageLoad}
query={client.query}
<OverviewPage
autocomplete={autocomplete}
basePath={basePath}
logOverviewPageLoad={logOverviewPageLoad}
setBreadcrumbs={setBreadcrumbs}
{...routerProps}
/>
Expand Down
11 changes: 5 additions & 6 deletions x-pack/test/functional/apps/uptime/monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
await esArchiver.load(archive);
});
after(async () => await esArchiver.unload(archive));
// TODO: update this test when states index is finalized
it.skip('loads and displays uptime data based on date range', async () => {
it('loads and displays uptime data based on date range', async () => {
await pageObjects.uptime.loadDataAndGoToMonitorPage(
'2019-01-28 12:40:08.078',
'2019-01-29 12:40:08.078',
'auto-http-0X131221E73F825974',
'auto-http-0X131221E73F825974'
'2019-09-10 12:40:08.078',
'2019-09-11 19:40:08.078',
'0000-intermittent',
'0000-intermittent'
);
});
});
Expand Down
13 changes: 6 additions & 7 deletions x-pack/test/functional/apps/uptime/overview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,23 @@ export default ({ getPageObjects }: FtrProviderContext) => {
// TODO: add UI functional tests
const pageObjects = getPageObjects(['uptime']);

// FLAKY: https://github.com/elastic/kibana/issues/35773
describe.skip('overview page', function() {
this.tags(['skipFirefox']);
const DEFAULT_DATE_START = '2019-01-28 12:40:08.078';
const DEFAULT_DATE_END = '2019-01-29 12:40:08.078';
describe('overview page', function() {
const DEFAULT_DATE_START = '2019-09-10 12:40:08.078';
const DEFAULT_DATE_END = '2019-09-11 19:40:08.078';
it('loads and displays uptime data based on date range', async () => {
await pageObjects.uptime.goToUptimeOverviewAndLoadData(
DEFAULT_DATE_START,
DEFAULT_DATE_END,
'monitor-page-link-auto-http-0X131221E73F825974'
'monitor-page-link-0000-intermittent'
);
});

it('runs filter query without issues', async () => {
await pageObjects.uptime.inputFilterQuery(
DEFAULT_DATE_START,
DEFAULT_DATE_END,
'monitor.status:up monitor.id:auto-http-0X131221E73F825974'
'monitor.status:up and monitor.id:"0000-intermittent"',
'monitor-page-link-0000-intermittent'
);
});
});
Expand Down
5 changes: 3 additions & 2 deletions x-pack/test/functional/page_objects/uptime_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ export function UptimePageProvider({ getPageObjects, getService }: FtrProviderCo
public async inputFilterQuery(
datePickerStartValue: string,
datePickerEndValue: string,
filterQuery: string
filterQuery: string,
testId: string
) {
await pageObjects.common.navigateToApp('uptime');
await pageObjects.timePicker.setAbsoluteRange(datePickerStartValue, datePickerEndValue);
await uptimeService.setFilterText(filterQuery);
await uptimeService.monitorIdExists('monitor-page-link-auto-http-0X131221E73F825974');
await uptimeService.monitorIdExists(testId);
}
})();
}

0 comments on commit 1afa93e

Please sign in to comment.