Skip to content

Commit

Permalink
Merge pull request #801 from ibi-group/fix-e2e-tests
Browse files Browse the repository at this point in the history
Fix e2e tests
  • Loading branch information
binh-dam-ibigroup authored Jun 20, 2022
2 parents 18ceca3 + 2e79605 commit 60296ed
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 12 deletions.
22 changes: 14 additions & 8 deletions __tests__/end-to-end.js
Original file line number Diff line number Diff line change
Expand Up @@ -1573,11 +1573,6 @@ describe('end-to-end', () => {
await waitForSelector('[data-test-id="route-route_id-input-container"]')

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

// set public to yes
await page.select(
Expand Down Expand Up @@ -1639,6 +1634,13 @@ describe('end-to-end', () => {
'example.branding.test'
)

// Set status to approved so the route is exported to a snapshot.
// Do this last, otherwise the approved status will change back to in-progress.
await page.select(
'[data-test-id="route-status-input-container"] select',
'2'
)

// save
await click('[data-test-id="save-entity-button"]')
await wait(2000, 'for save to happen')
Expand All @@ -1665,6 +1667,13 @@ describe('end-to-end', () => {
' updated'
)

// Set status to approved so the route is exported to a snapshot.
// Do this last, otherwise the approved status will change back to in-progress.
await page.select(
'[data-test-id="route-status-input-container"] select',
'2'
)

// save
await click('[data-test-id="save-entity-button"]')
await wait(2000, 'for save to happen')
Expand Down Expand Up @@ -2640,9 +2649,6 @@ describe('end-to-end', () => {
// wait for dialog to appear
await waitForSelector('[data-test-id="snapshot-dialog-name"]')

// confirm that we want to publish with unapproved routes
await click('[data-test-id="confirmPublishWithUnapproved"]')

// enter name
await type('[data-test-id="snapshot-dialog-name"]', 'test-snapshot')

Expand Down
20 changes: 16 additions & 4 deletions __tests__/test-utils/setup-e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const {
} = require('./utils')

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

// download otp
await downloadFile(
'https://repo1.maven.org/maven2/org/opentripplanner/otp/1.4.0/otp-1.4.0-shaded.jar',
otpJarFilename
)
await downloadFile(otpJarMavenUrl, otpJarFilename)

console.log('starting otp')
// Ensure default folder for graphs exists.
Expand Down Expand Up @@ -407,6 +406,19 @@ async function verifySetupForLocalEnvironment () {
}
]

// Make sure that certain e2e folders have permissions (assumes running on Linux/MacOS).
const desiredMode = 0o2777
await fs.ensureDir('/tmp/otp', desiredMode) // For otp-runner manifest files
await fs.ensureDir('/tmp/otp/graphs', desiredMode) // For OTP graph
await fs.ensureDir('/var/log', desiredMode) // For otp-runner log
await fs.ensureDir('/opt/otp', desiredMode) // For OTP jar referenced by otp-runner

// Download OTP jar into /opt/otp/ if not already present.
const otpJarExists = await fs.exists(otpJarForOtpRunner)
if (!otpJarExists) {
await downloadFile(otpJarMavenUrl, otpJarForOtpRunner)
}

await Promise.all(
endpointChecks.map(
endpoint => (
Expand Down

0 comments on commit 60296ed

Please sign in to comment.