Skip to content

Commit

Permalink
fixes functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dplumlee committed Mar 16, 2020
1 parent e5c46f6 commit 840e94a
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 10 deletions.
1 change: 1 addition & 0 deletions x-pack/plugins/endpoint/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ export interface EndpointEvent {
agent: {
id: string;
version: string;
type: string;
};
ecs: {
version: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const TakeActionDropdown = memo(() => {
<EuiPopover
button={TakeActionButton}
isOpen={isDropdownOpen}
anchorPosition="downRight"
closePopover={() => setIsDropdownOpen(false)}
data-test-subj="alertListTakeActionDropdownContent"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,25 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('includes Alert list data grid', async () => {
await testSubjects.existOrFail('alertListGrid');
});
it('updates the url upon submitting a new search bar query', async () => {
await pageObjects.endpointAlerts.enterSearchBarQuery();
await pageObjects.endpointAlerts.submitSearchBarFilter();
const currentUrl = await browser.getCurrentUrl();
expect(currentUrl).to.contain('query=');
expect(currentUrl).to.contain('date_range=');
describe('when submitting a new bar query', () => {
before(async () => {
await pageObjects.endpointAlerts.enterSearchBarQuery('test query');
await pageObjects.endpointAlerts.submitSearchBarFilter();
});
it('should update the url correctly', async () => {
const currentUrl = await browser.getCurrentUrl();
expect(currentUrl).to.contain('query=');
expect(currentUrl).to.contain('date_range=');
});
after(async () => {
await pageObjects.endpointAlerts.enterSearchBarQuery('');
await pageObjects.endpointAlerts.submitSearchBarFilter();
});
});

describe('and user has clicked details view link', () => {
before(async () => {
await pageObjects.endpointAlerts.setSearchBarDate('Mar 10, 2020 @ 19:33:40.767'); // A timestamp that encompases our es-archive data
await testSubjects.click('alertTypeCellLink');
});

Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/functional/apps/endpoint/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ export default function({ loadTestFile }: FtrProviderContext) {
loadTestFile(require.resolve('./management'));
loadTestFile(require.resolve('./policy_list'));
loadTestFile(require.resolve('./policy_details'));
loadTestFile(require.resolve('./alert_list'));
loadTestFile(require.resolve('./alerts'));
});
}
1 change: 0 additions & 1 deletion x-pack/test/functional/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ export default async function({ readConfigFile }) {
'--telemetry.banner=false',
'--timelion.ui.enabled=true',
'--xpack.endpoint.enabled=true',
'--xpack.endpoint.alertResultListDefaultDateRange.from=2018-01-10T00:00:00.000Z',
],
},
uiSettings: {
Expand Down
11 changes: 9 additions & 2 deletions x-pack/test/functional/page_objects/endpoint_alerts_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,18 @@ export function EndpointAlertsPageProvider({ getService }: FtrProviderContext) {
const testSubjects = getService('testSubjects');

return {
async enterSearchBarQuery() {
return await testSubjects.setValue('alertsSearchBar', 'test query');
async enterSearchBarQuery(query: string) {
return await testSubjects.setValue('alertsSearchBar', query, { clearWithKeyboard: true });
},
async submitSearchBarFilter() {
return await testSubjects.click('querySubmitButton');
},
async setSearchBarDate(timestamp: string) {
await testSubjects.click('superDatePickerShowDatesButton');
await testSubjects.click('superDatePickerstartDatePopoverButton');
await testSubjects.click('superDatePickerAbsoluteTab');
await testSubjects.setValue('superDatePickerAbsoluteDateInput', timestamp);
await this.submitSearchBarFilter();
},
};
}

0 comments on commit 840e94a

Please sign in to comment.