question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Next.js Image does not render image under Cypress Component test

See original GitHub issue

Current behavior

I have set up Cypress component testing for Next.js project which make heavy use of next/Image component. But Next.js dev server launched by Cypress returns 404: Cannot GET /_next/image

Desired behavior

It will be cool to see next.js Image component working.

Test code to reproduce

TO DO

Cypress Version

8.3.1

Other

No response

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:4
  • Comments:9

github_iconTop GitHub Comments

2reactions
Ilyeocommented, Oct 7, 2022

I had the same issue

Using next/image component I’m getting an load resource error Cannot GET /_next/image

A workaround that I found is passing unoptimized prop

<Image ... unoptimized />

That shows the image in the cypress component environment

This workaround does not like me and I do not recommend it, but it probably gives us a hint of the cause

1reaction
tschmidt64-SCcommented, Jul 21, 2022

I am also running into this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Test loading of image in Cypress - Stack Overflow
I want to test Cypress that an image is loaded into the page. And my test is like this: it("should display a image...
Read more >
Component Testing Next.js Application with Cypress - Medium
In this article, I'll show you how to write Component Testing your Next.js applications with Cypress. This could change your testing ...
Read more >
Testing | Next.js
Learn how to set up Next.js with three commonly used testing tools — Cypress, Playwright, Jest, and React Testing Library.
Read more >
Testing images with Cypress - YouTube
Today we'll write a test that asserts an image was correctly uploaded and displayed using Cypress.
Read more >
Introduction | Cypress Documentation
An overview of Continuous Integration; How to run Cypress tests in ... with an existing node_modules into a cypress/base docker image will not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found