Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions tests/cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ declare global {
pfCloseButtonIfExists(ariaLabel?: string, options?: Partial<Loggable & Timeoutable & Withinable & Shadow>): Chainable<void>;
menuToggleContains(text: string | RegExp, options?: Partial<Loggable & Timeoutable & Withinable & Shadow>): Chainable<JQuery<HTMLElement>>;
verifyTraceCount(expectedCount: number | string, options?: Partial<Loggable & Timeoutable & Withinable & Shadow>): Chainable<void>;
// Material-UI specific commands
muiSelect(ariaLabel: string, options?: Partial<Loggable & Timeoutable & Withinable & Shadow>): Chainable<JQuery<HTMLElement>>;
muiSelectOption(optionText: string, options?: Partial<Loggable & Timeoutable & Withinable & Shadow>): Chainable<JQuery<HTMLElement>>;
// Tracing-specific commands
setupTracePage(tempoInstance: string, tenant: string, timeframe?: string, serviceFilter?: string): Chainable<void>;
navigateToTraceDetails(): Chainable<void>;
Expand Down Expand Up @@ -595,6 +598,26 @@ Cypress.Commands.add(
},
);

// Material-UI Select commands

Cypress.Commands.add(
'muiSelect',
(ariaLabel: string, options?: Partial<Loggable & Timeoutable & Withinable & Shadow>) => {
const defaultOptions = { timeout: 10000, ...options };
// Find Material-UI Select component by aria-label (supports partial match)
cy.get(`[role="combobox"][aria-label*="${ariaLabel}"]`, defaultOptions);
},
);

Cypress.Commands.add(
'muiSelectOption',
(optionText: string, options?: Partial<Loggable & Timeoutable & Withinable & Shadow>) => {
const defaultOptions = { timeout: 10000, ...options };
// Find Material-UI Select option by text in the listbox
cy.get('[role="listbox"] [role="option"]', defaultOptions).contains(optionText);
},
);

Cypress.Commands.add(
'pfCloseButton',
(ariaLabel?: string, options?: Partial<Loggable & Timeoutable & Withinable & Shadow>) => {
Expand Down Expand Up @@ -685,8 +708,8 @@ Cypress.Commands.add(

// Set timeframe if provided
if (timeframe) {
cy.pfMenuToggle('Last 30 minutes').click();
cy.pfSelectMenuItem(timeframe).click();
cy.muiSelect('Select time range').click();
cy.muiSelectOption(timeframe).click();
}

// Set service filter if provided
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/dt-plugin-tests.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ describe('OpenShift Distributed Tracing UI Plugin tests', () => {
cy.pfSelectMenuItem('chainsaw-rbac / simplst').click();
cy.pfTypeahead('Select a tenant').click();
cy.pfSelectMenuItem('dev').click();
cy.pfMenuToggle('Last 30 minutes').click();
cy.pfSelectMenuItem('Last 15 minutes').click();
cy.muiSelect('Select time range').click();
cy.muiSelectOption('Last 15 minutes').click();
cy.pfMenuToggle('Service Name').click();
cy.pfMenuToggleByLabel('Multi typeahead checkbox').click();
cy.pfCheckMenuItem('http-rbac-1');
Expand Down Expand Up @@ -403,8 +403,8 @@ describe('OpenShift Distributed Tracing UI Plugin tests', () => {
cy.pfSelectMenuItem('chainsaw-mmo-rbac / mmo-rbac').click();
cy.pfTypeahead('Select a tenant').click();
cy.pfSelectMenuItem('dev').click();
cy.pfMenuToggle('Last').click();
cy.pfSelectMenuItem('Last 1 hour').click();
cy.muiSelect('Select time range').click();
cy.muiSelectOption('Last 1 hour').click();
cy.pfMenuToggle('Service Name').click();
cy.pfMenuToggleByLabel('Multi typeahead checkbox').click();
cy.pfCheckMenuItem('http-rbac-1');
Expand Down