Skip to content

Commit

Permalink
Update image tests from placeholder.com to *.vercel.app (#38081)
Browse files Browse the repository at this point in the history
Fixes flaky tests when placeholder.com is down

#38080 (comment)
  • Loading branch information
styfle authored Jun 28, 2022
1 parent 0cb1253 commit edf4ea3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const Page = () => {
<br />
<Image
id="external-image"
src="https://via.placeholder.com/800/000/FFF.png?text=test"
src="https://image-optimization-test.vercel.app/test.jpg"
width={400}
height={400}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,23 @@ function runTests() {
await check(
() =>
browser.eval(`document.getElementById("external-image").currentSrc`),
/placeholder.com/
'https://image-optimization-test.vercel.app/test.jpg'
)
await check(
() => browser.elementById('internal-image').getAttribute('src'),
/test\.png/
'/test.png'
)
await check(
() => browser.elementById('static-image').getAttribute('src'),
/test(.*)jpg/
)
await check(
() => browser.elementById('external-image').getAttribute('src'),
/https:\/\/via\.placeholder\.com\/800\/000\/FFF\.png\?text=test/
'https://image-optimization-test.vercel.app/test.jpg'
)
await check(
() => browser.elementById('eager-image').getAttribute('src'),
/test\.webp/
'/test.webp'
)

expect(
Expand Down
2 changes: 1 addition & 1 deletion test/integration/image-future/unoptimized/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const Page = () => {
<br />
<Image
id="external-image"
src="https://via.placeholder.com/800/000/FFF.png?text=test"
src="https://image-optimization-test.vercel.app/test.jpg"
width={400}
height={400}
/>
Expand Down
6 changes: 3 additions & 3 deletions test/integration/image-future/unoptimized/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function runTests() {
).toMatch(/test(.*)jpg/)
expect(
await browser.elementById('external-image').getAttribute('src')
).toBe('https://via.placeholder.com/800/000/FFF.png?text=test')
).toBe('https://image-optimization-test.vercel.app/test.jpg')
expect(await browser.elementById('eager-image').getAttribute('src')).toBe(
'/test.webp'
)
Expand Down Expand Up @@ -61,7 +61,7 @@ function runTests() {
await check(
() =>
browser.eval(`document.getElementById("external-image").currentSrc`),
/placeholder.com/
'https://image-optimization-test.vercel.app/test.jpg'
)

expect(
Expand All @@ -72,7 +72,7 @@ function runTests() {
).toMatch(/test(.*)jpg/)
expect(
await browser.elementById('external-image').getAttribute('src')
).toBe('https://via.placeholder.com/800/000/FFF.png?text=test')
).toBe('https://image-optimization-test.vercel.app/test.jpg')
expect(await browser.elementById('eager-image').getAttribute('src')).toBe(
'/test.webp'
)
Expand Down

0 comments on commit edf4ea3

Please sign in to comment.