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

Multi line assertion not working in Node 14 #2190

Closed
advait012 opened this issue Jul 13, 2021 · 13 comments
Closed

Multi line assertion not working in Node 14 #2190

advait012 opened this issue Jul 13, 2021 · 13 comments

Comments

@advait012
Copy link

advait012 commented Jul 13, 2021

Describe the bug
When we updated node version from 10 to 14 in our project. Assertion for existence of text is not working properly.
await text("text content").exists() does not seems to be working fine

As you can see above , the text in the page is "Your organisation already has a paid account". which is written in two lines . When I put assertion as :-

await text("Your organisation already has a paid account").exists() , It is failing and giving me error as "Error Message: AssertionError: Element with text Your organization already has a paid account doesn't exist"

When I replace the line with "Your organisation already has" during assertion. It is able to locate and pass the existence.So looks like multiline assertion is not working for node 14

Note : When I am running the same test case in Node 10. It is working fine

Versions:

  • Taiko: 1.2.5
  • Node.js : 14
Gauge version: 1.3.2
Commit Hash: 063444f

Plugins
-------
html-report (4.0.9)
java (0.7.6)
js (2.3.17)
screenshot (0.0.1)
xml-report (0.2.3)

Additional context
Add any other context about the problem here.

@sriv
Copy link
Member

sriv commented Jul 15, 2021

Can you share the html snippet of the text that you are asserting please?

@advait012
Copy link
Author

advait012 commented Jul 15, 2021

Removing screenshot for security reasons

@sriv
Copy link
Member

sriv commented Jul 16, 2021

screenshot does not help much. If you can share a sample html where this assertion is broken, I can try investigating this.

@advait012
Copy link
Author

testing.zip

Please find the sample html for investigation

@advait012
Copy link
Author

Hi @sriv , I have sent you the sample html a month ago . Please let me know if that helped.

@zabil
Copy link
Member

zabil commented Aug 12, 2021

@advait012 it will be much easier if you share the example as a GitHub repo so that someone can comment on the source code, clone and checkout etc.

@advait012
Copy link
Author

@zabil , Due to security reason I cannot share the source code or Github repo of my project . Can't we leverage the sample html I have sent you and test the mutli assertion over it?

@zabil
Copy link
Member

zabil commented Aug 12, 2021

You don't need to share the GitHub repo for your project. Please create a sample GitHub repository with a taiko script only replicating this issue so that someone can

  • Clone the repo
  • Run the taiko script and replicate the issue on the HTML

There are better chances of getting help if it's easier to replicate.

@sriv
Copy link
Member

sriv commented Aug 12, 2021

the sample provided is helpful, @advait012 you have a typo..

the html has this:

Your organization already has 
a paid account

whereas you are asserting on "Your organisation already has a paid account". Note the difference in spelling organization.

Changing it to match the html's spelling works for me.

@sriv sriv closed this as completed Aug 12, 2021
@advait012
Copy link
Author

What node version you using @sriv ?

@sriv
Copy link
Member

sriv commented Aug 12, 2021

> node --version
v16.3.0

I tested this on Windows 10.

@advait012
Copy link
Author

Hi @sriv , Don't know why it is still failing on my end , I have used the following step to verify

# Testing of multilne asssertion

## Multi Assertion testing

* Go to URL: "http://127.0.0.1:5500/testing.html" with timeout: "5000"
* Verify text: "Your organization already has a paid account" exists
step('Go to URL: <url> with timeout: <timeout>', async (url, timeout) => {
  await goto(url, { navigationTimeout: timeout });
  logger.info(`Launched: ${url}`);
});
step('Verify text: <textContent> exists', async (textContent) => {
  const response = await text(textContent);
  assert.ok(await response.exists(), `${await response.description} doesn't exist`);
});

@sriv
Copy link
Member

sriv commented Aug 17, 2021

What error do you see? Your code works fine for me with a new gauge+taiko project, and using the sample html you've provided above.

Note that you have some redundant await statements, but they do not cause the tests to fail.

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

3 participants