Prometheus: Migrate from aria-label to data-testid for selectors (#78554)

* migrate from aria-label to data-testid for selectors

* fix e2e tests with shared components

* fix e2e tests with more shared components

* pass data-testid to SelectBase component

* pass data-testid to value container and traverse the dom to access the input in e2e
This commit is contained in:
Brendan O'Handley
2023-12-26 13:43:06 -06:00
committed by GitHub
parent f41a0559fa
commit a9f4ffab5d
15 changed files with 52 additions and 57 deletions

View File

@@ -69,11 +69,20 @@ describe('Loki query builder', () => {
e2e.components.QueryBuilder.labelSelect().should('be.visible').click();
// wait until labels are loaded and set on the component before starting to type
cy.wait('@labelsRequest');
e2e.components.QueryBuilder.labelSelect().type('instance{enter}');
e2e.components.QueryBuilder.matchOperatorSelect().should('be.visible').click().type('=~{enter}');
e2e.components.QueryBuilder.labelSelect().children('div').children('input').type('instance{enter}');
e2e.components.QueryBuilder.matchOperatorSelect()
.should('be.visible')
.click()
.children('div')
.children('input')
.type('=~{enter}', { force: true });
e2e.components.QueryBuilder.valueSelect().should('be.visible').click();
cy.wait('@valuesRequest');
e2e.components.QueryBuilder.valueSelect().type('instance1{enter}').type('instance2{enter}');
e2e.components.QueryBuilder.valueSelect()
.children('div')
.children('input')
.type('instance1{enter}')
.type('instance2{enter}');
cy.contains(MISSING_LABEL_FILTER_ERROR_MESSAGE).should('not.exist');
cy.contains(finalQuery).should('be.visible');