Skip to content

Commit

Permalink
test: replace waitForFunction with waitForXPath
Browse files Browse the repository at this point in the history
  • Loading branch information
haoqunjiang committed Sep 6, 2019
1 parent 71aeaea commit b2848ae
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 21 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
"yorkie": "^2.0.0"
},
"resolutions": {
"puppeteer": "1.11.0",
"vue": "^2.6.10",
"vue-template-compiler": "^2.6.10",
"vue-server-renderer": "^2.6.10"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ exports.assertServe = async (name, options) => {
const file = await project.read(`src/App.vue`)
project.write(`src/App.vue`, file.replace(msg, `Updated`))
await nextUpdate() // wait for child stdout update signal
await page.waitForFunction(selector => {
const el = document.querySelector(selector)
return el && el.textContent.includes('Updated')
}, {}, 'h1')
await page.waitForXPath('//h1[contains(text(), "Updated")]')
}
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ test('global serve', async () => {
expect(await helpers.getText('h1')).toMatch('hi')
write('App.vue', entryVue.replace(`{{ msg }}`, 'Updated'))
await nextUpdate() // wait for child stdout update signal
await page.waitForFunction(selector => {
const el = document.querySelector(selector)
return el && el.textContent.includes('Updated')
}, {}, 'h1')
await page.waitForXPath('//h1[contains(text(), "Updated")]')
}
)
})
Expand Down
15 changes: 3 additions & 12 deletions packages/@vue/cli-service/__tests__/serve.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ test('serve', async () => {
const file = await project.read(`src/App.vue`)
project.write(`src/App.vue`, file.replace(msg, `Updated`))
await nextUpdate() // wait for child stdout update signal
await page.waitForFunction(selector => {
const el = document.querySelector(selector)
return el && el.textContent.includes('Updated')
}, {}, 'h1')
await page.waitForXPath('//h1[contains(text(), "Updated")]')
}
)
})
Expand Down Expand Up @@ -105,10 +102,7 @@ test('serve with inline entry', async () => {
const file = await project.read(`src/App.vue`)
project.write(`src/App.vue`, file.replace(msg, `Updated`))
await nextUpdate() // wait for child stdout update signal
await page.waitForFunction(selector => {
const el = document.querySelector(selector)
return el && el.textContent.includes('Updated')
}, {}, 'h1')
await page.waitForXPath('//h1[contains(text(), "Updated")]')
}
)
})
Expand All @@ -128,10 +122,7 @@ test('serve with no public dir', async () => {
const file = await project.read(`src/App.vue`)
project.write(`src/App.vue`, file.replace(msg, `Updated`))
await nextUpdate() // wait for child stdout update signal
await page.waitForFunction(selector => {
const el = document.querySelector(selector)
return el && el.textContent.includes('Updated')
}, {}, 'h1')
await page.waitForXPath('//h1[contains(text(), "Updated")]')
}
)
})
Expand Down

0 comments on commit b2848ae

Please sign in to comment.