[8.17] [APM][Cypress] Attempt to fix mobile transactions test (#217648) (#217955)

# Backport

This will backport the following commits from `main` to `8.17`:
- [[APM][Cypress] Attempt to fix mobile transactions test
(#217648)](https://github.com/elastic/kibana/pull/217648)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Sergi
Romeu","email":"sergi.romeu@elastic.co"},"sourceCommit":{"committedDate":"2025-04-11T08:28:49Z","message":"[APM][Cypress]
Attempt to fix mobile transactions test (#217648)\n\n##
Summary\n\nCloses
#207040","sha":"429a9db67d361b25f191a67c16775354a0c2d631","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","apm:mobile","backport:all-open","Team:obs-ux-infra_services","v9.1.0"],"title":"[APM][Cypress]
Attempt to fix mobile transactions
test","number":217648,"url":"https://github.com/elastic/kibana/pull/217648","mergeCommit":{"message":"[APM][Cypress]
Attempt to fix mobile transactions test (#217648)\n\n##
Summary\n\nCloses
#207040","sha":"429a9db67d361b25f191a67c16775354a0c2d631"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217648","number":217648,"mergeCommit":{"message":"[APM][Cypress]
Attempt to fix mobile transactions test (#217648)\n\n##
Summary\n\nCloses
#207040","sha":"429a9db67d361b25f191a67c16775354a0c2d631"}}]}]
BACKPORT-->
This commit is contained in:
Sergi Romeu 2025-04-11 14:32:48 +02:00 committed by GitHub
parent a77e876a9d
commit 6de7f8b966
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 28 additions and 31 deletions

View file

@ -21,42 +21,34 @@ const mobileTransactionsPageHref = url.format({
});
describe('Mobile transactions page', () => {
beforeEach(() => {
cy.loginAsViewerUser();
before(() => {
synthtrace.index(
generateMobileData({
from: new Date(start).getTime(),
to: new Date(end).getTime(),
})
);
});
describe('when data is loaded', () => {
before(() => {
synthtrace.index(
generateMobileData({
from: new Date(start).getTime(),
to: new Date(end).getTime(),
})
);
});
after(() => {
synthtrace.clean();
});
after(() => {
synthtrace.clean();
});
it('when click on tab it shows the correct table for each tab', () => {
cy.loginAsViewerUser();
cy.visitKibana(mobileTransactionsPageHref);
cy.waitUntilPageContentIsLoaded();
describe('when click on tab shows correct table', () => {
it('shows version tab', () => {
cy.visitKibana(mobileTransactionsPageHref);
cy.getByTestSubj('apmAppVersionTab').click().should('have.attr', 'aria-selected', 'true');
cy.url().should('include', 'mobileSelectedTab=app_version_tab');
});
cy.getByTestSubj('apmAppVersionTab').click();
cy.getByTestSubj('apmAppVersionTab').should('have.attr', 'aria-selected', 'true');
cy.url().should('include', 'mobileSelectedTab=app_version_tab');
it('shows OS version tab', () => {
cy.visitKibana(mobileTransactionsPageHref);
cy.getByTestSubj('apmOsVersionTab').click().should('have.attr', 'aria-selected', 'true');
cy.url().should('include', 'mobileSelectedTab=os_version_tab');
});
cy.getByTestSubj('apmOsVersionTab').click();
cy.getByTestSubj('apmOsVersionTab').should('have.attr', 'aria-selected', 'true');
cy.url().should('include', 'mobileSelectedTab=os_version_tab');
it('shows devices tab', () => {
cy.visitKibana(mobileTransactionsPageHref);
cy.getByTestSubj('apmDevicesTab').click().should('have.attr', 'aria-selected', 'true');
cy.url().should('include', 'mobileSelectedTab=devices_tab');
});
});
cy.getByTestSubj('apmDevicesTab').click();
cy.getByTestSubj('apmDevicesTab').should('have.attr', 'aria-selected', 'true');
cy.url().should('include', 'mobileSelectedTab=devices_tab');
});
});

View file

@ -161,6 +161,10 @@ Cypress.Commands.add('withHidden', (selector, callback) => {
cy.get(selector).invoke('attr', 'style', '');
});
Cypress.Commands.add('waitUntilPageContentIsLoaded', () => {
cy.getByTestSubj('kbnAppWrapper visibleChrome').find('[aria-busy=false]').should('be.visible');
});
// A11y configuration
const axeConfig = {

View file

@ -25,5 +25,6 @@ declare namespace Cypress {
updateAdvancedSettings(settings: Record<string, unknown>): void;
getByTestSubj(selector: string): Chainable<JQuery<Element>>;
withHidden(selector: string, callback: () => void): void;
waitUntilPageContentIsLoaded(): void;
}
}