Skip to content

Instantly share code, notes, and snippets.

@CodeDredd
Created October 19, 2023 18:35
Show Gist options
  • Save CodeDredd/ba99de4b46a15bcb861485782ecf7bce to your computer and use it in GitHub Desktop.
Save CodeDredd/ba99de4b46a15bcb861485782ecf7bce to your computer and use it in GitHub Desktop.
Full e2e test example with nuxt 3
import { fileURLToPath } from 'node:url';
import { describe, test } from 'vitest';
import { expect } from '@playwright/test';
import { setup, createPage } from '@nuxt/test-utils';
describe('Landing page', async () => {
await setup({
rootDir: fileURLToPath(new URL('..', import.meta.url)),
server: true,
browser: true,
});
test.each([
{ slug: '/mietwagen/usa/' },
{ slug: '/mietwagen/usa/miami/' },
{ slug: '/mietwagen/alamo/' },
{ slug: '/mietwagen/frankreich/' },
{ slug: '/mietwagen/portugal/algarve/' },
{ slug: '/mietwagen/portugal/faro/' },
{ slug: '/mietwagen/hertz/' },
{ slug: '/mietwagen/italien/rom/' },
])('with slug $slug has button', async ({ slug }) => {
const page = await createPage(slug);
const button = page.getByRole('button', {
name: 'Mietwagen suchen',
});
await expect(button).toBeVisible();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment