* Fix deduping assets * hash assets in the linker * fix extracting assets * Fix the hashed asset name * deserialize the asset back from the link section * prevent the read from being inlined * remove some extra logs * Fix liveview routing * Only look for direct dependencies on dioxus features * fix wasm split test * On wasm, create a new object file with the asset information * Fix multiple assets * add a regression test for 3467 * fix image link * fix linker out file * fix linux linker args * add windows linker command * fix linux link args * fix windows target triple * Expose an option to build assets in the linker intercept * Fix the standalone optimizer and document it in the dx help command * include the cli opt version in the hash * fix clippy * fix ssg port * add a safety note to the read_volatile call * move found assets log * fix some merge conflicts * fix build * make most env var for the linker optional * guess the target triple when dx acts as the linker intercept * automatically find the linker for normal builds * use the right linker in wasm mode * fix mac linker * look inside archive files (rlibs) * remove out.txt * fix clippy * fix typo * fix clippy * fix build * fix dx link name in docs * ignore libcompiler_builtins warnings * fix playwright * pass typocheck * fix printing sysroot * Modify final binary * fix wasm assets * remove old link section logic * fix tests * forward manganis export args * fail to evaluate relocatable address * retain all exports in the same pattern as other platforms * Fix adding assets during a wasm hot patch * less nesting and remove logs * fix clippy * log pdb files * read from pdb * print data section contents * print with object * normal windows builds working * fix hot patch windows * clean up logs * fix clippy * clean up assets * use the most recent pdb * fix doc test * fix typo * tiny nits * make bundled a reference instead of a pointer * add helpful comment to impl * match on file format * Fix asset hashing comment --------- Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
186 lines
6.5 KiB
JavaScript
186 lines
6.5 KiB
JavaScript
// @ts-check
|
|
const { test, expect, defineConfig } = require("@playwright/test");
|
|
|
|
test("button click", async ({ page }) => {
|
|
await page.goto("http://localhost:9990");
|
|
|
|
// Expect the page to contain the counter text.
|
|
const main = page.locator("#main");
|
|
await expect(main).toContainText("hello axum! 0");
|
|
// Expect the title to contain the counter text.
|
|
await expect(page).toHaveTitle("hello axum! 0");
|
|
|
|
// Click the increment button.
|
|
let button = page.locator("button.increment-button");
|
|
await button.click();
|
|
|
|
// Expect the page to contain the updated counter text.
|
|
await expect(main).toContainText("hello axum! 1");
|
|
// Expect the title to contain the updated counter text.
|
|
await expect(page).toHaveTitle("hello axum! 1");
|
|
});
|
|
|
|
test("svg", async ({ page }) => {
|
|
await page.goto("http://localhost:9990");
|
|
|
|
// Expect the page to contain the svg.
|
|
const svg = page.locator("svg");
|
|
|
|
// Expect the svg to contain the circle.
|
|
const circle = svg.locator("circle");
|
|
await expect(circle).toHaveAttribute("cx", "50");
|
|
await expect(circle).toHaveAttribute("cy", "50");
|
|
await expect(circle).toHaveAttribute("r", "40");
|
|
await expect(circle).toHaveAttribute("stroke", "green");
|
|
await expect(circle).toHaveAttribute("fill", "yellow");
|
|
});
|
|
|
|
test("raw attribute", async ({ page }) => {
|
|
await page.goto("http://localhost:9990");
|
|
|
|
// Expect the page to contain the div with the raw attribute.
|
|
const div = page.locator("div.raw-attribute-div");
|
|
await expect(div).toHaveAttribute("raw-attribute", "raw-attribute-value");
|
|
});
|
|
|
|
test("hidden attribute", async ({ page }) => {
|
|
await page.goto("http://localhost:9990");
|
|
|
|
// Expect the page to contain the div with the hidden attribute.
|
|
const div = page.locator("div.hidden-attribute-div");
|
|
await expect(div).toHaveAttribute("hidden", "true");
|
|
});
|
|
|
|
test("dangerous inner html", async ({ page }) => {
|
|
await page.goto("http://localhost:9990");
|
|
|
|
// Expect the page to contain the div with the dangerous inner html.
|
|
const div = page.locator("div.dangerous-inner-html-div");
|
|
await expect(div).toContainText("hello dangerous inner html");
|
|
});
|
|
|
|
test("input value", async ({ page }) => {
|
|
await page.goto("http://localhost:9990");
|
|
|
|
// Expect the page to contain the input with the value.
|
|
const input = page.locator("input");
|
|
await expect(input).toHaveValue("hello input");
|
|
});
|
|
|
|
test("style", async ({ page }) => {
|
|
await page.goto("http://localhost:9990");
|
|
|
|
// Expect the page to contain the div with the style.
|
|
const div = page.locator("div.style-div");
|
|
await expect(div).toHaveText("colored text");
|
|
await expect(div).toHaveCSS("color", "rgb(255, 0, 0)");
|
|
});
|
|
|
|
test("eval", async ({ page }) => {
|
|
await page.goto("http://localhost:9990");
|
|
|
|
// Expect the page to contain the div with the eval and have no text.
|
|
const div = page.locator("div.eval-result");
|
|
await expect(div).toHaveText("");
|
|
|
|
// Click the button to run the eval.
|
|
let button = page.locator("button.eval-button");
|
|
await button.click();
|
|
|
|
// Check that the title changed.
|
|
await expect(page).toHaveTitle("Hello from Dioxus Eval!");
|
|
|
|
// Check that the div has the eval value.
|
|
await expect(div).toHaveText("returned eval value");
|
|
});
|
|
|
|
test("prevent default", async ({ page }) => {
|
|
await page.goto("http://localhost:9990");
|
|
|
|
// Expect the page to contain the div with the eval and have no text.
|
|
const a = page.locator("a.prevent-default");
|
|
await expect(a).toHaveText("View source");
|
|
|
|
// Click the <a> element to change the text
|
|
await a.click();
|
|
|
|
// Check that the <a> element changed.
|
|
await expect(a).toHaveText("Psych!");
|
|
});
|
|
|
|
test("onmounted", async ({ page }) => {
|
|
await page.goto("http://localhost:9990");
|
|
|
|
// Expect the onmounted event to be called exactly once.
|
|
const mountedDiv = page.locator("div.onmounted-div");
|
|
await expect(mountedDiv).toHaveText("onmounted was called 1 times");
|
|
});
|
|
|
|
test("web-sys closure", async ({ page }) => {
|
|
await page.goto("http://localhost:9990");
|
|
// wait until the div is mounted
|
|
const scrollDiv = page.locator("div#web-sys-closure-div");
|
|
await scrollDiv.waitFor({ state: "attached" });
|
|
await page.keyboard.press("Enter");
|
|
await expect(scrollDiv).toHaveText("the keydown event was triggered");
|
|
});
|
|
|
|
test("document elements", async ({ page }) => {
|
|
await page.goto("http://localhost:9990");
|
|
// wait until the meta element is mounted
|
|
const meta = page.locator("meta#meta-head[name='testing']");
|
|
await meta.waitFor({ state: "attached" });
|
|
await expect(meta).toHaveAttribute("data", "dioxus-meta-element");
|
|
|
|
const link = page.locator("link#link-head[rel='stylesheet']");
|
|
await link.waitFor({ state: "attached" });
|
|
await expect(link).toHaveAttribute(
|
|
"href",
|
|
"https://fonts.googleapis.com/css?family=Roboto+Mono"
|
|
);
|
|
|
|
const stylesheet = page.locator("link#stylesheet-head[rel='stylesheet']");
|
|
await stylesheet.waitFor({ state: "attached" });
|
|
await expect(stylesheet).toHaveAttribute(
|
|
"href",
|
|
"https://fonts.googleapis.com/css?family=Roboto:300,300italic,700,700italic"
|
|
);
|
|
|
|
const script = page.locator("script#script-head");
|
|
await script.waitFor({ state: "attached" });
|
|
await expect(script).toHaveAttribute("async", "true");
|
|
|
|
const style = page.locator("style#style-head");
|
|
await style.waitFor({ state: "attached" });
|
|
const main = page.locator("#main");
|
|
await expect(main).toHaveCSS("font-family", "Roboto");
|
|
});
|
|
|
|
test("merge styles", async ({ page }) => {
|
|
await page.goto("http://localhost:9990");
|
|
// wait until the div is mounted
|
|
const div = page.locator("div#merge-styles-div");
|
|
await div.waitFor({ state: "attached" });
|
|
await expect(div).toHaveCSS("background-color", "rgb(255, 0, 0)");
|
|
await expect(div).toHaveCSS("width", "100px");
|
|
await expect(div).toHaveCSS("height", "100px");
|
|
});
|
|
|
|
test("select multiple", async ({ page }) => {
|
|
await page.goto("http://localhost:9990");
|
|
// wait until the select element is mounted
|
|
const staticSelect = page.locator("select#static-multiple-select");
|
|
await staticSelect.waitFor({ state: "attached" });
|
|
await expect(staticSelect).toHaveValues([]);
|
|
// Make sure the multiple attribute is actually set
|
|
await staticSelect.selectOption(["1", "2"]);
|
|
await expect(staticSelect).toHaveValues(["1", "2"]);
|
|
|
|
// The dynamic select element should act exactly the same
|
|
const dynamicSelect = page.locator("select#dynamic-multiple-select");
|
|
await dynamicSelect.waitFor({ state: "attached" });
|
|
await expect(dynamicSelect).toHaveValues([]);
|
|
await dynamicSelect.selectOption(["1", "2"]);
|
|
await expect(dynamicSelect).toHaveValues(["1", "2"]);
|
|
});
|