async-edge-cases.spec.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // @vitest-environment node
  2. import path from 'path'
  3. import { E2E_TIMEOUT, setupPuppeteer } from './e2eUtils'
  4. describe('basic-ssr', () => {
  5. const { page, text, click, isChecked } = setupPuppeteer()
  6. test(
  7. 'should work',
  8. async () => {
  9. await page().goto(
  10. `file://${path.resolve(__dirname, `async-edge-cases.html`)}`
  11. )
  12. // #4510
  13. expect(await text('#case-1')).toContain('1')
  14. expect(await isChecked('#case-1 input')).toBe(false)
  15. await click('#case-1 input')
  16. expect(await text('#case-1')).toContain('2')
  17. expect(await isChecked('#case-1 input')).toBe(true)
  18. await click('#case-1 input')
  19. expect(await text('#case-1')).toContain('3')
  20. expect(await isChecked('#case-1 input')).toBe(false)
  21. // #6566
  22. expect(await text('#case-2 button')).toContain('Expand is True')
  23. expect(await text('.count-a')).toContain('countA: 0')
  24. expect(await text('.count-b')).toContain('countB: 0')
  25. await click('#case-2 button')
  26. expect(await text('#case-2 button')).toContain('Expand is False')
  27. expect(await text('.count-a')).toContain('countA: 1')
  28. expect(await text('.count-b')).toContain('countB: 0')
  29. await click('#case-2 button')
  30. expect(await text('#case-2 button')).toContain('Expand is True')
  31. expect(await text('.count-a')).toContain('countA: 1')
  32. expect(await text('.count-b')).toContain('countB: 1')
  33. },
  34. E2E_TIMEOUT
  35. )
  36. })