2021-04-21 23:48:50 +00:00
|
|
|
const { open_test } = require("../../utils");
|
2020-05-23 18:08:09 +00:00
|
|
|
const { expect, use } = require("chai");
|
|
|
|
const chaiHtml = require("chai-html");
|
|
|
|
const fs = require("fs");
|
|
|
|
|
|
|
|
use(chaiHtml);
|
|
|
|
|
2020-05-23 18:21:46 +00:00
|
|
|
describe("Flash inside iframe with provided ruffle", () => {
|
2021-08-21 14:34:08 +00:00
|
|
|
it("loads the test", async () => {
|
|
|
|
await open_test(browser, __dirname);
|
2020-05-23 18:08:09 +00:00
|
|
|
});
|
|
|
|
|
2021-08-21 14:34:08 +00:00
|
|
|
it("polyfills inside an iframe", async () => {
|
|
|
|
await browser.switchToFrame(await browser.$("#test-frame"));
|
|
|
|
await browser.$("<ruffle-object />").waitForExist();
|
2020-05-23 18:08:09 +00:00
|
|
|
|
2021-08-21 14:34:08 +00:00
|
|
|
const actual = await browser.$("#test-container").getHTML(false);
|
2020-05-23 18:08:09 +00:00
|
|
|
const expected = fs.readFileSync(`${__dirname}/expected.html`, "utf8");
|
|
|
|
expect(actual).html.to.equal(expected);
|
|
|
|
});
|
|
|
|
|
2021-08-21 14:34:08 +00:00
|
|
|
it("polyfills even after a reload", async () => {
|
2020-05-23 18:08:09 +00:00
|
|
|
// Contaminate the old contents, to ensure we get a "fresh" state
|
2021-08-21 14:34:08 +00:00
|
|
|
await browser.execute(() => {
|
2020-05-23 18:08:09 +00:00
|
|
|
document.getElementById("test-container").remove();
|
|
|
|
});
|
|
|
|
|
|
|
|
// Then reload
|
2021-08-21 14:34:08 +00:00
|
|
|
await browser.switchToParentFrame();
|
|
|
|
await browser.$("#reload-link").click();
|
2020-05-23 18:08:09 +00:00
|
|
|
|
|
|
|
// And finally, check
|
2021-08-21 14:34:08 +00:00
|
|
|
await browser.switchToParentFrame();
|
|
|
|
await browser.switchToFrame(await browser.$("#test-frame"));
|
|
|
|
await browser.$("<ruffle-object />").waitForExist();
|
2020-05-23 18:08:09 +00:00
|
|
|
|
2021-08-21 14:34:08 +00:00
|
|
|
const actual = await browser.$("#test-container").getHTML(false);
|
2020-05-23 18:08:09 +00:00
|
|
|
const expected = fs.readFileSync(`${__dirname}/expected.html`, "utf8");
|
|
|
|
expect(actual).html.to.equal(expected);
|
|
|
|
});
|
|
|
|
});
|