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

[0.3.4] "100% Invoiced" is omitting everything after % #187

Closed
mholetzko opened this issue Aug 9, 2024 · 7 comments
Closed

[0.3.4] "100% Invoiced" is omitting everything after % #187

mholetzko opened this issue Aug 9, 2024 · 7 comments

Comments

@mholetzko
Copy link

Describe the bug

With 0.3.4 we see a bunch of issues on our test-suites. If we parse e.g. 100% Invoiced to a step variable, then the parsed result is 100 instead of the whole string 100% Invoiced.

This snippet shows the "issue" with the parseFloat implementation

const num1 = Number.parseFloat("100% Invoiced");
const num2 = Number("100% Invoiced")

// Expectation
console.log(Number.isNaN(num1)); -> False -> 100 -> Gauge parses as 100
console.log(Number.isNaN(num2)); -> True -> NaN -> Gauge parses as string as expected

We can henceforth not use version 0.3.4. If I find some time, I can imagine writing up a few more detailed requirements, test cases and implement it, but won't be possible in the next days :)

@lbockstaller

@zabil
Copy link
Member

zabil commented Aug 9, 2024

I've tried this with the following.

## Custom Parameters in steps
* This step parses a parameter which is not a number like "100% of the value"

And implementation

  @Step("This step parses a parameter which is not a number like <value>")
  public async validateStringParsing(value: string) {
    assert.strictEqual(value, "100% of the value");
  }

And get the right results

# Parameters
  ## Custom Parameters in steps	 ✔100% of the value

My versions

$ node --version                                                                                                                           
v22.4.0

$ Gauge version: 1.6.7
Commit Hash: 684d870

Plugins
-------
html-report (4.3.1)
screenshot (0.2.0)
ts (0.3.4)

The test passes and prints out the correct value (if i add a debug). Can you please provide an example step and implementation to replicate this?

@zabil
Copy link
Member

zabil commented Aug 14, 2024

Closing for now. Will re-open if info about steps and implementation and versions are provided.

@zabil zabil closed this as completed Aug 14, 2024
@mholetzko
Copy link
Author

Hey @zabil ,

I was on vacation - I'll try to extract an example incl. versions soon.
We have reverted the versions so there is no pressure on our side.

Will post here once I get to it - thanks for the quick reply though!

@kiranpatil-ic
Copy link

Seeing the same issue after upgrading to 1.3.4. Here are few details

Gauge version: 1.6.7
Plugins

html-report (4.3.1)
screenshot (0.3.0)
ts (0.3.4)
xml-report (0.5.1)

Here is an example

    @Step("Set filter to <commaSeparatedFilterValues>")
    async setFilter(commaSeparatedFilterValues: string) {
      console.log(`${commaSeparatedFilterValues} - ${typeof(commaSeparatedFilterValues)}`);
    }
* Set filter to "4578"

* Set filter to "4578 - 101"

* Set filter to "a4578"

---Output---

4578 - number
4578 - number
a4578 - string

As you can see above, if the step parameter is a number or begins with a numeric value, then the type of the parameter is number & any string value which follows the number is ignored. Downgrading to 0.3.3 works as expected.

@zabil Please make sure your package.json has the same version i.e 0.3.4 in the dependencies for you to reproduce this issue.

@hazzik
Copy link

hazzik commented Oct 9, 2024

Having the same issue with phone numbers :-(

@zabil
Copy link
Member

zabil commented Oct 9, 2024

Planning to spend some time on this. Can you give me an example of the phone number format with this issue? (please use a fake number)

@zabil
Copy link
Member

zabil commented Oct 11, 2024

Fixed via #191

@zabil zabil closed this as completed Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants