Skip to content

Instantly share code, notes, and snippets.

@ManUtopiK
Forked from CodeDredd/landingpages.spec.ts
Created October 19, 2023 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ManUtopiK/18c3f11aa47b53d1f1c384951314b2e9 to your computer and use it in GitHub Desktop.
Save ManUtopiK/18c3f11aa47b53d1f1c384951314b2e9 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