This is a client side page
-
+
{
return (
Hello World
-
+
{
expect(await browser.elementById('basic-image').getAttribute('src')).toBe(
- 'https://example.com/myaccount/foo.jpg'
+ 'https://example.com/myaccount/foo.jpg?q=60'
)
})
it('should correctly generate src even if preceding slash is included in prop', async () => {
@@ -40,16 +40,11 @@ function runTests() {
await browser.elementById('preceding-slash-image').getAttribute('src')
).toBe('https://example.com/myaccount/fooslash.jpg')
})
- it('should support manually selecting a different host', async () => {
- expect(
- await browser.elementById('secondary-image').getAttribute('src')
- ).toBe('https://examplesecondary.com/images/foo2.jpg')
- })
it('should add a srcset based on the loader', async () => {
expect(
await browser.elementById('basic-image').getAttribute('srcset')
).toBe(
- 'https://example.com/myaccount/foo.jpg?w=480 480w, https://example.com/myaccount/foo.jpg?w=1024 1024w, https://example.com/myaccount/foo.jpg?w=1600 1600w'
+ 'https://example.com/myaccount/foo.jpg?w=480&q=60 480w, https://example.com/myaccount/foo.jpg?w=1024&q=60 1024w, https://example.com/myaccount/foo.jpg?w=1600&q=60 1600w'
)
})
it('should add a srcset even with preceding slash in prop', async () => {
@@ -102,6 +97,7 @@ function lazyLoadingTests() {
await browser.eval(
`window.scrollTo(0, ${topOfMidImage - (viewportHeight + buffer)})`
)
+ await waitFor(200)
expect(await browser.elementById('lazy-mid').getAttribute('src')).toBe(
'https://example.com/myaccount/foo2.jpg'
)
@@ -126,6 +122,7 @@ function lazyLoadingTests() {
await browser.eval(
`window.scrollTo(0, ${topOfBottomImage - (viewportHeight + buffer)})`
)
+ await waitFor(200)
expect(await browser.elementById('lazy-bottom').getAttribute('src')).toBe(
'https://www.otherhost.com/foo3.jpg'
)
@@ -178,13 +175,6 @@ describe('Image Component Tests', () => {
)
).toBe(true)
})
- it('should add a preload tag for a priority image, with secondary host', async () => {
- expect(
- await hasPreloadLinkMatchingUrl(
- 'https://examplesecondary.com/images/withpriority2.png'
- )
- ).toBe(true)
- })
it('should add a preload tag for a priority image, with arbitrary host', async () => {
expect(
await hasPreloadLinkMatchingUrl(