test(e2e): avoid relying on CDN + reduce debounce delay
This commit is contained in:
parent
4d730f464d
commit
b983c68575
@ -7,7 +7,7 @@ describe('e2e: markdown', () => {
|
|||||||
async function testMarkdown(apiType: 'classic' | 'composition') {
|
async function testMarkdown(apiType: 'classic' | 'composition') {
|
||||||
const baseUrl = `file://${path.resolve(
|
const baseUrl = `file://${path.resolve(
|
||||||
__dirname,
|
__dirname,
|
||||||
`../${apiType}/markdown.html`
|
`../${apiType}/markdown.html#test`
|
||||||
)}`
|
)}`
|
||||||
|
|
||||||
await page().goto(baseUrl)
|
await page().goto(baseUrl)
|
||||||
@ -18,7 +18,7 @@ describe('e2e: markdown', () => {
|
|||||||
await page().type('textarea', '\n## foo\n\n- bar\n- baz')
|
await page().type('textarea', '\n## foo\n\n- bar\n- baz')
|
||||||
// assert the output is not updated yet because of debounce
|
// assert the output is not updated yet because of debounce
|
||||||
expect(await html('#editor div')).toBe('<h1 id="hello">hello</h1>\n')
|
expect(await html('#editor div')).toBe('<h1 id="hello">hello</h1>\n')
|
||||||
await page().waitFor(500)
|
await page().waitFor(16)
|
||||||
expect(await html('#editor div')).toBe(
|
expect(await html('#editor div')).toBe(
|
||||||
'<h1 id="hello">hello</h1>\n' +
|
'<h1 id="hello">hello</h1>\n' +
|
||||||
'<h2 id="foo">foo</h2>\n' +
|
'<h2 id="foo">foo</h2>\n' +
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script src="https://unpkg.com/marked@0.3.6"></script>
|
<script src="../../../../node_modules/marked/marked.min.js"></script>
|
||||||
<script src="https://unpkg.com/lodash@4.16.0"></script>
|
<script src="../../../../node_modules/lodash/lodash.min.js"></script>
|
||||||
<script src="../../dist/vue.global.js"></script>
|
<script src="../../dist/vue.global.js"></script>
|
||||||
|
|
||||||
<div id="editor">
|
<div id="editor">
|
||||||
@ -8,6 +8,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
const delay = window.location.hash === '#test' ? 16 : 300
|
||||||
|
|
||||||
const App = {
|
const App = {
|
||||||
data: {
|
data: {
|
||||||
input: '# hello'
|
input: '# hello'
|
||||||
@ -20,7 +22,7 @@ const App = {
|
|||||||
methods: {
|
methods: {
|
||||||
update: _.debounce(function (e) {
|
update: _.debounce(function (e) {
|
||||||
this.input = e.target.value
|
this.input = e.target.value
|
||||||
}, 300)
|
}, delay)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script src="../../dist/vue.global.js"></script>
|
<script src="../../dist/vue.global.js"></script>
|
||||||
<link rel="stylesheet" href="https://unpkg.com/todomvc-app-css/index.css">
|
<link rel="stylesheet" href="../../../../node_modules/todomvc-app-css/index.css">
|
||||||
|
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<section class="todoapp">
|
<section class="todoapp">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script src="https://unpkg.com/marked@0.3.6"></script>
|
<script src="../../../../node_modules/marked/marked.min.js"></script>
|
||||||
<script src="https://unpkg.com/lodash@4.16.0"></script>
|
<script src="../../../../node_modules/lodash/lodash.min.js"></script>
|
||||||
<script src="../../dist/vue.global.js"></script>
|
<script src="../../dist/vue.global.js"></script>
|
||||||
|
|
||||||
<div id="editor">
|
<div id="editor">
|
||||||
@ -8,13 +8,14 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
const delay = window.location.hash === '#test' ? 16 : 300
|
||||||
const { ref, computed } = Vue
|
const { ref, computed } = Vue
|
||||||
|
|
||||||
const App = {
|
const App = {
|
||||||
setup() {
|
setup() {
|
||||||
const input = ref('# hello')
|
const input = ref('# hello')
|
||||||
const output = computed(() => marked(input.value, { sanitize: true }))
|
const output = computed(() => marked(input.value, { sanitize: true }))
|
||||||
const update = _.debounce(e => { input.value = e.target.value }, 300)
|
const update = _.debounce(e => { input.value = e.target.value }, delay)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
input,
|
input,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script src="../../dist/vue.global.js"></script>
|
<script src="../../dist/vue.global.js"></script>
|
||||||
<link rel="stylesheet" href="https://unpkg.com/todomvc-app-css/index.css">
|
<link rel="stylesheet" href="../../../../node_modules/todomvc-app-css/index.css">
|
||||||
|
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<section class="todoapp">
|
<section class="todoapp">
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<script src="https://cdn.jsdelivr.net/lodash/4.3.0/lodash.min.js"></script>
|
<script src="../../../../node_modules/lodash/lodash.min.js"></script>
|
||||||
<script src="../../dist/vue.global.js"></script>
|
<script src="../../dist/vue.global.js"></script>
|
||||||
|
|
||||||
<div id="app">
|
<div id="app">
|
||||||
|
@ -35,5 +35,10 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/compiler-dom": "3.0.0-alpha.0",
|
"@vue/compiler-dom": "3.0.0-alpha.0",
|
||||||
"@vue/runtime-dom": "3.0.0-alpha.0"
|
"@vue/runtime-dom": "3.0.0-alpha.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"lodash": "^4.17.15",
|
||||||
|
"marked": "^0.7.0",
|
||||||
|
"todomvc-app-css": "^2.3.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
12
yarn.lock
12
yarn.lock
@ -3430,7 +3430,7 @@ lodash.sortby@^4.7.0:
|
|||||||
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
|
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
|
||||||
integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=
|
integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=
|
||||||
|
|
||||||
lodash@^4.13.1, lodash@^4.17.13, lodash@^4.17.4, lodash@~4.17.15:
|
lodash@^4.13.1, lodash@^4.17.13, lodash@^4.17.15, lodash@^4.17.4, lodash@~4.17.15:
|
||||||
version "4.17.15"
|
version "4.17.15"
|
||||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
|
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
|
||||||
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
|
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
|
||||||
@ -3568,6 +3568,11 @@ map-visit@^1.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
object-visit "^1.0.0"
|
object-visit "^1.0.0"
|
||||||
|
|
||||||
|
marked@^0.7.0:
|
||||||
|
version "0.7.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/marked/-/marked-0.7.0.tgz#b64201f051d271b1edc10a04d1ae9b74bb8e5c0e"
|
||||||
|
integrity sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg==
|
||||||
|
|
||||||
meow@^5.0.0:
|
meow@^5.0.0:
|
||||||
version "5.0.0"
|
version "5.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/meow/-/meow-5.0.0.tgz#dfc73d63a9afc714a5e371760eb5c88b91078aa4"
|
resolved "https://registry.yarnpkg.com/meow/-/meow-5.0.0.tgz#dfc73d63a9afc714a5e371760eb5c88b91078aa4"
|
||||||
@ -5298,6 +5303,11 @@ to-regex@^3.0.1, to-regex@^3.0.2:
|
|||||||
regex-not "^1.0.2"
|
regex-not "^1.0.2"
|
||||||
safe-regex "^1.1.0"
|
safe-regex "^1.1.0"
|
||||||
|
|
||||||
|
todomvc-app-css@^2.3.0:
|
||||||
|
version "2.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/todomvc-app-css/-/todomvc-app-css-2.3.0.tgz#cc27f1686ab4c418eef4e790289cc124baca2546"
|
||||||
|
integrity sha512-RG8hxqoVn8Be3wxyuyHfOSAXiY1Z0N+PYQOe/jxzy3wpU1Obfwd1RF1i/fz/fR+MrYL+Q+BdrUt8SsXdtR7Oow==
|
||||||
|
|
||||||
token-stream@0.0.1:
|
token-stream@0.0.1:
|
||||||
version "0.0.1"
|
version "0.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/token-stream/-/token-stream-0.0.1.tgz#ceeefc717a76c4316f126d0b9dbaa55d7e7df01a"
|
resolved "https://registry.yarnpkg.com/token-stream/-/token-stream-0.0.1.tgz#ceeefc717a76c4316f126d0b9dbaa55d7e7df01a"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user