ruffle/web/packages/selfhosted/test/polyfill/classic_frames/test.js

47 lines
1.5 KiB
JavaScript
Raw Normal View History

2020-05-23 17:37:06 +00:00
const { open_test } = require("../utils");
const { expect, use } = require("chai");
const chaiHtml = require("chai-html");
const fs = require("fs");
use(chaiHtml);
2020-05-23 18:08:09 +00:00
describe("Flash inside frame", () => {
2020-05-23 17:37:06 +00:00
it("loads the test", () => {
open_test(browser, __dirname);
});
it("polyfills inside a frame", () => {
browser.switchToFrame(browser.$("#test-frame"));
browser.waitUntil(() =>
browser.execute(() => document.readyState === "complete")
);
const actual = browser.$("#test-container").getHTML(false);
const expected = fs.readFileSync(`${__dirname}/expected.html`, "utf8");
expect(actual).html.to.equal(expected);
});
it("polyfills even after a reload", () => {
// Contaminate the old contents, to ensure we get a "fresh" state
browser.execute(() => {
document.getElementById("test-container").remove();
});
// Then reload
browser.switchToParentFrame();
browser.switchToFrame(browser.$("#nav-frame"));
browser.$("#reload-link").click();
// And finally, check
browser.switchToParentFrame();
browser.switchToFrame(browser.$("#test-frame"));
browser.waitUntil(() =>
browser.execute(() => document.readyState === "complete")
);
const actual = browser.$("#test-container").getHTML(false);
const expected = fs.readFileSync(`${__dirname}/expected.html`, "utf8");
expect(actual).html.to.equal(expected);
});
});