mirror of
https://github.com/hanzoai/vitest.git
synced 2026-09-24 17:04:25 +00:00
63 lines
1.9 KiB
TypeScript
63 lines
1.9 KiB
TypeScript
import { expect, test } from 'vitest'
|
|
import { instances, runBrowserTests } from './utils'
|
|
|
|
test('locators work correctly', async () => {
|
|
const { stderr, stdout } = await runBrowserTests({
|
|
root: './fixtures/locators',
|
|
reporters: [
|
|
['verbose', { isTTY: false }],
|
|
],
|
|
})
|
|
|
|
expect(stderr).toReportNoErrors()
|
|
|
|
instances.forEach(({ browser }) => {
|
|
expect(stdout).toReportPassedTest('blog.test.tsx', browser)
|
|
expect(stdout).toReportPassedTest('query.test.ts', browser)
|
|
})
|
|
|
|
const COUNT_TEST_FILES = 2
|
|
const COUNT_TESTS_OVERALL = 14
|
|
|
|
expect(stdout).toReportSummaryTestFiles({ passed: instances.length * COUNT_TEST_FILES })
|
|
expect(stdout).toReportSummaryTests({ passed: instances.length * COUNT_TESTS_OVERALL })
|
|
})
|
|
|
|
test('locators.exact option works', async () => {
|
|
const { stderr, stdout } = await runBrowserTests({
|
|
root: './fixtures/locators-exact',
|
|
reporters: [['verbose', { isTTY: false }]],
|
|
})
|
|
|
|
expect(stderr).toReportNoErrors()
|
|
|
|
instances.forEach(({ browser }) => {
|
|
expect(stdout).toReportPassedTest('basic.test.ts', browser)
|
|
})
|
|
|
|
const COUNT_TEST_FILES = 1
|
|
const COUNT_TESTS_OVERALL = 5
|
|
|
|
expect(stdout).toReportSummaryTestFiles({ passed: instances.length * COUNT_TEST_FILES })
|
|
expect(stdout).toReportSummaryTests({ passed: instances.length * COUNT_TESTS_OVERALL })
|
|
})
|
|
|
|
test('custom locators work', async () => {
|
|
const { stderr, stdout } = await runBrowserTests({
|
|
root: './fixtures/locators-custom',
|
|
reporters: [['verbose', { isTTY: false }]],
|
|
})
|
|
|
|
expect(stderr).toReportNoErrors()
|
|
|
|
instances.forEach(({ browser }) => {
|
|
expect(stdout).toReportPassedTest('basic.test.tsx', browser)
|
|
})
|
|
|
|
const COUNT_TEST_FILES = 1
|
|
const COUNT_TESTS_OVERALL = 5
|
|
|
|
expect(stdout).toReportSummaryTestFiles({ passed: instances.length * COUNT_TEST_FILES })
|
|
expect(stdout).toReportSummaryTests({ passed: instances.length * COUNT_TESTS_OVERALL })
|
|
})
|