cucumber-boilerplate icon indicating copy to clipboard operation
cucumber-boilerplate copied to clipboard

I expect that element does appear exactly * times - doesn't work

Open denis-platonov opened this issue 3 years ago • 3 comments

Issue description

Please provide a brief description of the problem you are experiencing

Steps to reproduce

Run a step "I expect that element "([^"])?" does( not) appear exactly "([^"]*)?" times"

Expected behavior

Should count the number of times an element is present on a page This step is also missing in snippets https://github.com/webdriverio/cucumber-boilerplate/blob/main/src/features/sampleSnippets.feature

Actual behavior

'Value must be a non-negative integer' error is thrown (prob some parsing\casting issue)

Issue occurred on browser/platform

Windows \ Chrome 100 image

denis-platonov avatar May 28 '22 18:05 denis-platonov

Great idea of this step, would love to see it working. The framework is fantastic as well. I love it a lot!

denis-platonov avatar May 28 '22 18:05 denis-platonov

@denis-platonov thanks for filing the issue.

This seems like a bug indeed. Would you like to help us providing a fix?

christian-bromann avatar May 30 '22 09:05 christian-bromann

I would love to but I'm not JavaScript\TypeScript developer

denis-platonov avatar May 30 '22 16:05 denis-platonov

https://github.com/webdriverio/cucumber-boilerplate/blob/002e934c24e502da4e348cb32eed9c9f2e7cf773/src/support/lib/checkIfElementExists.ts#L28-L29

The issue lies here, the code checks for strict equality. Whereas the exactly is being received as string (number "4"), so the type checking fails as the exactly should be a number and not a string. Converting the exactly to a number will fix the issue.

shubhit7 avatar Jun 14 '23 04:06 shubhit7