|
| 1 | +import { useDevserver } from '../../common/testing/devserver'; |
| 2 | +import { useWebDriver, webDriverTestTimeout } from '../../common/testing/webdriver'; |
| 3 | + |
| 4 | +describe('Script Isolation', () => { |
| 5 | + const devserver = useDevserver('examples/script_isolation/devserver.sh'); |
| 6 | + const wd = useWebDriver(devserver); |
| 7 | + |
| 8 | + it('renders `/foo.html` page with only `foo.js`', async () => { |
| 9 | + const browser = wd.get(); |
| 10 | + await browser.url('/foo.html'); |
| 11 | + |
| 12 | + expect(await browser.getTitle()).toBe('Script Isolation'); |
| 13 | + expect(await browser.$('#replace-foo').getText()) |
| 14 | + .toBe('This text rendered by page JavaScript!'); |
| 15 | + |
| 16 | + // Not replaced, because `bar.js` isn't included. |
| 17 | + expect(await browser.$('#replace-bar').getText()) |
| 18 | + .toBe('Text to be replaced.'); |
| 19 | + }, webDriverTestTimeout); |
| 20 | + |
| 21 | + it('renders `/bar.html` page with only `bar.js`', async () => { |
| 22 | + const browser = wd.get(); |
| 23 | + await browser.url('/bar.html'); |
| 24 | + |
| 25 | + expect(await browser.getTitle()).toBe('Script Isolation'); |
| 26 | + |
| 27 | + // Not replaced, because `bar.js` isn't included. |
| 28 | + expect(await browser.$('#replace-foo').getText()) |
| 29 | + .toBe('Text to be replaced.'); |
| 30 | + |
| 31 | + expect(await browser.$('#replace-bar').getText()) |
| 32 | + .toBe('This text rendered by page JavaScript!'); |
| 33 | + }, webDriverTestTimeout); |
| 34 | +}); |
0 commit comments