diff --git a/Cargo.toml b/Cargo.toml index 39487d8ba0..a47a0525fd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ members = [ "packages/*", "examples/*", + "tests/*", "website", # We have the CLI subcrates as workspace members so we can actively develop on them # They also can't be a workspace until nested workspaces are supported diff --git a/docs/0.3.x/en-US/testing/checkpoints.md b/docs/0.3.x/en-US/testing/checkpoints.md index 66df65bfce..871bb55aea 100644 --- a/docs/0.3.x/en-US/testing/checkpoints.md +++ b/docs/0.3.x/en-US/testing/checkpoints.md @@ -6,10 +6,10 @@ This, and many similar problems, are easily solvable using one of Perseus' most Note that checkpoints will never be reached if your app is not run with `perseus test`. If you use `--no-run` and then execute the server binary manually, be sure to provide the `PERSEUS_TESTING=true` environment variable. -You can wait for a Perseus checkpoint to be reached like so (taken from [here](https://github.com/arctic-hen7/perseus/blob/main/examples/basic/tests/main.rs)): +You can wait for a Perseus checkpoint to be reached like so (taken from [here](https://github.com/arctic-hen7/perseus/blob/main/tests/basic/tests/main.rs)): ```rust -{{#include ../../../../examples/basic/tests/main.rs}} +{{#include ../../../../tests/basic/tests/main.rs}} ``` Note in particular the use of the `wait_for_checkpoint!` macro, which accepts three arguments: diff --git a/docs/0.3.x/en-US/testing/fantoccini-basics.md b/docs/0.3.x/en-US/testing/fantoccini-basics.md index 85c36286f1..04a11578a6 100644 --- a/docs/0.3.x/en-US/testing/fantoccini-basics.md +++ b/docs/0.3.x/en-US/testing/fantoccini-basics.md @@ -2,10 +2,10 @@ Now that you know a bit more about how Perseus tests work, it's time to go through how to write them! -Remember, you're controlling an actual browser, so you basically have everything available to you that a user can do (mostly). You can even take screenshots! All this is achieved with [Fantoccini](https://github.com/jonhoo/fantoccini), which you can learn more about [here](https://docs.rs/fantoccini). For now though, here's a quick tutorial on the basics, using [this](https://github.com/arctic-hen7/perseus/blob/main/examples/basic/tests/main.rs) example: +Remember, you're controlling an actual browser, so you basically have everything available to you that a user can do (mostly). You can even take screenshots! All this is achieved with [Fantoccini](https://github.com/jonhoo/fantoccini), which you can learn more about [here](https://docs.rs/fantoccini). For now though, here's a quick tutorial on the basics, using [this](https://github.com/arctic-hen7/perseus/blob/main/tests/basic/tests/main.rs) example: ```rust -{{#include ../../../../examples/basic/tests/main.rs}} +{{#include ../../../../tests/basic/tests/main.rs}} ``` ## Going to a Page diff --git a/docs/0.3.x/en-US/testing/intro.md b/docs/0.3.x/en-US/testing/intro.md index 2c5c2acad2..d14ff866ac 100644 --- a/docs/0.3.x/en-US/testing/intro.md +++ b/docs/0.3.x/en-US/testing/intro.md @@ -10,10 +10,10 @@ It's that last type that Perseus is particularly concerned with, because that's In terms of unit tests, these can be done for normal logic (that doesn't render something) with Rust's own testing system. Any integration tests, as well as unit tests that do render things, should be done with [`wasm-bindgen-test`](https://rustwasm.github.io/wasm-bindgen/wasm-bindgen-test/index.html). This module provides a custom _test harness_ macro (alternative to `#[test]`) that spins up a _headless browser_ (browser without a GUI) that can be used to render your code. Note that this should be done for testing Sycamore components, and not for testing integrated Perseus systems. -When you want to test logic flows in your app, like the possibilities of how a user will interact with a login form, the best way is to use end-to-end testing, which Perseus supports with a custom test harness macro that can be used like so (taken from [here](https://github.com/arctic-hen7/perseus/blob/main/examples/basic/tests/main.rs)): +When you want to test logic flows in your app, like the possibilities of how a user will interact with a login form, the best way is to use end-to-end testing, which Perseus supports with a custom test harness macro that can be used like so (taken from [here](https://github.com/arctic-hen7/perseus/blob/main/tests/basic/tests/main.rs)): ```rust -{{#include ../../../../examples/basic/tests/main.rs}} +{{#include ../../../../tests/basic/tests/main.rs}} ``` The first thing to note is the module that this test imports. It's called [Fantoccini](https://github.com/jonhoo/fantoccini), and it basically lets you control a web browser with code. We'll get to exactly how this works soon. This test goes to (where a Perseus app is hosted) and then clicks a link on it and makes sure that it's been taken to the correct new URL. diff --git a/docs/next/en-US/reference/testing/checkpoints.md b/docs/next/en-US/reference/testing/checkpoints.md index 66df65bfce..871bb55aea 100644 --- a/docs/next/en-US/reference/testing/checkpoints.md +++ b/docs/next/en-US/reference/testing/checkpoints.md @@ -6,10 +6,10 @@ This, and many similar problems, are easily solvable using one of Perseus' most Note that checkpoints will never be reached if your app is not run with `perseus test`. If you use `--no-run` and then execute the server binary manually, be sure to provide the `PERSEUS_TESTING=true` environment variable. -You can wait for a Perseus checkpoint to be reached like so (taken from [here](https://github.com/arctic-hen7/perseus/blob/main/examples/basic/tests/main.rs)): +You can wait for a Perseus checkpoint to be reached like so (taken from [here](https://github.com/arctic-hen7/perseus/blob/main/tests/basic/tests/main.rs)): ```rust -{{#include ../../../../examples/basic/tests/main.rs}} +{{#include ../../../../tests/basic/tests/main.rs}} ``` Note in particular the use of the `wait_for_checkpoint!` macro, which accepts three arguments: diff --git a/docs/next/en-US/reference/testing/fantoccini-basics.md b/docs/next/en-US/reference/testing/fantoccini-basics.md index 3fe61f5239..ab75290524 100644 --- a/docs/next/en-US/reference/testing/fantoccini-basics.md +++ b/docs/next/en-US/reference/testing/fantoccini-basics.md @@ -2,10 +2,10 @@ Now that you know a bit more about how Perseus tests work, it's time to go through how to write them! -Remember, you're controlling an actual browser, so you basically have everything available to you that a user can do (mostly). You can even take screenshots! All this is achieved with [Fantoccini](https://github.com/jonhoo/fantoccini), which you can learn more about [here](https://docs.rs/fantoccini). For now though, here's a quick tutorial on the basics, using [this](https://github.com/arctic-hen7/perseus/blob/main/examples/basic/tests/main.rs) example: +Remember, you're controlling an actual browser, so you basically have everything available to you that a user can do (mostly). You can even take screenshots! All this is achieved with [Fantoccini](https://github.com/jonhoo/fantoccini), which you can learn more about [here](https://docs.rs/fantoccini). For now though, here's a quick tutorial on the basics, using [this](https://github.com/arctic-hen7/perseus/blob/main/tests/basic/tests/main.rs) example: ```rust -{{#include ../../../../examples/basic/tests/main.rs}} +{{#include ../../../../tests/basic/tests/main.rs}} ``` ## Going to a Page diff --git a/docs/next/en-US/reference/testing/intro.md b/docs/next/en-US/reference/testing/intro.md index 2c5c2acad2..d14ff866ac 100644 --- a/docs/next/en-US/reference/testing/intro.md +++ b/docs/next/en-US/reference/testing/intro.md @@ -10,10 +10,10 @@ It's that last type that Perseus is particularly concerned with, because that's In terms of unit tests, these can be done for normal logic (that doesn't render something) with Rust's own testing system. Any integration tests, as well as unit tests that do render things, should be done with [`wasm-bindgen-test`](https://rustwasm.github.io/wasm-bindgen/wasm-bindgen-test/index.html). This module provides a custom _test harness_ macro (alternative to `#[test]`) that spins up a _headless browser_ (browser without a GUI) that can be used to render your code. Note that this should be done for testing Sycamore components, and not for testing integrated Perseus systems. -When you want to test logic flows in your app, like the possibilities of how a user will interact with a login form, the best way is to use end-to-end testing, which Perseus supports with a custom test harness macro that can be used like so (taken from [here](https://github.com/arctic-hen7/perseus/blob/main/examples/basic/tests/main.rs)): +When you want to test logic flows in your app, like the possibilities of how a user will interact with a login form, the best way is to use end-to-end testing, which Perseus supports with a custom test harness macro that can be used like so (taken from [here](https://github.com/arctic-hen7/perseus/blob/main/tests/basic/tests/main.rs)): ```rust -{{#include ../../../../examples/basic/tests/main.rs}} +{{#include ../../../../tests/basic/tests/main.rs}} ``` The first thing to note is the module that this test imports. It's called [Fantoccini](https://github.com/jonhoo/fantoccini), and it basically lets you control a web browser with code. We'll get to exactly how this works soon. This test goes to (where a Perseus app is hosted) and then clicks a link on it and makes sure that it's been taken to the correct new URL. diff --git a/examples/i18n/Cargo.toml b/examples/i18n/Cargo.toml index b95b63e48b..df85e1a126 100644 --- a/examples/i18n/Cargo.toml +++ b/examples/i18n/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "perseus-test-i18n" +name = "perseus-example-i18n" version = "0.1.0" edition = "2018" diff --git a/examples/plugins/Cargo.toml b/examples/plugins/Cargo.toml index 06b0d06bb4..facebb262b 100644 --- a/examples/plugins/Cargo.toml +++ b/examples/plugins/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "perseus-test-plugins" -version = "0.3.2-beta.8" +name = "perseus-example-plugins" +version = "0.3.2" edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/examples/rx_state/Cargo.toml b/examples/rx_state/Cargo.toml index 0f03c930bf..147b65bed1 100644 --- a/examples/rx_state/Cargo.toml +++ b/examples/rx_state/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "perseus-test-rx-state" +name = "perseus-example-rx-state" version = "0.3.2" edition = "2018" diff --git a/examples/showcase/Cargo.toml b/examples/showcase/Cargo.toml index 6197765a49..1d5c20d4a5 100644 --- a/examples/showcase/Cargo.toml +++ b/examples/showcase/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "perseus-test-showcase" +name = "perseus-example-showcase" version = "0.1.0" edition = "2018"