-
Notifications
You must be signed in to change notification settings - Fork 8.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[APM] Fix broken e2e tests #129475
[APM] Fix broken e2e tests #129475
Changes from all commits
d254c06
1821899
6fc2c9f
0c64e2b
fe4bde6
fe56bfe
62a841a
89cbc62
5996469
5608bf4
cf5b9de
ce1e888
db4c363
a4a280d
761dc8e
714435a
7147d07
c357e4a
b3bfe0a
4bb24eb
12cbeae
9bd1f3a
cbd4d32
87c5ecc
10280e9
29bb6f7
0245846
7127d67
17e1265
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,21 +14,15 @@ const end = '2021-10-10T00:15:00.000Z'; | |
|
||
const serviceInventoryHref = url.format({ | ||
pathname: '/app/apm/services', | ||
query: { rangeFrom: start, rangeTo: end }, | ||
}); | ||
|
||
const apisToIntercept = [ | ||
{ | ||
endpoint: '/internal/apm/service?*', | ||
name: 'servicesMainStatistics', | ||
}, | ||
{ | ||
endpoint: '/internal/apm/services/detailed_statistics?*', | ||
name: 'servicesDetailedStatistics', | ||
query: { | ||
comparisonEnabled: 'true', | ||
environment: 'ENVIRONMENT_ALL', | ||
rangeFrom: start, | ||
rangeTo: end, | ||
offset: '1d', | ||
}, | ||
]; | ||
}); | ||
|
||
// flaky test | ||
describe.skip('Home page', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we unskip this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is still flaky |
||
before(async () => { | ||
await synthtrace.index( | ||
|
@@ -47,12 +41,12 @@ describe.skip('Home page', () => { | |
cy.loginAsReadOnlyUser(); | ||
}); | ||
|
||
it('Redirects to service page with environment, rangeFrom and rangeTo added to the URL', () => { | ||
it('Redirects to service page with comparisonEnabled, environment, rangeFrom, rangeTo and offset added to the URL', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. More redirects have been added by #127812 |
||
cy.visit('/app/apm'); | ||
|
||
cy.url().should( | ||
'include', | ||
'app/apm/services?environment=ENVIRONMENT_ALL&rangeFrom=now-15m&rangeTo=now' | ||
'app/apm/services?comparisonEnabled=true&environment=ENVIRONMENT_ALL&rangeFrom=now-15m&rangeTo=now&offset=1d' | ||
); | ||
}); | ||
|
||
|
@@ -66,17 +60,11 @@ describe.skip('Home page', () => { | |
|
||
describe('navigations', () => { | ||
it('navigates to service overview page with transaction type', () => { | ||
apisToIntercept.map(({ endpoint, name }) => { | ||
cy.intercept('GET', endpoint).as(name); | ||
}); | ||
|
||
cy.visit(serviceInventoryHref); | ||
|
||
cy.contains('Services'); | ||
cy.contains('opbeans-rum').click({ force: true }); | ||
|
||
cy.get('[data-test-subj="serviceLink_rum-js"]').then((element) => { | ||
element[0].click(); | ||
}); | ||
cy.get('[data-test-subj="headerFilterTransactionType"]').should( | ||
'have.value', | ||
'page-load' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,9 @@ const aliasNames = apiRequestsToIntercept.map( | |
|
||
describe('When navigating to the service inventory', () => { | ||
before(async () => { | ||
cy.loginAsReadOnlyUser(); | ||
cy.visit(serviceInventoryHref); | ||
gbamparop marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const { rangeFrom, rangeTo } = timeRange; | ||
await synthtrace.index( | ||
opbeans({ | ||
|
@@ -50,11 +53,6 @@ describe('When navigating to the service inventory', () => { | |
await synthtrace.clean(); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.loginAsReadOnlyUser(); | ||
cy.visit(serviceInventoryHref); | ||
}); | ||
|
||
it('has no detectable a11y violations on load', () => { | ||
cy.contains('h1', 'Services'); | ||
// set skipFailures to true to not fail the test when there are accessibility failures | ||
|
@@ -77,11 +75,14 @@ describe('When navigating to the service inventory', () => { | |
cy.contains('h1', 'opbeans-node'); | ||
}); | ||
|
||
describe('Calls APIs', () => { | ||
describe.skip('Calls APIs', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you leave a comment here to explain why it's skipped (and maybe reference an issue)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, it was failing while waiting for the API calls to finish |
||
beforeEach(() => { | ||
apiRequestsToIntercept.map(({ endpoint, aliasName }) => { | ||
cy.intercept('GET', endpoint).as(aliasName); | ||
}); | ||
|
||
cy.loginAsReadOnlyUser(); | ||
cy.visit(serviceInventoryHref); | ||
}); | ||
|
||
it('with the correct environment when changing the environment', () => { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,11 +69,10 @@ describe('Service overview - header filters', () => { | |
await synthtrace.clean(); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.loginAsReadOnlyUser(); | ||
}); | ||
|
||
describe('Filtering by transaction type', () => { | ||
beforeEach(() => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's the purpose of moving this into both child test suites? was this supposed to be a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dgieselaar I noticed that once in a while a test fails because cypress logs kibana out, so to avoid such a thing I decided to move the login function to inside each |
||
cy.loginAsReadOnlyUser(); | ||
}); | ||
it('changes url when selecting different value', () => { | ||
cy.visit(serviceOverviewHref); | ||
cy.contains('opbeans-node'); | ||
|
@@ -95,7 +94,6 @@ describe('Service overview - header filters', () => { | |
cy.intercept('GET', endpoint).as(name); | ||
}); | ||
cy.visit(serviceOverviewHref); | ||
cy.contains('opbeans-node'); | ||
cy.get('[data-test-subj="headerFilterTransactionType"]').should( | ||
'have.value', | ||
'request' | ||
|
@@ -120,6 +118,9 @@ describe('Service overview - header filters', () => { | |
}); | ||
|
||
describe('Filtering by kuerybar', () => { | ||
beforeEach(() => { | ||
cy.loginAsReadOnlyUser(); | ||
}); | ||
it('filters by transaction.name', () => { | ||
cy.visit( | ||
url.format({ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,6 @@ const apisToIntercept = [ | |
}, | ||
]; | ||
|
||
// Skipping tests since it's flaky. | ||
describe.skip('Service overview: Time Comparison', () => { | ||
before(async () => { | ||
await synthtrace.index( | ||
|
@@ -71,7 +70,8 @@ describe.skip('Service overview: Time Comparison', () => { | |
|
||
it('enables by default the time comparison feature with Last 24 hours selected', () => { | ||
cy.visit(serviceOverviewPath); | ||
cy.url().should('include', 'comparisonEnabled=true&offset=1d'); | ||
cy.url().should('include', 'comparisonEnabled=true'); | ||
cy.url().should('include', 'offset=1d'); | ||
}); | ||
|
||
describe('when comparison is toggled off', () => { | ||
|
@@ -92,7 +92,6 @@ describe.skip('Service overview: Time Comparison', () => { | |
cy.intercept('GET', endpoint).as(name); | ||
}); | ||
cy.visit(serviceOverviewHref); | ||
cy.contains('opbeans-java'); | ||
|
||
cy.get('[data-test-subj="comparisonSelect"]').should('be.enabled'); | ||
const offset = `offset=1d`; | ||
|
@@ -106,6 +105,8 @@ describe.skip('Service overview: Time Comparison', () => { | |
} | ||
); | ||
|
||
cy.contains('opbeans-java'); | ||
|
||
// toggles off comparison | ||
cy.contains('Comparison').click(); | ||
cy.get('[data-test-subj="comparisonSelect"]').should('be.disabled'); | ||
|
@@ -127,32 +128,52 @@ describe.skip('Service overview: Time Comparison', () => { | |
cy.visit(serviceOverviewPath); | ||
cy.contains('opbeans-java'); | ||
// opens the page with "Day before" selected | ||
cy.get('[data-test-subj="comparisonSelect"]').should('have.value', 'day'); | ||
cy.get('[data-test-subj="comparisonSelect"]').should('have.value', '1d'); | ||
|
||
// selects another comparison type | ||
cy.get('[data-test-subj="comparisonSelect"]').select('week'); | ||
cy.get('[data-test-subj="comparisonSelect"]').should('have.value', 'week'); | ||
cy.get('[data-test-subj="comparisonSelect"]').select('1w'); | ||
cy.get('[data-test-subj="comparisonSelect"]').should('have.value', '1w'); | ||
}); | ||
|
||
it('changes comparison type when a new time range is selected', () => { | ||
cy.visit(serviceOverviewPath); | ||
cy.visit(serviceOverviewHref); | ||
cy.contains('opbeans-java'); | ||
// Time comparison default value | ||
cy.get('[data-test-subj="comparisonSelect"]').should('have.value', 'day'); | ||
cy.get('[data-test-subj="comparisonSelect"]').should('have.value', '1d'); | ||
cy.contains('Day before'); | ||
cy.contains('Week before'); | ||
|
||
cy.selectAbsoluteTimeRange( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed this to use absolute dates to calculate the |
||
'2021-10-10T00:00:00.000Z', | ||
'2021-10-20T00:00:00.000Z' | ||
); | ||
|
||
cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').click(); | ||
|
||
cy.get('[data-test-subj="comparisonSelect"]').should( | ||
'have.value', | ||
'864000000ms' | ||
); | ||
cy.get('[data-test-subj="comparisonSelect"]').should( | ||
'not.contain.text', | ||
'Day before' | ||
); | ||
cy.get('[data-test-subj="comparisonSelect"]').should( | ||
'not.contain.text', | ||
'Week before' | ||
); | ||
|
||
cy.changeTimeRange('Today'); | ||
cy.contains('Day before'); | ||
cy.contains('Week before'); | ||
|
||
cy.changeTimeRange('Last 24 hours'); | ||
cy.get('[data-test-subj="comparisonSelect"]').should('have.value', 'day'); | ||
cy.get('[data-test-subj="comparisonSelect"]').should('have.value', '1d'); | ||
cy.contains('Day before'); | ||
cy.contains('Week before'); | ||
|
||
cy.changeTimeRange('Last 7 days'); | ||
cy.get('[data-test-subj="comparisonSelect"]').should('have.value', 'week'); | ||
cy.get('[data-test-subj="comparisonSelect"]').should('have.value', '1w'); | ||
cy.get('[data-test-subj="comparisonSelect"]').should( | ||
'contain.text', | ||
'Week before' | ||
|
@@ -162,20 +183,6 @@ describe.skip('Service overview: Time Comparison', () => { | |
'Day before' | ||
); | ||
cy.contains('Week before'); | ||
|
||
cy.changeTimeRange('Last 30 days'); | ||
cy.get('[data-test-subj="comparisonSelect"]').should( | ||
'have.value', | ||
'period' | ||
); | ||
cy.get('[data-test-subj="comparisonSelect"]').should( | ||
'not.contain.text', | ||
'Day before' | ||
); | ||
cy.get('[data-test-subj="comparisonSelect"]').should( | ||
'not.contain.text', | ||
'Week before' | ||
); | ||
}); | ||
|
||
it('hovers over throughput chart shows previous and current period', () => { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,12 +53,12 @@ Cypress.Commands.add( | |
cy.get('[data-test-subj="superDatePickerstartDatePopoverButton"]').click(); | ||
cy.get('[data-test-subj="superDatePickerAbsoluteDateInput"]') | ||
.eq(0) | ||
.clear() | ||
.clear({ force: true }) | ||
.type(moment(start).format(format), { force: true }); | ||
cy.get('[data-test-subj="superDatePickerendDatePopoverButton"]').click(); | ||
cy.get('[data-test-subj="superDatePickerAbsoluteDateInput"]') | ||
.eq(1) | ||
.clear() | ||
.clear({ force: true }) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This element is not visible and the |
||
.type(moment(end).format(format), { force: true }); | ||
} | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An expectation was added to be more explicit