Skip to content

Commit 0af6058

Browse files
Merge pull request #709 from ibi-group/dev
Feature Release: September 2 2022
2 parents b2db337 + 60296ed commit 0af6058

File tree

183 files changed

+15503
-5540
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

183 files changed

+15503
-5540
lines changed

.github/issue_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
_**NOTE:** This issue system is intended for reporting bugs and tracking progress in software development. Although this software is licensed with an open-source license, any issue opened here may not be responded to in a timely manner. [Conveyal](https://www.conveyal.com) is unable to provide technical support for custom deployments of this software unless your company has a support contract with us. Please remove this note when creating the issue._
1+
_**NOTE:** This issue system is intended for reporting bugs and tracking progress in software development. Although this software is licensed with an open-source license, any issue opened here may not be dealt with in a timely manner. [IBI Group](https://www.ibigroup.com/) is able to provide technical support for custom deployments of this software. Please contact [Ritesh Warade](mailto:[email protected]?subject=Data%20Tools%20inquiry%20via%20GitHub&body=Name:%20%0D%0AAgency/Company:%20%0D%0ABest%20date/time%20for%20a%20demo/discussion:%20%0D%0ADescription%20of%20needs:%20) if your company or organization is interested in opening a support contract with us. Please remove this note when creating the issue._
22

33
## Observed behavior (please include a screenshot if possible)
44

.github/pull_request_template.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
- [ ] All tests and CI builds passing
88
- [ ] The description lists all relevant PRs included in this release _(remove this if not merging to master)_
99
- [ ] e2e tests are all passing _(remove this if not merging to master)_
10-
- [ ] Code coverage does not significantly worsen (ideally it improves) _(remove this if not merging to master)_
1110

1211
### Description
1312

.github/workflows/node-ci.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Node.js CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test-build-release:
7+
8+
runs-on: ubuntu-latest
9+
# Add postgres for end-to-end
10+
services:
11+
postgres:
12+
image: postgres:10.8
13+
# Set postgres env variables according to test env.yml config
14+
env:
15+
POSTGRES_USER: postgres
16+
POSTGRES_PASSWORD: postgres
17+
POSTGRES_DB: postgres
18+
ports:
19+
- 5432:5432
20+
# Set health checks to wait until postgres has started
21+
options: >-
22+
--health-cmd pg_isready
23+
--health-interval 10s
24+
--health-timeout 5s
25+
--health-retries 5
26+
steps:
27+
- uses: actions/checkout@v2
28+
# install python 3.x in order to have mkdocs properly installed
29+
- uses: actions/setup-python@v2
30+
with:
31+
python-version: '3.x'
32+
- name: Install mkdocs
33+
run: |
34+
pip install mkdocs
35+
mkdocs --version
36+
- name: Use Node.js 12.x
37+
uses: actions/setup-node@v1
38+
with:
39+
node-version: 12.x
40+
- name: Install npm/yarn packages using cache
41+
uses: bahmutov/npm-install@v1
42+
# Inject slug vars, so that we can reference $GITHUB_HEAD_REF_SLUG for branch name
43+
- name: Inject slug/short variables
44+
uses: rlespinasse/[email protected]
45+
- name: Check if End-to-end should run
46+
run: ./scripts/check-if-e2e-should-run-on-ci.sh
47+
- name: Lint code
48+
run: yarn lint
49+
- name: Lint messages
50+
run: yarn lint-messages
51+
- name: Run flow check
52+
run: yarn flow
53+
- name: Run tests
54+
run: yarn test-client
55+
- name: Build with minification
56+
run: yarn run build -- --minify
57+
- name: Build docs
58+
run: mkdocs build
59+
- name: Start MongoDB
60+
if: env.SHOULD_RUN_E2E == 'true'
61+
uses: supercharge/[email protected]
62+
with:
63+
mongodb-version: 4.2
64+
- name: Add aws credentials for datatools-server
65+
if: env.SHOULD_RUN_E2E == 'true'
66+
run: mkdir ~/.aws && printf '%s\n' '[default]' 'aws_access_key_id=${AWS_ACCESS_KEY_ID}' 'aws_secret_access_key=${AWS_SECRET_ACCESS_KEY}' 'region=${AWS_REGION}' > ~/.aws/config
67+
env:
68+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
69+
AWS_REGION: ${{ secrets.AWS_REGION }}
70+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
71+
- name: Install otp-runner
72+
if: env.SHOULD_RUN_E2E == 'true'
73+
run: yarn global add https://github.com/ibi-group/otp-runner.git
74+
- name: Run e2e tests
75+
if: env.SHOULD_RUN_E2E == 'true'
76+
run: yarn test-end-to-end
77+
env:
78+
AUTH0_API_CLIENT: ${{ secrets.AUTH0_API_CLIENT }}
79+
AUTH0_API_SECRET: ${{ secrets.AUTH0_API_SECRET }}
80+
AUTH0_CLIENT_ID: ${{ secrets.AUTH0_CLIENT_ID }}
81+
AUTH0_DOMAIN: ${{ secrets.AUTH0_DOMAIN }}
82+
AUTH0_SECRET: ${{ secrets.AUTH0_SECRET }}
83+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
84+
AWS_REGION: ${{ secrets.AWS_REGION }}
85+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
86+
E2E_AUTH0_PASSWORD: ${{ secrets.E2E_AUTH0_PASSWORD }}
87+
E2E_AUTH0_USERNAME: ${{ secrets.E2E_AUTH0_USERNAME }}
88+
GRAPH_HOPPER_KEY: ${{ secrets.GRAPH_HOPPER_KEY }}
89+
GTFS_DATABASE_PASSWORD: ${{ secrets.GTFS_DATABASE_PASSWORD }}
90+
GTFS_DATABASE_URL: ${{ secrets.GTFS_DATABASE_URL }}
91+
GTFS_DATABASE_USER: ${{ secrets.GTFS_DATABASE_USER }}
92+
LOGS_S3_BUCKET: ${{ secrets.LOGS_S3_BUCKET }}
93+
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
94+
MONGO_DB_NAME: ${{ secrets.MONGO_DB_NAME }}
95+
MS_TEAMS_WEBHOOK_URL: ${{ secrets.MS_TEAMS_WEBHOOK_URL }}
96+
OSM_VEX: ${{ secrets.OSM_VEX }}
97+
RUN_E2E: "true"
98+
S3_BUCKET: ${{ secrets.S3_BUCKET }}
99+
SPARKPOST_EMAIL: ${{ secrets.SPARKPOST_EMAIL }}
100+
SPARKPOST_KEY: ${{ secrets.SPARKPOST_KEY }}
101+
TRANSITFEEDS_KEY: ${{ secrets.TRANSITFEEDS_KEY }}
102+
# At this point, the build is successful.
103+
- name: Semantic Release
104+
env:
105+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
107+
run: yarn semantic-release

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ env.yml-original
2828
.env
2929
!configurations/test/env.yml
3030
scripts/*client.json
31+
32+
# Vs code settings
33+
.vscode/

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx lint-staged

.travis.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# CHANGELOG
2+
----------------------
3+
* Fix timetable previous stop time checks from checking text columns.
4+
* Add feature allowing routing to avoid highways.
5+
* Support Polish language and add initial translations.
6+
* Fix bug displaying null continuous_pickup as '0'.
7+
* Add route type selector with new extended GTFS route types.
8+
* Fix bug to update continuous_pickup/dropoff values correctly.

__tests__/end-to-end.js

Lines changed: 60 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)