Skip to content

Commit 60296ed

Browse files
Merge pull request #801 from ibi-group/fix-e2e-tests
Fix e2e tests
2 parents 18ceca3 + 2e79605 commit 60296ed

File tree

2 files changed

+30
-12
lines changed

2 files changed

+30
-12
lines changed

__tests__/end-to-end.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,11 +1573,6 @@ describe('end-to-end', () => {
15731573
await waitForSelector('[data-test-id="route-route_id-input-container"]')
15741574

15751575
// fill out form
1576-
// set status to approved
1577-
await page.select(
1578-
'[data-test-id="route-status-input-container"] select',
1579-
'2'
1580-
)
15811576

15821577
// set public to yes
15831578
await page.select(
@@ -1639,6 +1634,13 @@ describe('end-to-end', () => {
16391634
'example.branding.test'
16401635
)
16411636

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+
16421644
// save
16431645
await click('[data-test-id="save-entity-button"]')
16441646
await wait(2000, 'for save to happen')
@@ -1665,6 +1667,13 @@ describe('end-to-end', () => {
16651667
' updated'
16661668
)
16671669

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+
16681677
// save
16691678
await click('[data-test-id="save-entity-button"]')
16701679
await wait(2000, 'for save to happen')
@@ -2640,9 +2649,6 @@ describe('end-to-end', () => {
26402649
// wait for dialog to appear
26412650
await waitForSelector('[data-test-id="snapshot-dialog-name"]')
26422651

2643-
// confirm that we want to publish with unapproved routes
2644-
await click('[data-test-id="confirmPublishWithUnapproved"]')
2645-
26462652
// enter name
26472653
await type('[data-test-id="snapshot-dialog-name"]', 'test-snapshot')
26482654

__tests__/test-utils/setup-e2e.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ const {
2020
} = require('./utils')
2121

2222
const serverJarFilename = 'dt-latest-dev.jar'
23+
const otpJarMavenUrl = 'https://repo1.maven.org/maven2/org/opentripplanner/otp/1.4.0/otp-1.4.0-shaded.jar'
24+
const otpJarForOtpRunner = '/opt/otp/otp-v1.4.0'
2325
const ENV_YML_VARIABLES = [
2426
'AUTH0_CLIENT_ID',
2527
'AUTH0_DOMAIN',
@@ -333,10 +335,7 @@ async function startOtp () {
333335
console.log('downloading otp jar')
334336

335337
// download otp
336-
await downloadFile(
337-
'https://repo1.maven.org/maven2/org/opentripplanner/otp/1.4.0/otp-1.4.0-shaded.jar',
338-
otpJarFilename
339-
)
338+
await downloadFile(otpJarMavenUrl, otpJarFilename)
340339

341340
console.log('starting otp')
342341
// Ensure default folder for graphs exists.
@@ -407,6 +406,19 @@ async function verifySetupForLocalEnvironment () {
407406
}
408407
]
409408

409+
// Make sure that certain e2e folders have permissions (assumes running on Linux/MacOS).
410+
const desiredMode = 0o2777
411+
await fs.ensureDir('/tmp/otp', desiredMode) // For otp-runner manifest files
412+
await fs.ensureDir('/tmp/otp/graphs', desiredMode) // For OTP graph
413+
await fs.ensureDir('/var/log', desiredMode) // For otp-runner log
414+
await fs.ensureDir('/opt/otp', desiredMode) // For OTP jar referenced by otp-runner
415+
416+
// Download OTP jar into /opt/otp/ if not already present.
417+
const otpJarExists = await fs.exists(otpJarForOtpRunner)
418+
if (!otpJarExists) {
419+
await downloadFile(otpJarMavenUrl, otpJarForOtpRunner)
420+
}
421+
410422
await Promise.all(
411423
endpointChecks.map(
412424
endpoint => (

0 commit comments

Comments
 (0)