Skip to content

Commit

Permalink
Fix image tests
Browse files Browse the repository at this point in the history
- fixed brittle onLoad test (see #37993)
- src="" is now omitted
  • Loading branch information
eps1lon committed Apr 29, 2024
1 parent ad1dd0d commit 720767d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/integration/next-image-new/default/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ function runTests(mode) {
let browser = await webdriver(appPort, '/on-load')

await browser.eval(
`document.getElementById("footer").scrollIntoView({behavior: "smooth"})`
`document.getElementById("msg1").scrollIntoView({behavior: "smooth"})`
)

await check(
Expand Down Expand Up @@ -1138,9 +1138,10 @@ function runTests(mode) {
const warnings = (await browser.log()).filter(
(log) => log.source === 'error'
)
expect(warnings.length).toBe(0)

expect(await browser.elementById('img').getAttribute('src')).toBe('')
expect(warnings).toEqual([])

expect(await browser.elementById('img').getAttribute('src')).toBe(null)
expect(await browser.elementById('img').getAttribute('srcset')).toBe(null)
expect(await browser.elementById('img').getAttribute('width')).toBe('200')
expect(await browser.elementById('img').getAttribute('height')).toBe(
Expand All @@ -1153,9 +1154,9 @@ function runTests(mode) {
const warnings = (await browser.log()).filter(
(log) => log.source === 'error'
)
expect(warnings.length).toBe(0)
expect(warnings).toEqual([])

expect(await browser.elementById('img').getAttribute('src')).toBe('')
expect(await browser.elementById('img').getAttribute('src')).toBe(null)
expect(await browser.elementById('img').getAttribute('srcset')).toBe(null)
expect(await browser.elementById('img').getAttribute('width')).toBe('200')
expect(await browser.elementById('img').getAttribute('height')).toBe(
Expand Down Expand Up @@ -1571,7 +1572,6 @@ describe('Image Component Default Tests', () => {
afterAll(async () => {
await killApp(app)
})

runTests('server')
}
)
Expand Down

0 comments on commit 720767d

Please sign in to comment.