Skip to content

Commit c3cbed8

Browse files
authored
test: [DBAAS1-1386] - Fix cypress test failing for cds select component (#13199)
1 parent f399c85 commit c3cbed8

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

packages/manager/cypress/e2e/core/databases/update-database.spec.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,15 @@ const modifyMaintenanceWindow = (label: string, windowValue: string) => {
187187
.should('be.visible')
188188
.should('be.disabled');
189189

190-
ui.autocomplete.findByLabel(label).should('be.visible').type(windowValue);
191-
cy.contains(windowValue).should('be.visible').click();
190+
// Open the dropdown via shadow DOM
191+
ui.cdsAutoComplete.findByLabel(label, 'input[role="combobox"]').click();
192+
193+
// Select the value from the dropdown
194+
ui.cdsAutoComplete
195+
.findByLabel(label, '[role="listbox"]')
196+
.contains(windowValue)
197+
.click();
198+
192199
ui.cdsButton.findButtonByTitle('Save Changes').then((btn) => {
193200
btn[0].click(); // Native DOM click
194201
});
@@ -343,7 +350,7 @@ const validateActionItems = (state: string, label: string) => {
343350
};
344351

345352
// eslint-disable-next-line sonarjs/no-skipped-tests
346-
describe.skip('Update database clusters', () => {
353+
describe('Update database clusters', () => {
347354
beforeEach(() => {
348355
mockAppendFeatureFlags({
349356
databaseVpc: true,

packages/manager/cypress/support/ui/autocomplete.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,24 @@ export const autocomplete = {
4343
},
4444
};
4545

46+
export const cdsAutoComplete = {
47+
/**
48+
* Finds a cds select component within shadow DOM by its title and returns the Cypress chainable.
49+
*
50+
* @param cdsSelectLabel - Title of cds button to find
51+
* @param role - Role of the element to find within the shadow DOM (e.g., 'combobox', 'listbox')
52+
*
53+
* @returns Cypress chainable.
54+
*/
55+
findByLabel: (label: string, role: string): Cypress.Chainable => {
56+
return cy
57+
.get(`[data-qa-autocomplete="${label}"] cds-select`)
58+
.shadow()
59+
.find(`${role}`)
60+
.should('be.visible');
61+
},
62+
};
63+
4664
/**
4765
* Autocomplete Popper UI element.
4866
*

0 commit comments

Comments
 (0)