-
Notifications
You must be signed in to change notification settings - Fork 26.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { createNextDescribe } from '../../../lib/e2e-utils' | ||
|
||
createNextDescribe( | ||
'app dir next-image (with https)', | ||
{ | ||
files: __dirname, | ||
skipDeployment: true, | ||
startCommand: `yarn next dev --experimental-https`, | ||
}, | ||
({ next }) => { | ||
if (!process.env.CI) { | ||
console.warn('only runs on CI as it requires administrator privileges') | ||
it('only runs on CI as it requires administrator privileges', () => {}) | ||
return | ||
} | ||
|
||
it('loads images without any errors', async () => { | ||
let failCount = 0 | ||
const browser = await next.browser('/', { | ||
beforePageLoad(page) { | ||
page.on('response', (response) => { | ||
const url = response.url() | ||
if (!url.includes('/_next/image')) return | ||
|
||
const status = response.status() | ||
|
||
console.log(`URL: ${url} Status: ${status}`) | ||
|
||
if (!response.ok()) { | ||
console.log(`Request failed: ${url}`) | ||
failCount++ | ||
} | ||
}) | ||
}, | ||
}) | ||
const image = browser.elementByCss('#app-page') | ||
const src = await image.getAttribute('src') | ||
|
||
expect(src).toContain( | ||
'/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Ftest.3f1a293b.png&w=828&q=90' | ||
) | ||
|
||
expect(failCount).toBe(0) | ||
}) | ||
} | ||
) |