Gathering detailed insights and metrics for @autometa/cucumber-runner
Gathering detailed insights and metrics for @autometa/cucumber-runner
Gathering detailed insights and metrics for @autometa/cucumber-runner
Gathering detailed insights and metrics for @autometa/cucumber-runner
npm install @autometa/cucumber-runner
Typescript
Module System
Node Version
NPM Version
@autometa/test-builder@0.2.12
Updated on Feb 02, 2024
@autometa/scopes@0.5.11
Updated on Feb 02, 2024
@autometa/jest-transformer@0.1.88
Updated on Feb 02, 2024
@autometa/jest-executor@0.4.14
Updated on Feb 02, 2024
@autometa/http@1.4.13
Updated on Feb 02, 2024
@autometa/gherkin@0.6.9
Updated on Feb 02, 2024
TypeScript (97.73%)
JavaScript (1.05%)
Gherkin (1.01%)
Handlebars (0.21%)
Total Downloads
18,694
Last Day
3
Last Week
30
Last Month
189
Last Year
6,159
6 Stars
690 Commits
2 Forks
2 Watchers
268 Branches
3 Contributors
Updated on Oct 12, 2024
Minified
Minified + Gzipped
Latest Version
0.11.9
Package Id
@autometa/cucumber-runner@0.11.9
Unpacked Size
296.44 kB
Size
61.99 kB
File Count
242
NPM Version
8.19.4
Node Version
19.8.1
Published on
Feb 02, 2024
Cumulative downloads
Total Downloads
Last Day
-57.1%
3
Compared to previous day
Last Week
-67%
30
Compared to previous week
Last Month
-10%
189
Compared to previous month
Last Year
-42.1%
6,159
Compared to previous year
20
25
Autometa Cucumber Runner is a wrapper for multiple established
test runners like jest and vitest that enables support for testing .feature
files.
1npm add -D @autometa/cucumber-runner
1yarn add -D @autometa/cucumber-runner
1pnpm add -D @autometa/cucumber-runner
To begin, add *.feature.ts
as a test file pattern to your
test library config if needed. Also, add autometa.config.ts
to the setup files option
1import { defineConfig } from 'vitest/config'
2
3defineConfig({
4 ...
5 setupFiles: ['autometa.config.ts']
6 include: ['**/*.{test,spec,feature}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}']
7 ...
8})
9
1export default { 2 ... 3 setupFilesAfterEnv: ['autometa.config.ts'] 4 testMatch: ['**/?(*.)+(spec|test|feature).[jt]s?(x)'] 5 ... 6}
Next, create the autometa.config.ts
. To use globally available
step files, add a globals
option, and provide the test functions
of your test framework. It's also a good idea to import reflect-metadata
from this file. reflect-metadata
is a required dependency of this library.
1import "reflect-metadata";
2import { defineConfig } from "@autometa/cucumber-runner";
3import { describe, test, beforeEach, beforeAll, afterEach, afterAll } from "vitest";
4
5defineConfig({
6 globals: "globals",
7 runner: {
8 name: "vitest",
9 describe,
10 test,
11 beforeEach,
12 beforeAll,
13 afterEach,
14 afterAll,
15 },
16});
1import "reflect-metadata";
2import { defineConfig } from "@autometa/cucumber-runner";
3
4defineConfig({
5 globals: "globals",
6 runner: {
7 name: "jest",
8 describe,
9 test,
10 beforeEach,
11 beforeAll,
12 afterEach,
13 afterAll,
14 },
15});
1Feature: A User Can Log In 2 Background: Set up a new User 3 Given a new registered User 4 | username | name | age | password | 5 | johnny5 | John | 45 | paS5091! | 6 7 Scenario: A User logs in with valid credentials 8 When they log in 9 | username | password | 10 | johnny5 | paS5091! | 11 Then they see their profile 12 13 Scenario: A User logs in with a bad password 14 When they log in 15 | username | password | 16 | johnny5 | oops | 17 Then they are informed their password is incorrect
1import { Given, When, Then, Feature, Before, Scenario } from "@autometa/cucumber-runner"; 2import { App } from "../src/app"; 3 4Before("Launch browser", async ({ world, myDriver }) => { 5 world.page = await myDriver.start(process.env.API_URL); 6}); 7 8Given("a new registered User", async (data: HTable, { world, httpClient }: App) => { 9 const userDetails = data.json(0); 10 await httpClient.createUser(userDetails); 11}); 12 13When("they log in", async (userDetails: HTable, { world: { page } }: App) => { 14 const { username, password } = userDetails.json(0); 15 await page.logUserIn(username, password); 16}); 17 18Then("they see their profile", async ({ world: { page } }: App) => { 19 await page.verifyProfileOpen(); 20}); 21 22Then( 23 "they are informed their {word} is incorrect", 24 async (field: string, { world: { page } }: App) => { 25 await page.verifyBadLoginField(field); 26 } 27); 28 29Feature("../features/my-feature.feature"); 30 31// override Steps 32 33Feature(() => { 34 Given("a new registered User", async (data: HTable, { world: { page } }: App) => { 35 const userDetails = data.json(0); 36 await page.gotoRegistration(); 37 await page.registerWith(userDetails); 38 }); 39 40 Scenario("A User logs in with a bad password", () => { 41 Then("they are informed their password is incorrect", async ({ world: { page } }: App) => { 42 await page.verifyBadPassword(); 43 }); 44 }); 45}, "../features/my-feature.feature"); 46 47// load multiple feature files 48 49Feature("../features/my-feature.feature", "../features/my-other-feature.feature");
No vulnerabilities found.
No security vulnerabilities found.