Skip to content

Commit

Permalink
fixing up broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
parkiino committed Apr 21, 2020
1 parent 0f69d0c commit 58e637e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ describe('when on the hosts page', () => {
expect(policyStatusLink).not.toBeNull();
expect(policyStatusLink.textContent).toEqual('Successful');
expect(policyStatusLink.getAttribute('href')).toEqual(
'?selected_host=1&show=policy_response'
'?page_index=0&page_size=10&selected_host=1&show=policy_response'
);
});
it('should update the URL when policy status link is clicked', async () => {
Expand All @@ -150,7 +150,9 @@ describe('when on the hosts page', () => {
fireEvent.click(policyStatusLink);
});
const changedUrlAction = await userChangedUrlChecker;
expect(changedUrlAction.payload.search).toEqual('?selected_host=1&show=policy_response');
expect(changedUrlAction.payload.search).toEqual(
'?page_index=0&page_size=10&selected_host=1&show=policy_response'
);
});
it('should include the link to logs', async () => {
const renderResult = render();
Expand All @@ -170,7 +172,7 @@ describe('when on the hosts page', () => {
});
});

it('should navigate to logs without full page refresh', async () => {
it('should navigate to logs without full page refresh', () => {
expect(coreStart.application.navigateToApp.mock.calls).toHaveLength(1);
});
});
Expand Down Expand Up @@ -205,7 +207,9 @@ describe('when on the hosts page', () => {
it('should include the back to details link', async () => {
const subHeaderBackLink = await renderResult.findByTestId('flyoutSubHeaderBackButton');
expect(subHeaderBackLink.textContent).toBe('Endpoint Details');
expect(subHeaderBackLink.getAttribute('href')).toBe('?selected_host=1');
expect(subHeaderBackLink.getAttribute('href')).toBe(
'?page_index=0&page_size=10&selected_host=1'
);
});
it('should update URL when back to details link is clicked', async () => {
const subHeaderBackLink = await renderResult.findByTestId('flyoutSubHeaderBackButton');
Expand All @@ -214,7 +218,9 @@ describe('when on the hosts page', () => {
fireEvent.click(subHeaderBackLink);
});
const changedUrlAction = await userChangedUrlChecker;
expect(changedUrlAction.payload.search).toEqual('?selected_host=1');
expect(changedUrlAction.payload.search).toEqual(
'?page_index=0&page_size=10&selected_host=1'
);
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export const HostList = () => {
<PageView
viewType="list"
data-test-subj="hostPage"
headerLeft={i18n.translate('xpack.endpoint.hostList.title', { defaultMessage: 'Hosts' })}
headerLeft={i18n.translate('xpack.endpoint.host.hosts', { defaultMessage: 'Hosts' })}
>
{hasSelectedHost && <HostDetailsFlyout />}
<EuiText color="subdued" size="xs">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
await testSubjects.existOrFail('welcomeTitle');
});

it(`endpoint management shows 'Hosts'`, async () => {
it(`endpoint hosts shows hosts lists page`, async () => {
await pageObjects.common.navigateToUrlWithBrowserHistory('endpoint', '/hosts', undefined, {
basePath: '/s/custom_space',
ensureCurrentUrl: false,
shouldLoginIfPrompted: false,
});
await testSubjects.existOrFail('hostListTitle');
await testSubjects.existOrFail('hostPage');
});
});

Expand Down

0 comments on commit 58e637e

Please sign in to comment.