Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update error load fail test so that webdriver can still connect to app #10673

Merged
merged 2 commits into from Feb 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 10 additions & 5 deletions test/integration/error-load-fail/test/index.test.js
@@ -1,26 +1,31 @@
/* eslint-env jest */
/* global jasmine */
import path from 'path'
import { join } from 'path'
import fs from 'fs-extra'
import webdriver from 'next-webdriver'
import { nextBuild, nextStart, findPort, killApp, check } from 'next-test-utils'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 1
const appDir = path.join(__dirname, '..')
const appDir = join(__dirname, '..')
let app

describe('Failing to load _error', () => {
afterAll(() => killApp(app))

it('handles failing to load _error correctly', async () => {
await nextBuild(appDir)
const buildId = await fs.readFile(join(appDir, '.next/BUILD_ID'), 'utf8')
const appPort = await findPort()
const app = await nextStart(appDir, appPort)
app = await nextStart(appDir, appPort)

const browser = await webdriver(appPort, '/')
await browser.eval(`window.beforeNavigate = true`)

await browser.elementByCss('#to-broken').moveTo()
await browser.waitForElementByCss('script[src*="broken.js"')

// stop app so that _error can't be loaded
await killApp(app)
// remove _error client bundle so that it can't be loaded
await fs.remove(join(appDir, '.next/static/', buildId, 'pages/_error.js'))

await browser.elementByCss('#to-broken').click()

Expand Down