Skip to content

Commit 835f010

Browse files
committed
Fix image tests
- fixed brittle onLoad test (see #37993) - src="" is now omitted
1 parent ec155bc commit 835f010

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

test/integration/next-image-new/default/test/index.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ function runTests(mode) {
373373
let browser = await webdriver(appPort, '/on-load')
374374

375375
await browser.eval(
376-
`document.getElementById("footer").scrollIntoView({behavior: "smooth"})`
376+
`document.getElementById("msg1").scrollIntoView({behavior: "smooth"})`
377377
)
378378

379379
await check(
@@ -1138,9 +1138,10 @@ function runTests(mode) {
11381138
const warnings = (await browser.log()).filter(
11391139
(log) => log.source === 'error'
11401140
)
1141-
expect(warnings.length).toBe(0)
11421141

1143-
expect(await browser.elementById('img').getAttribute('src')).toBe('')
1142+
expect(warnings).toEqual([])
1143+
1144+
expect(await browser.elementById('img').getAttribute('src')).toBe(null)
11441145
expect(await browser.elementById('img').getAttribute('srcset')).toBe(null)
11451146
expect(await browser.elementById('img').getAttribute('width')).toBe('200')
11461147
expect(await browser.elementById('img').getAttribute('height')).toBe(
@@ -1153,9 +1154,9 @@ function runTests(mode) {
11531154
const warnings = (await browser.log()).filter(
11541155
(log) => log.source === 'error'
11551156
)
1156-
expect(warnings.length).toBe(0)
1157+
expect(warnings).toEqual([])
11571158

1158-
expect(await browser.elementById('img').getAttribute('src')).toBe('')
1159+
expect(await browser.elementById('img').getAttribute('src')).toBe(null)
11591160
expect(await browser.elementById('img').getAttribute('srcset')).toBe(null)
11601161
expect(await browser.elementById('img').getAttribute('width')).toBe('200')
11611162
expect(await browser.elementById('img').getAttribute('height')).toBe(
@@ -1571,7 +1572,6 @@ describe('Image Component Default Tests', () => {
15711572
afterAll(async () => {
15721573
await killApp(app)
15731574
})
1574-
15751575
runTests('server')
15761576
}
15771577
)

0 commit comments

Comments
 (0)