Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
6e4f0d8e
Unverified
Commit
6e4f0d8e
authored
Sep 25, 2018
by
Tim Neutkens
Committed by
GitHub
Sep 25, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use getBrowserBodyText for HMR test (#5290)
parent
7961946c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
21 deletions
+16
-21
hmr.js
test/integration/basic/test/hmr.js
+5
-5
browser.js
test/integration/export/test/browser.js
+9
-11
dev.js
test/integration/export/test/dev.js
+2
-5
No files found.
test/integration/basic/test/hmr.js
View file @
6e4f0d8e
...
...
@@ -2,7 +2,7 @@
import
webdriver
from
'next-webdriver'
import
{
readFileSync
,
writeFileSync
,
renameSync
,
existsSync
}
from
'fs'
import
{
join
}
from
'path'
import
{
waitFor
,
check
}
from
'next-test-utils'
import
{
waitFor
,
check
,
getBrowserBodyText
}
from
'next-test-utils'
import
cheerio
from
'cheerio'
export
default
(
context
,
renderViaHTTP
)
=>
{
...
...
@@ -22,7 +22,7 @@ export default (context, renderViaHTTP) => {
renameSync
(
contactPagePath
,
newContactPagePath
)
await
check
(
()
=>
browser
.
elementByCss
(
'body'
).
text
(
),
()
=>
getBrowserBodyText
(
browser
),
/This page could not be found/
)
...
...
@@ -31,7 +31,7 @@ export default (context, renderViaHTTP) => {
// wait until the page comes back
await
check
(
()
=>
browser
.
elementByCss
(
'body'
).
text
(
),
()
=>
getBrowserBodyText
(
browser
),
/This is the contact page/
)
}
finally
{
...
...
@@ -63,7 +63,7 @@ export default (context, renderViaHTTP) => {
writeFileSync
(
aboutPagePath
,
editedContent
,
'utf8'
)
await
check
(
()
=>
browser
.
elementByCss
(
'body'
).
text
(
),
()
=>
getBrowserBodyText
(
browser
),
/COOL page/
)
...
...
@@ -71,7 +71,7 @@ export default (context, renderViaHTTP) => {
writeFileSync
(
aboutPagePath
,
originalContent
,
'utf8'
)
await
check
(
()
=>
browser
.
elementByCss
(
'body'
).
text
(
),
()
=>
getBrowserBodyText
(
browser
),
/This is the about page/
)
}
finally
{
...
...
test/integration/export/test/browser.js
View file @
6e4f0d8e
/* global describe, it, expect */
import
webdriver
from
'next-webdriver'
import
{
check
}
from
'next-test-utils'
import
{
check
,
getBrowserBodyText
}
from
'next-test-utils'
export
default
function
(
context
)
{
describe
(
'Render via browser'
,
()
=>
{
...
...
@@ -147,23 +147,21 @@ export default function (context) {
describe
(
'pages in the nested level: level1'
,
()
=>
{
it
(
'should render the home page'
,
async
()
=>
{
const
browser
=
await
webdriver
(
context
.
port
,
'/'
)
const
text
=
await
browser
.
elementByCss
(
'#level1-home-page'
).
click
()
.
waitForElementByCss
(
'#level1-home-page'
)
.
elementByCss
(
'#level1-home-page p'
).
text
()
expect
(
text
).
toBe
(
'This is the Level1 home page'
)
await
browser
.
eval
(
'document.getElementById("level1-home-page").click()'
)
await
check
(()
=>
getBrowserBodyText
(
browser
),
/This is the Level1 home page/
)
browser
.
close
()
})
it
(
'should render the about page'
,
async
()
=>
{
const
browser
=
await
webdriver
(
context
.
port
,
'/'
)
const
text
=
await
browser
.
elementByCss
(
'#level1-about-page'
).
click
()
.
waitForElementByCss
(
'#level1-about-page'
)
.
elementByCss
(
'#level1-about-page p'
).
text
()
expect
(
text
).
toBe
(
'This is the Level1 about page'
)
await
browser
.
eval
(
'document.getElementById("level1-about-page").click()'
)
await
check
(()
=>
getBrowserBodyText
(
browser
),
/This is the Level1 about page/
)
browser
.
close
()
})
})
...
...
test/integration/export/test/dev.js
View file @
6e4f0d8e
/* global describe, it, expect */
import
webdriver
from
'next-webdriver'
import
{
renderViaHTTP
}
from
'next-test-utils'
import
{
renderViaHTTP
,
getBrowserBodyText
,
check
}
from
'next-test-utils'
import
cheerio
from
'cheerio'
const
loadJSONInPage
=
pageContent
=>
{
...
...
@@ -12,11 +12,8 @@ export default function (context) {
describe
(
'Render in development mode'
,
()
=>
{
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
()
await
check
(()
=>
getBrowserBodyText
(
browser
),
/This is the home page/
)
})
it
(
'should render pages only existent in exportPathMap page'
,
async
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment