Enable skipped e2e tests (#139912)

* Enable skipped e2e tests

* review comments

* return request

* return promise
This commit is contained in:
Miriam 2022-09-06 09:11:27 +01:00 committed by GitHub
parent a771b021e1
commit f54349f26b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 256 additions and 190 deletions

View file

@ -52,7 +52,7 @@ const apisToIntercept = [
},
];
describe.skip('when navigating to integration page', () => {
describe('when navigating to integration page', () => {
beforeEach(() => {
const integrationsPath = '/app/integrations/browse';

View file

@ -6,10 +6,42 @@
*/
const basePath = '/app/apm/settings/custom-links';
const deleteAllCustomLinks = () => {
// delete customLink if exists
const kibanaUrl = Cypress.env('KIBANA_URL');
cy.request({
log: false,
method: 'GET',
url: `${kibanaUrl}/internal/apm/settings/custom_links`,
body: {},
headers: {
'kbn-xsrf': 'e2e_test',
},
auth: { user: 'editor', pass: 'changeme' },
}).then((response) => {
const promises = response.body.customLinks.map((item: any) => {
if (item.id) {
return cy.request({
log: false,
method: 'DELETE',
url: `${kibanaUrl}/internal/apm/settings/custom_links/${item.id}`,
body: {},
headers: {
'kbn-xsrf': 'e2e_test',
},
auth: { user: 'editor', pass: 'changeme' },
failOnStatusCode: false,
});
}
});
return Promise.all(promises);
});
};
describe('Custom links', () => {
beforeEach(() => {
cy.loginAsEditorUser();
deleteAllCustomLinks();
});
it('shows empty message and create button', () => {

View file

@ -16,7 +16,7 @@ const timeRange = {
rangeTo: end,
};
describe.skip('Dependencies', () => {
describe('Dependencies', () => {
before(() => {
synthtrace.index(
opbeans({
@ -57,7 +57,7 @@ describe.skip('Dependencies', () => {
});
});
describe.skip('dependency overview page', () => {
describe('dependency overview page', () => {
it('shows dependency information and you can navigate to a page for an upstream service', () => {
cy.visitKibana(
`/app/apm/dependencies/overview?${new URLSearchParams({

View file

@ -96,7 +96,7 @@ describe('Error details', () => {
});
describe('when clicking on View x occurences in discover', () => {
it.skip('should redirects the user to discover', () => {
it('should redirects the user to discover', () => {
cy.visitKibana(errorDetailsPageHref);
cy.contains('View 1 occurrence in Discover').click();
cy.url().should('include', 'app/discover');

View file

@ -23,7 +23,7 @@ const serviceInventoryHref = url.format({
},
});
describe.skip('Home page', () => {
describe('Home page', () => {
before(() => {
synthtrace.index(
opbeans({

View file

@ -32,18 +32,11 @@ const mainApiRequestsToIntercept = [
},
];
const secondaryApiRequestsToIntercept = [
{
endpoint: 'internal/apm/suggestions?*',
aliasName: 'suggestionsRequest',
},
];
const mainAliasNames = mainApiRequestsToIntercept.map(
({ aliasName }) => `@${aliasName}`
);
describe('When navigating to the service inventory', () => {
describe('Service inventory', () => {
before(() => {
const { rangeFrom, rangeTo } = timeRange;
synthtrace.index(
@ -53,44 +46,44 @@ describe('When navigating to the service inventory', () => {
})
);
});
beforeEach(() => {
cy.loginAsViewerUser();
cy.visitKibana(serviceInventoryHref);
});
after(() => {
synthtrace.clean();
});
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
checkA11y({ skipFailures: true });
});
it('has a list of services', () => {
cy.contains('opbeans-node');
cy.contains('opbeans-java');
cy.contains('opbeans-rum');
});
it('has a list of environments', () => {
cy.get('td:contains(production)').should('have.length', 3);
});
it('when clicking on a service it loads the service overview for that service', () => {
cy.contains('opbeans-node').click({ force: true });
cy.url().should('include', '/apm/services/opbeans-node/overview');
cy.contains('h1', 'opbeans-node');
});
describe.skip('Calls APIs', () => {
describe('When navigating to the service inventory', () => {
beforeEach(() => {
[...mainApiRequestsToIntercept, ...secondaryApiRequestsToIntercept].map(
({ endpoint, aliasName }) => {
cy.intercept('GET', endpoint).as(aliasName);
}
cy.loginAsViewerUser();
cy.visitKibana(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
checkA11y({ skipFailures: true });
});
it('has a list of services', () => {
cy.contains('opbeans-node');
cy.contains('opbeans-java');
cy.contains('opbeans-rum');
});
it('has a list of environments', () => {
cy.get('td:contains(production)').should('have.length', 3);
});
it('when clicking on a service it loads the service overview for that service', () => {
cy.contains('opbeans-node').click({ force: true });
cy.url().should('include', '/apm/services/opbeans-node/overview');
cy.contains('h1', 'opbeans-node');
});
});
describe('Calls APIs', () => {
beforeEach(() => {
cy.intercept('GET', '/internal/apm/services?*').as('servicesRequest');
cy.intercept('POST', '/internal/apm/services/detailed_statistics?*').as(
'detailedStatisticsRequest'
);
cy.loginAsViewerUser();
@ -99,12 +92,8 @@ describe('When navigating to the service inventory', () => {
it('with the correct environment when changing the environment', () => {
cy.wait(mainAliasNames);
cy.get('[data-test-subj="environmentFilter"]').type('pro');
cy.expectAPIsToHaveBeenCalledWith({
apisIntercepted: ['@suggestionsRequest'],
value: 'fieldValue=pro',
});
cy.get('[data-test-subj="environmentFilter"]').type('production');
cy.contains('button', 'production').click();
@ -120,7 +109,7 @@ describe('When navigating to the service inventory', () => {
cy.wait(mainAliasNames);
});
it.skip('when selecting a different time range and clicking the update button', () => {
it('when selecting a different time range and clicking the update button', () => {
cy.wait(mainAliasNames);
cy.selectAbsoluteTimeRange(
@ -134,71 +123,75 @@ describe('When navigating to the service inventory', () => {
cy.wait(mainAliasNames);
});
});
});
describe('Check detailed statistics API with multiple services', () => {
before(() => {
const { rangeFrom, rangeTo } = timeRange;
synthtrace.index(
generateMultipleServicesData({
from: new Date(rangeFrom).getTime(),
to: new Date(rangeTo).getTime(),
})
);
});
beforeEach(() => {
cy.loginAsViewerUser();
});
after(() => {
synthtrace.clean();
});
it('calls detailed API with visible items only', () => {
cy.intercept('POST', '/internal/apm/services/detailed_statistics?*').as(
'detailedStatisticsRequest'
);
cy.intercept('GET', '/internal/apm/services?*').as('mainStatisticsRequest');
cy.visitKibana(
`${serviceInventoryHref}&pageSize=10&sortField=serviceName&sortDirection=asc`
);
cy.wait('@mainStatisticsRequest');
cy.contains('Services');
cy.get('.euiPagination__list').children().should('have.length', 5);
cy.wait('@detailedStatisticsRequest').then((payload) => {
expect(payload.request.body.serviceNames).eql(
JSON.stringify([
'0',
'1',
'10',
'11',
'12',
'13',
'14',
'15',
'16',
'17',
])
describe('Check detailed statistics API with multiple services', () => {
before(() => {
// clean previous data created
synthtrace.clean();
const { rangeFrom, rangeTo } = timeRange;
synthtrace.index(
generateMultipleServicesData({
from: new Date(rangeFrom).getTime(),
to: new Date(rangeTo).getTime(),
})
);
});
cy.get('[data-test-subj="pagination-button-1"]').click();
cy.wait('@detailedStatisticsRequest').then((payload) => {
expect(payload.request.body.serviceNames).eql(
JSON.stringify([
'18',
'19',
'2',
'20',
'21',
'22',
'23',
'24',
'25',
'26',
])
beforeEach(() => {
cy.loginAsViewerUser();
});
after(() => {
synthtrace.clean();
});
it('calls detailed API with visible items only', () => {
cy.intercept('POST', '/internal/apm/services/detailed_statistics?*').as(
'detailedStatisticsRequest'
);
cy.intercept('GET', '/internal/apm/services?*').as(
'mainStatisticsRequest'
);
cy.visitKibana(
`${serviceInventoryHref}&pageSize=10&sortField=serviceName&sortDirection=asc`
);
cy.wait('@mainStatisticsRequest');
cy.contains('Services');
cy.get('.euiPagination__list').children().should('have.length', 5);
cy.wait('@detailedStatisticsRequest').then((payload) => {
expect(payload.request.body.serviceNames).eql(
JSON.stringify([
'0',
'1',
'10',
'11',
'12',
'13',
'14',
'15',
'16',
'17',
])
);
});
cy.get('[data-test-subj="pagination-button-1"]').click();
cy.wait('@detailedStatisticsRequest').then((payload) => {
expect(payload.request.body.serviceNames).eql(
JSON.stringify([
'18',
'19',
'2',
'20',
'21',
'22',
'23',
'24',
'25',
'26',
])
);
});
});
});
});

View file

@ -89,7 +89,7 @@ describe('Service overview - header filters', () => {
);
});
it.skip('calls APIs with correct transaction type', () => {
it('calls APIs with correct transaction type', () => {
apisToIntercept.map(({ endpoint, name }) => {
cy.intercept('GET', endpoint).as(name);
});
@ -117,7 +117,7 @@ describe('Service overview - header filters', () => {
});
});
describe.skip('Filtering by kuerybar', () => {
describe('Filtering by kuerybar', () => {
beforeEach(() => {
cy.loginAsViewerUser();
});

View file

@ -12,11 +12,21 @@ import { opbeans } from '../../../fixtures/synthtrace/opbeans';
const start = '2021-10-10T00:00:00.000Z';
const end = '2021-10-10T00:15:00.000Z';
const serviceOverviewHref = url.format({
const serviceJavaOverviewHref = url.format({
pathname: '/app/apm/services/opbeans-java/overview',
query: { rangeFrom: start, rangeTo: end },
});
const serviceRumOverviewHref = url.format({
pathname: '/app/apm/services/opbeans-rum/overview',
query: { rangeFrom: start, rangeTo: end },
});
const testServiveHref = url.format({
pathname: '/app/apm/services/test-service/overview',
query: { rangeFrom: start, rangeTo: end },
});
const serviceNodeName = 'opbeans-java-prod-1';
const apisToIntercept = [
@ -37,28 +47,45 @@ const apisToIntercept = [
];
describe('Instances table', () => {
beforeEach(() => {
cy.loginAsViewerUser();
before(() => {
synthtrace.index(
opbeans({
from: new Date(start).getTime(),
to: new Date(end).getTime(),
})
);
});
describe.skip('when data is not loaded', () => {
describe('when there is no data', () => {
beforeEach(() => {
cy.loginAsViewerUser();
});
it('shows empty message', () => {
cy.visitKibana(serviceOverviewHref);
cy.contains('opbeans-java');
cy.visitKibana(testServiveHref);
cy.contains('test-service');
cy.get('[data-test-subj="serviceInstancesTableContainer"]').contains(
'No items found'
'No instances found'
);
});
});
describe('when is RUM service', () => {
beforeEach(() => {
cy.loginAsViewerUser();
});
it('hides instances table', () => {
cy.visitKibana(serviceRumOverviewHref);
cy.contains('opbeans-rum');
cy.get('[data-test-subj="serviceInstancesTableContainer"]').should(
'not.exist'
);
});
});
describe('when data is loaded', () => {
before(() => {
synthtrace.index(
opbeans({
from: new Date(start).getTime(),
to: new Date(end).getTime(),
})
);
beforeEach(() => {
cy.loginAsViewerUser();
});
after(() => {
@ -66,7 +93,7 @@ describe('Instances table', () => {
});
it('has data in the table', () => {
cy.visitKibana(serviceOverviewHref);
cy.visitKibana(serviceJavaOverviewHref);
cy.contains('opbeans-java');
cy.contains(serviceNodeName);
});
@ -75,7 +102,7 @@ describe('Instances table', () => {
cy.intercept('GET', endpoint).as(name);
});
cy.visitKibana(serviceOverviewHref);
cy.visitKibana(serviceJavaOverviewHref);
cy.contains('opbeans-java');
cy.wait('@instancesMainRequest');
@ -91,12 +118,12 @@ describe('Instances table', () => {
});
});
it.skip('shows actions available', () => {
it('shows actions available', () => {
apisToIntercept.map(({ endpoint, name }) => {
cy.intercept('GET', endpoint).as(name);
});
cy.visitKibana(serviceOverviewHref);
cy.visitKibana(serviceJavaOverviewHref);
cy.contains('opbeans-java');
cy.wait('@instancesMainRequest');

View file

@ -219,7 +219,7 @@ describe('Service Overview', () => {
cy.visitKibana(baseUrl);
});
it.skip('with the correct environment when changing the environment', () => {
it('with the correct environment when changing the environment', () => {
cy.wait(aliasNames);
cy.intercept('GET', 'internal/apm/suggestions?*').as(
@ -250,7 +250,7 @@ describe('Service Overview', () => {
cy.wait(aliasNames);
});
it.skip('when selecting a different time range and clicking the update button', () => {
it('when selecting a different time range and clicking the update button', () => {
cy.wait(aliasNames);
const timeStart = moment(start).subtract(5, 'm').toISOString();

View file

@ -50,7 +50,7 @@ const apisToIntercept = [
},
];
describe.skip('Service overview: Time Comparison', () => {
describe('Service overview: Time Comparison', () => {
before(() => {
synthtrace.index(
opbeans({
@ -65,6 +65,29 @@ describe.skip('Service overview: Time Comparison', () => {
});
beforeEach(() => {
cy.intercept(
'GET',
'/internal/apm/services/opbeans-java/transactions/charts/latency?*'
).as('latencyChartRequest');
cy.intercept('GET', '/internal/apm/services/opbeans-java/throughput?*').as(
'throughputChartRequest'
);
cy.intercept(
'GET',
'/internal/apm/services/opbeans-java/transactions/charts/error_rate?*'
).as('errorRateChartRequest');
cy.intercept(
'GET',
'/internal/apm/services/opbeans-java/transactions/groups/detailed_statistics?*'
).as('transactionGroupsDetailedRequest');
cy.intercept(
'POST',
'/internal/apm/services/opbeans-java/errors/groups/detailed_statistics?*'
).as('errorGroupsDetailedRequest');
cy.intercept(
'GET',
'/internal/apm/services/opbeans-java/service_overview_instances/detailed_statistics?*'
).as('instancesDetailedRequest');
cy.loginAsViewerUser();
});
@ -74,57 +97,7 @@ describe.skip('Service overview: Time Comparison', () => {
cy.url().should('include', 'offset=1d');
});
describe('when comparison is toggled off', () => {
it('disables select box', () => {
cy.visitKibana(serviceOverviewHref);
cy.contains('opbeans-java');
// Comparison is enabled by default
cy.get('[data-test-subj="comparisonSelect"]').should('be.enabled');
// toggles off comparison
cy.contains('Comparison').click();
cy.get('[data-test-subj="comparisonSelect"]').should('be.disabled');
});
it('calls APIs without comparison time range', () => {
apisToIntercept.map(({ endpoint, name }) => {
cy.intercept('GET', endpoint).as(name);
});
cy.visitKibana(serviceOverviewHref);
cy.get('[data-test-subj="comparisonSelect"]').should('be.enabled');
const offset = `offset=1d`;
// When the page loads it fetches all APIs with comparison time range
cy.wait(apisToIntercept.map(({ name }) => `@${name}`)).then(
(interceptions) => {
interceptions.map((interception) => {
expect(interception.request.url).include(offset);
});
}
);
cy.contains('opbeans-java');
// toggles off comparison
cy.contains('Comparison').click();
cy.get('[data-test-subj="comparisonSelect"]').should('be.disabled');
// When comparison is disabled APIs are called withou comparison time range
cy.wait(apisToIntercept.map(({ name }) => `@${name}`)).then(
(interceptions) => {
interceptions.map((interception) => {
expect(interception.request.url).not.include(offset);
});
}
);
});
});
it('changes comparison type', () => {
apisToIntercept.map(({ endpoint, name }) => {
cy.intercept('GET', endpoint).as(name);
});
cy.visitKibana(serviceOverviewPath);
cy.contains('opbeans-java');
// opens the page with "Day before" selected
@ -186,9 +159,6 @@ describe.skip('Service overview: Time Comparison', () => {
});
it('hovers over throughput chart shows previous and current period', () => {
apisToIntercept.map(({ endpoint, name }) => {
cy.intercept('GET', endpoint).as(name);
});
cy.visitKibana(
url.format({
pathname: serviceOverviewPath,
@ -209,4 +179,48 @@ describe.skip('Service overview: Time Comparison', () => {
cy.contains('Throughput');
cy.contains('0 tpm');
});
describe('when comparison is toggled off', () => {
it('disables select box', () => {
cy.visitKibana(serviceOverviewHref);
cy.contains('opbeans-java');
// Comparison is enabled by default
cy.get('[data-test-subj="comparisonSelect"]').should('be.enabled');
// toggles off comparison
cy.contains('Comparison').click();
cy.get('[data-test-subj="comparisonSelect"]').should('be.disabled');
});
it('calls APIs without comparison time range', () => {
cy.visitKibana(serviceOverviewHref);
cy.get('[data-test-subj="comparisonSelect"]').should('be.enabled');
const offset = `offset=1d`;
// When the page loads it fetches all APIs with comparison time range
cy.wait(apisToIntercept.map(({ name }) => `@${name}`)).then(
(interceptions) => {
interceptions.map((interception) => {
expect(interception.request.url).include(offset);
});
}
);
cy.contains('opbeans-java');
// toggles off comparison
cy.contains('Comparison').click();
cy.get('[data-test-subj="comparisonSelect"]').should('be.disabled');
// When comparison is disabled APIs are called withou comparison time range
cy.wait(apisToIntercept.map(({ name }) => `@${name}`)).then(
(interceptions) => {
interceptions.map((interception) => {
expect(interception.request.url).not.include(offset);
});
}
);
});
});
});

View file

@ -166,7 +166,7 @@ export function ServiceOverviewInstancesTable({
>
<EuiBasicTable
noItemsMessage={
isLoading
status === FETCH_STATUS.LOADING
? i18n.translate('xpack.apm.serviceOverview.loadingText', {
defaultMessage: 'Loading…',
})