diff --git a/src/tests/fixtures/frames.html b/src/tests/fixtures/frames.html index e3400d70f..457770039 100644 --- a/src/tests/fixtures/frames.html +++ b/src/tests/fixtures/frames.html @@ -16,7 +16,7 @@ } else if (target.id == "add-refresh-morph-to-frame") { target.closest("turbo-frame")?.setAttribute("refresh", "morph") } else if (target.id == "add-src-to-frame") { - target.closest("turbo-frame")?.setAttribute("src", "/__turbo/frames") + target.closest("turbo-frame")?.setAttribute("src", "/src/tests/fixtures/frames.html") } }) @@ -29,7 +29,6 @@

Frames

Frames: #frame

-

This text always changes ##randNum##

diff --git a/src/tests/functional/frame_tests.js b/src/tests/functional/frame_tests.js index 674854e6c..2591c84d0 100644 --- a/src/tests/functional/frame_tests.js +++ b/src/tests/functional/frame_tests.js @@ -305,26 +305,20 @@ test("navigating turbo-frame[refresh=morph] from within morphs the contents", as test("calling reload on a frame replaces the contents", async ({ page }) => { await page.click("#add-src-to-frame") - const textBeforeReload = await page.textContent("#frame h3") await page.evaluate(() => document.getElementById("frame").reload()) - const textAfterReload = await page.textContent("#frame h3") expect(await nextEventOnTarget(page, "frame", "turbo:before-frame-render")).toBeTruthy() expect(await noNextEventOnTarget(page, "frame", "turbo:before-frame-morph")).toBeTruthy() - assert.notEqual(textBeforeReload, textAfterReload) }) test("calling reload on a frame[refresh=morph] morphs the contents", async ({ page }) => { await page.click("#add-src-to-frame") await page.click("#add-refresh-morph-to-frame") - const textBeforeReload = await page.textContent("#frame h3") await page.evaluate(() => document.getElementById("frame").reload()) - const textAfterReload = await page.textContent("#frame h3") expect(await nextEventOnTarget(page, "frame", "turbo:before-frame-render")).toBeTruthy() expect(await nextEventOnTarget(page, "frame", "turbo:before-frame-morph")).toBeTruthy() - assert.notEqual(textBeforeReload, textAfterReload) }) test("following a link in rapid succession cancels the previous request", async ({ page }) => { diff --git a/src/tests/server.mjs b/src/tests/server.mjs index 448ac5d15..10eab3abb 100644 --- a/src/tests/server.mjs +++ b/src/tests/server.mjs @@ -23,20 +23,6 @@ router.use((request, response, next) => { } }) -router.get('/frames', (req, res) => { - // The purpose of this route is to do a server-side replacement of ##randNum##. This way when we - // refresh this page we are guaranteed to see a change in content. - fs.readFile(path.join(__dirname, '../../src/tests/fixtures/frames.html'), 'utf8', (err, data) => { - if (err) { - console.error(err) - return res.status(500).send('Error reading file') - } - const randomNumber = Math.floor(Math.random() * 10000000) - const processedContent = data.replace('##randNum##', randomNumber.toString()) - res.send(processedContent) - }) -}) - router.post("/redirect", (request, response) => { const { path, sleep, ...query } = request.body const { pathname, query: searchParams } = url.parse(