Home / File/ commits.spec.ts — vue Source File

commits.spec.ts — vue Source File

Architecture documentation for commits.spec.ts, a typescript file in the vue codebase. 4 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  8b169d2b_d8bf_df75_5eb8_783abe859c91["commits.spec.ts"]
  74c9703b_0a18_7462_9820_16ae2926fb68["e2eUtils.ts"]
  8b169d2b_d8bf_df75_5eb8_783abe859c91 --> 74c9703b_0a18_7462_9820_16ae2926fb68
  a0544ceb_04fe_69ff_50e4_5f4b5588b908["setupPuppeteer"]
  8b169d2b_d8bf_df75_5eb8_783abe859c91 --> a0544ceb_04fe_69ff_50e4_5f4b5588b908
  86d0ef47_5ef3_4c63_5a71_03f519f9407a["getExampleUrl"]
  8b169d2b_d8bf_df75_5eb8_783abe859c91 --> 86d0ef47_5ef3_4c63_5a71_03f519f9407a
  313ddaef_b900_e3a3_40d0_0e48667c409b["commits.mock.ts"]
  8b169d2b_d8bf_df75_5eb8_783abe859c91 --> 313ddaef_b900_e3a3_40d0_0e48667c409b
  style 8b169d2b_d8bf_df75_5eb8_783abe859c91 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// @vitest-environment node
import { setupPuppeteer, getExampleUrl, E2E_TIMEOUT } from './e2eUtils'
import mocks from './commits.mock'

describe('e2e: commits', () => {
  const { page, click, count, text, isChecked } = setupPuppeteer()

  async function testCommits(apiType: 'classic' | 'composition') {
    // intercept and mock the response to avoid hitting the actual API
    await page().setRequestInterception(true)
    page().on('request', req => {
      const match = req.url().match(/&sha=(.*)$/)
      if (!match) {
        req.continue()
      } else {
        const ret = JSON.stringify(mocks[match[1] as 'main' | 'dev'])
        req.respond({
          status: 200,
          contentType: 'application/json',
          headers: { 'Access-Control-Allow-Origin': '*' },
          body: ret
        })
      }
    })

    await page().goto(getExampleUrl('commits', apiType))
    await page().waitForSelector('li')

    expect(await count('input')).toBe(2)
    expect(await count('label')).toBe(2)
    expect(await text('label[for="main"]')).toBe('main')
    expect(await text('label[for="dev"]')).toBe('dev')
    expect(await isChecked('#main')).toBe(true)
    expect(await isChecked('#dev')).toBe(false)
    expect(await text('p')).toBe('vuejs/vue@main')
    expect(await count('li')).toBe(3)
    expect(await count('li .commit')).toBe(3)
    expect(await count('li .message')).toBe(3)

    await click('#dev')
    expect(await text('p')).toBe('vuejs/vue@dev')
    expect(await count('li')).toBe(3)
    expect(await count('li .commit')).toBe(3)
    expect(await count('li .message')).toBe(3)
  }

  test(
    'classic',
    async () => {
      await testCommits('classic')
    },
    E2E_TIMEOUT
  )

  test(
    'composition',
    async () => {
      await testCommits('composition')
    },
    E2E_TIMEOUT
  )
})

Domain

Frequently Asked Questions

What does commits.spec.ts do?
commits.spec.ts is a source file in the vue codebase, written in typescript. It belongs to the CompilerSFC domain.
What does commits.spec.ts depend on?
commits.spec.ts imports 4 module(s): commits.mock.ts, e2eUtils.ts, getExampleUrl, setupPuppeteer.
Where is commits.spec.ts in the architecture?
commits.spec.ts is located at test/e2e/commits.spec.ts (domain: CompilerSFC, directory: test/e2e).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free