Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
test: fix the CSP capability test (#2394)
Pavel Feldman5277fb94797f
diff --git a/test/capabilities.spec.js b/test/capabilities.spec.jsindex ff0bf480af..ef01be7856 100644--- a/test/capabilities.spec.js+++ b/test/capabilities.spec.js@@ -34,15 +34,17 @@ describe('Capabilities', function() {expect(value).toBe('incoming');});- it.fail(FFOX)('should respect CSP', async({page, server}) => {- server.setCSP('/empty.html', 'script-src ' + server.PREFIX);+ it('should respect CSP', async({page, server}) => {+ server.setRoute('/empty.html', async (req, res) => {+ res.setHeader('Content-Security-Policy', `script-src 'unsafe-inline';`);+ res.end(`+ <script>+ window.testStatus = 'SUCCESS';+ window.testStatus = eval("'FAILED'");+ </script>`);+ });+await page.goto(server.EMPTY_PAGE);- expect(await page.evaluate(() => new Promise(f => setTimeout(() => {- try {- f(eval("'failed'"));- } catch (e) {- f('success');- }- }, 0)))).toBe('success');+ expect(await page.evaluate(() => window.testStatus)).toBe('SUCCESS');});});