From 28de9e484db038aeafd4a40880e41a03e72179f9 Mon Sep 17 00:00:00 2001 From: Owen Pearson Date: Mon, 4 Jul 2022 02:44:58 +0100 Subject: [PATCH] Temp CI changes --- src/platform/web/lib/transport/fetchrequest.ts | 10 ++++++++++ test/rest/push.test.js | 4 ++-- test/support/runPlaywrightTests.js | 4 ++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/platform/web/lib/transport/fetchrequest.ts b/src/platform/web/lib/transport/fetchrequest.ts index 0b80921fcf..5420e91116 100644 --- a/src/platform/web/lib/transport/fetchrequest.ts +++ b/src/platform/web/lib/transport/fetchrequest.ts @@ -38,6 +38,8 @@ export default function fetchRequest( rest ? rest.options.timeouts.httpRequestTimeout : Defaults.TIMEOUTS.httpRequestTimeout ); + console.log({ uri, _method, headers, body }); + fetch(uri + '?' + new URLSearchParams(params || {}), { method: _method, headers: fetchHeaders, @@ -47,6 +49,8 @@ export default function fetchRequest( .then((res) => { clearTimeout(timeout); const contentType = res.headers.get('Content-Type'); + console.log(`Request to ${uri + '?' + new URLSearchParams(params || {})}`); + console.log(`Response status: ${res.status} with Content-Type: ${contentType}`); if (!res.ok) { if (!contentType) { // TODO @@ -55,6 +59,8 @@ export default function fetchRequest( } if (contentType && contentType.indexOf('application/json') > -1) { res.json().then((body) => { + console.log('here'); + console.log(body); const err = getAblyError(body, res.headers) || new ErrorInfo( @@ -76,8 +82,12 @@ export default function fetchRequest( } if (contentType.indexOf('application/json') > -1) { res.json().then((body) => { + console.log('here2'); + console.log(body); callback(null, body, res.headers, true, res.status); return; + }).catch(err => { + console.log(err); }); } if (contentType.indexOf('application/x-msgpack') > -1) { diff --git a/test/rest/push.test.js b/test/rest/push.test.js index 6b782e4dfe..de18d628c8 100644 --- a/test/rest/push.test.js +++ b/test/rest/push.test.js @@ -30,7 +30,7 @@ define(['ably', 'shared_helper', 'async', 'chai'], function (Ably, helper, async }, }; - describe('rest/push', function () { + describe.only('rest/push', function () { this.timeout(60 * 1000); before(function (done) { @@ -39,7 +39,7 @@ define(['ably', 'shared_helper', 'async', 'chai'], function (Ably, helper, async }); }); - it('Get subscriptions', function (done) { + it.only('Get subscriptions', function (done) { var subscribes = []; var deletes = []; var subsByChannel = {}; diff --git a/test/support/runPlaywrightTests.js b/test/support/runPlaywrightTests.js index 030cded919..7b24eaa10c 100644 --- a/test/support/runPlaywrightTests.js +++ b/test/support/runPlaywrightTests.js @@ -28,6 +28,10 @@ const runTests = async (browserType) => { console.log(detail); }); + page.on('console', (msg) => { + console.log(msg.text()); + }); + // Expose a function inside the playwright browser to exit with the right status code when tests pass/fail page.exposeFunction('onTestResult', ({ detail }) => { console.log(`${browserType.name()} tests complete: ${detail.passes}/${detail.total} passed`);