Skip to content

Commit b2848ae

Browse files
committed
test: replace waitForFunction with waitForXPath
1 parent 71aeaea commit b2848ae

File tree

4 files changed

+5
-21
lines changed

4 files changed

+5
-21
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@
8282
"yorkie": "^2.0.0"
8383
},
8484
"resolutions": {
85-
"puppeteer": "1.11.0",
8685
"vue": "^2.6.10",
8786
"vue-template-compiler": "^2.6.10",
8887
"vue-server-renderer": "^2.6.10"

packages/@vue/cli-plugin-typescript/__tests__/tsPlugin.helper.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ exports.assertServe = async (name, options) => {
1919
const file = await project.read(`src/App.vue`)
2020
project.write(`src/App.vue`, file.replace(msg, `Updated`))
2121
await nextUpdate() // wait for child stdout update signal
22-
await page.waitForFunction(selector => {
23-
const el = document.querySelector(selector)
24-
return el && el.textContent.includes('Updated')
25-
}, {}, 'h1')
22+
await page.waitForXPath('//h1[contains(text(), "Updated")]')
2623
}
2724
)
2825
})

packages/@vue/cli-service-global/__tests__/globalService.spec.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ test('global serve', async () => {
3535
expect(await helpers.getText('h1')).toMatch('hi')
3636
write('App.vue', entryVue.replace(`{{ msg }}`, 'Updated'))
3737
await nextUpdate() // wait for child stdout update signal
38-
await page.waitForFunction(selector => {
39-
const el = document.querySelector(selector)
40-
return el && el.textContent.includes('Updated')
41-
}, {}, 'h1')
38+
await page.waitForXPath('//h1[contains(text(), "Updated")]')
4239
}
4340
)
4441
})

packages/@vue/cli-service/__tests__/serve.spec.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ test('serve', async () => {
1919
const file = await project.read(`src/App.vue`)
2020
project.write(`src/App.vue`, file.replace(msg, `Updated`))
2121
await nextUpdate() // wait for child stdout update signal
22-
await page.waitForFunction(selector => {
23-
const el = document.querySelector(selector)
24-
return el && el.textContent.includes('Updated')
25-
}, {}, 'h1')
22+
await page.waitForXPath('//h1[contains(text(), "Updated")]')
2623
}
2724
)
2825
})
@@ -105,10 +102,7 @@ test('serve with inline entry', async () => {
105102
const file = await project.read(`src/App.vue`)
106103
project.write(`src/App.vue`, file.replace(msg, `Updated`))
107104
await nextUpdate() // wait for child stdout update signal
108-
await page.waitForFunction(selector => {
109-
const el = document.querySelector(selector)
110-
return el && el.textContent.includes('Updated')
111-
}, {}, 'h1')
105+
await page.waitForXPath('//h1[contains(text(), "Updated")]')
112106
}
113107
)
114108
})
@@ -128,10 +122,7 @@ test('serve with no public dir', async () => {
128122
const file = await project.read(`src/App.vue`)
129123
project.write(`src/App.vue`, file.replace(msg, `Updated`))
130124
await nextUpdate() // wait for child stdout update signal
131-
await page.waitForFunction(selector => {
132-
const el = document.querySelector(selector)
133-
return el && el.textContent.includes('Updated')
134-
}, {}, 'h1')
125+
await page.waitForXPath('//h1[contains(text(), "Updated")]')
135126
}
136127
)
137128
})

0 commit comments

Comments
 (0)