From 2e2cf65a4697f1a966da09d467520eb865f065d9 Mon Sep 17 00:00:00 2001 From: Kacper Donat Date: Tue, 10 Dec 2019 17:51:15 +0100 Subject: [PATCH] add test for one stop scenario --- cypress.json | 3 +- cypress/integration/start.spec.ts | 28 +++++++++++++++---- resources/components/finder.html | 2 +- .../Database/GenericStopRepository.php | 6 ++-- src/Provider/Dummy/DummyStopRepository.php | 25 +++++++++++++---- templates/app.html.twig | 4 +-- tsconfig.json | 3 +- 7 files changed, 52 insertions(+), 19 deletions(-) diff --git a/cypress.json b/cypress.json index 59049e5..506f93e 100644 --- a/cypress.json +++ b/cypress.json @@ -1,5 +1,6 @@ { "supportFile": "cypress/support/index.ts", "fixturesFolder": false, - "baseUrl": "http://czydojade.localhost:8080" + "baseUrl": "http://czydojade.localhost:8080/dummy/", + "modifyObstructiveCode": false } \ No newline at end of file diff --git a/cypress/integration/start.spec.ts b/cypress/integration/start.spec.ts index 6e8abd6..cae2b4e 100644 --- a/cypress/integration/start.spec.ts +++ b/cypress/integration/start.spec.ts @@ -1,10 +1,26 @@ -describe("The Start Page", () => { +describe("Get departures for one stop", () => { it("Sucessfully Loads", () => { - cy.visit('/dummy'); + cy.visit('/'); }); - it("Allows to open favourites window", () => { - cy.get('#open_favourites_picker').click(); - cy.get('#favourites_list').should('exist'); - }) + it("Allows to search", () => { + cy.get('.finder input').type("Lipo"); + + cy.get('.finder__stops ul li:first-child').should('contain.text', 'Lipowa') + }); + + it('Allows to pick a stop', () => { + cy.get('.finder__stops ul li:first-child button[data-action="add"]').click(); + + cy.get('#stops li:first-child').should('contain.text', 'Lipowa') + }); + + it ('Shows departures from picked stop', () => { + cy.get('#departures .departures .stop__name').should('contain.text', 'Lipowa'); + }); + + // it("Allows to open favourites window", () => { + // cy.get('#open_favourites_picker').click(); + // cy.get('#favourites_list').should('exist'); + // }) }); \ No newline at end of file diff --git a/resources/components/finder.html b/resources/components/finder.html index eeaaad6..aa90b4f 100644 --- a/resources/components/finder.html +++ b/resources/components/finder.html @@ -22,7 +22,7 @@