Closed jzaratei closed 7 months ago
Same here, I'm using Windows 11 Pro Node: v18.18.1 pnpm: 8.15.4 "@playwright/test": "^1.42.1" "playwright-bdd": "^6.0.1",
Could you try to use windows backslashes "\" in paths in defineBddConfig?
I just tried with my defineBddConfig like:
const testDir = defineBddConfig({ importTestFrom: 'support\\fixtures.ts', paths: ['.\\features'], require: ['steps\\*.ts'], quotes: 'backtick', featuresRoot: '.\\features' });
Still got the same error and I ran bddgen successfully on version 5.8.0 with the above too so we know it's correct
Got it! Could you also paste an output of 'npx bddgen --verbose'
Sure here you go (I did swap back the slashes but can put back to windows style if needs be):
npx bddgen --verbose
Loading features from: ./features
Loading steps from: steps/*.ts
Loaded steps: 166
Loaded features: 20
C:\Users\Adam.Wood\Documents\Code\NextGenDemo.UI\test\node_modules\.pnpm\playwright-bdd@6.0.1_@cucumber+cucumber@10.3.1_@playwright+test@1.42.1\node_modules\playwright-bdd\dist\gen\testFile.js:312
throw new Error(`Pickle step not found for step: ${step.text}`);
^
Error: Pickle step not found for step: an authenticated Marketplace Operator
at TestFile.findPickleStep (C:\Users\Adam.Wood\Documents\Code\NextGenDemo.UI\test\node_modules\.pnpm\playwright-bdd@6.0.1_@cucumber+cucumber@10.3.1_@playwright+test@1.42.1\node_modules\playwright-bdd\src\gen\testFile.ts:406:11)
at TestFile.getStep (C:\Users\Adam.Wood\Documents\Code\NextGenDemo.UI\test\node_modules\.pnpm\playwright-bdd@6.0.1_@cucumber+cucumber@10.3.1_@playwright+test@1.42.1\node_modules\playwright-bdd\src\gen\testFile.ts:316:29)
at C:\Users\Adam.Wood\Documents\Code\NextGenDemo.UI\test\node_modules\.pnpm\playwright-bdd@6.0.1_@cucumber+cucumber@10.3.1_@playwright+test@1.42.1\node_modules\playwright-bdd\src\gen\testFile.ts:279:16
at Array.map (<anonymous>)
at TestFile.getSteps (C:\Users\Adam.Wood\Documents\Code\NextGenDemo.UI\test\node_modules\.pnpm\playwright-bdd@6.0.1_@cucumber+cucumber@10.3.1_@playwright+test@1.42.1\node_modules\playwright-bdd\src\gen\testFile.ts:271:34)
at TestFile.getBeforeEach (C:\Users\Adam.Wood\Documents\Code\NextGenDemo.UI\test\node_modules\.pnpm\playwright-bdd@6.0.1_@cucumber+cucumber@10.3.1_@playwright+test@1.42.1\node_modules\playwright-bdd\src\gen\testFile.ts:200:38)
at TestFile.getSuiteChild (C:\Users\Adam.Wood\Documents\Code\NextGenDemo.UI\test\node_modules\.pnpm\playwright-bdd@6.0.1_@cucumber+cucumber@10.3.1_@playwright+test@1.42.1\node_modules\playwright-bdd\src\gen\testFile.ts:184:39)
at C:\Users\Adam.Wood\Documents\Code\NextGenDemo.UI\test\node_modules\.pnpm\playwright-bdd@6.0.1_@cucumber+cucumber@10.3.1_@playwright+test@1.42.1\node_modules\playwright-bdd\src\gen\testFile.ts:178:60
at Array.forEach (<anonymous>)
at TestFile.getSuite (C:\Users\Adam.Wood\Documents\Code\NextGenDemo.UI\test\node_modules\.pnpm\playwright-bdd@6.0.1_@cucumber+cucumber@10.3.1_@playwright+test@1.42.1\node_modules\playwright-bdd\src\gen\testFile.ts:178:22)
at TestFile.getRootSuite (C:\Users\Adam.Wood\Documents\Code\NextGenDemo.UI\test\node_modules\.pnpm\playwright-bdd@6.0.1_@cucumber+cucumber@10.3.1_@playwright+test@1.42.1\node_modules\playwright-bdd\src\gen\testFile.ts:168:17)
at TestFile.build (C:\Users\Adam.Wood\Documents\Code\NextGenDemo.UI\test\node_modules\.pnpm\playwright-bdd@6.0.1_@cucumber+cucumber@10.3.1_@playwright+test@1.42.1\node_modules\playwright-bdd\src\gen\testFile.ts:116:15)
at C:\Users\Adam.Wood\Documents\Code\NextGenDemo.UI\test\node_modules\.pnpm\playwright-bdd@6.0.1_@cucumber+cucumber@10.3.1_@playwright+test@1.42.1\node_modules\playwright-bdd\src\gen\index.ts:111:12
at Array.map (<anonymous>)
at TestFilesGenerator.buildFiles (C:\Users\Adam.Wood\Documents\Code\NextGenDemo.UI\test\node_modules\.pnpm\playwright-bdd@6.0.1_@cucumber+cucumber@10.3.1_@playwright+test@1.42.1\node_modules\playwright-bdd\src\gen\index.ts:102:8)
at C:\Users\Adam.Wood\Documents\Code\NextGenDemo.UI\test\node_modules\.pnpm\playwright-bdd@6.0.1_@cucumber+cucumber@10.3.1_@playwright+test@1.42.1\node_modules\playwright-bdd\src\gen\index.ts:44:12
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at withExitHandler (C:\Users\Adam.Wood\Documents\Code\NextGenDemo.UI\test\node_modules\.pnpm\playwright-bdd@6.0.1_@cucumber+cucumber@10.3.1_@playwright+test@1.42.1\node_modules\playwright-bdd\src\utils\exit.ts:30:12)
at TestFilesGenerator.generate (C:\Users\Adam.Wood\Documents\Code\NextGenDemo.UI\test\node_modules\.pnpm\playwright-bdd@6.0.1_@cucumber+cucumber@10.3.1_@playwright+test@1.42.1\node_modules\playwright-bdd\src\gen\index.ts:41:5)
at async Promise.all (index 0)
at Command.<anonymous> (C:\Users\Adam.Wood\Documents\Code\NextGenDemo.UI\test\node_modules\.pnpm\playwright-bdd@6.0.1_@cucumber+cucumber@10.3.1_@playwright+test@1.42.1\node_modules\playwright-bdd\src\cli\commands\test.ts:29:5)
Node.js v18.18.1
Thank you @adamwood-novafori Looks like it's reproduced only on win. Lets do one more thing: could you clone and run playwright-bdd-example: https://github.com/vitalets/playwright-bdd-example And if it runs fine, try to run your project without decorator steps (if possible).
Yeah might be windows being difficult as usual!
I've just tried it with the example project with npm and pnpm and it works fine.
Couldn't see much difference between the setup of that one and mine I even tried matching the same defineBddConfig and adding the tsconfig you had but still the same issue. Even tried changing the project structure to match the typical workplace with src and test directories but couldn't replicate it.
Edit: I just tried installing cucumber explicitly and not just as a peer but still no luck
My project uses playwright style with fixtures so no decorators.
hmmm 🤔
@adamwood-novafori maybe start from another side: could you comment parts of your project to get it look like playwright-bdd-example?
hello, the problem seems to be the number of features to generate. I found out the maximum is 9 features to make it work, if I try with 10 I got the pickle error. Actually my project has 12 features in total.
hello, the problem seems to be the number of features to generate. I found out the maximum is 9 features to make it work, if I try with 10 I got the pickle error. Actually my project has 12 features in total.
Hello I though the problem was the number of features in total but actually, in my case, the problem is an specific feature with no scenarios (commented as TODO). If I delete that, then I am able to generate all the features. @adamwood-novafori try to delete 1 by 1 your feature until you get your project works.
@jzaratei Nice find! I located my problem feature file and it's because I had a background step but my actual tests were commented out because of waiting for bug fixes.
So maybe that's what caused the problem, generating a playwright test when there's a background but no tests
@vitalets here you a branch where you could replicate the issue. https://github.com/jzaratei/playwright-bdd-example/tree/emptyFeature
Reproduced it, preparing the fix.
Fixed in 6.0.2. For feature without scenarios spec file will not be generated. @jzaratei @adamwood-novafori please re-check on your side and feel free to reopen in case of any issues. Thank you for your feedback!
Given export default defineConfig({
When
I execute npx bddgen
Then
I get an error
But I expect
test cases generated successfully.
Isolated demo
Environment