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

srcset Proxying doesn't work with React #2958

Closed
helgenlechner opened this issue Aug 25, 2023 · 5 comments · Fixed by #2968
Closed

srcset Proxying doesn't work with React #2958

helgenlechner opened this issue Aug 25, 2023 · 5 comments · Fixed by #2968

Comments

@helgenlechner
Copy link

What is your Scenario?

I'm trying to load responsive images with srcsets in an integration test for a React app.

What is the Current behavior?

Images cannot be loaded, because the proxying does not work correctly. The proxied URL is malformed.

What is the Expected behavior?

Images with srcsets can be loaded and rendered correctly.

What is your public website URL? (or attach your complete example)

Here's a minimal Sandbox where the behavior can be observed: https://codesandbox.io/s/srcset-proxying-test-58w6s7

The first image is rendered with a simple React app, that just renders the image with a srcset. The second image is just rendered in static HTML but has the same properties as the first image. In the preview, the image is visible twice, as expected:
Screenshot 2023-08-25 at 15 21 55

When running the provided Testcafe script and test, the image rendered through React fails to load, and only the statically rendered image shows up:
Screenshot 2023-08-25 at 15 22 21
(The image itself is different in the two screenshots because I'm using an sample image API.)

What is your TestCafe test code?

Test Runner Script: https://codesandbox.io/s/srcset-proxying-test-58w6s7?file=/test/runTest.js

Test Script: https://codesandbox.io/s/srcset-proxying-test-58w6s7?file=/test/imgTest.js

Your complete configuration file

None other than what is specified in the Sandbox.

Your complete test report

No response

Screenshots

No response

Steps to Reproduce

  1. Run the Testcafe script that is provided in the Sandbox. I'm not sure if that is possible within the Sandox. You may have to paste the runTest.js and imgTest.js to local files.
  2. The test will open the Sandbox and pause, showing one failed and one successfully loaded image.

TestCafe version

2.6.2

Node.js version

16.14.2

Command-line arguments

node ./test/runTest.js

Browser name(s) and version(s)

Chrome 116.0.5845.96

Platform(s) and version(s)

macOS 13.4.1

Other

I can't use Testcafe's new Native Automation because we run the tests in CI in Browserstack and in Chrome, Edge, Firefox and Safari.

@Aleksey28
Copy link
Collaborator

Hi @helgenlechner,

I didn't manage to reproduce the issue with the latest TestCafe version. Please update your TestCafe package.

@helgenlechner
Copy link
Author

Hi @Aleksey28,

Thank you for taking a look. I have now updated to the latest version of TestCafe (3.3.0) and the issue still persists. I wonder how you got it to work? Are you using Native Automation? Like I stated in the original description, I can't use Native Automation, because we use remote browsers and also we need to test in Firefox and Safari.

Screenshot 2023-09-01 at 09 05 46

@AlexKamaev
Copy link
Contributor

@helgenlechner
I confirm that the issue still exists in non-Native Automation mode.

@AlexKamaev AlexKamaev reopened this Sep 6, 2023
gg-kialo added a commit to gg-kialo/testcafe-hammerhead that referenced this issue Oct 18, 2023
Some frameworks, like React, use non-canonicalised attribute names. The
spec and browsers allow this, but hammerhead is only checking if the
attribute name without canonicalisation matches `srcset`.

By using the `loweredAttr` for the comparision, hammerhead will be more
accepting of inputs and resolve srcset issues with React projets (DevExpress#2958).

See facebook/react#10863 for more background.
gg-kialo added a commit to gg-kialo/testcafe-hammerhead that referenced this issue Oct 18, 2023
Some frameworks, like React, use non-canonicalised attribute names. The
spec and browsers allow this, but hammerhead is only checking if the
attribute name without canonicalisation matches `srcset`.

By using the `loweredAttr` for the comparision, hammerhead will be more
accepting of inputs and resolve srcset issues with React projets
(fixes DevExpress#2958).

See facebook/react#10863 for more background.
gg-kialo added a commit to gg-kialo/testcafe-hammerhead that referenced this issue Oct 18, 2023
Some frameworks, like React, use non-canonicalised attribute names. The
spec and browsers allow this, but hammerhead is only checking if the
attribute name without canonicalisation matches `srcset`.

By using the `loweredAttr` for the comparision, hammerhead will be more
accepting of inputs and resolve srcset issues with React projets
(fixes DevExpress#2958).

See facebook/react#10863 for more background.
gg-kialo added a commit to gg-kialo/testcafe-hammerhead that referenced this issue Oct 18, 2023
Some frameworks, like React, use non-canonicalised attribute names. The
spec and browsers allow this, but hammerhead is only checking if the
attribute name without canonicalisation matches `srcset`.

By using the `loweredAttr` for the comparison, hammerhead will be more
accepting of inputs and resolve srcset issues with React projects
(fixes DevExpress#2958).

See facebook/react#10863 for more background.
@gg-kialo
Copy link
Contributor

I ran into the same issue and have opened a PR to fix: #2968

gg-kialo added a commit to gg-kialo/testcafe-hammerhead that referenced this issue Oct 18, 2023
Some frameworks, like React, use non-canonicalised attribute names. The
spec and browsers allow this, but hammerhead is only checking if the
attribute name without canonicalisation matches `srcset`.

By using the `loweredAttr` for the comparison, hammerhead will be more
accepting of inputs and resolve srcset issues with React projects
(fixes DevExpress#2958).

See facebook/react#10863 for more background.
gg-kialo added a commit to gg-kialo/testcafe-hammerhead that referenced this issue Oct 18, 2023
Some frameworks, like React, use non-canonicalised attribute names. The
spec and browsers allow this, but hammerhead is only checking if the
attribute name without canonicalisation matches `srcset`.

By using the `loweredAttr` for the comparison, hammerhead will be more
accepting of inputs and resolve srcset issues with React projects
(fixes DevExpress#2958).

See facebook/react#10863 for more background.
gg-kialo added a commit to gg-kialo/testcafe-hammerhead that referenced this issue Oct 24, 2023
Some frameworks, like React, use non-canonicalised attribute names. The
spec and browsers allow this, but hammerhead is only checking if the
attribute name without canonicalisation matches `srcset`.

By using the `loweredAttr` for the comparison, hammerhead will be more
accepting of inputs and resolve srcset issues with React projects
(fixes DevExpress#2958).

See facebook/react#10863 for more background.
Aleksey28 pushed a commit that referenced this issue Oct 24, 2023
Some frameworks, like React, use non-canonicalised attribute names. The
spec and browsers allow this, but hammerhead is only checking if the
attribute name without canonicalisation matches `srcset`.

By using the `loweredAttr` for the comparison, hammerhead will be more
accepting of inputs and resolve srcset issues with React projects
(fixes #2958).

See facebook/react#10863 for more background.
@github-actions
Copy link

Release v31.6.3 addresses this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants