-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(e2e): polish source related cases (#4311)
- Loading branch information
1 parent
ba8a1d9
commit 0719125
Showing
23 changed files
with
87 additions
and
93 deletions.
There are no files selected for viewing
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { build, dev, gotoPage } from '@e2e/helper'; | ||
import { expect, test } from '@playwright/test'; | ||
|
||
test('should allow to define global variables in development', async ({ | ||
page, | ||
}) => { | ||
const rsbuild = await dev({ | ||
cwd: __dirname, | ||
page, | ||
}); | ||
|
||
await gotoPage(page, rsbuild); | ||
|
||
const testEl = page.locator('#test-el'); | ||
await expect(testEl).toHaveText('aaaaa'); | ||
|
||
await rsbuild.close(); | ||
}); | ||
|
||
test('should allow to define global variables in production build', async ({ | ||
page, | ||
}) => { | ||
const rsbuild = await build({ | ||
cwd: __dirname, | ||
page, | ||
}); | ||
|
||
await gotoPage(page, rsbuild); | ||
|
||
const testEl = page.locator('#test-el'); | ||
await expect(testEl).toHaveText('aaaaa'); | ||
|
||
await rsbuild.close(); | ||
}); |
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,9 @@ | ||
import { defineConfig } from '@rsbuild/core'; | ||
|
||
export default defineConfig({ | ||
source: { | ||
define: { | ||
ENABLE_TEST: JSON.stringify(true), | ||
}, | ||
}, | ||
}); |
File renamed without changes.
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,28 @@ | ||
import { build, dev } from '@e2e/helper'; | ||
import { expect, test } from '@playwright/test'; | ||
|
||
test('should allow to configure pre-entry in development', async ({ page }) => { | ||
const rsbuild = await dev({ | ||
cwd: __dirname, | ||
page, | ||
}); | ||
|
||
await expect(page.innerHTML('#test-el')).resolves.toBe('aaaaa'); | ||
await expect(page.evaluate('window.aa')).resolves.toBe(2); | ||
|
||
await rsbuild.close(); | ||
}); | ||
|
||
test('should allow to configure pre-entry in production build', async ({ | ||
page, | ||
}) => { | ||
const rsbuild = await build({ | ||
cwd: __dirname, | ||
page, | ||
}); | ||
|
||
await expect(page.innerHTML('#test-el')).resolves.toBe('aaaaa'); | ||
await expect(page.evaluate('window.aa')).resolves.toBe(2); | ||
|
||
await rsbuild.close(); | ||
}); |
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,7 @@ | ||
import { defineConfig } from '@rsbuild/core'; | ||
|
||
export default defineConfig({ | ||
source: { | ||
preEntry: ['./src/pre.js'], | ||
}, | ||
}); |
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 @@ | ||
window.aa = 2; |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
0719125
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