Skip to content

Commit fe863bc

Browse files
committed
Use more intentional css selectors
The prior selectors made the test difficult to understand due to poor naming. Use: ~ for siblings (of a very distinct element) (We could also give dropdowns more distinct data-* values) " " space for descendants > parent / child
1 parent 2b77afb commit fe863bc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

cypress/e2e/ui/Overview/reports.cy.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,22 @@ describe('Overview > Reports Tests', () => {
3232
let columns = [];
3333
let tableName = '';
3434

35-
cy.get(':nth-child(3) > .col-md-8 > .btn-group > .btn').click({force: true});
36-
cy.get(':nth-child(3) > .col-md-8 > .btn-group > .open > .dropdown-menu > [data-original-index="1"] > a').then((option) => {
35+
cy.get('.btn[data-id="chosen_model"]').click({ force: true });
36+
cy.get('.btn[data-id="chosen_model"] ~ .dropdown-menu [data-original-index="1"] > a').then((option) => {
3737
cy.get(option).click({ force: true });
3838
basedOn = option[0].innerText;
3939
tableName = basedOn.substring(0, basedOn.length - 1).replace(' ', '');
4040
});
41-
cy.get('[align="left"] > .btn-group > .btn').click({ force: true });
42-
cy.get('[align="left"] > .btn-group > .open > .dropdown-menu > [data-original-index="0"] > a > .text').then((option) => {
41+
cy.get('.btn[data-id="available_fields"]').click({ force: true });
42+
cy.get('.btn[data-id="available_fields"] ~ .dropdown-menu [data-original-index="0"] > a > .text').then((option) => {
4343
cy.get(option).click({ force: true });
4444
columns.push(option[0].innerText.trim());
4545
});
46-
cy.get('[align="left"] > .btn-group > .open > .dropdown-menu > [data-original-index="1"] > a > .text').then((option) => {
46+
cy.get('.btn[data-id="available_fields"] ~ .dropdown-menu [data-original-index="1"] > a > .text').then((option) => {
4747
cy.get(option).click({ force: true });
4848
columns.push(option[0].innerText.trim());
4949
});
50-
cy.get('[align="left"] > .btn-group > .btn > .filter-option').click({ force: true});
50+
cy.get('.btn[data-id="available_fields"]').click({ force: true});
5151
cy.intercept('/report/form_field_changed/new?button=right').as('fieldsChanged');
5252
cy.get('[alt="Move selected fields down"]').click({force: true});
5353
cy.wait('@fieldsChanged').then(() => {

0 commit comments

Comments
 (0)