Skip to content

Commit

Permalink
remove redundant Cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thecristen committed Mar 5, 2024
1 parent 32414a4 commit 3f6009c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 64 deletions.
17 changes: 0 additions & 17 deletions cypress/e2e/screenshots.cy.js

This file was deleted.

50 changes: 3 additions & 47 deletions cypress/e2e/smoke.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* fail if the page responds in a server error or a 404 error, or if any of the
* endpoints called in the background during the test fail. This group of tests
* is intended to be shallow, with more in-depth functionality tested elsewhere.
*
* More testing done on critical user journeys, in the Playwright end-to-end
* testing scenarios.
*/
describe("passes smoke test", () => {
/**
Expand Down Expand Up @@ -141,31 +144,6 @@ describe("passes smoke test", () => {
}
});

it("transit near me", () => {
cy.intercept("/api/realtime/stops/*").as("getStops"); // slow request
const latitude = 42.351693;
const longitude = -71.066009;
cy.visit("/transit-near-me", {
onBeforeLoad({ navigator }) {
cy.stub(navigator.geolocation, "getCurrentPosition").callsArgWith(0, {
coords: { latitude, longitude }
});
}
});
// find the transit nearby
cy.get('input[placeholder="Enter a location"]').focus();
cy.get(".c-search-bar__my-location").click();
// redirects to results
cy.url().should(
"contain",
`location%5Blatitude%5D=${latitude}&location%5Blongitude%5D=${longitude}`
);
cy.wait("@getStops");
cy.contains("Park St & Tremont St", { timeout: 15000 });
cy.contains("Silver Line");
cy.get("img.leaflet-marker-icon").should("have.length.greaterThan", 0);
});

it("trip planner", () => {
cy.visit("/trip-planner");

Expand Down Expand Up @@ -196,28 +174,6 @@ describe("passes smoke test", () => {
cy.get('img.leaflet-marker-icon[src="/images/icon-map-pin-b.svg"]');
});

// enable retries, since it times out sometimes
it(
"makes trip plans",
{
retries: 3
},
() => {
cy.visit("/trip-planner");
cy.get("#from").click();
cy.contains(".c-search-bar__-suggestion", "South Station").click();
cy.get("#to").click();
cy.contains(".c-search-bar__-suggestion", "Boston Logan Airport").click();
cy.contains("Get trip suggestions").click();
cy.url({ timeout: 10000 }).should("contain", "plan%5Bfrom%5D");
cy.contains("Trips shown are based on your selections");
cy.get(".m-trip-plan-results__itinerary").should(
"have.length.greaterThan",
0
);
}
);

it("alerts page", () => {
cy.visit("/alerts");
cy.contains(".m-alerts__mode-buttons a", "Bus").click();
Expand Down
3 changes: 3 additions & 0 deletions integration/scenarios/find-transit-near-me.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ exports.scenario = async ({ page, baseURL }) => {
await expect
.poll(async () => page.locator("div.m-tnm-sidebar__route").count())
.toBeGreaterThan(0);
await expect
.poll(async () => page.locator("img.leaflet-marker-icon").count())
.toBeGreaterThan(0);
};

0 comments on commit 3f6009c

Please sign in to comment.