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: add failing test for event source (#2382)
Andrey Lushnikov3f97a9fb69dc
diff --git a/test/network.spec.js b/test/network.spec.jsindex f539e87234..f74372b60b 100644--- a/test/network.spec.js+++ b/test/network.spec.js@@ -259,6 +259,33 @@ describe('Response.statusText', function() {});});+describe('Request.resourceType', function() {+ it.fail(FFOX || WEBKIT)('should return event source', async ({page, server}) => {+ const SSE_MESSAGE = {foo: 'bar'};+ // 1. Setup server-sent events on server that immediately sends a message to the client.+ server.setRoute('/sse', (req, res) => {+ res.writeHead(200, {+ 'Content-Type': 'text/event-stream',+ 'Connection': 'keep-alive',+ 'Cache-Control': 'no-cache',+ });+ res.write(`data: ${JSON.stringify(SSE_MESSAGE)}\n\n`);+ });+ // 2. Subscribe to page request events.+ await page.goto(server.EMPTY_PAGE);+ const requests = [];+ page.on('request', request => requests.push(request));+ // 3. Connect to EventSource in browser and return first message.+ expect(await page.evaluate(() => {+ const eventSource = new EventSource('/sse');+ return new Promise(resolve => {+ eventSource.onmessage = e => resolve(JSON.parse(e.data));+ });+ })).toEqual(SSE_MESSAGE);+ expect(requests[0].resourceType()).toBe('eventsource');+ });+});+describe('Network Events', function() {it('Page.Events.Request', async({page, server}) => {const requests = [];