Skip to content

Commit

Permalink
add utils.js file to store functions used in multiple cypress tests
Browse files Browse the repository at this point in the history
Signed-off-by: David Cui <[email protected]>
  • Loading branch information
davidcui1225 committed Dec 9, 2021
1 parent 2c4b73b commit 5637d11
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dashboards-reports/.cypress/integration/01-create.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { visitReportingLandingPage } from "../support/constants";
import { visitReportingLandingPage } from "../support/utils";

describe('Adding sample data', () => {
it('Adds sample data', () => {
Expand Down
2 changes: 1 addition & 1 deletion dashboards-reports/.cypress/integration/03-details.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { visitReportingLandingPage } from "../support/constants";
import { visitReportingLandingPage } from "../support/utils";

describe('Cypress', () => {
it('Visit report definition details page', () => {
Expand Down
8 changes: 0 additions & 8 deletions dashboards-reports/.cypress/support/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,3 @@ export const ADMIN_AUTH = {
username: 'admin',
password: 'admin',
};

export function visitReportingLandingPage() {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/reports-dashboards#/`);
cy.location('pathname', { timeout: 60000 }).should(
'include',
'/reports-dashboards'
);
}
12 changes: 12 additions & 0 deletions dashboards-reports/.cypress/support/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

export function visitReportingLandingPage() {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/reports-dashboards#/`);
cy.location('pathname', { timeout: 60000 }).should(
'include',
'/reports-dashboards'
);
}

0 comments on commit 5637d11

Please sign in to comment.