mirror of https://github.com/vuejs/core.git
test: configure test hooks sequence order, remove workaround
This commit is contained in:
parent
0fbc19f2d0
commit
a1b3057c4d
|
@ -21,26 +21,13 @@ describe('e2e: Transition', () => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
// await page().goto(baseUrl)
|
await page().goto(baseUrl)
|
||||||
// await page().waitForSelector('#app')
|
await page().waitForSelector('#app')
|
||||||
// })
|
})
|
||||||
|
|
||||||
// workaround for https://github.com/vitest-dev/vitest/issues/2756
|
|
||||||
function runTest(desc: string, runner: any, timeout?: number) {
|
|
||||||
test(
|
|
||||||
desc,
|
|
||||||
async () => {
|
|
||||||
await page().goto(baseUrl)
|
|
||||||
await page().waitForSelector('#app')
|
|
||||||
await runner()
|
|
||||||
},
|
|
||||||
timeout
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('transition with v-if', () => {
|
describe('transition with v-if', () => {
|
||||||
runTest(
|
test(
|
||||||
'basic transition',
|
'basic transition',
|
||||||
async () => {
|
async () => {
|
||||||
await page().goto(baseUrl)
|
await page().goto(baseUrl)
|
||||||
|
@ -98,7 +85,7 @@ describe('e2e: Transition', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'named transition',
|
'named transition',
|
||||||
async () => {
|
async () => {
|
||||||
await page().evaluate(() => {
|
await page().evaluate(() => {
|
||||||
|
@ -154,7 +141,7 @@ describe('e2e: Transition', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'custom transition classes',
|
'custom transition classes',
|
||||||
async () => {
|
async () => {
|
||||||
await page().evaluate(() => {
|
await page().evaluate(() => {
|
||||||
|
@ -215,7 +202,7 @@ describe('e2e: Transition', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'transition with dynamic name',
|
'transition with dynamic name',
|
||||||
async () => {
|
async () => {
|
||||||
await page().evaluate(() => {
|
await page().evaluate(() => {
|
||||||
|
@ -277,7 +264,7 @@ describe('e2e: Transition', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'transition events without appear',
|
'transition events without appear',
|
||||||
async () => {
|
async () => {
|
||||||
const beforeLeaveSpy = vi.fn()
|
const beforeLeaveSpy = vi.fn()
|
||||||
|
@ -381,7 +368,7 @@ describe('e2e: Transition', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'events with arguments',
|
'events with arguments',
|
||||||
async () => {
|
async () => {
|
||||||
const beforeLeaveSpy = vi.fn()
|
const beforeLeaveSpy = vi.fn()
|
||||||
|
@ -497,7 +484,7 @@ describe('e2e: Transition', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest('onEnterCancelled', async () => {
|
test('onEnterCancelled', async () => {
|
||||||
const enterCancelledSpy = vi.fn()
|
const enterCancelledSpy = vi.fn()
|
||||||
|
|
||||||
await page().exposeFunction('enterCancelledSpy', enterCancelledSpy)
|
await page().exposeFunction('enterCancelledSpy', enterCancelledSpy)
|
||||||
|
@ -559,7 +546,7 @@ describe('e2e: Transition', () => {
|
||||||
expect(await html('#container')).toBe('<!--v-if-->')
|
expect(await html('#container')).toBe('<!--v-if-->')
|
||||||
})
|
})
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'transition on appear',
|
'transition on appear',
|
||||||
async () => {
|
async () => {
|
||||||
const appearClass = await page().evaluate(async () => {
|
const appearClass = await page().evaluate(async () => {
|
||||||
|
@ -635,7 +622,7 @@ describe('e2e: Transition', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'transition events with appear',
|
'transition events with appear',
|
||||||
async () => {
|
async () => {
|
||||||
const onLeaveSpy = vi.fn()
|
const onLeaveSpy = vi.fn()
|
||||||
|
@ -783,7 +770,7 @@ describe('e2e: Transition', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'css: false',
|
'css: false',
|
||||||
async () => {
|
async () => {
|
||||||
const onBeforeEnterSpy = vi.fn()
|
const onBeforeEnterSpy = vi.fn()
|
||||||
|
@ -861,7 +848,7 @@ describe('e2e: Transition', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'no transition detected',
|
'no transition detected',
|
||||||
async () => {
|
async () => {
|
||||||
await page().evaluate(() => {
|
await page().evaluate(() => {
|
||||||
|
@ -903,7 +890,7 @@ describe('e2e: Transition', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'animations',
|
'animations',
|
||||||
async () => {
|
async () => {
|
||||||
await page().evaluate(() => {
|
await page().evaluate(() => {
|
||||||
|
@ -955,7 +942,7 @@ describe('e2e: Transition', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'explicit transition type',
|
'explicit transition type',
|
||||||
async () => {
|
async () => {
|
||||||
await page().evaluate(() => {
|
await page().evaluate(() => {
|
||||||
|
@ -1025,7 +1012,7 @@ describe('e2e: Transition', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'transition on SVG elements',
|
'transition on SVG elements',
|
||||||
async () => {
|
async () => {
|
||||||
await page().evaluate(() => {
|
await page().evaluate(() => {
|
||||||
|
@ -1096,7 +1083,7 @@ describe('e2e: Transition', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'custom transition higher-order component',
|
'custom transition higher-order component',
|
||||||
async () => {
|
async () => {
|
||||||
await page().evaluate(() => {
|
await page().evaluate(() => {
|
||||||
|
@ -1153,7 +1140,7 @@ describe('e2e: Transition', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'transition on child components with empty root node',
|
'transition on child components with empty root node',
|
||||||
async () => {
|
async () => {
|
||||||
await page().evaluate(() => {
|
await page().evaluate(() => {
|
||||||
|
@ -1232,7 +1219,7 @@ describe('e2e: Transition', () => {
|
||||||
|
|
||||||
describe('transition with Suspense', () => {
|
describe('transition with Suspense', () => {
|
||||||
// #1583
|
// #1583
|
||||||
runTest(
|
test(
|
||||||
'async component transition inside Suspense',
|
'async component transition inside Suspense',
|
||||||
async () => {
|
async () => {
|
||||||
const onLeaveSpy = vi.fn()
|
const onLeaveSpy = vi.fn()
|
||||||
|
@ -1326,7 +1313,7 @@ describe('e2e: Transition', () => {
|
||||||
)
|
)
|
||||||
|
|
||||||
// #1689
|
// #1689
|
||||||
runTest(
|
test(
|
||||||
'static node transition inside Suspense',
|
'static node transition inside Suspense',
|
||||||
async () => {
|
async () => {
|
||||||
await page().evaluate(() => {
|
await page().evaluate(() => {
|
||||||
|
@ -1384,7 +1371,7 @@ describe('e2e: Transition', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'out-in mode with Suspense',
|
'out-in mode with Suspense',
|
||||||
async () => {
|
async () => {
|
||||||
const onLeaveSpy = vi.fn()
|
const onLeaveSpy = vi.fn()
|
||||||
|
@ -1451,7 +1438,7 @@ describe('e2e: Transition', () => {
|
||||||
)
|
)
|
||||||
|
|
||||||
// #3963
|
// #3963
|
||||||
runTest(
|
test(
|
||||||
'Suspense fallback should work with transition',
|
'Suspense fallback should work with transition',
|
||||||
async () => {
|
async () => {
|
||||||
await page().evaluate(() => {
|
await page().evaluate(() => {
|
||||||
|
@ -1515,7 +1502,7 @@ describe('e2e: Transition', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('transition with v-show', () => {
|
describe('transition with v-show', () => {
|
||||||
runTest(
|
test(
|
||||||
'named transition with v-show',
|
'named transition with v-show',
|
||||||
async () => {
|
async () => {
|
||||||
await page().evaluate(() => {
|
await page().evaluate(() => {
|
||||||
|
@ -1574,7 +1561,7 @@ describe('e2e: Transition', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'transition events with v-show',
|
'transition events with v-show',
|
||||||
async () => {
|
async () => {
|
||||||
const beforeLeaveSpy = vi.fn()
|
const beforeLeaveSpy = vi.fn()
|
||||||
|
@ -1680,7 +1667,7 @@ describe('e2e: Transition', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'onLeaveCancelled (v-show only)',
|
'onLeaveCancelled (v-show only)',
|
||||||
async () => {
|
async () => {
|
||||||
const onLeaveCancelledSpy = vi.fn()
|
const onLeaveCancelledSpy = vi.fn()
|
||||||
|
@ -1742,7 +1729,7 @@ describe('e2e: Transition', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'transition on appear with v-show',
|
'transition on appear with v-show',
|
||||||
async () => {
|
async () => {
|
||||||
const beforeEnterSpy = vi.fn()
|
const beforeEnterSpy = vi.fn()
|
||||||
|
@ -1848,7 +1835,7 @@ describe('e2e: Transition', () => {
|
||||||
)
|
)
|
||||||
|
|
||||||
// #4845
|
// #4845
|
||||||
runTest(
|
test(
|
||||||
'transition events should not call onEnter with v-show false',
|
'transition events should not call onEnter with v-show false',
|
||||||
async () => {
|
async () => {
|
||||||
const beforeEnterSpy = vi.fn()
|
const beforeEnterSpy = vi.fn()
|
||||||
|
@ -1922,7 +1909,7 @@ describe('e2e: Transition', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('explicit durations', () => {
|
describe('explicit durations', () => {
|
||||||
runTest(
|
test(
|
||||||
'single value',
|
'single value',
|
||||||
async () => {
|
async () => {
|
||||||
await page().evaluate(duration => {
|
await page().evaluate(duration => {
|
||||||
|
@ -1978,7 +1965,7 @@ describe('e2e: Transition', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'enter with explicit durations',
|
'enter with explicit durations',
|
||||||
async () => {
|
async () => {
|
||||||
await page().evaluate(duration => {
|
await page().evaluate(duration => {
|
||||||
|
@ -2034,7 +2021,7 @@ describe('e2e: Transition', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'leave with explicit durations',
|
'leave with explicit durations',
|
||||||
async () => {
|
async () => {
|
||||||
await page().evaluate(duration => {
|
await page().evaluate(duration => {
|
||||||
|
@ -2090,7 +2077,7 @@ describe('e2e: Transition', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'separate enter and leave',
|
'separate enter and leave',
|
||||||
async () => {
|
async () => {
|
||||||
await page().evaluate(duration => {
|
await page().evaluate(duration => {
|
||||||
|
@ -2149,7 +2136,7 @@ describe('e2e: Transition', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'warn invalid durations',
|
'warn invalid durations',
|
||||||
async () => {
|
async () => {
|
||||||
createApp({
|
createApp({
|
||||||
|
@ -2187,7 +2174,7 @@ describe('e2e: Transition', () => {
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
runTest('warn when used on multiple elements', async () => {
|
test('warn when used on multiple elements', async () => {
|
||||||
createApp({
|
createApp({
|
||||||
render() {
|
render() {
|
||||||
return h(Transition, null, {
|
return h(Transition, null, {
|
||||||
|
@ -2200,7 +2187,7 @@ describe('e2e: Transition', () => {
|
||||||
).toHaveBeenWarned()
|
).toHaveBeenWarned()
|
||||||
})
|
})
|
||||||
|
|
||||||
runTest('warn when invalid transition mode', () => {
|
test('warn when invalid transition mode', () => {
|
||||||
createApp({
|
createApp({
|
||||||
template: `
|
template: `
|
||||||
<div id="container">
|
<div id="container">
|
||||||
|
@ -2214,7 +2201,7 @@ describe('e2e: Transition', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
// #3227
|
// #3227
|
||||||
runTest(`HOC w/ merged hooks`, async () => {
|
test(`HOC w/ merged hooks`, async () => {
|
||||||
const innerSpy = vi.fn()
|
const innerSpy = vi.fn()
|
||||||
const outerSpy = vi.fn()
|
const outerSpy = vi.fn()
|
||||||
|
|
||||||
|
@ -2253,7 +2240,7 @@ describe('e2e: Transition', () => {
|
||||||
expect(root.innerHTML).toBe(`<!---->`)
|
expect(root.innerHTML).toBe(`<!---->`)
|
||||||
})
|
})
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'should work with dev root fragment',
|
'should work with dev root fragment',
|
||||||
async () => {
|
async () => {
|
||||||
await page().evaluate(() => {
|
await page().evaluate(() => {
|
||||||
|
|
|
@ -20,25 +20,12 @@ describe('e2e: TransitionGroup', () => {
|
||||||
|
|
||||||
const transitionFinish = (time = duration) => timeout(time + buffer)
|
const transitionFinish = (time = duration) => timeout(time + buffer)
|
||||||
|
|
||||||
// beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
// await page().goto(baseUrl)
|
await page().goto(baseUrl)
|
||||||
// await page().waitForSelector('#app')
|
await page().waitForSelector('#app')
|
||||||
// })
|
})
|
||||||
|
|
||||||
// workaround for https://github.com/vitest-dev/vitest/issues/2756
|
test(
|
||||||
function runTest(desc: string, runner: any, timeout?: number) {
|
|
||||||
test(
|
|
||||||
desc,
|
|
||||||
async () => {
|
|
||||||
await page().goto(baseUrl)
|
|
||||||
await page().waitForSelector('#app')
|
|
||||||
await runner()
|
|
||||||
},
|
|
||||||
timeout
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
runTest(
|
|
||||||
'enter',
|
'enter',
|
||||||
async () => {
|
async () => {
|
||||||
await page().evaluate(() => {
|
await page().evaluate(() => {
|
||||||
|
@ -92,7 +79,7 @@ describe('e2e: TransitionGroup', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'leave',
|
'leave',
|
||||||
async () => {
|
async () => {
|
||||||
await page().evaluate(() => {
|
await page().evaluate(() => {
|
||||||
|
@ -136,7 +123,7 @@ describe('e2e: TransitionGroup', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'enter + leave',
|
'enter + leave',
|
||||||
async () => {
|
async () => {
|
||||||
await page().evaluate(() => {
|
await page().evaluate(() => {
|
||||||
|
@ -186,7 +173,7 @@ describe('e2e: TransitionGroup', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'appear',
|
'appear',
|
||||||
async () => {
|
async () => {
|
||||||
const appearHtml = await page().evaluate(() => {
|
const appearHtml = await page().evaluate(() => {
|
||||||
|
@ -261,7 +248,7 @@ describe('e2e: TransitionGroup', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'move',
|
'move',
|
||||||
async () => {
|
async () => {
|
||||||
await page().evaluate(() => {
|
await page().evaluate(() => {
|
||||||
|
@ -311,7 +298,7 @@ describe('e2e: TransitionGroup', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'dynamic name',
|
'dynamic name',
|
||||||
async () => {
|
async () => {
|
||||||
await page().evaluate(() => {
|
await page().evaluate(() => {
|
||||||
|
@ -370,7 +357,7 @@ describe('e2e: TransitionGroup', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest(
|
test(
|
||||||
'events',
|
'events',
|
||||||
async () => {
|
async () => {
|
||||||
const onLeaveSpy = vi.fn()
|
const onLeaveSpy = vi.fn()
|
||||||
|
@ -507,7 +494,7 @@ describe('e2e: TransitionGroup', () => {
|
||||||
E2E_TIMEOUT
|
E2E_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
runTest('warn unkeyed children', () => {
|
test('warn unkeyed children', () => {
|
||||||
createApp({
|
createApp({
|
||||||
template: `
|
template: `
|
||||||
<transition-group name="test">
|
<transition-group name="test">
|
||||||
|
|
|
@ -46,6 +46,9 @@ export default defineConfig({
|
||||||
environmentMatchGlobs: [
|
environmentMatchGlobs: [
|
||||||
['packages/{vue,vue-compat,runtime-dom}/**', 'jsdom']
|
['packages/{vue,vue-compat,runtime-dom}/**', 'jsdom']
|
||||||
],
|
],
|
||||||
|
sequence: {
|
||||||
|
hooks: 'list'
|
||||||
|
},
|
||||||
coverage: {
|
coverage: {
|
||||||
provider: 'istanbul',
|
provider: 'istanbul',
|
||||||
reporter: ['text', 'html'],
|
reporter: ['text', 'html'],
|
||||||
|
|
Loading…
Reference in New Issue