mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-20 06:55:06 -04:00
feat(test): added e2e tests
This commit is contained in:
parent
ebfdb64fde
commit
ec7cb9351c
11 changed files with 245 additions and 5 deletions
|
@ -5,6 +5,7 @@ import { fileURLToPath } from 'url';
|
|||
const currentDirname = dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
const toolsDir = join(currentDirname, '..', 'src', 'tools');
|
||||
// eslint-disable-next-line no-undef
|
||||
const toolName = process.argv[2];
|
||||
|
||||
if (!toolName) {
|
||||
|
@ -73,6 +74,28 @@ import { expect, describe, it } from 'vitest';
|
|||
`,
|
||||
);
|
||||
|
||||
createToolFile(
|
||||
`${toolName}.e2e.spec.ts`,
|
||||
`
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test.describe('Tool - ${toolNameTitleCase}', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('/${toolName}');
|
||||
});
|
||||
|
||||
test('Has correct title', async ({ page }) => {
|
||||
await expect(page).toHaveTitle('${toolNameTitleCase} - IT Tools');
|
||||
});
|
||||
|
||||
test('', async ({ page }) => {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
`,
|
||||
);
|
||||
|
||||
const toolsIndex = join(toolsDir, 'index.ts');
|
||||
const indexContent = await readFile(toolsIndex, { encoding: 'utf-8' }).then((r) => r.split('\n'));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue