Only apply subsystem to final binary, not cdylibs (#5002)

This commit is contained in:
Evan Almloff authored and GitHub committed 2025-11-21 10:12:49 -08:00
1 parent 75d9ece3af
commit 84efc00757
10 files changed
+177 -60

No files matched your search

+60 -36
View File
@@ -8,44 +8,24 @@ const path = require("path");
*/
// require('dotenv').config();
/**
* @see https://playwright.dev/docs/test-configuration
*/
module.exports = defineConfig({
testDir: ".",
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: "html",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "retain-on-failure",
// Increase the timeout for navigations to give dx time to build the project
navigationTimeout: 50 * 60 * 1000,
},
timeout: 50 * 60 * 1000,
/* Configure projects for major browsers */
projects: [
let webServer = [];
let grep = undefined;
let grepInvert = undefined;
if (process.platform === "win32") {
webServer = [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
cwd: path.join(process.cwd(), "windows-headless"),
command:
"cargo run --package dioxus-cli --release -- run --force-sequential",
port: 8787,
timeout: 50 * 60 * 1000,
reuseExistingServer: !process.env.CI,
stdout: "pipe",
},
],
/* Run your local dev server before starting the tests */
webServer: [
];
grep = /windows/;
} else {
webServer = [
{
command:
"cargo run --package dioxus-playwright-liveview-test --bin dioxus-playwright-liveview-test",
@@ -224,5 +204,49 @@ module.exports = defineConfig({
reuseExistingServer: !process.env.CI,
stdout: "pipe",
},
];
grepInvert = /windows/;
}
/**
* @see https://playwright.dev/docs/test-configuration
*/
module.exports = defineConfig({
testDir: ".",
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: "html",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "retain-on-failure",
// Increase the timeout for navigations to give dx time to build the project
navigationTimeout: 50 * 60 * 1000,
},
timeout: 50 * 60 * 1000,
/* Configure projects for major browsers */
projects: [
{
name: "chromium",
grep,
grepInvert,
use: { ...devices["Desktop Chrome"] },
},
],
/* Run your local dev server before starting the tests */
webServer,
});
@@ -0,0 +1,7 @@
[package]
name = "windows-headless"
edition = "2024"
version.workspace = true
[dependencies]
dioxus = { workspace = true, features = ["desktop"] }
@@ -0,0 +1,23 @@
use dioxus::LaunchBuilder;
use dioxus::prelude::*;
fn main() {
LaunchBuilder::new()
.with_cfg(
dioxus::desktop::Config::new()
.with_windows_browser_args("--remote-debugging-port=8787"),
)
.launch(app);
}
fn app() -> Element {
let mut count = use_signal(|| 0);
rsx! {
h1 { "High-five counter: {count}" }
button {
id: "increment-button",
onclick: move |_| count += 1, "Up high!"
}
}
}
+37
View File
@@ -0,0 +1,37 @@
const { expect, defineConfig } = require("@playwright/test");
import { test as base } from '@playwright/test';
import fs from 'fs';
import os from 'os';
import path from 'path';
import childProcess from 'child_process';
export const test = base.extend({
browser: async ({ playwright }, use, testInfo) => {
const browser = await playwright.chromium.connectOverCDP(`http://127.0.0.1:8787`);
await use(browser);
await browser.close();
},
context: async ({ browser }, use) => {
const context = browser.contexts()[0];
await use(context);
},
page: async ({ context }, use) => {
const page = context.pages()[0];
await use(page);
},
});
test("button click", async ({ page }) => {
// Expect the page to contain the counter text.
const main = page.locator("#main");
await expect(main).toContainText("High-five counter: 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("High-five counter: 1");
});