Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Cucumber AutoComplete issue for steps with multiple variants. #230

Closed
gitToSantosh opened this issue Oct 21, 2024 · 3 comments
Closed
Labels
question Further information is requested

Comments

@gitToSantosh
Copy link

gitToSantosh commented Oct 21, 2024

Problem
When I have steps like below:

Then I see link with text "How to install Playwright" should be displayed
Then I see link with text "How to install Playwright" should not be displayed

and step as below

Then( 'I see link with text {string} should( not) be displayed', async ( { page, $step }, text: string ) => {
	const negate = /should not/.test( $step.title );
	if ( negate ) {
		await expect( page.getByRole( 'link', { name: text } ) ).toBeHidden();
	} else {
		await expect( page.getByRole( 'link', { name: text } ) ).toBeVisible();
	}
} );

Cucumber autocomplete only identifies the negation step and fails to identify the positive step and shows as warning

Alternatively, when i use below step

Then( 'I see link with text {string} should(| not) be displayed', async ( { page, $step }, text: string ) => {
	const negate = /should not/.test( $step.title );
	if ( negate ) {
		await expect( page.getByRole( 'link', { name: text } ) ).toBeHidden();
	} else {
		await expect( page.getByRole( 'link', { name: text } ) ).toBeVisible();
	}
} );

Cucumber autocomplete identifies both positive and negative steps, but here bddgen fails to identify one of the steps

Please provide some solutions

@gitToSantosh gitToSantosh added the question Further information is requested label Oct 21, 2024
@vitalets
Copy link
Owner

vitalets commented Oct 22, 2024

It's a bug in CucumberAutocomplete: alexkrechik/VSCucumberAutoComplete#292
I've tried with official Cucumber extension, it handles optional part correctly and navigates to the definition from both steps. So for now I suggest to switch on it if applicable.

Also I've submitted a fix to alexkrechik/VSCucumberAutoComplete#509.
Lets keep this issue open to track the progress.

@gitToSantosh
Copy link
Author

Thanks , I am now using official Cucumber Extension and yes it works

@vitalets
Copy link
Owner

You are welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants