-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: reorganize assets e2e cases (#3841)
- Loading branch information
1 parent
630f999
commit bd5f711
Showing
17 changed files
with
82 additions
and
80 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,19 @@ | ||
import { build } from '@e2e/helper'; | ||
import { expect, test } from '@playwright/test'; | ||
import { pluginReact } from '@rsbuild/plugin-react'; | ||
|
||
test('should inline small assets automatically', async ({ page }) => { | ||
const rsbuild = await build({ | ||
cwd: __dirname, | ||
page, | ||
plugins: [pluginReact()], | ||
}); | ||
|
||
await expect( | ||
page.evaluate( | ||
`document.getElementById('test-img').src.startsWith('data:image/png')`, | ||
), | ||
).resolves.toBeTruthy(); | ||
|
||
await rsbuild.close(); | ||
}); |
File renamed without changes.
File renamed without changes.
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,21 @@ | ||
import { build } from '@e2e/helper'; | ||
import { expect, test } from '@playwright/test'; | ||
import { pluginReact } from '@rsbuild/plugin-react'; | ||
|
||
test('should allow to disable assets inline with `?__inline=false`', async ({ | ||
page, | ||
}) => { | ||
const rsbuild = await build({ | ||
cwd: __dirname, | ||
page, | ||
plugins: [pluginReact()], | ||
}); | ||
|
||
await expect( | ||
page.evaluate( | ||
`document.getElementById('test-img').src.includes('static/image/icon')`, | ||
), | ||
).resolves.toBeTruthy(); | ||
|
||
await rsbuild.close(); | ||
}); |
File renamed without changes.
File renamed without changes.
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,19 @@ | ||
import { build } from '@e2e/helper'; | ||
import { expect, test } from '@playwright/test'; | ||
import { pluginReact } from '@rsbuild/plugin-react'; | ||
|
||
test('should allow to inline assets with `?inline`', async ({ page }) => { | ||
const rsbuild = await build({ | ||
cwd: __dirname, | ||
page, | ||
plugins: [pluginReact()], | ||
}); | ||
|
||
await expect( | ||
page.evaluate( | ||
`document.getElementById('test-img').src.startsWith('data:image/png')`, | ||
), | ||
).resolves.toBeTruthy(); | ||
|
||
await rsbuild.close(); | ||
}); |
File renamed without changes.
File renamed without changes.
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,19 @@ | ||
import { build } from '@e2e/helper'; | ||
import { expect, test } from '@playwright/test'; | ||
import { pluginReact } from '@rsbuild/plugin-react'; | ||
|
||
test('should allow to get assets URL with `?url`', async ({ page }) => { | ||
const rsbuild = await build({ | ||
cwd: __dirname, | ||
page, | ||
plugins: [pluginReact()], | ||
}); | ||
|
||
await expect( | ||
page.evaluate( | ||
`document.getElementById('test-img').src.includes('static/image/icon')`, | ||
), | ||
).resolves.toBeTruthy(); | ||
|
||
await rsbuild.close(); | ||
}); |
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
2 changes: 1 addition & 1 deletion
2
e2e/cases/output/assets__inline/src/App.jsx → e2e/cases/output/data-uri-limit/src/App.jsx
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import img from '@assets/icon.png?inline'; | ||
import img from '@assets/icon.png'; | ||
|
||
function App() { | ||
return ( | ||
|
File renamed without changes.
bd5f711
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Ran ecosystem CI: Open