Don't re-use the same page file for error-recovery tests (#7144)

* Don't re-use the same page file for error-recovery tests

* bump

* bump
This commit is contained in:
JJ Kasper 2019-04-24 13:19:26 -05:00 committed by GitHub
parent 0c3018c6ce
commit b21ebaa8e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 79 additions and 16 deletions

View file

@ -0,0 +1,9 @@
export default () => {
return (
<div className='hmr-about-page'>
<p>
This is the about page.
</p>
</div>
)
}

View file

@ -0,0 +1,9 @@
export default () => {
return (
<div className='hmr-about-page'>
<p>
This is the about page.
</p>
</div>
)
}

View file

@ -0,0 +1,9 @@
export default () => {
return (
<div className='hmr-about-page'>
<p>
This is the about page.
</p>
</div>
)
}

View file

@ -0,0 +1,9 @@
export default () => {
return (
<div className='hmr-about-page'>
<p>
This is the about page.
</p>
</div>
)
}

View file

@ -0,0 +1,9 @@
export default () => {
return (
<div className='hmr-about-page'>
<p>
This is the about page.
</p>
</div>
)
}

View file

@ -0,0 +1,9 @@
export default () => {
return (
<div className='hmr-about-page'>
<p>
This is the about page.
</p>
</div>
)
}

View file

@ -0,0 +1,9 @@
export default () => {
return (
<div className='hmr-about-page'>
<p>
This is the about page.
</p>
</div>
)
}

View file

@ -39,10 +39,10 @@ export default (context, renderViaHTTP) => {
it('should have installed the react-overlay-editor editor handler', async () => {
let browser
const aboutPage = new File(join(__dirname, '../', 'pages', 'hmr', 'about.js'))
const aboutPage = new File(join(__dirname, '../', 'pages', 'hmr', 'about1.js'))
try {
aboutPage.replace('</div>', 'div')
browser = await webdriver(context.appPort, '/hmr/about')
browser = await webdriver(context.appPort, '/hmr/about1')
// react-error-overlay uses the following inline style if an editorHandler is installed
expect(await getReactErrorOverlayContent(browser)).toMatch(/style="cursor: pointer;"/)
@ -72,9 +72,9 @@ export default (context, renderViaHTTP) => {
it('should detect syntax errors and recover', async () => {
let browser
const aboutPage = new File(join(__dirname, '../', 'pages', 'hmr', 'about.js'))
const aboutPage = new File(join(__dirname, '../', 'pages', 'hmr', 'about2.js'))
try {
browser = await webdriver(context.appPort, '/hmr/about')
browser = await webdriver(context.appPort, '/hmr/about2')
await check(
() => getBrowserBodyText(browser),
/This is the about page/
@ -108,10 +108,10 @@ export default (context, renderViaHTTP) => {
})
it('should show the error on all pages', async () => {
const aboutPage = new File(join(__dirname, '../', 'pages', 'hmr', 'about.js'))
const aboutPage = new File(join(__dirname, '../', 'pages', 'hmr', 'about2.js'))
let browser
try {
await renderViaHTTP('/hmr/about')
await renderViaHTTP('/hmr/about2')
aboutPage.replace('</div>', 'div')
@ -145,9 +145,9 @@ export default (context, renderViaHTTP) => {
it('should detect runtime errors on the module scope', async () => {
let browser
const aboutPage = new File(join(__dirname, '../', 'pages', 'hmr', 'about.js'))
const aboutPage = new File(join(__dirname, '../', 'pages', 'hmr', 'about3.js'))
try {
browser = await webdriver(context.appPort, '/hmr/about')
browser = await webdriver(context.appPort, '/hmr/about3')
await check(
() => getBrowserBodyText(browser),
/This is the about page/
@ -173,9 +173,9 @@ export default (context, renderViaHTTP) => {
it('should recover from errors in the render function', async () => {
let browser
const aboutPage = new File(join(__dirname, '../', 'pages', 'hmr', 'about.js'))
const aboutPage = new File(join(__dirname, '../', 'pages', 'hmr', 'about4.js'))
try {
browser = await webdriver(context.appPort, '/hmr/about')
browser = await webdriver(context.appPort, '/hmr/about4')
await check(
() => getBrowserBodyText(browser),
/This is the about page/
@ -210,9 +210,9 @@ export default (context, renderViaHTTP) => {
it('should recover after exporting an invalid page', async () => {
let browser
const aboutPage = new File(join(__dirname, '../', 'pages', 'hmr', 'about.js'))
const aboutPage = new File(join(__dirname, '../', 'pages', 'hmr', 'about5.js'))
try {
browser = await webdriver(context.appPort, '/hmr/about')
browser = await webdriver(context.appPort, '/hmr/about5')
await check(
() => getBrowserBodyText(browser),
/This is the about page/
@ -251,9 +251,9 @@ export default (context, renderViaHTTP) => {
it('should recover after a bad return from the render function', async () => {
let browser
const aboutPage = new File(join(__dirname, '../', 'pages', 'hmr', 'about.js'))
const aboutPage = new File(join(__dirname, '../', 'pages', 'hmr', 'about6.js'))
try {
browser = await webdriver(context.appPort, '/hmr/about')
browser = await webdriver(context.appPort, '/hmr/about6')
await check(
() => getBrowserBodyText(browser),
/This is the about page/
@ -292,9 +292,9 @@ export default (context, renderViaHTTP) => {
it('should recover after undefined exported as default', async () => {
let browser
const aboutPage = new File(join(__dirname, '../', 'pages', 'hmr', 'about.js'))
const aboutPage = new File(join(__dirname, '../', 'pages', 'hmr', 'about7.js'))
try {
browser = await webdriver(context.appPort, '/hmr/about')
browser = await webdriver(context.appPort, '/hmr/about7')
await check(
() => getBrowserBodyText(browser),
/This is the about page/