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

getProxyUrl doesn't resolve relative paths for special page URLs #2399

Closed
benmonro opened this issue Aug 4, 2020 · 4 comments · Fixed by #2532
Closed

getProxyUrl doesn't resolve relative paths for special page URLs #2399

benmonro opened this issue Aug 4, 2020 · 4 comments · Fixed by #2532

Comments

@benmonro
Copy link

benmonro commented Aug 4, 2020

What is your Test Scenario?

when using the clientScripts in a testcafe config, if you then try to use t.navigateTo an error occurs. all details and repro steps can be found here: testing-library/testcafe-testing-library#222

What is the Current behavior?

error

What is the Expected behavior?

no error

What is your web application and your TestCafe test code?

Your website URL (or attach your complete example):
Your complete test code (or attach your test files):
 
Your complete configuration file (if any):

Your complete test report:

Screenshots:

Steps to Reproduce:

  1. Go to my website ...
  2. Execute this command...
  3. See the error...

Your Environment details:

  • testcafe version:
  • node.js version:
  • command-line arguments:
  • browser name and version:
  • platform and version:
  • other:
@Ogurecher
Copy link
Contributor

Hello @benmonro,
Thank you for your report. I've reproduced this issue. We'll update this thread once it's fixed.

@miherlosev miherlosev self-assigned this Aug 5, 2020
@miherlosev miherlosev transferred this issue from DevExpress/testcafe Aug 5, 2020
@miherlosev miherlosev removed their assignment Aug 5, 2020
@miherlosev miherlosev changed the title bug when using clientScripts in conjunction with clientScripts 'getFirstDestUrl' function from 'utils/stack-processing' cannot determine URL for some error stack Aug 5, 2020
@miherlosev
Copy link
Contributor

Steps to reproduce:

  • git clone https://github.com/SamuelDavis/testing-library-testcafe-integration;
  • cd testing-library-testcafe-integration;
  • npm install;
  • npx testcafe chrome tests.js;

@miherlosev miherlosev added this to the Sprint #62 milestone Aug 5, 2020
@AndreyBelym
Copy link
Contributor

I would say that getFirstDestUrl function works correctly in this case since the error that we use to parse stack is originated from the service TestCafe script - the injected client script, not by some page script, and doesn't contain any proxied URL:

Error
    at beforeTransform (http://172.22.14.234:59840/hammerhead.js:28337:19)
    at transformProgram (http://172.22.14.234:59840/hammerhead.js:28409:9)
    at processScript (http://172.22.14.234:59840/hammerhead.js:27817:46)
    at FunctionWrapper (http://172.22.14.234:59840/hammerhead.js:19904:121)
    at http://172.22.14.234:59840/custom-client-scripts/__node_modules_@testing-library_dom_dist_@testing-library_dom_umd_js:14115:7
    at createCommonjsModule (http://172.22.14.234:59840/custom-client-scripts/__node_modules_@testing-library_dom_dist_@testing-library_dom_umd_js:129:7)
    at http://172.22.14.234:59840/custom-client-scripts/__node_modules_@testing-library_dom_dist_@testing-library_dom_umd_js:13420:19
    at http://172.22.14.234:59840/custom-client-scripts/__node_modules_@testing-library_dom_dist_@testing-library_dom_umd_js:5:29
    at http://172.22.14.234:59840/custom-client-scripts/__node_modules_@testing-library_dom_dist_@testing-library_dom_umd_js:6:2"

I think that getProxyUrl is the real culprit here. It returns incorrect results when handling relative URLs called on the proxied about:blank page. Compare this:

image
image

@miherlosev
Copy link
Contributor

@AndreyBelym is right.

In case, if the stack doesn't contain the tested page URL, we are trying to calculate it using the getProxyUrl('./') function call.

@miherlosev miherlosev changed the title 'getFirstDestUrl' function from 'utils/stack-processing' cannot determine URL for some error stack getProxyUrl doesn't resolve relative paths for special page URLs Aug 6, 2020
@miherlosev miherlosev removed this from the Sprint #62 milestone Aug 6, 2020
@LavrovArtem LavrovArtem added this to the Sprint #72 milestone Dec 29, 2020
LavrovArtem added a commit to LavrovArtem/testcafe-hammerhead that referenced this issue Dec 29, 2020
miherlosev pushed a commit that referenced this issue Dec 30, 2020
…Ls` (close #2399) (#2532)

* fix `'getProxyUrl' doesn't resolve relative paths for special page URLs` (close #2399)

* fix server tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants