@@ -259,6 +259,20 @@ async function expectSelectorToNotContainHtml (selector: string, html: string) {
259259 expect ( innerHTML ) . not . toContain ( html )
260260}
261261
262+ /**
263+ * Checks that the expected feed version validity dates are displayed.
264+ */
265+ async function expectFeedVersionValidityDates ( startDate : string , endDate : string ) {
266+ await expectSelectorToContainHtml (
267+ '[data-test-id="active-feed-version-validity-start"]' ,
268+ startDate
269+ )
270+ await expectSelectorToContainHtml (
271+ '[data-test-id="active-feed-version-validity-end"]' ,
272+ endDate
273+ )
274+ }
275+
262276/**
263277 * Create a new project. Assumes that this is called while the browser is on
264278 * the home page.
@@ -301,6 +315,7 @@ async function deleteProject (projectId: string) {
301315 // verify deletion
302316 await goto ( `http://localhost:9966/project/${ projectId } ` )
303317 await waitForSelector ( '.project-not-found' )
318+ await wait ( 5000 , 'for previously rendered project markup to be removed' )
304319 await expectSelectorToContainHtml ( '.project-not-found' , projectId )
305320 log . info ( `confirmed successful deletion of project with id ${ projectId } ` )
306321}
@@ -549,6 +564,17 @@ async function pickColor (containerSelector: string, color: string) {
549564 await clearAndType ( `${ containerSelector } input` , color )
550565}
551566
567+ /**
568+ * A helper method to choose a route type
569+ * in the route editor (but not in the feed editor).
570+ */
571+ async function pickRouteType ( containerSelector : string , routeOptionId : string ) {
572+ await click ( `${ containerSelector } a` )
573+ await waitForSelector ( `${ containerSelector } .dropdown-content` )
574+ await waitForSelector ( `[data-test-id="${ routeOptionId } "]` )
575+ await click ( `[data-test-id="${ routeOptionId } "] label` )
576+ }
577+
552578/**
553579 * A helper method to type in an autocomplete value and then select an option
554580 * from an react-select component.
@@ -1085,13 +1111,10 @@ describe('end-to-end', () => {
10851111 await uploadGtfs ( )
10861112
10871113 // wait for main tab to show up with version validity info
1088- await waitForSelector ( '[data-test-id="feed-version-validity"]' )
1114+ await waitForSelector ( '[data-test-id="active- feed-version-validity-start "]' )
10891115
10901116 // verify feed was uploaded
1091- await expectSelectorToContainHtml (
1092- '[data-test-id="feed-version-validity"]' ,
1093- 'Valid from Jan. 01, 2014 to Dec. 31, 2018'
1094- )
1117+ await expectFeedVersionValidityDates ( 'Jan 1, 2014' , 'Dec 31, 2018' )
10951118 } , defaultTestTimeout )
10961119
10971120 // this test also sets the feed source as deployable
@@ -1132,10 +1155,7 @@ describe('end-to-end', () => {
11321155 await wait ( 2000 , 'for feed source to update' )
11331156
11341157 // verify that feed was fetched and processed
1135- await expectSelectorToContainHtml (
1136- '[data-test-id="feed-version-validity"]' ,
1137- 'Valid from Apr. 08, 2018 to Jun. 30, 2018'
1138- )
1158+ await expectFeedVersionValidityDates ( 'Apr 8, 2018' , 'Jun 30, 2018' )
11391159 } , defaultTestTimeout )
11401160
11411161 if ( doNonEssentialSteps ) {
@@ -1245,10 +1265,7 @@ describe('end-to-end', () => {
12451265 await wait ( 2000 , 'for data to refresh' )
12461266 await waitForSelector ( '#feed-source-viewer-tabs' )
12471267 // verify that the previous feed is now the displayed feed
1248- await expectSelectorToContainHtml (
1249- '[data-test-id="feed-version-validity"]' ,
1250- 'Valid from Apr. 08, 2018 to Jun. 30, 2018'
1251- )
1268+ await expectFeedVersionValidityDates ( 'Apr 8, 2018' , 'Jun 30, 2018' )
12521269 } , defaultTestTimeout )
12531270 }
12541271 } )
@@ -1556,11 +1573,6 @@ describe('end-to-end', () => {
15561573 await waitForSelector ( '[data-test-id="route-route_id-input-container"]' )
15571574
15581575 // fill out form
1559- // set status to approved
1560- await page . select (
1561- '[data-test-id="route-status-input-container"] select' ,
1562- '2'
1563- )
15641576
15651577 // set public to yes
15661578 await page . select (
@@ -1593,9 +1605,9 @@ describe('end-to-end', () => {
15931605 )
15941606
15951607 // route type
1596- await page . select (
1597- '[data-test-id="route-route_type-input-container"] select ' ,
1598- '3'
1608+ await pickRouteType (
1609+ '[data-test-id="route-route_type-input-container"]' ,
1610+ 'route-type-option- 3'
15991611 )
16001612
16011613 // route color
@@ -1622,6 +1634,13 @@ describe('end-to-end', () => {
16221634 'example.branding.test'
16231635 )
16241636
1637+ // Set status to approved so the route is exported to a snapshot.
1638+ // Do this last, otherwise the approved status will change back to in-progress.
1639+ await page . select (
1640+ '[data-test-id="route-status-input-container"] select' ,
1641+ '2'
1642+ )
1643+
16251644 // save
16261645 await click ( '[data-test-id="save-entity-button"]' )
16271646 await wait ( 2000 , 'for save to happen' )
@@ -1648,6 +1667,13 @@ describe('end-to-end', () => {
16481667 ' updated'
16491668 )
16501669
1670+ // Set status to approved so the route is exported to a snapshot.
1671+ // Do this last, otherwise the approved status will change back to in-progress.
1672+ await page . select (
1673+ '[data-test-id="route-status-input-container"] select' ,
1674+ '2'
1675+ )
1676+
16511677 // save
16521678 await click ( '[data-test-id="save-entity-button"]' )
16531679 await wait ( 2000 , 'for save to happen' )
@@ -2338,10 +2364,14 @@ describe('end-to-end', () => {
23382364
23392365 // add 1st stop
23402366 await reactSelectOption ( '.pattern-stop-card' , 'la' , 1 , true )
2367+ await wait ( 500 , 'for 1st stop to be selected' )
2368+ await click ( '[data-test-id="add-pattern-stop-button"]' )
23412369 await wait ( 2000 , 'for 1st stop to save' )
23422370
23432371 // add 2nd stop
23442372 await reactSelectOption ( '.pattern-stop-card' , 'ru' , 1 , true )
2373+ await wait ( 500 , 'for 2nd stop to be selected' )
2374+ await click ( '[data-test-id="add-pattern-stop-button"]' )
23452375 await wait ( 2000 , 'for auto-save to happen' )
23462376
23472377 // reload to make sure stuff was saved
@@ -2653,13 +2683,10 @@ describe('end-to-end', () => {
26532683 await click ( '#feed-source-viewer-tabs-tab-' )
26542684
26552685 // wait for main tab to show up with version validity info
2656- await waitForSelector ( '[data-test-id="feed-version-validity"]' )
2686+ await waitForSelector ( '[data-test-id="active- feed-version-validity-start "]' )
26572687
26582688 // verify that snapshot was made active version
2659- await expectSelectorToContainHtml (
2660- '[data-test-id="feed-version-validity"]' ,
2661- 'Valid from May. 29, 2018 to May. 29, 2028'
2662- )
2689+ await expectFeedVersionValidityDates ( 'May 29, 2018' , 'May 29, 2028' )
26632690 } , defaultTestTimeout , 'should create snapshot' )
26642691
26652692 // TODO: download and validate gtfs??
@@ -2688,7 +2715,10 @@ describe('end-to-end', () => {
26882715 '[data-test-id="deployment-router-id"]'
26892716 )
26902717 // get rid of router id text and react tags
2691- routerId = innerHTML . replace ( 'Router ID: ' , '' )
2718+ // (remove any square brackets too)
2719+ routerId = innerHTML
2720+ . replace ( 'Router ID: ' , '' )
2721+ . replace ( / [ [ \] ] / g, '' )
26922722
26932723 // confirm deployment
26942724 await click ( '[data-test-id="confirm-deploy-server-button"]' )
@@ -2698,9 +2728,11 @@ describe('end-to-end', () => {
26982728 } , defaultTestTimeout + 30000 ) // Add thirty seconds for deployment job
26992729
27002730 makeEditorEntityTest ( 'should be able to do a trip plan on otp' , async ( ) => {
2731+ await wait ( 15000 , 'for OTP to pick up the newly-built graph' )
27012732 // hit the otp endpoint
2733+ const url = `${ OTP_ROOT } ${ routerId } /plan?fromPlace=37.04532992924222%2C-122.07542181015015&toPlace=37.04899494106061%2C-122.07432746887208&time=00%3A32&date=2018-07-24&mode=TRANSIT%2CWALK&maxWalkDistance=804.672&arriveBy=false&wheelchair=false&locale=en`
27022734 const response = await fetch (
2703- ` ${ OTP_ROOT } ${ routerId } /plan?fromPlace=37.04532992924222%2C-122.07542181015015&toPlace=37.04899494106061%2C-122.07432746887208&time=12%3A32am&date=07-24-2018&mode=TRANSIT%2CWALK&maxWalkDistance=804.672&arriveBy=false&wheelchair=false&locale=en` ,
2735+ url ,
27042736 {
27052737 headers : {
27062738 'Content-Type' : 'application/json; charset=utf-8'
0 commit comments