-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(e2e): add
cucumber
test runner (#711)
- Loading branch information
Showing
13 changed files
with
703 additions
and
639 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<template> | ||
<div> | ||
<NuxtWelcome /> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"default": { | ||
"paths": [ | ||
"test/acceptance/features/**/*.feature" | ||
], | ||
"import": [ | ||
"test/acceptance/**/*.ts" | ||
], | ||
"publish": false, | ||
"format": [ | ||
"summary" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// https://nuxt.com/docs/api/configuration/nuxt-config | ||
export default defineNuxtConfig({ | ||
devtools: { enabled: true } | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "nuxt-app-cucumber", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"build": "nuxt build", | ||
"dev": "nuxt dev", | ||
"generate": "nuxt generate", | ||
"preview": "nuxt preview", | ||
"postinstall": "nuxt prepare", | ||
"test": "NODE_OPTIONS='--loader ts-node/esm' NODE_ENV=test cucumber-js" | ||
}, | ||
"dependencies": { | ||
"nuxt": "^3.9.1", | ||
"vue": "^3.4.7", | ||
"vue-router": "^4.2.5" | ||
}, | ||
"devDependencies": { | ||
"@cucumber/cucumber": "^10.2.1", | ||
"@nuxt/test-utils": "latest", | ||
"ts-node": "^10.9.2" | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
examples/app-cucumber/test/acceptance/features/home/features/home.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@tag-home-page | ||
|
||
Feature: 🏠 Home Page | ||
|
||
Scenario: 🏠 Home Page is displayed | ||
Given the user goes on the home page |
15 changes: 15 additions & 0 deletions
15
...p-cucumber/test/acceptance/features/playwright/step-definitions/playwright.given-steps.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import assert from 'node:assert' | ||
import { Given } from '@cucumber/cucumber' | ||
import { $fetch, createPage } from '@nuxt/test-utils/e2e' | ||
|
||
Given(/^the user goes on the home page$/u, async function (): Promise<void> { | ||
// Browser test | ||
const page = await createPage('/') | ||
const text = await page.getByRole('heading', { name: 'Welcome to Nuxt!' }).innerText() | ||
assert.match(text, /Welcome to Nuxt!/) | ||
await page.close() | ||
|
||
// SSR test | ||
const html: string = await $fetch('/') | ||
assert.match(html, /<!DOCTYPE html>/) | ||
}) |
8 changes: 8 additions & 0 deletions
8
examples/app-cucumber/test/acceptance/features/support/hooks.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { fileURLToPath } from 'node:url' | ||
import { setup } from '@nuxt/test-utils/e2e' | ||
|
||
await setup({ | ||
runner: 'cucumber', | ||
server: true, | ||
rootDir: fileURLToPath(new URL('../../../..', import.meta.url)) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "./.nuxt/tsconfig.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.