Skip to content

Commit

Permalink
improve examples
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalets committed Jul 10, 2024
1 parent 68e66ba commit fff6bcd
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 16 deletions.
7 changes: 7 additions & 0 deletions examples/basic/features/steps/fixtures.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { test as base, createBdd } from 'playwright-bdd';

export const test = base.extend({
// add your fixtures here
});

export const { Given, When, Then } = createBdd(test);
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { expect } from '@playwright/test';
import { createBdd } from 'playwright-bdd';

const { Given, When, Then } = createBdd();
import { Given, When, Then } from './fixtures';

Given('I am on home page', async ({ page }) => {
await page.goto('https://playwright.dev');
Expand Down
6 changes: 3 additions & 3 deletions examples/basic/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { defineBddConfig, cucumberReporter } from 'playwright-bdd';
// before playwright-bdd v7
const testDir = defineBddConfig({
paths: ['features/*.feature'],
require: ['steps/*.ts'],
require: ['features/steps/*.ts'],
});

// since playwright-bdd v7
/*
const testDir = defineBddConfig({
features: './features',
steps: './steps',
features: 'features/*.feature',
steps: 'features/steps/*.ts',
});
*/

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions examples/cucumber-style/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import { defineBddConfig, cucumberReporter } from 'playwright-bdd';
// before playwright-bdd v7
const testDir = defineBddConfig({
paths: ['features'],
require: ['steps/*.ts'],
importTestFrom: 'steps/fixtures.ts',
require: ['features/steps/*.ts'],
importTestFrom: 'features/steps/fixtures.ts',
});

// since playwright-bdd v7
/*
const testDir = defineBddConfig({
features: './features',
steps: './steps',
features: 'features',
steps: 'features/steps/*.ts',
});
*/

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions examples/decorators/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import { defineBddConfig, cucumberReporter } from 'playwright-bdd';

// before playwright-bdd v7
const testDir = defineBddConfig({
importTestFrom: 'steps/fixtures.ts',
paths: ['features'],
importTestFrom: 'features/steps/fixtures.ts',
});

// since playwright-bdd v7
/*
const testDir = defineBddConfig({
features: './features',
steps: './steps',
features: 'features',
steps: 'features/steps/*.ts',
});
*/

Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions examples/esm/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { defineBddConfig, cucumberReporter } from 'playwright-bdd';
// before playwright-bdd v7
const testDir = defineBddConfig({
paths: ['features/*.feature'],
import: ['steps/*.ts'], // <- note 'import' instead of 'require'
import: ['features/steps/*.ts'], // <- note 'import' instead of 'require'
});

// since playwright-bdd v7
/*
const testDir = defineBddConfig({
features: './features',
steps: './steps',
features: 'features/*.feature',
steps: 'features/steps/*.ts',
});
*/

Expand Down

0 comments on commit fff6bcd

Please sign in to comment.