Skip to content

Commit

Permalink
adding e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cauemarcondes committed May 3, 2021
1 parent 115cb53 commit 55ce4c0
Showing 1 changed file with 23 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,38 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import url from 'url';
import archives_metadata from '../../fixtures/es_archiver/archives_metadata';
import { esArchiverLoad, esArchiverUnload } from '../../tasks/es_archiver';

const { start, end } = archives_metadata['apm_8.0.0'];

const servicesPath = '/app/apm/services';
const baseUrl = url.format({
pathname: servicesPath,
query: { rangeFrom: start, rangeTo: end },
});

describe('Home page', () => {
before(() => {
esArchiverLoad('apm_8.0.0');
beforeEach(() => {
cy.loginAsReadOnlyUser();
});
after(() => {
esArchiverUnload('apm_8.0.0');
});
it('Redirects to service page with rangeFrom and rangeTo added to the URL', () => {
const baseUrl = url.format({
pathname: '/app/apm',
query: { rangeFrom: start, rangeTo: end },
});
cy.visit('/app/apm');

cy.visit(baseUrl);
cy.url().should(
'include',
'app/apm/services?rangeFrom=now-15m&rangeTo=now'
);
cy.get('.euiTabs .euiTab-isSelected').contains('Services');
});

it('includes services with only metric documents', () => {
cy.visit(
`${baseUrl}&kuery=not%2520(processor.event%2520%253A%2522transaction%2522%2520)`
);
cy.contains('opbeans-python');
cy.contains('opbeans-java');
cy.contains('opbeans-node');
});
});

0 comments on commit 55ce4c0

Please sign in to comment.