Skip to content
Open
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
64 changes: 25 additions & 39 deletions .cypress/integration/02-edit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,94 +4,80 @@
*/

describe('Cypress', () => {
it('Visit edit page, update name and description', () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/reports-dashboards#/`);
beforeEach(() => {
// Wait before visiting to allow index refresh after previous test's save
cy.wait(5000);
cy.visit(`${Cypress.env('opensearchDashboards')}/app/reports-dashboards#/`, {
timeout: 60000,
});
cy.location('pathname', { timeout: 60000 }).should(
'include',
'/reports-dashboards'
);
// Retry: if the list doesn't load, reload the page
cy.get('body').then(($body) => {
if ($body.find('#reportDefinitionDetailsLink').length === 0) {
cy.wait(5000);
cy.reload();
}
});
cy.get('#reportDefinitionDetailsLink', { timeout: 60000 }).should('exist');
});

cy.wait(12500);

it('Visit edit page, update name and description', () => {
cy.get('#reportDefinitionDetailsLink').first().click();

cy.get('#editReportDefinitionButton').should('exist');

cy.get('#editReportDefinitionButton').click();

cy.url().should('include', 'edit');

cy.wait(1000);

// update the report name
cy.get('#reportSettingsName').type(' update name', { force: true });

Check warning on line 36 in .cypress/integration/02-edit.spec.ts

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls

// update report description
cy.get('#reportSettingsDescription').type(' update description');

cy.get('#editReportDefinitionButton').click({ force: true });

Check warning on line 41 in .cypress/integration/02-edit.spec.ts

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls

cy.wait(12500);

// check that re-direct to home page
cy.get('#reportDefinitionDetailsLink').should('exist');
cy.get('#reportDefinitionDetailsLink', { timeout: 60000 }).should('exist');
});

it('Visit edit page, change report trigger', () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/reports-dashboards#/`);
cy.location('pathname', { timeout: 60000 }).should(
'include',
'/reports-dashboards'
);

cy.wait(12500);

cy.get('#reportDefinitionDetailsLink').first().click();

cy.get('#editReportDefinitionButton').should('exist');

cy.get('#editReportDefinitionButton').click();

cy.url().should('include', 'edit');

cy.wait(1000);
cy.get('#reportDefinitionTriggerTypes > div:nth-child(2)').click({ force: true });
cy.get('#reportDefinitionTriggerTypes > div:nth-child(2)').click({

Check warning on line 55 in .cypress/integration/02-edit.spec.ts

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
force: true,
});

cy.get('#Schedule').check({ force: true });

Check warning on line 59 in .cypress/integration/02-edit.spec.ts

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
cy.get('#editReportDefinitionButton').click({ force: true });

Check warning on line 60 in .cypress/integration/02-edit.spec.ts

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls

cy.wait(12500);

// check that re-direct to home page
cy.get('#reportDefinitionDetailsLink').should('exist');
cy.get('#reportDefinitionDetailsLink', { timeout: 60000 }).should('exist');
});

it('Visit edit page, change report trigger back', () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/reports-dashboards#/`);
cy.location('pathname', { timeout: 60000 }).should(
'include',
'/reports-dashboards'
);

cy.wait(12500);

cy.get('#reportDefinitionDetailsLink').first().click();

cy.get('#editReportDefinitionButton').should('exist');

cy.get('#editReportDefinitionButton').click();

cy.url().should('include', 'edit');

cy.wait(1000);

cy.get('#reportDefinitionTriggerTypes > div:nth-child(1)').click({ force: true });
cy.get('#reportDefinitionTriggerTypes > div:nth-child(1)').click({

Check warning on line 74 in .cypress/integration/02-edit.spec.ts

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
force: true,
});

cy.get('#editReportDefinitionButton').click({ force: true });

Check warning on line 78 in .cypress/integration/02-edit.spec.ts

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls

cy.wait(12500);

// check that re-direct to home page
cy.get('#reportDefinitionDetailsLink').should('exist');
cy.get('#reportDefinitionDetailsLink', { timeout: 60000 }).should('exist');
});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@
"qs": "^6.14.1",
"uuid": "^11.1.1"
}
}
}
Loading