-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #185 from makeen-project/feature_ALS-1781_responsi…
…ve_demo_cases [Enhancements] Responsive automation
- Loading branch information
Showing
20 changed files
with
740 additions
and
568 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,44 @@ | ||
describe("Should record user events correctly", () => { | ||
beforeEach(() => { | ||
cy.visitDomain(`${Cypress.env("WEB_DOMAIN")}/demo`); | ||
}); | ||
|
||
it("should successfully send correct user event to pinpoint", () => { | ||
cy.wait(10000); | ||
cy.getAllLocalStorage().then(result => { | ||
const analyticsEndpointId = result[`${Cypress.env("WEB_DOMAIN")}`]["amazon-location_analyticsEndpointId"]; | ||
cy.get('[data-testid="hamburger-menu"]').click(); | ||
cy.wait(2000); | ||
cy.contains("Settings").click(); | ||
cy.intercept("POST", "**/events").as("postPinpointEvents"); | ||
cy.get('[data-testid="option-item-Map style"]').click(); | ||
cy.wait(2000); | ||
cy.get('[data-testid="map-style-item-location.aws.com.demo.maps.HERE.Explore"]').click(); | ||
cy.wait(2000); | ||
cy.wait("@postPinpointEvents").then(intercepted => { | ||
const requestBody = intercepted.request.body; | ||
const responseBody = intercepted.response.body; | ||
expect(Object.values(requestBody["BatchItem"][analyticsEndpointId]["Events"])[0].EventType).to.equal( | ||
"MAP_STYLE_CHANGE" | ||
); | ||
expect(responseBody["Results"][analyticsEndpointId].EndpointItemResponse.Message).to.equal("Accepted"); | ||
expect(responseBody["Results"][analyticsEndpointId].EndpointItemResponse.StatusCode).to.equal(202); | ||
expect(Object.values(responseBody["Results"][analyticsEndpointId].EventsItemResponse)[0].Message).to.equal( | ||
"Accepted" | ||
); | ||
expect(Object.values(responseBody["Results"][analyticsEndpointId].EventsItemResponse)[0].StatusCode).to.equal( | ||
202 | ||
); | ||
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); | ||
}); | ||
|
||
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"]; | ||
cy.exec("node extra/fetch-pinpoint-analytics-events/index.js", { | ||
failOnNonZeroExit: false, | ||
env: { | ||
PINPOINT_IDENTITY_POOL_ID: Cypress.env("PINPOINT_IDENTITY_POOL_ID"), | ||
PINPOINT_APPLICATION_ID: Cypress.env("PINPOINT_APPLICATION_ID"), | ||
ANALYTICS_ENDPOINT_ID: analyticsEndpointId | ||
} | ||
}).then(result => { | ||
cy.task("log", { result }); | ||
|
||
if (result.stdout) { | ||
const response = JSON.parse(result.stdout); | ||
expect(response["$metadata"]["httpStatusCode"]).to.equal(200); | ||
expect(response["EndpointResponse"]["Id"]).to.equal(analyticsEndpointId); | ||
expect(response["EndpointResponse"]["User"]["UserId"]).to.equal(`AnonymousUser:${analyticsEndpointId}`); | ||
} | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
it("should successfully create correct endpoint with the correct event to correct pinpoint application", () => { | ||
cy.wait(10000); | ||
cy.getAllLocalStorage().then(result => { | ||
const analyticsEndpointId = result[`${Cypress.env("WEB_DOMAIN")}`]["amazon-location_analyticsEndpointId"]; | ||
cy.exec("node extra/fetch-pinpoint-analytics-events/index.js", { | ||
failOnNonZeroExit: false, | ||
env: { | ||
PINPOINT_IDENTITY_POOL_ID: Cypress.env("PINPOINT_IDENTITY_POOL_ID"), | ||
PINPOINT_APPLICATION_ID: Cypress.env("PINPOINT_APPLICATION_ID"), | ||
ANALYTICS_ENDPOINT_ID: analyticsEndpointId | ||
} | ||
}).then(result => { | ||
cy.task("log", { result }); | ||
|
||
if (result.stdout) { | ||
const response = JSON.parse(result.stdout); | ||
expect(response["$metadata"]["httpStatusCode"]).to.equal(200); | ||
expect(response["EndpointResponse"]["Id"]).to.equal(analyticsEndpointId); | ||
expect(response["EndpointResponse"]["User"]["UserId"]).to.equal(`AnonymousUser:${analyticsEndpointId}`); | ||
} | ||
}); | ||
context("Responsive view", () => { | ||
beforeEach(() => { | ||
cy.visitDomainInResponsiveView(`${Cypress.env("WEB_DOMAIN")}/demo`); | ||
}); | ||
|
||
it("PPA-003 - should successfully send correct user event to pinpoint", () => { | ||
cy.sendCorrectEventToPinpoint(true); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.