-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix duplicate steps error message, [#74]
- Loading branch information
Showing
9 changed files
with
96 additions
and
7 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
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
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
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 @@ | ||
Feature: unique steps | ||
|
||
Scenario: scenario 1 | ||
Given unique step | ||
|
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 @@ | ||
Feature: duplicate steps | ||
|
||
Scenario: scenario 1 | ||
Given duplicate step | ||
|
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,26 @@ | ||
import { defineConfig } from '@playwright/test'; | ||
import { defineBddConfig } from '../../dist'; | ||
|
||
export default defineConfig({ | ||
projects: [ | ||
{ | ||
name: 'no duplicate steps', | ||
testDir: defineBddConfig({ | ||
outputDir: `.features-gen/one`, | ||
paths: ['features/one.feature'], | ||
importTestFrom: 'steps/fixtures.ts', | ||
}), | ||
}, | ||
{ | ||
// important to have duplicate steps in the second project | ||
// that runs in a worker process | ||
name: 'duplicates', | ||
testDir: defineBddConfig({ | ||
outputDir: `.features-gen/two`, | ||
paths: ['features/two.feature'], | ||
importTestFrom: 'steps/fixtures.ts', | ||
}), | ||
}, | ||
], | ||
forbidOnly: Boolean(process.env.FORBID_ONLY), | ||
}); |
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 { Fixture, Given } from '../../../dist/decorators'; | ||
import { test } from './fixtures'; | ||
|
||
export | ||
@Fixture<typeof test>('todoPage') | ||
class TodoPage { | ||
@Given('unique step') | ||
async step1() {} | ||
|
||
@Given('duplicate step') | ||
async step2() {} | ||
|
||
@Given('duplicate step') | ||
async step3() {} | ||
} |
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,10 @@ | ||
import { test as base } from '../../../dist'; | ||
import { TodoPage } from './TodoPage'; | ||
|
||
type Fixtures = { | ||
todoPage: TodoPage; | ||
}; | ||
|
||
export const test = base.extend<Fixtures>({ | ||
todoPage: ({}, use) => use(new TodoPage()), | ||
}); |
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,21 @@ | ||
import { test, TestDir, execPlaywrightTestWithError, DEFAULT_CMD } from '../helpers.mjs'; | ||
|
||
const testDir = new TestDir(import.meta); | ||
|
||
test(`${testDir.name} (main thread)`, () => { | ||
execPlaywrightTestWithError( | ||
testDir.name, | ||
DUPLICATE_STEPS_ERROR, | ||
`${DEFAULT_CMD} -- project duplicates`, | ||
); | ||
}); | ||
|
||
test(`${testDir.name} (worker)`, () => { | ||
execPlaywrightTestWithError(testDir.name, DUPLICATE_STEPS_ERROR); | ||
}); | ||
|
||
const DUPLICATE_STEPS_ERROR = [ | ||
'Multiple step definitions matched for text: "duplicate step" (features/two.feature)', | ||
' duplicate step', | ||
' duplicate step', | ||
].join('\n'); |