mirror of
https://github.com/bitsycore/skiko.git
synced 2026-10-06 23:17:27 +00:00
This PR includes: - Skottie extension module for each target - Exposing some internal parts of skiko so that they can be used in extension modules Required external changes : - Compile Skia static libraries with `visibility=default` instead of `hidden`. I found it difficult to make symbols tagged as `hidden` visible again. Going from `visible` to `hidden` was much more straightforward - Each static library that Skia produces is self-contained and thus, might have Skia core object files inside. This means we have to remove such files from Skottie during the Skia build Closes [SKIKO-1146](https://youtrack.jetbrains.com/issue/SKIKO-1146) --------- Co-authored-by: Ivan Matkov <matkov.ivan@gmail.com>
51 lines
1.6 KiB
JavaScript
51 lines
1.6 KiB
JavaScript
const { expect, test } = require("@playwright/test");
|
|
|
|
function collectRuntimeFailures(page) {
|
|
const failures = [];
|
|
|
|
page.on("pageerror", error => {
|
|
failures.push(`Uncaught exception:\n${error.stack || error.message}`);
|
|
});
|
|
|
|
page.on("console", message => {
|
|
const type = message.type();
|
|
const text = message.text();
|
|
if (type === "error" || type === "assert") {
|
|
failures.push(`console.${type}: ${text}`);
|
|
} else {
|
|
console.log(`browser ${type}: ${text}`);
|
|
}
|
|
});
|
|
|
|
page.on("requestfailed", request => {
|
|
const reason = request.failure()?.errorText || "unknown network error";
|
|
failures.push(`Failed request: ${request.method()} ${request.url()} - ${reason}`);
|
|
});
|
|
|
|
page.on("response", response => {
|
|
const url = new URL(response.url());
|
|
if (response.status() >= 400 && url.pathname !== "/favicon.ico") {
|
|
failures.push(`HTTP ${response.status()}: ${response.request().method()} ${response.url()}`);
|
|
}
|
|
});
|
|
|
|
page.on("crash", () => {
|
|
failures.push("The browser page crashed");
|
|
});
|
|
|
|
return failures;
|
|
}
|
|
|
|
test("Skiko extensions sample starts in browser", async ({ page }) => {
|
|
const failures = collectRuntimeFailures(page);
|
|
const response = await page.goto("/", { waitUntil: "domcontentloaded" });
|
|
|
|
expect(response, "No navigation response").not.toBeNull();
|
|
expect(response.ok(), `Page returned HTTP ${response.status()}`).toBeTruthy();
|
|
|
|
await page.waitForSelector("#SkikoTarget[data-skiko-ready='true']");
|
|
await page.waitForTimeout(500);
|
|
|
|
expect(failures, `Runtime failures detected:\n${failures.join("\n\n")}`).toEqual([]);
|
|
});
|