forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
234 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ dist | |
node_modules | ||
|
||
# logs | ||
npm-debug.log | ||
*.log | ||
|
||
# coverage | ||
.nyc_output | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* global jasmine, describe, it, expect, beforeAll, afterAll */ | ||
|
||
import { join } from 'path' | ||
import { | ||
nextBuild, | ||
nextExport, | ||
renderViaHTTP, | ||
startStaticServer, | ||
stopApp | ||
} from 'next-test-utils' | ||
import webdriver from 'next-webdriver' | ||
|
||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 40000 | ||
const appDir = join(__dirname, '../') | ||
const context = {} | ||
|
||
describe('Static Export', () => { | ||
beforeAll(async () => { | ||
const outdir = join(appDir, '.out') | ||
await nextBuild(appDir) | ||
await nextExport(appDir, { outdir }) | ||
|
||
context.server = await startStaticServer(join(appDir, '.out')) | ||
context.port = context.server.address().port | ||
}) | ||
afterAll(() => stopApp(context.server)) | ||
|
||
describe('Render via SSR', () => { | ||
it('should render the home page', async () => { | ||
const html = await renderViaHTTP(context.port, '/') | ||
expect(html).toMatch(/This is the home page/) | ||
}) | ||
}) | ||
|
||
describe('Render via browser', () => { | ||
it('should render the home page', async () => { | ||
const browser = await webdriver(context.port, '/') | ||
const text = await browser | ||
.elementByCss('#home-page p').text() | ||
|
||
expect(text).toBe('This is the home page') | ||
browser.close() | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.