File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
test/integration/image-component/default/test Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,19 @@ const nextConfig = join(appDir, 'next.config.js')
2222let appPort
2323let app
2424
25+ async function hasImageMatchingUrl ( browser , url ) {
26+ const links = await browser . elementsByCss ( 'img' )
27+ let foundMatch = false
28+ for ( const link of links ) {
29+ const src = await link . getAttribute ( 'src' )
30+ if ( src === url ) {
31+ foundMatch = true
32+ break
33+ }
34+ }
35+ return foundMatch
36+ }
37+
2538function runTests ( mode ) {
2639 it ( 'should load the images' , async ( ) => {
2740 let browser
@@ -54,6 +67,16 @@ function runTests(mode) {
5467
5568 return 'result-correct'
5669 } , / r e s u l t - c o r r e c t / )
70+
71+ expect (
72+ await hasImageMatchingUrl (
73+ browser ,
74+ mode === 'serverless'
75+ ? // FIXME: this is a bug
76+ `http://localhost:${ appPort } /_next/image/?url=%2Ftest.jpg&w=420&q=75`
77+ : `http://localhost:${ appPort } /_next/image?url=%2Ftest.jpg&w=420&q=75`
78+ )
79+ ) . toBe ( true )
5780 } finally {
5881 if ( browser ) {
5982 await browser . close ( )
You can’t perform that action at this time.
0 commit comments