From 3f6009ce2b2b3afcfada76663181e75881fba851 Mon Sep 17 00:00:00 2001 From: Cristen Jones Date: Mon, 4 Mar 2024 21:52:56 -0500 Subject: [PATCH] remove redundant Cypress tests --- cypress/e2e/screenshots.cy.js | 17 ------- cypress/e2e/smoke.cy.js | 50 ++----------------- integration/scenarios/find-transit-near-me.js | 3 ++ 3 files changed, 6 insertions(+), 64 deletions(-) delete mode 100644 cypress/e2e/screenshots.cy.js diff --git a/cypress/e2e/screenshots.cy.js b/cypress/e2e/screenshots.cy.js deleted file mode 100644 index 511a862b97..0000000000 --- a/cypress/e2e/screenshots.cy.js +++ /dev/null @@ -1,17 +0,0 @@ -/** Take and compare screenshots of pages and elements. - * If it goes well it might be the basis for some regression tests! - */ - -describe.skip("Screenshots look good:", () => { - afterEach(() => { - cy.takeFullScreenshot(); - }); - - [ - "/", - "/stops/subway" - ] - .forEach((url) => { - it(url, () => { cy.visit(url) }); - }); -}); diff --git a/cypress/e2e/smoke.cy.js b/cypress/e2e/smoke.cy.js index bcb6e4108d..0e3cd5588a 100644 --- a/cypress/e2e/smoke.cy.js +++ b/cypress/e2e/smoke.cy.js @@ -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", () => { /** @@ -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"); @@ -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(); diff --git a/integration/scenarios/find-transit-near-me.js b/integration/scenarios/find-transit-near-me.js index b8c1b8564b..6f76f28fa6 100644 --- a/integration/scenarios/find-transit-near-me.js +++ b/integration/scenarios/find-transit-near-me.js @@ -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); };