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 55ce4c0 commit ce0ffe6
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

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'];

Expand All @@ -17,6 +18,12 @@ const baseUrl = url.format({
});

describe('Home page', () => {
before(() => {
esArchiverLoad('apm_8.0.0');
});
after(() => {
esArchiverUnload('apm_8.0.0');
});
beforeEach(() => {
cy.loginAsReadOnlyUser();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { includes } from 'lodash';
import url from 'url';
import archives_metadata from '../../../fixtures/es_archiver/archives_metadata';
import { esArchiverLoad, esArchiverUnload } from '../../../tasks/es_archiver';
Expand Down Expand Up @@ -60,10 +61,10 @@ const apisToIntercept = [

describe('Service overview - header filters', () => {
before(() => {
// esArchiverLoad('apm_8.0.0');
esArchiverLoad('apm_8.0.0');
});
after(() => {
// esArchiverUnload('apm_8.0.0');
esArchiverUnload('apm_8.0.0');
});
beforeEach(() => {
cy.loginAsReadOnlyUser();
Expand Down Expand Up @@ -119,12 +120,19 @@ describe('Service overview - header filters', () => {
});

describe('Filtering by kuerybar', () => {
it('filters by transaction.name', () => {
cy.visit(baseUrl);
cy.contains('Kibana');
it.only('filters by transaction.name', () => {
cy.visit(url.format({
pathname: '/app/apm/services/opbeans-java/overview',
query: { rangeFrom: start, rangeTo: end },
}));
cy.contains('opbeans-java');
cy.get('[data-test-subj="headerFilterKuerybar"]').type('transaction.n');
// cy.get('[data-test-subj="transaction.name"]').click();
// cy.contains('transaction.name').click();
cy.contains('transaction.name');
cy.get('[data-test-subj="suggestionContainer"]').find('li').first().click();
cy.get('[data-test-subj="headerFilterKuerybar"]').type(':');
cy.get('[data-test-subj="suggestionContainer"]').find('li').first().click();
cy.get('[data-test-subj="suggestionContainer"]').realPress('{enter}')
cy.url().should('include', '&kuery=transaction.name')
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ function Suggestion(props) {
selected={props.selected}
onClick={() => props.onClick(props.suggestion)}
onMouseEnter={props.onMouseEnter}
data-test-subj={props.suggestion.text}
>
<Icon type={props.suggestion.type}>
<EuiIcon type={getEuiIconType(props.suggestion.type)} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ class Suggestions extends Component {
});

return (
<List innerRef={(node) => (this.parentNode = node)}>{suggestions}</List>
<List
data-test-subj="suggestionContainer"
innerRef={(node) => (this.parentNode = node)}
>
{suggestions}
</List>
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ export class Typeahead extends Component {
>
<div style={{ position: 'relative' }}>
<EuiFieldSearch
data-test-subj="headerFilterKuerybar"
fullWidth
style={{
backgroundImage: 'none',
Expand Down

0 comments on commit ce0ffe6

Please sign in to comment.