Skip to content

Commit

Permalink
fix e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 committed Jun 18, 2020
1 parent a0a7a44 commit 7056e40
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
15 changes: 12 additions & 3 deletions x-pack/plugins/apm/e2e/cypress/integration/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,22 @@ const BASE_URL = Cypress.config().baseUrl;
/** The default time in ms to wait for a Cypress command to complete */
export const DEFAULT_TIMEOUT = 60 * 1000;

export function loginAndWaitForPage(url: string) {
export function loginAndWaitForPage(
url: string,
dateRange?: { to: string; from: string }
) {
const username = Cypress.env('elasticsearch_username');
const password = Cypress.env('elasticsearch_password');

cy.log(`Authenticating via ${username} / ${password}`);

const fullUrl = `${BASE_URL}${url}?rangeFrom=${RANGE_FROM}&rangeTo=${RANGE_TO}`;
let rangeFrom = RANGE_FROM;
let rangeTo = RANGE_TO;
if (dateRange) {
rangeFrom = dateRange.from;
rangeTo = dateRange.to;
}

const fullUrl = `${BASE_URL}${url}?rangeFrom=${rangeFrom}&rangeTo=${rangeTo}`;
cy.visit(fullUrl, { auth: { username, password } });

cy.viewport('macbook-15');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Feature: RUM Dashboard

Scenario: Client metrics
Given a user browses the APM UI application
Given a user browses the APM UI application for RUM Data
When the user inspects the real user monitoring tab
Then should redirect to rum dashboard
And should have correct client metrics
6 changes: 3 additions & 3 deletions x-pack/plugins/apm/e2e/cypress/integration/snapshots.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ module.exports = {
"__version": "4.5.0",
"APM": {
"Transaction duration charts": {
"1": "55.0 ms",
"2": "27.5 ms",
"3": "0.0 ms"
"1": "55 ms",
"2": "28 ms",
"3": "0 ms"
}
},
"RUM Dashboard": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import { loginAndWaitForPage } from '../../integration/helpers';
/** The default time in ms to wait for a Cypress command to complete */
export const DEFAULT_TIMEOUT = 60 * 1000;

Given(`a user browses the APM UI application`, () => {
Given(`a user browses the APM UI application for RUM Data`, () => {
// open service overview page
loginAndWaitForPage(`/app/apm#/services`);
const RANGE_FROM = 'now-24h';
const RANGE_TO = 'now';
loginAndWaitForPage(`/app/apm#/services`, { from: RANGE_FROM, to: RANGE_TO });
});

When(`the user inspects the real user monitoring tab`, () => {
Expand Down

0 comments on commit 7056e40

Please sign in to comment.