diff --git a/src/content/docs/guides/test/webdriver/example/selenium.md b/src/content/docs/guides/test/WebDriver Testing/Example App/selenium.mdx similarity index 85% rename from src/content/docs/guides/test/webdriver/example/selenium.md rename to src/content/docs/guides/test/WebDriver Testing/Example App/selenium.mdx index a57f79ca2e..10e35f1b3a 100644 --- a/src/content/docs/guides/test/webdriver/example/selenium.md +++ b/src/content/docs/guides/test/WebDriver Testing/Example App/selenium.mdx @@ -1,13 +1,15 @@ --- -sidebar_position: 2 +title: Selenium +description: WebDriver Testing +sidebar: + order: 2 --- +{/*TODO: REVISE COPY TO V2 */} -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' +import CommandTabs from '@components/CommandTabs.astro'; -# Selenium -:::info Example Application +:::info[Example Application] This [Selenium] guide expects you to have already gone through the [example Application setup] to follow step-by-step. The general information may still be helpful otherwise. ::: @@ -50,56 +52,23 @@ We have a script that runs [Mocha] as a test framework exposed as the `test` com that we will be using to run the tests. [Mocha] as the testing framework, [Chai] as the assertion library, and [`selenium-webdriver`] which is the Node.js [Selenium] package. -
Click me if you want to see how to set a project up from scratch +
+Click me if you want to see how to set a project up from scratch If you want to install the dependencies from scratch, just run the following command. - - - -```shell -npm install mocha chai selenium-webdriver -``` - - - - - -```shell -yarn add mocha chai selenium-webdriver -``` - - - + I suggest also adding a `"test": "mocha"` item in the `package.json` `"scripts"` key so that running Mocha can be called simply with - - - -```shell -npm test -``` - - - - - -```shell -yarn test -``` - - - +
@@ -204,27 +173,11 @@ more WebDriver related items. Now that we are all set up with our dependencies and our test script, let's run it! - - - -```shell -npm test -``` - - - - - -```shell -yarn test -``` - - + We should see output the following output: diff --git a/src/content/docs/guides/test/webdriver/example/setup.md b/src/content/docs/guides/test/WebDriver Testing/Example App/setup.md similarity index 98% rename from src/content/docs/guides/test/webdriver/example/setup.md rename to src/content/docs/guides/test/WebDriver Testing/Example App/setup.md index 9d2713973a..2adcc8fccd 100644 --- a/src/content/docs/guides/test/webdriver/example/setup.md +++ b/src/content/docs/guides/test/WebDriver Testing/Example App/setup.md @@ -1,11 +1,13 @@ --- -sidebar_position: 1 +title: Setup Example +description: WebDriver Testing +sidebar: + order: 1 --- + import HelloTauriWebdriver from '@site/static/img/webdriver/hello-tauri-webdriver.png' -# Setup Example - This example application solely focuses on adding WebDriver testing to an already existing project. To have a project to test in the following two sections, we will set up an extremely minimal Tauri application for use in our testing. We will not use the Tauri CLI, any frontend dependencies or build steps, and not be bundling the @@ -22,6 +24,8 @@ line with `cargo new hello-tauri-webdriver --bin`, which will scaffold a minimal directory will serve as the working directory for the rest of this guide, so make sure the commands you run are inside this new `hello-tauri-webdriver/` directory. + + ## Creating a Minimal Frontend We will create a minimal HTML file to act as our example application's front end. We will also be using a few things diff --git a/src/content/docs/guides/test/webdriver/example/webdriverio.md b/src/content/docs/guides/test/WebDriver Testing/Example App/webdriverio.mdx similarity index 87% rename from src/content/docs/guides/test/webdriver/example/webdriverio.md rename to src/content/docs/guides/test/WebDriver Testing/Example App/webdriverio.mdx index 2bdb3d6a01..5cbf8ac59f 100644 --- a/src/content/docs/guides/test/webdriver/example/webdriverio.md +++ b/src/content/docs/guides/test/WebDriver Testing/Example App/webdriverio.mdx @@ -1,11 +1,12 @@ --- -sidebar_position: 3 +title: WebdriverIO +description: WebDriver Testing +sidebar: + order: 3 --- +{/*TODO: REVISE COPY TO V2 */} -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -# WebdriverIO +import CommandTabs from '@components/CommandTabs.astro'; :::info Example Application This [WebdriverIO] guide expects you to have already gone through the [example Application setup] to follow @@ -53,58 +54,25 @@ We have a script that runs a [WebdriverIO] config as a test suite exposed as the dependencies added by the `@wdio/cli` command when we first set it up. In short, these dependencies are for the most simple setup using a local WebDriver runner, [Mocha] as the test framework, and a simple Spec Reporter. -
Click me if you want to see how to set a project up from scratch +
+Click me if you want to see how to set a project up from scratch The CLI is interactive, and you may choose the tools to work with yourself. Note that you will likely diverge from the rest of the guide, and you need to set up the differences yourself. Let's add the [WebdriverIO] CLI to this npm project. - - - -```shell -npm install @wdio/cli -``` - - - - - -```shell -yarn add @wdio/cli -``` - - - + To then run the interactive config command to set up a [WebdriverIO] test suite, you can then run: - - - -```shell -npx wdio config -``` - - - - - -```shell -yarn wdio config -``` - - - +
@@ -212,27 +180,11 @@ covered by the [WebdriverIO API docs]. Now that we are all set up with config and a spec let's run it! - - - -```shell -npm test -``` - - - - - -```shell -yarn test -``` - - + We should see output the following output: diff --git a/src/content/docs/guides/test/webdriver/ci.md b/src/content/docs/guides/test/WebDriver Testing/ci.md similarity index 96% rename from src/content/docs/guides/test/webdriver/ci.md rename to src/content/docs/guides/test/WebDriver Testing/ci.md index 34991c91b1..0c6bd45538 100644 --- a/src/content/docs/guides/test/webdriver/ci.md +++ b/src/content/docs/guides/test/WebDriver Testing/ci.md @@ -1,4 +1,9 @@ -# Continuous Integration +--- +title: Continuous Integration +description: WebDriver Testing + +--- + Utilizing Linux and some programs to create a fake display, it is possible to run [WebDriver] tests with [`tauri-driver`] on your CI. The following example uses the [WebdriverIO] example we [previously built together] and diff --git a/src/content/docs/guides/test/webdriver/introduction.md b/src/content/docs/guides/test/WebDriver Testing/introduction.md similarity index 95% rename from src/content/docs/guides/test/webdriver/introduction.md rename to src/content/docs/guides/test/WebDriver Testing/introduction.md index fb7726eb06..41b96962a5 100644 --- a/src/content/docs/guides/test/webdriver/introduction.md +++ b/src/content/docs/guides/test/WebDriver Testing/introduction.md @@ -1,9 +1,12 @@ --- -sidebar_position: 1 title: Introduction +description: WebDriver Testing +sidebar: + order: 1 --- + -:::caution Currently in pre-alpha +:::caution[Currently in pre-alpha] Webdriver support for Tauri is still in pre-alpha. Tooling that is dedicated to it, such as [tauri-driver], is still in active development and may change as necessary over time. Additionally, only Windows and Linux are currently supported. ::: diff --git a/src/content/docs/guides/test/_category_.yml b/src/content/docs/guides/test/_category_.yml deleted file mode 100644 index 4029fd27d0..0000000000 --- a/src/content/docs/guides/test/_category_.yml +++ /dev/null @@ -1,4 +0,0 @@ -label: 'Testing' -position: 6 -customProps: - description: Techniques for testing inside and outside the Tauri runtime diff --git a/src/content/docs/guides/test/mocking.md b/src/content/docs/guides/test/mocking.md index 0b6079a728..0667ec8f13 100644 --- a/src/content/docs/guides/test/mocking.md +++ b/src/content/docs/guides/test/mocking.md @@ -1,4 +1,11 @@ -# Mocking Tauri APIs +--- +title: Mock Tauri APIs +description: Techniques for testing inside and outside the Tauri runtime +sidebar: + order: 1 +--- + + When writing your frontend tests, having a "fake" Tauri environment to simulate windows or intercept IPC calls is common, so-called _mocking_. The [`@tauri-apps/api/mocks`] module provides some helpful tools to make this easier for you: diff --git a/src/content/docs/guides/test/webdriver/_category_.yml b/src/content/docs/guides/test/webdriver/_category_.yml deleted file mode 100644 index 15ebabddd5..0000000000 --- a/src/content/docs/guides/test/webdriver/_category_.yml +++ /dev/null @@ -1 +0,0 @@ -label: 'WebDriver Testing' diff --git a/src/content/docs/guides/test/webdriver/example/_category_.yml b/src/content/docs/guides/test/webdriver/example/_category_.yml deleted file mode 100644 index 67b45c7819..0000000000 --- a/src/content/docs/guides/test/webdriver/example/_category_.yml +++ /dev/null @@ -1,2 +0,0 @@ -label: 'Example Application' -position: 2