fix playwrite tests

This commit is contained in:
Evan Almloff 2023-07-07 19:03:25 -07:00
parent aa26c086de
commit 576bc61855
5 changed files with 8 additions and 6 deletions

View file

@ -15,6 +15,7 @@ tokio = { workspace = true, features = ["full"], optional = true }
serde = "1.0.159"
execute = "0.2.12"
tower-http = { version = "0.4.1", features = ["auth"] }
simple_logger = "4.2.0"
[features]
default = []

View file

@ -41,7 +41,6 @@ fn app(cx: Scope<AppProps>) -> Element {
}
#[server(PostServerData)]
#[middleware(tower_http::validate_request::ValidateRequestHeaderLayer::bearer("passwordlol"))]
async fn post_server_data(
#[extract] axum::extract::Host(host): axum::extract::Host,
data: String,
@ -59,7 +58,6 @@ async fn get_server_data() -> Result<String, ServerFnError> {
fn main() {
launch!(@([127, 0, 0, 1], 8080), app, {
serve_cfg: ServeConfigBuilder::new(app, (AppProps { count: 0 })),
incremental: IncrementalRendererConfig::default().invalidate_after(std::time::Duration::from_secs(120)),
serve_cfg: ServeConfigBuilder::new(app, AppProps { count: 0 }),
});
}

View file

@ -40,9 +40,9 @@ impl SsrRendererPool {
let mut renderer = pool.pull(pre_renderer);
// SAFETY: The fullstack renderer will only write UTF-8 to the buffer.
wrapper.render_before_body(unsafe { &mut to.as_bytes_mut() })?;
wrapper.render_before_body(unsafe { &mut to.as_mut_vec() })?;
renderer.render_to(to, &vdom)?;
wrapper.render_after_body(unsafe { &mut to.as_bytes_mut() })?;
wrapper.render_after_body(unsafe { &mut to.as_mut_vec() })?;
Ok(RenderFreshness::now(None))
}

View file

@ -497,4 +497,7 @@ pub enum IncrementalRendererError {
/// An IO error occurred while rendering a route.
#[error("IoError: {0}")]
IoError(#[from] std::io::Error),
/// An IO error occurred while rendering a route.
#[error("Other: {0}")]
Other(#[from] Box<dyn std::error::Error + Send + Sync>),
}

View file

@ -89,7 +89,7 @@ module.exports = defineConfig({
},
{
cwd: path.join(process.cwd(), 'playwrite-tests', 'fullstack'),
command: 'dioxus build --features web\ncargo run --release --features ssr --no-default-features',
command: 'dioxus build --features web --release\ncargo run --release --features ssr --no-default-features',
port: 3333,
timeout: 10 * 60 * 1000,
reuseExistingServer: !process.env.CI,