diff --git a/src/utils/correct-file-path.js b/src/utils/correct-file-path.js index a6a7b31fbdd..064e74c7fe3 100644 --- a/src/utils/correct-file-path.js +++ b/src/utils/correct-file-path.js @@ -7,7 +7,7 @@ export default function (filePath, expectedExtention) { const correctedPath = filePath .split(path.posix.sep) - .filter(fragment => !!fragment) + .filter((fragment, index) => index === 0 || !!fragment) .map(str => sanitizeFilename(str)) .join(path.sep); diff --git a/test/functional/fixtures/api/es-next/native-dialogs-handling/iframe/testcafe-fixtures/page-load-test.js b/test/functional/fixtures/api/es-next/native-dialogs-handling/iframe/testcafe-fixtures/page-load-test.js index 954589c5524..1e78c451189 100644 --- a/test/functional/fixtures/api/es-next/native-dialogs-handling/iframe/testcafe-fixtures/page-load-test.js +++ b/test/functional/fixtures/api/es-next/native-dialogs-handling/iframe/testcafe-fixtures/page-load-test.js @@ -1,7 +1,6 @@ import { expect } from 'chai'; -fixture `Page load` - .page `http://localhost:3000/fixtures/api/es-next/native-dialogs-handling/iframe/pages/page-load.html`; +fixture `Page load`; const pageUrl = 'http://localhost:3000/fixtures/api/es-next/native-dialogs-handling/iframe/pages/page-load.html'; @@ -10,7 +9,8 @@ const iframeUrl = 'http://localhost:3000/fixtures/api/es-next/native-dialogs-han test('Expected dialogs after page load', async t => { await t - .setNativeDialogHandler(() => null); + .setNativeDialogHandler(() => null) + .navigateTo(pageUrl); // NOTE: waiting for iframe loading await t.switchToIframe('#iframe'); diff --git a/test/functional/fixtures/api/es-next/native-dialogs-handling/testcafe-fixtures/page-load-test.js b/test/functional/fixtures/api/es-next/native-dialogs-handling/testcafe-fixtures/page-load-test.js index ac49df405fb..595f8e6cfc1 100644 --- a/test/functional/fixtures/api/es-next/native-dialogs-handling/testcafe-fixtures/page-load-test.js +++ b/test/functional/fixtures/api/es-next/native-dialogs-handling/testcafe-fixtures/page-load-test.js @@ -1,8 +1,7 @@ import { ClientFunction } from 'testcafe'; import { expect } from 'chai'; -fixture `Page load` - .page `http://localhost:3000/fixtures/api/es-next/native-dialogs-handling/pages/page-load.html`; +fixture `Page load`; const getResult = ClientFunction(() => document.getElementById('result').textContent); @@ -16,7 +15,8 @@ test('Expected dialogs after page load', async t => { return true; return null; - }); + }) + .navigateTo(pageUrl); expect(await getResult()).equals('true'); diff --git a/test/functional/site/server.js b/test/functional/site/server.js index 280adab96a4..b7ca1197e1e 100644 --- a/test/functional/site/server.js +++ b/test/functional/site/server.js @@ -19,6 +19,13 @@ const CONTENT_TYPES = { '.png': 'image/png' }; +const NON_CACHEABLE_PAGES = [ + '/fixtures/api/es-next/roles/pages', + '/fixtures/api/es-next/request-hooks/pages', + '/fixtures/regression/gh-2015/pages', + '/fixtures/regression/gh-2282/pages' +]; + const UPLOAD_SUCCESS_PAGE_TEMPLATE = readSync('./views/upload-success.html.mustache'); @@ -66,7 +73,7 @@ Server.prototype._setupRoutes = function () { .then(function (content) { res.setHeader('content-type', CONTENT_TYPES[path.extname(resourcePath)]); - if (!reqPath.startsWith('/fixtures/api/es-next/roles/pages') && !reqPath.startsWith('/fixtures/api/es-next/request-hooks/pages')) + if (NON_CACHEABLE_PAGES.every(pagePrefix => !reqPath.startsWith(pagePrefix))) res.setHeader('cache-control', 'max-age=3600'); setTimeout(function () {