Skip to content

Commit

Permalink
Merge pull request #187 from makeen-project/feature_ALS-1781_responsi…
Browse files Browse the repository at this point in the history
…ve_demo_cases

[Enhancements] Responsive automation
  • Loading branch information
wadhawh authored May 30, 2024
2 parents 0e370fb + d6a49d3 commit 8bcd4e7
Show file tree
Hide file tree
Showing 17 changed files with 361 additions and 297 deletions.
17 changes: 11 additions & 6 deletions cypress/e2e/pinpointAnalytics.cy.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
/* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. */
/* SPDX-License-Identifier: MIT-0 */

import { Viewport } from "../support/constants";

describe("Should record user events correctly", () => {
context("Desktop view", () => {
beforeEach(() => {
cy.visitDomain(`${Cypress.env("WEB_DOMAIN")}/demo`);
});

it("PPA-001 - should successfully send correct user event to pinpoint", () => {
cy.sendCorrectEventToPinpoint(false);
cy.sendCorrectEventToPinpoint(Viewport.DESKTOP);
});

it("PPA-002 - should successfully create correct endpoint with the correct event to correct pinpoint application", () => {
cy.getAllLocalStorage().then(result => {
const analyticsEndpointId = result[`${Cypress.env("WEB_DOMAIN")}`]["amazon-location_analyticsEndpointId"];
Expand All @@ -20,7 +25,7 @@ describe("Should record user events correctly", () => {
}
}).then(result => {
cy.task("log", { result });

if (result.stdout) {
const response = JSON.parse(result.stdout);
expect(response["$metadata"]["httpStatusCode"]).to.equal(200);
Expand All @@ -36,9 +41,9 @@ describe("Should record user events correctly", () => {
beforeEach(() => {
cy.visitDomainInResponsiveView(`${Cypress.env("WEB_DOMAIN")}/demo`);
});

it("PPA-003 - should successfully send correct user event to pinpoint", () => {
cy.sendCorrectEventToPinpoint(true);
cy.sendCorrectEventToPinpoint(Viewport.RESPONSIVE);
});
});
});
2 changes: 1 addition & 1 deletion cypress/e2e/unauthUserCanAccessLimitedFunctionality.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe("Unauthorized users have limited permissions", () => {
context("Responsive view", () => {
it("UULP-002 - shouldn't allow unauth users to use tracker and geofence", { scrollBehavior: false }, () => {
cy.visitDomainInResponsiveView(`${Cypress.env("WEB_DOMAIN")}/demo`);
cy.openResponsiveMenu('[data-testid="bottomsheet"]')
cy.openResponsiveMenu('[data-testid="bottomsheet"]');
cy.get(awsAccountButtonLocator).should("exist");
});
});
Expand Down
12 changes: 7 additions & 5 deletions cypress/e2e/unauthUserCanAccessSimulation.cy.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
/* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. */
/* SPDX-License-Identifier: MIT-0 */

import { Viewport } from "../support/constants";

describe("Unauth Simulation", () => {
context("Desktop view", () => {
beforeEach(() => {
cy.visitDomain(`${Cypress.env("WEB_DOMAIN")}/demo`);
});

it("US-001 - should allow user to use unauth simulation", () => {
cy.useUnauthSimulation(false)
cy.useUnauthSimulation(Viewport.DESKTOP);
});
});

context("Responsive view", () => {
beforeEach(() => {
cy.visitDomainInResponsiveView(`${Cypress.env("WEB_DOMAIN")}/demo`);
});

it("US-002 - should allow user to use unauth simulation", () => {
cy.useUnauthSimulation(true)
cy.useUnauthSimulation(Viewport.RESPONSIVE);
});
});
});
});
14 changes: 8 additions & 6 deletions cypress/e2e/userIsAbleToConnectAndDisconnectAwsAccount.cy.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
/* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. */
/* SPDX-License-Identifier: MIT-0 */

import { Viewport } from "../support/constants";

describe("Connecting and Disconnecting AWS account", () => {
context("Desktop view", () => {
beforeEach(() => {
cy.visitDomain(`${Cypress.env("WEB_DOMAIN")}/demo`);
cy.connectAwsAccount(false);
cy.connectAwsAccount(Viewport.DESKTOP);
});

it("CDAA-001 - should allow user to connect, sign-in, sign-out and disconnect AWS account from sidebar", () => {
cy.signOutAndDisconnectFromAwsAccount(false);
cy.signOutAndDisconnectFromAwsAccount(Viewport.DESKTOP);
});
});

context("Responsive view", () => {
beforeEach(() => {
cy.visitDomainInResponsiveView(`${Cypress.env("WEB_DOMAIN")}/demo`);
cy.connectAwsAccount(true);
cy.connectAwsAccount(Viewport.RESPONSIVE);
});

it("CDAA-002 - should allow user to connect, sign-in, sign-out and disconnect AWS account from sidebar", () => {
cy.signOutAndDisconnectFromAwsAccount(true);
cy.signOutAndDisconnectFromAwsAccount(Viewport.RESPONSIVE);
});
});
});
48 changes: 28 additions & 20 deletions cypress/e2e/userIsAbleToSearch.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ describe("Search", () => {
cy.visitDomain(`${Cypress.env("WEB_DOMAIN")}/demo`);
cy.get('[placeholder="Search"]').click();
});

it("DS-001 - should allow user to view the list of search results once search is performed", { scrollBehavior: false }, () => {
cy.get('[inputmode="search"]').type("gramercy park music school USA");
cy.get('[class="amplify-scrollview amplify-autocomplete__menu" ]').should("be.visible");
});


it(
"DS-001 - should allow user to view the list of search results once search is performed",
{ scrollBehavior: false },
() => {
cy.get('[inputmode="search"]').type("gramercy park music school USA");
cy.get('[class="amplify-scrollview amplify-autocomplete__menu" ]').should("be.visible");
}
);

it(
"DS-002 - should allow user to search an address and view the information popup after selecting a suggestion",
{ scrollBehavior: false },
Expand All @@ -25,12 +29,12 @@ describe("Search", () => {
cy.get('[class="mapboxgl-popup popup-container mapboxgl-popup-anchor-left"]').should("be.visible");
}
);

it("DS-003 - should allow user to search by geocode", { scrollBehavior: false }, () => {
cy.get('[inputmode="search"]').type("-31.9627092,115.9248736").wait(10000).type("{downArrow}").type("{enter}");
cy.get('[class="mapboxgl-popup popup-container mapboxgl-popup-anchor-left"]').should("be.visible");
});

it("DS-004 - should allow user to view the POIs after a search", { scrollBehavior: false }, () => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
Cypress.on("uncaught:exception", (err, runnable) => {
Expand All @@ -43,12 +47,12 @@ describe("Search", () => {
cy.wait(2000);
}
});

it("DS-005 - should show user an error message when no search text is present", { scrollBehavior: false }, () => {
cy.get('[inputmode="search"]').type("{enter}");
cy.get("div").should("contain", "Failed to search place by text, 'Text' must have length at least 1");
});

it.skip("should enable nl search and allow user to view POI after nl search", { scrollBehavior: false }, () => {
cy.get('[id="nl-search"]').click();
cy.get('[placeholder="Search"]').click();
Expand All @@ -62,28 +66,32 @@ describe("Search", () => {
cy.visitDomainInResponsiveView(`${Cypress.env("WEB_DOMAIN")}/demo`);
cy.get('[placeholder="Search"]').click();
});

it("DS-006 - should allow user to view the list of search results once search is performed", { scrollBehavior: false }, () => {
cy.get('[data-testid="search-box-input"]').type("gramercy park music school USA");
cy.get('[data-testid="search-suggestions"]').should("be.visible");
});


it(
"DS-006 - should allow user to view the list of search results once search is performed",
{ scrollBehavior: false },
() => {
cy.get('[data-testid="search-box-input"]').type("gramercy park music school USA");
cy.get('[data-testid="search-suggestions"]').should("be.visible");
}
);

it(
"DS-007 - should allow user to search an address and view the information popup after selecting a suggestion",
{ scrollBehavior: false },
() => {
cy.get('[data-testid="search-box-input"]').type("gramercy park music school USA")
cy.get('[data-testid="search-box-input"]').type("gramercy park music school USA");
cy.get('[data-testid="search-suggestions"]').click();
cy.get('[data-testid="poi-body"]').should("be.visible");
}
);

it("DS-008 - should allow user to search by geocode", { scrollBehavior: false }, () => {
cy.get('[data-testid="search-box-input"]').type("-31.9627092,115.9248736");
cy.get('[data-testid="search-suggestions"]').click();
cy.get('[data-testid="poi-body"]').should("be.visible");
});

it("DS-009 - should allow user to view the POIs after a search", { scrollBehavior: false }, () => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
Cypress.on("uncaught:exception", (err, runnable) => {
Expand All @@ -97,7 +105,7 @@ describe("Search", () => {
cy.wait(2000);
}
});

it("DS-010 - should show user an error message when no search text is present", { scrollBehavior: false }, () => {
cy.get('[data-testid="search-box-input"]').type("{enter}");
cy.get("div").should("contain", "Failed to search place by text, 'Text' must have length at least 1");
Expand Down
14 changes: 8 additions & 6 deletions cypress/e2e/userIsAbleToUseGeofence.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@

import { faker } from "@faker-js/faker";

import { Viewport } from "../support/constants";

describe("Geofence", () => {
context("Desktop view", () => {
const geofenceName = faker.random.word();

beforeEach(() => {
cy.visitDomain(`${Cypress.env("WEB_DOMAIN")}/demo`);
cy.connectAwsAccount(false);
cy.connectAwsAccount(Viewport.DESKTOP);
});

it("GF-001 - should allow user to add, edit and delete geofence", () => {
cy.addEditAndDeleteGeofence(false, geofenceName);
cy.addEditAndDeleteGeofence(Viewport.DESKTOP, geofenceName);
});
});

Expand All @@ -22,11 +24,11 @@ describe("Geofence", () => {

beforeEach(() => {
cy.visitDomainInResponsiveView(`${Cypress.env("WEB_DOMAIN")}/demo`);
cy.connectAwsAccount(true,);
cy.connectAwsAccount(Viewport.RESPONSIVE);
});

it("GF-002 - should allow user to add, edit and delete geofence", () => {
cy.addEditAndDeleteGeofence(true, geofenceName);
cy.addEditAndDeleteGeofence(Viewport.RESPONSIVE, geofenceName);
});
});
});
30 changes: 16 additions & 14 deletions cypress/e2e/userIsAbleToUseRoute.cy.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
/* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. */
/* SPDX-License-Identifier: MIT-0 */

import { Viewport } from "../support/constants";

describe("Route", () => {
context("Desktop view", () => {
beforeEach(() => {
cy.visitDomain(`${Cypress.env("WEB_DOMAIN")}/demo`);
cy.get('[class="amplify-flex icon outter-end-component"]').click();
cy.wait(2000);
});

it(
"R-001 - should allow user to perform a route search and is able to select current location if enabled",
{ scrollBehavior: false },
() => {
cy.searchRouteAndSelectCurrentLocation();
}
);

it("R-002 - should allow user to swap the departure and destination addresses", { scrollBehavior: false }, () => {
cy.swapDepartureAndDestinationAddresses();
});

it("R-003 - should allow user to select any of the route modes from car, walk and truck", () => {
cy.canSelectAnyRouteMode();
});

it("R-004 - should allow user to search for route with avoid toll route option", () => {
cy.searchRouteWithAvoidTollOption(false)
cy.searchRouteWithAvoidTollOption(Viewport.DESKTOP);
});

it("R-005 - should allow user to search for route with avoid ferry option", () => {
cy.searchRouteWithAvoidFerryOption(false);
cy.searchRouteWithAvoidFerryOption(Viewport.DESKTOP);
});
});

Expand All @@ -40,29 +42,29 @@ describe("Route", () => {
cy.get('[data-testid="explore-button-container-Routes"]').click();
cy.wait(2000);
});

it(
"R-006 - should allow user to perform a route search and is able to select current location if enabled",
{ scrollBehavior: false },
() => {
cy.searchRouteAndSelectCurrentLocation();
}
);

it("R-007 - should allow user to swap the departure and destination addresses", { scrollBehavior: false }, () => {
cy.swapDepartureAndDestinationAddresses();
});

it("R-008 - should allow user to select any of the route modes from car, walk and truck", () => {
cy.canSelectAnyRouteMode();
});

it("R-009 - should allow user to search for route with avoid toll route option", () => {
cy.searchRouteWithAvoidTollOption(true)
cy.searchRouteWithAvoidTollOption(Viewport.RESPONSIVE);
});

it("R-010 - should allow user to search for route with avoid ferry option", () => {
cy.searchRouteWithAvoidFerryOption(true);
cy.searchRouteWithAvoidFerryOption(Viewport.RESPONSIVE);
});
});
});
Loading

0 comments on commit 8bcd4e7

Please sign in to comment.