Skip to content

Commit

Permalink
fixed failing E2E tests
Browse files Browse the repository at this point in the history
  • Loading branch information
its-aazizi committed Aug 25, 2023
1 parent 1b83bb2 commit 17736d5
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 18 deletions.
4 changes: 2 additions & 2 deletions cypress/e2e/unauthUserCanAccessSimulation.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ describe("Unauth Simulation", () => {
{ timeout: 20000 }
)
.should("be.visible")
.click({ multiple: true });
.click({ multiple: true, force: true });
cy.get(
'[class="Toastify__toast Toastify__toast-theme--dark Toastify__toast--info Toastify__toast--close-on-click exit-geofence"]',
{ timeout: 20000 }
)
.should("be.visible")
.click({ multiple: true });
.click({ multiple: true, force: true });
cy.wait(2000);
cy.get('[data-testid="pause-button"]').click();
cy.wait(2000);
Expand Down
20 changes: 20 additions & 0 deletions cypress/e2e/userIsAbleToConnectAndDisconnectAwsAccount.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,29 @@ describe("Connecting and Disconnecting AWS account", () => {
});
});
cy.wait(5000);
cy.get('[data-testid="hamburger-menu"]').click();

cy.get("#root").then($root => {
const root = $root.find('[class="amplify-button amplify-field-group__control amplify-button--primary"]');
root.length && root[0].innerText === "Sign in"
? root[0].click()
: cy.get('[data-testid="hamburger-menu"]').click();
});
cy.wait(5000);

cy.get('[data-testid="hamburger-menu"]').click();
cy.get('[data-testid="sign-out-button"]').click();
cy.wait(5000);
cy.get('[data-testid="hamburger-menu"]').click();

cy.get("#root").then($root => {
const root = $root.find('[class="amplify-button amplify-field-group__control amplify-button--primary"]');
root.length && root[0].innerText === "Sign out"
? root[0].click()
: cy.get('[data-testid="hamburger-menu"]').click();
});
cy.wait(5000);

cy.get('[data-testid="hamburger-menu"]').click();
cy.get('[data-testid="disconnect-aws-account-button"]').click();
cy.wait(10000);
Expand Down
44 changes: 28 additions & 16 deletions cypress/e2e/userIsAbleToUseTracker.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,11 @@ describe("Tracker", () => {
});

it("should allow user to add a tracker and the user should see the notifications for Geofence enter and exit events", () => {
cy.get('[data-testid="hamburger-menu"]').click();
cy.wait(2000);

cy.contains("Tracker").click();
cy.wait(2000);

cy.contains("Continue").click();
cy.wait(2000);

cy.get('[class="amplify-flex geofence-button"]').click();
cy.wait(4000);

cy.get('[placeholder="Enter address or coordinates"]').type("Rio Tinto Perth Western Australia");
cy.get('[placeholder="Enter address or coordinates"]').type("Empire State Building");
cy.wait(4000);
cy.contains("Rio Tinto Operations Centre").click();
cy.contains("Empire State Building").click();
cy.wait(2000);
cy.get('[placeholder="Type unique Geofence Name"]').type(`${geofenceName}`);
cy.wait(2000);
Expand All @@ -79,16 +69,20 @@ describe("Tracker", () => {
cy.get('[class="amplify-flex geofence-card-close"]').click();
cy.wait(500);

cy.get('[data-testid="hamburger-menu"]').click();
cy.wait(2000);
cy.contains("Tracker").click();
cy.wait(2000);
cy.contains("Continue").click();
cy.wait(2000);
cy.get('[class="mapboxgl-canvas"]').click("left", { force: true });
cy.wait(2000);
cy.get('[class="mapboxgl-canvas"]').click("right", { force: true });
cy.wait(2000);
cy.get('[class="mapboxgl-canvas"]').click("right", { force: true });
cy.wait(2000);

cy.contains("Save").click();
cy.wait(2000);

cy.get('[class="amplify-button amplify-field-group__control amplify-button--primary play-pause-button"]').click();
cy.wait(2000);

Expand All @@ -97,19 +91,37 @@ describe("Tracker", () => {
{ timeout: 50000 }
)
.should("be.visible")
.click({ multiple: true });
.click({ multiple: true, force: true });

cy.get(
'[class="Toastify__toast Toastify__toast-theme--dark Toastify__toast--info Toastify__toast--close-on-click exit-geofence"]',
{ timeout: 50000 }
)
.should("be.visible")
.click({ multiple: true });
.click({ multiple: true, force: true });

cy.wait(2000);
cy.get('[data-testid="auth-tracker-box-close"]').click();

cy.get('[class="amplify-flex geofence-button"]').click();
cy.wait(2000);
cy.contains("Go Back").click();
cy.wait(2000);
cy.get(`[data-testid="icon-trash-${geofenceName}"]`).click({ force: true });
cy.get('[class="amplify-flex geofence-card-close"]').click();

cy.get('[data-testid="hamburger-menu"]').click();
cy.get('[data-testid="sign-out-button"]').click();
cy.get('[data-testid="hamburger-menu"]').click();

cy.get("#root").then($root => {
const root = $root.find('[class="amplify-button amplify-field-group__control amplify-button--primary"]');
root.length && root[0].innerText === "Sign out"
? root[0].click()
: cy.get('[data-testid="hamburger-menu"]').click();
});
cy.wait(5000);

cy.get('[data-testid="hamburger-menu"]').click();
cy.get('[data-testid="disconnect-aws-account-button"]').click();
});
Expand Down

0 comments on commit 17736d5

Please sign in to comment.