> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.doc-detective.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.doc-detective.com/_mcp/server.

# Sessions and surfaces, written as tests

> Procedures that keep cookies and browser state, work across tabs, windows, browser sessions, processes, and apps, and choose where and how they run, shown as plain prose, detected tests, inline tests, and standalone specs in every supported format.

Each example shows one procedure as prose, as detected tests, as inline tests, and as a standalone spec. For what each tab holds, see [Navigation and interaction](/reference/docs-as-tests/navigation-interaction).

In a detected variant, a `step` statement holds each step that default detection can't produce, such as `saveCookie` or `startSurface`. Each of those statements also works on its own, because a run with detection off reads only the statements.

The permutation sections, from [`saveCookie` and `loadCookie` permutations](#savecookie-and-loadcookie-permutations) on, vary one setting each. A **Varies** line names the setting, its value, and its effect.

## Keep a session cookie

This procedure uses [`saveCookie`](/docs/actions/savecookie) and [`loadCookie`](/docs/actions/loadcookie) in their name, file path, and object forms, with [`goTo`](/docs/actions/goto) and [`find`](/docs/actions/find).

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Keep a session cookie

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_demo/signed-in). The server sets the `sessions_demo` cookie.
2. Save the `sessions_demo` cookie four ways. Save it to the `sessions_demo` and `SESSIONS_DEMO_COOKIE` environment variables, and to `sessions_demo.txt` in the output folder. Save it to `sessions_demo.txt` in a `tmp` folder next to this file, keeping only the `localhost` cookie.
3. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_demo/signed-out), which replaces the cookie.
4. Load the cookie from `sessions_demo.txt` in the output folder.
5. Go to [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_demo=signed-in**.
6. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_demo/signed-out) again, and load the cookie from the `SESSIONS_DEMO_COOKIE` environment variable.
7. Go to [the cookie report](http://localhost:8092/cookies) again, and check that it shows **sessions_demo=signed-in**.
8. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_demo/signed-out) once more, and load the `localhost` cookie from `tmp/sessions_demo.txt`.
9. Go to [the cookie report](http://localhost:8092/cookies) a last time, and check that it shows **sessions_demo=signed-in**.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Keep a session cookie

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_demo/signed-in). The server sets the `sessions_demo` cookie.
2. Save the `sessions_demo` cookie four ways. Save it to the `sessions_demo` and `SESSIONS_DEMO_COOKIE` environment variables, and to `sessions_demo.txt` in the output folder. Save it to `sessions_demo.txt` in a `tmp` folder next to this file, keeping only the `localhost` cookie.
3. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_demo/signed-out), which replaces the cookie.
4. Load the cookie from `sessions_demo.txt` in the output folder.
5. Go to [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_demo=signed-in**.
6. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_demo/signed-out) again, and load the cookie from the `SESSIONS_DEMO_COOKIE` environment variable.
7. Go to [the cookie report](http://localhost:8092/cookies) again, and check that it shows **sessions_demo=signed-in**.
8. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_demo/signed-out) once more, and load the `localhost` cookie from `tmp/sessions_demo.txt`.
9. Go to [the cookie report](http://localhost:8092/cookies) a last time, and check that it shows **sessions_demo=signed-in**.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Keep a session cookie

. Sign in at http://localhost:8092/cookies/set/sessions_demo/signed-in[the sign-in page]. The server sets the `sessions_demo` cookie.
. Save the `sessions_demo` cookie four ways. Save it to the `sessions_demo` and `SESSIONS_DEMO_COOKIE` environment variables, and to `sessions_demo.txt` in the output folder. Save it to `sessions_demo.txt` in a `tmp` folder next to this file, keeping only the `localhost` cookie.
. Go to http://localhost:8092/cookies/set/sessions_demo/signed-out[the sign-out page], which replaces the cookie.
. Load the cookie from `sessions_demo.txt` in the output folder.
. Go to http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_demo=signed-in*.
. Go to http://localhost:8092/cookies/set/sessions_demo/signed-out[the sign-out page] again, and load the cookie from the `SESSIONS_DEMO_COOKIE` environment variable.
. Go to http://localhost:8092/cookies[the cookie report] again, and check that it shows *sessions_demo=signed-in*.
. Go to http://localhost:8092/cookies/set/sessions_demo/signed-out[the sign-out page] once more, and load the `localhost` cookie from `tmp/sessions_demo.txt`.
. Go to http://localhost:8092/cookies[the cookie report] a last time, and check that it shows *sessions_demo=signed-in*.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Keep a session cookie</title></head>
<body>
<h1>Keep a session cookie</h1>
<ol>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_demo/signed-in">the sign-in page</a>. The server sets the <code>sessions_demo</code> cookie.</li>
  <li>Save the <code>sessions_demo</code> cookie four ways. Save it to the <code>sessions_demo</code> and <code>SESSIONS_DEMO_COOKIE</code> environment variables, and to <code>sessions_demo.txt</code> in the output folder. Save it to <code>sessions_demo.txt</code> in a <code>tmp</code> folder next to this file, keeping only the <code>localhost</code> cookie.</li>
  <li>Go to <a href="http://localhost:8092/cookies/set/sessions_demo/signed-out">the sign-out page</a>, which replaces the cookie.</li>
  <li>Load the cookie from <code>sessions_demo.txt</code> in the output folder.</li>
  <li>Go to <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_demo=signed-in</strong>.</li>
  <li>Go to <a href="http://localhost:8092/cookies/set/sessions_demo/signed-out">the sign-out page</a> again, and load the cookie from the <code>SESSIONS_DEMO_COOKIE</code> environment variable.</li>
  <li>Go to <a href="http://localhost:8092/cookies">the cookie report</a> again, and check that it shows <strong>sessions_demo=signed-in</strong>.</li>
  <li>Go to <a href="http://localhost:8092/cookies/set/sessions_demo/signed-out">the sign-out page</a> once more, and load the <code>localhost</code> cookie from <code>tmp/sessions_demo.txt</code>.</li>
  <li>Go to <a href="http://localhost:8092/cookies">the cookie report</a> a last time, and check that it shows <strong>sessions_demo=signed-in</strong>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Keep a session cookie
=====================

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_demo/signed-in>`__. The server sets the ``sessions_demo`` cookie.

#. Save the ``sessions_demo`` cookie four ways. Save it to the ``sessions_demo`` and ``SESSIONS_DEMO_COOKIE`` environment variables, and to ``sessions_demo.txt`` in the output folder. Save it to ``sessions_demo.txt`` in a ``tmp`` folder next to this file, keeping only the ``localhost`` cookie.

#. Go to `the sign-out page <http://localhost:8092/cookies/set/sessions_demo/signed-out>`__, which replaces the cookie.

#. Load the cookie from ``sessions_demo.txt`` in the output folder.

#. Go to `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_demo=signed-in**.

#. Go to `the sign-out page <http://localhost:8092/cookies/set/sessions_demo/signed-out>`__ again, and load the cookie from the ``SESSIONS_DEMO_COOKIE`` environment variable.

#. Go to `the cookie report <http://localhost:8092/cookies>`__ again, and check that it shows **sessions_demo=signed-in**.

#. Go to `the sign-out page <http://localhost:8092/cookies/set/sessions_demo/signed-out>`__ once more, and load the ``localhost`` cookie from ``tmp/sessions_demo.txt``.

#. Go to `the cookie report <http://localhost:8092/cookies>`__ a last time, and check that it shows **sessions_demo=signed-in**.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-cookies">
  <title>Keep a session cookie</title>
  <taskbody>
    <steps>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_demo/signed-in" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_demo</codeph> cookie.</cmd></step>
      <step><cmd>Save the <codeph>sessions_demo</codeph> cookie four ways. Save it to the <codeph>sessions_demo</codeph> and <codeph>SESSIONS_DEMO_COOKIE</codeph> environment variables, and to <codeph>sessions_demo.txt</codeph> in the output folder. Save it to <codeph>sessions_demo.txt</codeph> in a <codeph>tmp</codeph> folder next to this file, keeping only the <codeph>localhost</codeph> cookie.</cmd></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies/set/sessions_demo/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd></step>
      <step><cmd>Load the cookie from <codeph>sessions_demo.txt</codeph> in the output folder.</cmd></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_demo=signed-in</b>.</cmd></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies/set/sessions_demo/signed-out" scope="external" format="html">the sign-out page</xref> again, and load the cookie from the <codeph>SESSIONS_DEMO_COOKIE</codeph> environment variable.</cmd></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref> again, and check that it shows <b>sessions_demo=signed-in</b>.</cmd></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies/set/sessions_demo/signed-out" scope="external" format="html">the sign-out page</xref> once more, and load the <codeph>localhost</codeph> cookie from <codeph>tmp/sessions_demo.txt</codeph>.</cmd></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref> a last time, and check that it shows <b>sessions_demo=signed-in</b>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-cookies","detectSteps":true} -->

# Keep a session cookie

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_demo/signed-in). The server sets the `sessions_demo` cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-in"} -->
2. Save the `sessions_demo` cookie four ways. Save it to the `sessions_demo` and `SESSIONS_DEMO_COOKIE` environment variables, and to `sessions_demo.txt` in the output folder. Save it to `sessions_demo.txt` in a `tmp` folder next to this file, keeping only the `localhost` cookie.
   <!-- step {"saveCookie":"sessions_demo"} -->
   <!-- step {"saveCookie":{"name":"sessions_demo","variable":"SESSIONS_DEMO_COOKIE"}} -->
   <!-- step {"saveCookie":{"name":"sessions_demo","path":"sessions_demo.txt","overwrite":true}} -->
   <!-- step {"saveCookie":{"name":"sessions_demo","path":"sessions_demo.txt","directory":"tmp","domain":"localhost","overwrite":true}} -->
3. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_demo/signed-out), which replaces the cookie.
4. Load the cookie from `sessions_demo.txt` in the output folder.
   <!-- step {"loadCookie":"sessions_demo.txt"} -->
5. Go to [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_demo=signed-in**.
6. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_demo/signed-out) again, and load the cookie from the `SESSIONS_DEMO_COOKIE` environment variable.
   <!-- step {"loadCookie":{"name":"sessions_demo","variable":"SESSIONS_DEMO_COOKIE"}} -->
7. Go to [the cookie report](http://localhost:8092/cookies) again, and check that it shows **sessions_demo=signed-in**.
8. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_demo/signed-out) once more, and load the `localhost` cookie from `tmp/sessions_demo.txt`.
   <!-- step {"loadCookie":{"name":"sessions_demo","path":"sessions_demo.txt","directory":"tmp","domain":"localhost"}} -->
9. Go to [the cookie report](http://localhost:8092/cookies) a last time, and check that it shows **sessions_demo=signed-in**.

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-cookies","detectSteps":true} */}

# Keep a session cookie

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_demo/signed-in). The server sets the `sessions_demo` cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-in"} */}
2. Save the `sessions_demo` cookie four ways. Save it to the `sessions_demo` and `SESSIONS_DEMO_COOKIE` environment variables, and to `sessions_demo.txt` in the output folder. Save it to `sessions_demo.txt` in a `tmp` folder next to this file, keeping only the `localhost` cookie.
   {/* step {"saveCookie":"sessions_demo"} */}
   {/* step {"saveCookie":{"name":"sessions_demo","variable":"SESSIONS_DEMO_COOKIE"}} */}
   {/* step {"saveCookie":{"name":"sessions_demo","path":"sessions_demo.txt","overwrite":true}} */}
   {/* step {"saveCookie":{"name":"sessions_demo","path":"sessions_demo.txt","directory":"tmp","domain":"localhost","overwrite":true}} */}
3. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_demo/signed-out), which replaces the cookie.
4. Load the cookie from `sessions_demo.txt` in the output folder.
   {/* step {"loadCookie":"sessions_demo.txt"} */}
5. Go to [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_demo=signed-in**.
6. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_demo/signed-out) again, and load the cookie from the `SESSIONS_DEMO_COOKIE` environment variable.
   {/* step {"loadCookie":{"name":"sessions_demo","variable":"SESSIONS_DEMO_COOKIE"}} */}
7. Go to [the cookie report](http://localhost:8092/cookies) again, and check that it shows **sessions_demo=signed-in**.
8. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_demo/signed-out) once more, and load the `localhost` cookie from `tmp/sessions_demo.txt`.
   {/* step {"loadCookie":{"name":"sessions_demo","path":"sessions_demo.txt","directory":"tmp","domain":"localhost"}} */}
9. Go to [the cookie report](http://localhost:8092/cookies) a last time, and check that it shows **sessions_demo=signed-in**.

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Keep a session cookie

// (test {"testId":"sessions-cookies","detectSteps":true})

. Sign in at http://localhost:8092/cookies/set/sessions_demo/signed-in[the sign-in page]. The server sets the `sessions_demo` cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-in"})
. Save the `sessions_demo` cookie four ways. Save it to the `sessions_demo` and `SESSIONS_DEMO_COOKIE` environment variables, and to `sessions_demo.txt` in the output folder. Save it to `sessions_demo.txt` in a `tmp` folder next to this file, keeping only the `localhost` cookie.
+
// (step {"saveCookie":"sessions_demo"})
+
// (step {"saveCookie":{"name":"sessions_demo","variable":"SESSIONS_DEMO_COOKIE"}})
+
// (step {"saveCookie":{"name":"sessions_demo","path":"sessions_demo.txt","overwrite":true}})
+
// (step {"saveCookie":{"name":"sessions_demo","path":"sessions_demo.txt","directory":"tmp","domain":"localhost","overwrite":true}})
. Go to http://localhost:8092/cookies/set/sessions_demo/signed-out[the sign-out page], which replaces the cookie.
. Load the cookie from `sessions_demo.txt` in the output folder.
+
// (step {"loadCookie":"sessions_demo.txt"})
. Go to http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_demo=signed-in*.
. Go to http://localhost:8092/cookies/set/sessions_demo/signed-out[the sign-out page] again, and load the cookie from the `SESSIONS_DEMO_COOKIE` environment variable.
+
// (step {"loadCookie":{"name":"sessions_demo","variable":"SESSIONS_DEMO_COOKIE"}})
. Go to http://localhost:8092/cookies[the cookie report] again, and check that it shows *sessions_demo=signed-in*.
. Go to http://localhost:8092/cookies/set/sessions_demo/signed-out[the sign-out page] once more, and load the `localhost` cookie from `tmp/sessions_demo.txt`.
+
// (step {"loadCookie":{"name":"sessions_demo","path":"sessions_demo.txt","directory":"tmp","domain":"localhost"}})
. Go to http://localhost:8092/cookies[the cookie report] a last time, and check that it shows *sessions_demo=signed-in*.

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Keep a session cookie</title></head>
<body>
<!-- test {"testId":"sessions-cookies","detectSteps":true} -->
<h1>Keep a session cookie</h1>
<ol>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_demo/signed-in">the sign-in page</a>. The server sets the <code>sessions_demo</code> cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-in"} --></li>
  <li>Save the <code>sessions_demo</code> cookie four ways. Save it to the <code>sessions_demo</code> and <code>SESSIONS_DEMO_COOKIE</code> environment variables, and to <code>sessions_demo.txt</code> in the output folder. Save it to <code>sessions_demo.txt</code> in a <code>tmp</code> folder next to this file, keeping only the <code>localhost</code> cookie.
    <!-- step {"saveCookie":"sessions_demo"} -->
    <!-- step {"saveCookie":{"name":"sessions_demo","variable":"SESSIONS_DEMO_COOKIE"}} -->
    <!-- step {"saveCookie":{"name":"sessions_demo","path":"sessions_demo.txt","overwrite":true}} -->
    <!-- step {"saveCookie":{"name":"sessions_demo","path":"sessions_demo.txt","directory":"tmp","domain":"localhost","overwrite":true}} --></li>
  <li>Go to <a href="http://localhost:8092/cookies/set/sessions_demo/signed-out">the sign-out page</a>, which replaces the cookie.</li>
  <li>Load the cookie from <code>sessions_demo.txt</code> in the output folder.
    <!-- step {"loadCookie":"sessions_demo.txt"} --></li>
  <li>Go to <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_demo=signed-in</strong>.</li>
  <li>Go to <a href="http://localhost:8092/cookies/set/sessions_demo/signed-out">the sign-out page</a> again, and load the cookie from the <code>SESSIONS_DEMO_COOKIE</code> environment variable.
    <!-- step {"loadCookie":{"name":"sessions_demo","variable":"SESSIONS_DEMO_COOKIE"}} --></li>
  <li>Go to <a href="http://localhost:8092/cookies">the cookie report</a> again, and check that it shows <strong>sessions_demo=signed-in</strong>.</li>
  <li>Go to <a href="http://localhost:8092/cookies/set/sessions_demo/signed-out">the sign-out page</a> once more, and load the <code>localhost</code> cookie from <code>tmp/sessions_demo.txt</code>.
    <!-- step {"loadCookie":{"name":"sessions_demo","path":"sessions_demo.txt","directory":"tmp","domain":"localhost"}} --></li>
  <li>Go to <a href="http://localhost:8092/cookies">the cookie report</a> a last time, and check that it shows <strong>sessions_demo=signed-in</strong>.</li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Keep a session cookie
=====================

.. test {"testId":"sessions-cookies","detectSteps":true}

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_demo/signed-in>`__. The server sets the ``sessions_demo`` cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-in"}

#. Save the ``sessions_demo`` cookie four ways. Save it to the ``sessions_demo`` and ``SESSIONS_DEMO_COOKIE`` environment variables, and to ``sessions_demo.txt`` in the output folder. Save it to ``sessions_demo.txt`` in a ``tmp`` folder next to this file, keeping only the ``localhost`` cookie.

   .. step {"saveCookie":"sessions_demo"}

   .. step {"saveCookie":{"name":"sessions_demo","variable":"SESSIONS_DEMO_COOKIE"}}

   .. step {"saveCookie":{"name":"sessions_demo","path":"sessions_demo.txt","overwrite":true}}

   .. step {"saveCookie":{"name":"sessions_demo","path":"sessions_demo.txt","directory":"tmp","domain":"localhost","overwrite":true}}

#. Go to `the sign-out page <http://localhost:8092/cookies/set/sessions_demo/signed-out>`__, which replaces the cookie.

#. Load the cookie from ``sessions_demo.txt`` in the output folder.

   .. step {"loadCookie":"sessions_demo.txt"}

#. Go to `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_demo=signed-in**.

#. Go to `the sign-out page <http://localhost:8092/cookies/set/sessions_demo/signed-out>`__ again, and load the cookie from the ``SESSIONS_DEMO_COOKIE`` environment variable.

   .. step {"loadCookie":{"name":"sessions_demo","variable":"SESSIONS_DEMO_COOKIE"}}

#. Go to `the cookie report <http://localhost:8092/cookies>`__ again, and check that it shows **sessions_demo=signed-in**.

#. Go to `the sign-out page <http://localhost:8092/cookies/set/sessions_demo/signed-out>`__ once more, and load the ``localhost`` cookie from ``tmp/sessions_demo.txt``.

   .. step {"loadCookie":{"name":"sessions_demo","path":"sessions_demo.txt","directory":"tmp","domain":"localhost"}}

#. Go to `the cookie report <http://localhost:8092/cookies>`__ a last time, and check that it shows **sessions_demo=signed-in**.

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-cookies">
  <title>Keep a session cookie</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-cookies","detectSteps":true}'/>
    <steps>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_demo/signed-in" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_demo</codeph> cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-in"}'/></info></step>
      <step><cmd>Save the <codeph>sessions_demo</codeph> cookie four ways. Save it to the <codeph>sessions_demo</codeph> and <codeph>SESSIONS_DEMO_COOKIE</codeph> environment variables, and to <codeph>sessions_demo.txt</codeph> in the output folder. Save it to <codeph>sessions_demo.txt</codeph> in a <codeph>tmp</codeph> folder next to this file, keeping only the <codeph>localhost</codeph> cookie.</cmd>
        <info><data name="doc-detective" value='step {"saveCookie":"sessions_demo"}'/><data name="doc-detective" value='step {"saveCookie":{"name":"sessions_demo","variable":"SESSIONS_DEMO_COOKIE"}}'/><data name="doc-detective" value='step {"saveCookie":{"name":"sessions_demo","path":"sessions_demo.txt","overwrite":true}}'/><data name="doc-detective" value='step {"saveCookie":{"name":"sessions_demo","path":"sessions_demo.txt","directory":"tmp","domain":"localhost","overwrite":true}}'/></info></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies/set/sessions_demo/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd></step>
      <step><cmd>Load the cookie from <codeph>sessions_demo.txt</codeph> in the output folder.</cmd>
        <info><data name="doc-detective" value='step {"loadCookie":"sessions_demo.txt"}'/></info></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_demo=signed-in</b>.</cmd></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies/set/sessions_demo/signed-out" scope="external" format="html">the sign-out page</xref> again, and load the cookie from the <codeph>SESSIONS_DEMO_COOKIE</codeph> environment variable.</cmd>
        <info><data name="doc-detective" value='step {"loadCookie":{"name":"sessions_demo","variable":"SESSIONS_DEMO_COOKIE"}}'/></info></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref> again, and check that it shows <b>sessions_demo=signed-in</b>.</cmd></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies/set/sessions_demo/signed-out" scope="external" format="html">the sign-out page</xref> once more, and load the <codeph>localhost</codeph> cookie from <codeph>tmp/sessions_demo.txt</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"loadCookie":{"name":"sessions_demo","path":"sessions_demo.txt","directory":"tmp","domain":"localhost"}}'/></info></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref> a last time, and check that it shows <b>sessions_demo=signed-in</b>.</cmd></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-cookies","detectSteps":false} -->

# Keep a session cookie

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_demo/signed-in). The server sets the `sessions_demo` cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-in"} -->
2. Save the `sessions_demo` cookie four ways. Save it to the `sessions_demo` and `SESSIONS_DEMO_COOKIE` environment variables, and to `sessions_demo.txt` in the output folder. Save it to `sessions_demo.txt` in a `tmp` folder next to this file, keeping only the `localhost` cookie.
   <!-- step {"saveCookie":"sessions_demo"} -->
   <!-- step {"saveCookie":{"name":"sessions_demo","variable":"SESSIONS_DEMO_COOKIE"}} -->
   <!-- step {"saveCookie":{"name":"sessions_demo","path":"sessions_demo.txt","overwrite":true}} -->
   <!-- step {"saveCookie":{"name":"sessions_demo","path":"sessions_demo.txt","directory":"tmp","domain":"localhost","overwrite":true}} -->
3. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_demo/signed-out), which replaces the cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-out"} -->
4. Load the cookie from `sessions_demo.txt` in the output folder.
   <!-- step {"loadCookie":"sessions_demo.txt"} -->
5. Go to [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_demo=signed-in**.
   <!-- step {"goTo":"http://localhost:8092/cookies"} -->
   <!-- step {"find":"sessions_demo=signed-in"} -->
6. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_demo/signed-out) again, and load the cookie from the `SESSIONS_DEMO_COOKIE` environment variable.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-out"} -->
   <!-- step {"loadCookie":{"name":"sessions_demo","variable":"SESSIONS_DEMO_COOKIE"}} -->
7. Go to [the cookie report](http://localhost:8092/cookies) again, and check that it shows **sessions_demo=signed-in**.
   <!-- step {"goTo":"http://localhost:8092/cookies"} -->
   <!-- step {"find":"sessions_demo=signed-in"} -->
8. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_demo/signed-out) once more, and load the `localhost` cookie from `tmp/sessions_demo.txt`.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-out"} -->
   <!-- step {"loadCookie":{"name":"sessions_demo","path":"sessions_demo.txt","directory":"tmp","domain":"localhost"}} -->
9. Go to [the cookie report](http://localhost:8092/cookies) a last time, and check that it shows **sessions_demo=signed-in**.
   <!-- step {"goTo":"http://localhost:8092/cookies"} -->
   <!-- step {"find":"sessions_demo=signed-in"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-cookies","detectSteps":false} */}

# Keep a session cookie

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_demo/signed-in). The server sets the `sessions_demo` cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-in"} */}
2. Save the `sessions_demo` cookie four ways. Save it to the `sessions_demo` and `SESSIONS_DEMO_COOKIE` environment variables, and to `sessions_demo.txt` in the output folder. Save it to `sessions_demo.txt` in a `tmp` folder next to this file, keeping only the `localhost` cookie.
   {/* step {"saveCookie":"sessions_demo"} */}
   {/* step {"saveCookie":{"name":"sessions_demo","variable":"SESSIONS_DEMO_COOKIE"}} */}
   {/* step {"saveCookie":{"name":"sessions_demo","path":"sessions_demo.txt","overwrite":true}} */}
   {/* step {"saveCookie":{"name":"sessions_demo","path":"sessions_demo.txt","directory":"tmp","domain":"localhost","overwrite":true}} */}
3. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_demo/signed-out), which replaces the cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-out"} */}
4. Load the cookie from `sessions_demo.txt` in the output folder.
   {/* step {"loadCookie":"sessions_demo.txt"} */}
5. Go to [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_demo=signed-in**.
   {/* step {"goTo":"http://localhost:8092/cookies"} */}
   {/* step {"find":"sessions_demo=signed-in"} */}
6. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_demo/signed-out) again, and load the cookie from the `SESSIONS_DEMO_COOKIE` environment variable.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-out"} */}
   {/* step {"loadCookie":{"name":"sessions_demo","variable":"SESSIONS_DEMO_COOKIE"}} */}
7. Go to [the cookie report](http://localhost:8092/cookies) again, and check that it shows **sessions_demo=signed-in**.
   {/* step {"goTo":"http://localhost:8092/cookies"} */}
   {/* step {"find":"sessions_demo=signed-in"} */}
8. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_demo/signed-out) once more, and load the `localhost` cookie from `tmp/sessions_demo.txt`.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-out"} */}
   {/* step {"loadCookie":{"name":"sessions_demo","path":"sessions_demo.txt","directory":"tmp","domain":"localhost"}} */}
9. Go to [the cookie report](http://localhost:8092/cookies) a last time, and check that it shows **sessions_demo=signed-in**.
   {/* step {"goTo":"http://localhost:8092/cookies"} */}
   {/* step {"find":"sessions_demo=signed-in"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Keep a session cookie

// (test {"testId":"sessions-cookies","detectSteps":false})

. Sign in at http://localhost:8092/cookies/set/sessions_demo/signed-in[the sign-in page]. The server sets the `sessions_demo` cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-in"})
. Save the `sessions_demo` cookie four ways. Save it to the `sessions_demo` and `SESSIONS_DEMO_COOKIE` environment variables, and to `sessions_demo.txt` in the output folder. Save it to `sessions_demo.txt` in a `tmp` folder next to this file, keeping only the `localhost` cookie.
+
// (step {"saveCookie":"sessions_demo"})
+
// (step {"saveCookie":{"name":"sessions_demo","variable":"SESSIONS_DEMO_COOKIE"}})
+
// (step {"saveCookie":{"name":"sessions_demo","path":"sessions_demo.txt","overwrite":true}})
+
// (step {"saveCookie":{"name":"sessions_demo","path":"sessions_demo.txt","directory":"tmp","domain":"localhost","overwrite":true}})
. Go to http://localhost:8092/cookies/set/sessions_demo/signed-out[the sign-out page], which replaces the cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-out"})
. Load the cookie from `sessions_demo.txt` in the output folder.
+
// (step {"loadCookie":"sessions_demo.txt"})
. Go to http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_demo=signed-in*.
+
// (step {"goTo":"http://localhost:8092/cookies"})
+
// (step {"find":"sessions_demo=signed-in"})
. Go to http://localhost:8092/cookies/set/sessions_demo/signed-out[the sign-out page] again, and load the cookie from the `SESSIONS_DEMO_COOKIE` environment variable.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-out"})
+
// (step {"loadCookie":{"name":"sessions_demo","variable":"SESSIONS_DEMO_COOKIE"}})
. Go to http://localhost:8092/cookies[the cookie report] again, and check that it shows *sessions_demo=signed-in*.
+
// (step {"goTo":"http://localhost:8092/cookies"})
+
// (step {"find":"sessions_demo=signed-in"})
. Go to http://localhost:8092/cookies/set/sessions_demo/signed-out[the sign-out page] once more, and load the `localhost` cookie from `tmp/sessions_demo.txt`.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-out"})
+
// (step {"loadCookie":{"name":"sessions_demo","path":"sessions_demo.txt","directory":"tmp","domain":"localhost"}})
. Go to http://localhost:8092/cookies[the cookie report] a last time, and check that it shows *sessions_demo=signed-in*.
+
// (step {"goTo":"http://localhost:8092/cookies"})
+
// (step {"find":"sessions_demo=signed-in"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Keep a session cookie</title></head>
<body>
<!-- test {"testId":"sessions-cookies","detectSteps":false} -->
<h1>Keep a session cookie</h1>
<ol>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_demo/signed-in">the sign-in page</a>. The server sets the <code>sessions_demo</code> cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-in"} --></li>
  <li>Save the <code>sessions_demo</code> cookie four ways. Save it to the <code>sessions_demo</code> and <code>SESSIONS_DEMO_COOKIE</code> environment variables, and to <code>sessions_demo.txt</code> in the output folder. Save it to <code>sessions_demo.txt</code> in a <code>tmp</code> folder next to this file, keeping only the <code>localhost</code> cookie.
    <!-- step {"saveCookie":"sessions_demo"} -->
    <!-- step {"saveCookie":{"name":"sessions_demo","variable":"SESSIONS_DEMO_COOKIE"}} -->
    <!-- step {"saveCookie":{"name":"sessions_demo","path":"sessions_demo.txt","overwrite":true}} -->
    <!-- step {"saveCookie":{"name":"sessions_demo","path":"sessions_demo.txt","directory":"tmp","domain":"localhost","overwrite":true}} --></li>
  <li>Go to <a href="http://localhost:8092/cookies/set/sessions_demo/signed-out">the sign-out page</a>, which replaces the cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-out"} --></li>
  <li>Load the cookie from <code>sessions_demo.txt</code> in the output folder.
    <!-- step {"loadCookie":"sessions_demo.txt"} --></li>
  <li>Go to <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_demo=signed-in</strong>.
    <!-- step {"goTo":"http://localhost:8092/cookies"} -->
    <!-- step {"find":"sessions_demo=signed-in"} --></li>
  <li>Go to <a href="http://localhost:8092/cookies/set/sessions_demo/signed-out">the sign-out page</a> again, and load the cookie from the <code>SESSIONS_DEMO_COOKIE</code> environment variable.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-out"} -->
    <!-- step {"loadCookie":{"name":"sessions_demo","variable":"SESSIONS_DEMO_COOKIE"}} --></li>
  <li>Go to <a href="http://localhost:8092/cookies">the cookie report</a> again, and check that it shows <strong>sessions_demo=signed-in</strong>.
    <!-- step {"goTo":"http://localhost:8092/cookies"} -->
    <!-- step {"find":"sessions_demo=signed-in"} --></li>
  <li>Go to <a href="http://localhost:8092/cookies/set/sessions_demo/signed-out">the sign-out page</a> once more, and load the <code>localhost</code> cookie from <code>tmp/sessions_demo.txt</code>.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-out"} -->
    <!-- step {"loadCookie":{"name":"sessions_demo","path":"sessions_demo.txt","directory":"tmp","domain":"localhost"}} --></li>
  <li>Go to <a href="http://localhost:8092/cookies">the cookie report</a> a last time, and check that it shows <strong>sessions_demo=signed-in</strong>.
    <!-- step {"goTo":"http://localhost:8092/cookies"} -->
    <!-- step {"find":"sessions_demo=signed-in"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Keep a session cookie
=====================

.. test {"testId":"sessions-cookies","detectSteps":false}

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_demo/signed-in>`__. The server sets the ``sessions_demo`` cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-in"}

#. Save the ``sessions_demo`` cookie four ways. Save it to the ``sessions_demo`` and ``SESSIONS_DEMO_COOKIE`` environment variables, and to ``sessions_demo.txt`` in the output folder. Save it to ``sessions_demo.txt`` in a ``tmp`` folder next to this file, keeping only the ``localhost`` cookie.

   .. step {"saveCookie":"sessions_demo"}

   .. step {"saveCookie":{"name":"sessions_demo","variable":"SESSIONS_DEMO_COOKIE"}}

   .. step {"saveCookie":{"name":"sessions_demo","path":"sessions_demo.txt","overwrite":true}}

   .. step {"saveCookie":{"name":"sessions_demo","path":"sessions_demo.txt","directory":"tmp","domain":"localhost","overwrite":true}}

#. Go to `the sign-out page <http://localhost:8092/cookies/set/sessions_demo/signed-out>`__, which replaces the cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-out"}

#. Load the cookie from ``sessions_demo.txt`` in the output folder.

   .. step {"loadCookie":"sessions_demo.txt"}

#. Go to `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_demo=signed-in**.

   .. step {"goTo":"http://localhost:8092/cookies"}

   .. step {"find":"sessions_demo=signed-in"}

#. Go to `the sign-out page <http://localhost:8092/cookies/set/sessions_demo/signed-out>`__ again, and load the cookie from the ``SESSIONS_DEMO_COOKIE`` environment variable.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-out"}

   .. step {"loadCookie":{"name":"sessions_demo","variable":"SESSIONS_DEMO_COOKIE"}}

#. Go to `the cookie report <http://localhost:8092/cookies>`__ again, and check that it shows **sessions_demo=signed-in**.

   .. step {"goTo":"http://localhost:8092/cookies"}

   .. step {"find":"sessions_demo=signed-in"}

#. Go to `the sign-out page <http://localhost:8092/cookies/set/sessions_demo/signed-out>`__ once more, and load the ``localhost`` cookie from ``tmp/sessions_demo.txt``.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-out"}

   .. step {"loadCookie":{"name":"sessions_demo","path":"sessions_demo.txt","directory":"tmp","domain":"localhost"}}

#. Go to `the cookie report <http://localhost:8092/cookies>`__ a last time, and check that it shows **sessions_demo=signed-in**.

   .. step {"goTo":"http://localhost:8092/cookies"}

   .. step {"find":"sessions_demo=signed-in"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-cookies">
  <title>Keep a session cookie</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-cookies","detectSteps":false}'/>
    <steps>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_demo/signed-in" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_demo</codeph> cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-in"}'/></info></step>
      <step><cmd>Save the <codeph>sessions_demo</codeph> cookie four ways. Save it to the <codeph>sessions_demo</codeph> and <codeph>SESSIONS_DEMO_COOKIE</codeph> environment variables, and to <codeph>sessions_demo.txt</codeph> in the output folder. Save it to <codeph>sessions_demo.txt</codeph> in a <codeph>tmp</codeph> folder next to this file, keeping only the <codeph>localhost</codeph> cookie.</cmd>
        <info><data name="doc-detective" value='step {"saveCookie":"sessions_demo"}'/><data name="doc-detective" value='step {"saveCookie":{"name":"sessions_demo","variable":"SESSIONS_DEMO_COOKIE"}}'/><data name="doc-detective" value='step {"saveCookie":{"name":"sessions_demo","path":"sessions_demo.txt","overwrite":true}}'/><data name="doc-detective" value='step {"saveCookie":{"name":"sessions_demo","path":"sessions_demo.txt","directory":"tmp","domain":"localhost","overwrite":true}}'/></info></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies/set/sessions_demo/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-out"}'/></info></step>
      <step><cmd>Load the cookie from <codeph>sessions_demo.txt</codeph> in the output folder.</cmd>
        <info><data name="doc-detective" value='step {"loadCookie":"sessions_demo.txt"}'/></info></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_demo=signed-in</b>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies"}'/><data name="doc-detective" value='step {"find":"sessions_demo=signed-in"}'/></info></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies/set/sessions_demo/signed-out" scope="external" format="html">the sign-out page</xref> again, and load the cookie from the <codeph>SESSIONS_DEMO_COOKIE</codeph> environment variable.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-out"}'/><data name="doc-detective" value='step {"loadCookie":{"name":"sessions_demo","variable":"SESSIONS_DEMO_COOKIE"}}'/></info></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref> again, and check that it shows <b>sessions_demo=signed-in</b>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies"}'/><data name="doc-detective" value='step {"find":"sessions_demo=signed-in"}'/></info></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies/set/sessions_demo/signed-out" scope="external" format="html">the sign-out page</xref> once more, and load the <codeph>localhost</codeph> cookie from <codeph>tmp/sessions_demo.txt</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_demo/signed-out"}'/><data name="doc-detective" value='step {"loadCookie":{"name":"sessions_demo","path":"sessions_demo.txt","directory":"tmp","domain":"localhost"}}'/></info></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref> a last time, and check that it shows <b>sessions_demo=signed-in</b>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies"}'/><data name="doc-detective" value='step {"find":"sessions_demo=signed-in"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-cookies",
      "steps": [
        {
          "goTo": "http://localhost:8092/cookies/set/sessions_demo/signed-in"
        },
        {
          "saveCookie": "sessions_demo"
        },
        {
          "saveCookie": {
            "name": "sessions_demo",
            "variable": "SESSIONS_DEMO_COOKIE"
          }
        },
        {
          "saveCookie": {
            "name": "sessions_demo",
            "path": "sessions_demo.txt",
            "overwrite": true
          }
        },
        {
          "saveCookie": {
            "name": "sessions_demo",
            "path": "sessions_demo.txt",
            "directory": "tmp",
            "domain": "localhost",
            "overwrite": true
          }
        },
        {
          "goTo": "http://localhost:8092/cookies/set/sessions_demo/signed-out"
        },
        {
          "loadCookie": "sessions_demo.txt"
        },
        {
          "goTo": "http://localhost:8092/cookies"
        },
        {
          "find": "sessions_demo=signed-in"
        },
        {
          "goTo": "http://localhost:8092/cookies/set/sessions_demo/signed-out"
        },
        {
          "loadCookie": {
            "name": "sessions_demo",
            "variable": "SESSIONS_DEMO_COOKIE"
          }
        },
        {
          "goTo": "http://localhost:8092/cookies"
        },
        {
          "find": "sessions_demo=signed-in"
        },
        {
          "goTo": "http://localhost:8092/cookies/set/sessions_demo/signed-out"
        },
        {
          "loadCookie": {
            "name": "sessions_demo",
            "path": "sessions_demo.txt",
            "directory": "tmp",
            "domain": "localhost"
          }
        },
        {
          "goTo": "http://localhost:8092/cookies"
        },
        {
          "find": "sessions_demo=signed-in"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-cookies
    steps:
      - goTo: http://localhost:8092/cookies/set/sessions_demo/signed-in
      - saveCookie: sessions_demo
      - saveCookie:
          name: sessions_demo
          variable: SESSIONS_DEMO_COOKIE
      - saveCookie:
          name: sessions_demo
          path: sessions_demo.txt
          overwrite: true
      - saveCookie:
          name: sessions_demo
          path: sessions_demo.txt
          directory: tmp
          domain: localhost
          overwrite: true
      - goTo: http://localhost:8092/cookies/set/sessions_demo/signed-out
      - loadCookie: sessions_demo.txt
      - goTo: http://localhost:8092/cookies
      - find: sessions_demo=signed-in
      - goTo: http://localhost:8092/cookies/set/sessions_demo/signed-out
      - loadCookie:
          name: sessions_demo
          variable: SESSIONS_DEMO_COOKIE
      - goTo: http://localhost:8092/cookies
      - find: sessions_demo=signed-in
      - goTo: http://localhost:8092/cookies/set/sessions_demo/signed-out
      - loadCookie:
          name: sessions_demo
          path: sessions_demo.txt
          directory: tmp
          domain: localhost
      - goTo: http://localhost:8092/cookies
      - find: sessions_demo=signed-in
```

### Forms in this example

| Step                                                                   | What it does                                                                                                                       |
| ---------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `"saveCookie": "sessions_demo"`                                        | Saves the cookie to the `sessions_demo` environment variable.                                                                      |
| `"saveCookie": { "name", "variable" }`                                 | Saves the cookie to the environment variable that `variable` names.                                                                |
| `"saveCookie": { "name", "path", "overwrite" }`                        | Saves the cookie to a file in `outputDir`, replacing an earlier file.                                                              |
| `"saveCookie": { "name", "path", "directory", "domain", "overwrite" }` | Saves only the cookie for `domain` to a file in `directory`. A relative `directory` resolves against the file that holds the test. |
| `"loadCookie": "sessions_demo.txt"`                                    | Loads the cookie named for the file from `outputDir`.                                                                              |
| `"loadCookie": { "name", "variable" }`                                 | Loads the cookie from an environment variable.                                                                                     |
| `"loadCookie": { "name", "path", "directory", "domain" }`              | Loads the cookie for `domain` from a file in `directory`.                                                                          |

`"loadCookie": "sessions_demo"`, a bare cookie name, loads from the environment variable of that name.

### Config for the detected run

The detected variants run with this example's own config, which sets contexts for every test that has no `runOn` of its own. Here, `browsers` is an array of browser names, so the test runs in Firefox and then in Chrome:

**`doc-detective.json`**

```json title="doc-detective.json"
{
  "detectSteps": true,
  "runOn": [
    {
      "platforms": ["linux", "mac", "windows"],
      "browsers": ["firefox", "chrome"]
    }
  ],
  "browserFallback": "explicit",
  "retries": 1
}
```

`browserFallback` set to `explicit` falls back to another browser only for a context whose browser Doc Detective picked itself. `retries` re-runs a context once on a fresh session when its session breaks mid-run. A context's own `browserFallback` and `retries` override these. See [`config`](/reference/schemas/config).

### What detection finds

Each link becomes a `checkLink` step, and each link after "Go to" also becomes a `goTo` step. The bold `sessions_demo=signed-in` becomes a `find` step. The first link comes after `Sign in at`, which isn't a navigation verb, so detection only checks it, and a `goTo` statement opens it. No default rule produces `saveCookie` or `loadCookie`, so those are statements in every detected variant.

## Reuse a signed-in browser state in two browsers

This procedure uses [`saveState`](/docs/actions/savestate) and [`loadState`](/docs/actions/loadstate) in their object and string forms, and runs in two [contexts](/reference/schemas/context): headless Firefox with a set `window` and `viewport`, and headless Chrome.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Reuse a signed-in browser state

Run these steps in Firefox and in Chrome.

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_state/signed-in). The server sets the `sessions_state` cookie.
2. Save the browser state to `sessions-state.json` in the output folder, and to `sessions-state.json` in a `tmp` folder next to this file.
3. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_state/signed-out), which replaces the cookie.
4. Load the browser state from `sessions-state.json` in the output folder.
5. Go to [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_state=signed-in**.
6. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_state/signed-out) again, and load the browser state from `tmp/sessions-state.json`.
7. Go to [the cookie report](http://localhost:8092/cookies) again, and check that it shows **sessions_state=signed-in**.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Reuse a signed-in browser state

Run these steps in Firefox and in Chrome.

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_state/signed-in). The server sets the `sessions_state` cookie.
2. Save the browser state to `sessions-state.json` in the output folder, and to `sessions-state.json` in a `tmp` folder next to this file.
3. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_state/signed-out), which replaces the cookie.
4. Load the browser state from `sessions-state.json` in the output folder.
5. Go to [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_state=signed-in**.
6. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_state/signed-out) again, and load the browser state from `tmp/sessions-state.json`.
7. Go to [the cookie report](http://localhost:8092/cookies) again, and check that it shows **sessions_state=signed-in**.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Reuse a signed-in browser state

Run these steps in Firefox and in Chrome.

. Sign in at http://localhost:8092/cookies/set/sessions_state/signed-in[the sign-in page]. The server sets the `sessions_state` cookie.
. Save the browser state to `sessions-state.json` in the output folder, and to `sessions-state.json` in a `tmp` folder next to this file.
. Go to http://localhost:8092/cookies/set/sessions_state/signed-out[the sign-out page], which replaces the cookie.
. Load the browser state from `sessions-state.json` in the output folder.
. Go to http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_state=signed-in*.
. Go to http://localhost:8092/cookies/set/sessions_state/signed-out[the sign-out page] again, and load the browser state from `tmp/sessions-state.json`.
. Go to http://localhost:8092/cookies[the cookie report] again, and check that it shows *sessions_state=signed-in*.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Reuse a signed-in browser state</title></head>
<body>
<h1>Reuse a signed-in browser state</h1>
<p>Run these steps in Firefox and in Chrome.</p>
<ol>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_state/signed-in">the sign-in page</a>. The server sets the <code>sessions_state</code> cookie.</li>
  <li>Save the browser state to <code>sessions-state.json</code> in the output folder, and to <code>sessions-state.json</code> in a <code>tmp</code> folder next to this file.</li>
  <li>Go to <a href="http://localhost:8092/cookies/set/sessions_state/signed-out">the sign-out page</a>, which replaces the cookie.</li>
  <li>Load the browser state from <code>sessions-state.json</code> in the output folder.</li>
  <li>Go to <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_state=signed-in</strong>.</li>
  <li>Go to <a href="http://localhost:8092/cookies/set/sessions_state/signed-out">the sign-out page</a> again, and load the browser state from <code>tmp/sessions-state.json</code>.</li>
  <li>Go to <a href="http://localhost:8092/cookies">the cookie report</a> again, and check that it shows <strong>sessions_state=signed-in</strong>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Reuse a signed-in browser state
===============================

Run these steps in Firefox and in Chrome.

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_state/signed-in>`__. The server sets the ``sessions_state`` cookie.

#. Save the browser state to ``sessions-state.json`` in the output folder, and to ``sessions-state.json`` in a ``tmp`` folder next to this file.

#. Go to `the sign-out page <http://localhost:8092/cookies/set/sessions_state/signed-out>`__, which replaces the cookie.

#. Load the browser state from ``sessions-state.json`` in the output folder.

#. Go to `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_state=signed-in**.

#. Go to `the sign-out page <http://localhost:8092/cookies/set/sessions_state/signed-out>`__ again, and load the browser state from ``tmp/sessions-state.json``.

#. Go to `the cookie report <http://localhost:8092/cookies>`__ again, and check that it shows **sessions_state=signed-in**.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-state">
  <title>Reuse a signed-in browser state</title>
  <taskbody>
    <context><p>Run these steps in Firefox and in Chrome.</p></context>
    <steps>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_state/signed-in" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_state</codeph> cookie.</cmd></step>
      <step><cmd>Save the browser state to <codeph>sessions-state.json</codeph> in the output folder, and to <codeph>sessions-state.json</codeph> in a <codeph>tmp</codeph> folder next to this file.</cmd></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies/set/sessions_state/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd></step>
      <step><cmd>Load the browser state from <codeph>sessions-state.json</codeph> in the output folder.</cmd></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_state=signed-in</b>.</cmd></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies/set/sessions_state/signed-out" scope="external" format="html">the sign-out page</xref> again, and load the browser state from <codeph>tmp/sessions-state.json</codeph>.</cmd></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref> again, and check that it shows <b>sessions_state=signed-in</b>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-state","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":[{"name":"firefox","headless":true,"window":{"width":1280,"height":900},"viewport":{"width":1200,"height":800}}],"browserFallback":"off","retries":2},{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true}}]} -->

# Reuse a signed-in browser state

Run these steps in Firefox and in Chrome.

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_state/signed-in). The server sets the `sessions_state` cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_state/signed-in"} -->
2. Save the browser state to `sessions-state.json` in the output folder, and to `sessions-state.json` in a `tmp` folder next to this file.
   <!-- step {"saveState":{"path":"sessions-state.json","overwrite":true}} -->
   <!-- step {"saveState":{"path":"sessions-state.json","directory":"tmp","overwrite":true}} -->
3. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_state/signed-out), which replaces the cookie.
4. Load the browser state from `sessions-state.json` in the output folder.
   <!-- step {"loadState":"sessions-state.json"} -->
5. Go to [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_state=signed-in**.
6. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_state/signed-out) again, and load the browser state from `tmp/sessions-state.json`.
   <!-- step {"loadState":{"path":"sessions-state.json","directory":"tmp"}} -->
7. Go to [the cookie report](http://localhost:8092/cookies) again, and check that it shows **sessions_state=signed-in**.

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-state","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":[{"name":"firefox","headless":true,"window":{"width":1280,"height":900},"viewport":{"width":1200,"height":800}}],"browserFallback":"off","retries":2},{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true}}]} */}

# Reuse a signed-in browser state

Run these steps in Firefox and in Chrome.

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_state/signed-in). The server sets the `sessions_state` cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_state/signed-in"} */}
2. Save the browser state to `sessions-state.json` in the output folder, and to `sessions-state.json` in a `tmp` folder next to this file.
   {/* step {"saveState":{"path":"sessions-state.json","overwrite":true}} */}
   {/* step {"saveState":{"path":"sessions-state.json","directory":"tmp","overwrite":true}} */}
3. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_state/signed-out), which replaces the cookie.
4. Load the browser state from `sessions-state.json` in the output folder.
   {/* step {"loadState":"sessions-state.json"} */}
5. Go to [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_state=signed-in**.
6. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_state/signed-out) again, and load the browser state from `tmp/sessions-state.json`.
   {/* step {"loadState":{"path":"sessions-state.json","directory":"tmp"}} */}
7. Go to [the cookie report](http://localhost:8092/cookies) again, and check that it shows **sessions_state=signed-in**.

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Reuse a signed-in browser state

// (test {"testId":"sessions-state","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":[{"name":"firefox","headless":true,"window":{"width":1280,"height":900},"viewport":{"width":1200,"height":800}}],"browserFallback":"off","retries":2},{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true}}]})

Run these steps in Firefox and in Chrome.

. Sign in at http://localhost:8092/cookies/set/sessions_state/signed-in[the sign-in page]. The server sets the `sessions_state` cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_state/signed-in"})
. Save the browser state to `sessions-state.json` in the output folder, and to `sessions-state.json` in a `tmp` folder next to this file.
+
// (step {"saveState":{"path":"sessions-state.json","overwrite":true}})
+
// (step {"saveState":{"path":"sessions-state.json","directory":"tmp","overwrite":true}})
. Go to http://localhost:8092/cookies/set/sessions_state/signed-out[the sign-out page], which replaces the cookie.
. Load the browser state from `sessions-state.json` in the output folder.
+
// (step {"loadState":"sessions-state.json"})
. Go to http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_state=signed-in*.
. Go to http://localhost:8092/cookies/set/sessions_state/signed-out[the sign-out page] again, and load the browser state from `tmp/sessions-state.json`.
+
// (step {"loadState":{"path":"sessions-state.json","directory":"tmp"}})
. Go to http://localhost:8092/cookies[the cookie report] again, and check that it shows *sessions_state=signed-in*.

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Reuse a signed-in browser state</title></head>
<body>
<!-- test {"testId":"sessions-state","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":[{"name":"firefox","headless":true,"window":{"width":1280,"height":900},"viewport":{"width":1200,"height":800}}],"browserFallback":"off","retries":2},{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true}}]} -->
<h1>Reuse a signed-in browser state</h1>
<p>Run these steps in Firefox and in Chrome.</p>
<ol>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_state/signed-in">the sign-in page</a>. The server sets the <code>sessions_state</code> cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_state/signed-in"} --></li>
  <li>Save the browser state to <code>sessions-state.json</code> in the output folder, and to <code>sessions-state.json</code> in a <code>tmp</code> folder next to this file.
    <!-- step {"saveState":{"path":"sessions-state.json","overwrite":true}} -->
    <!-- step {"saveState":{"path":"sessions-state.json","directory":"tmp","overwrite":true}} --></li>
  <li>Go to <a href="http://localhost:8092/cookies/set/sessions_state/signed-out">the sign-out page</a>, which replaces the cookie.</li>
  <li>Load the browser state from <code>sessions-state.json</code> in the output folder.
    <!-- step {"loadState":"sessions-state.json"} --></li>
  <li>Go to <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_state=signed-in</strong>.</li>
  <li>Go to <a href="http://localhost:8092/cookies/set/sessions_state/signed-out">the sign-out page</a> again, and load the browser state from <code>tmp/sessions-state.json</code>.
    <!-- step {"loadState":{"path":"sessions-state.json","directory":"tmp"}} --></li>
  <li>Go to <a href="http://localhost:8092/cookies">the cookie report</a> again, and check that it shows <strong>sessions_state=signed-in</strong>.</li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Reuse a signed-in browser state
===============================

.. test {"testId":"sessions-state","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":[{"name":"firefox","headless":true,"window":{"width":1280,"height":900},"viewport":{"width":1200,"height":800}}],"browserFallback":"off","retries":2},{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true}}]}

Run these steps in Firefox and in Chrome.

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_state/signed-in>`__. The server sets the ``sessions_state`` cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_state/signed-in"}

#. Save the browser state to ``sessions-state.json`` in the output folder, and to ``sessions-state.json`` in a ``tmp`` folder next to this file.

   .. step {"saveState":{"path":"sessions-state.json","overwrite":true}}

   .. step {"saveState":{"path":"sessions-state.json","directory":"tmp","overwrite":true}}

#. Go to `the sign-out page <http://localhost:8092/cookies/set/sessions_state/signed-out>`__, which replaces the cookie.

#. Load the browser state from ``sessions-state.json`` in the output folder.

   .. step {"loadState":"sessions-state.json"}

#. Go to `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_state=signed-in**.

#. Go to `the sign-out page <http://localhost:8092/cookies/set/sessions_state/signed-out>`__ again, and load the browser state from ``tmp/sessions-state.json``.

   .. step {"loadState":{"path":"sessions-state.json","directory":"tmp"}}

#. Go to `the cookie report <http://localhost:8092/cookies>`__ again, and check that it shows **sessions_state=signed-in**.

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-state">
  <title>Reuse a signed-in browser state</title>
  <taskbody>
    <context><p>Run these steps in Firefox and in Chrome.</p></context>
    <data name="doc-detective" value='test {"testId":"sessions-state","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":[{"name":"firefox","headless":true,"window":{"width":1280,"height":900},"viewport":{"width":1200,"height":800}}],"browserFallback":"off","retries":2},{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true}}]}'/>
    <steps>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_state/signed-in" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_state</codeph> cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_state/signed-in"}'/></info></step>
      <step><cmd>Save the browser state to <codeph>sessions-state.json</codeph> in the output folder, and to <codeph>sessions-state.json</codeph> in a <codeph>tmp</codeph> folder next to this file.</cmd>
        <info><data name="doc-detective" value='step {"saveState":{"path":"sessions-state.json","overwrite":true}}'/><data name="doc-detective" value='step {"saveState":{"path":"sessions-state.json","directory":"tmp","overwrite":true}}'/></info></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies/set/sessions_state/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd></step>
      <step><cmd>Load the browser state from <codeph>sessions-state.json</codeph> in the output folder.</cmd>
        <info><data name="doc-detective" value='step {"loadState":"sessions-state.json"}'/></info></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_state=signed-in</b>.</cmd></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies/set/sessions_state/signed-out" scope="external" format="html">the sign-out page</xref> again, and load the browser state from <codeph>tmp/sessions-state.json</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"loadState":{"path":"sessions-state.json","directory":"tmp"}}'/></info></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref> again, and check that it shows <b>sessions_state=signed-in</b>.</cmd></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-state","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":[{"name":"firefox","headless":true,"window":{"width":1280,"height":900},"viewport":{"width":1200,"height":800}}],"browserFallback":"off","retries":2},{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true}}]} -->

# Reuse a signed-in browser state

Run these steps in Firefox and in Chrome.

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_state/signed-in). The server sets the `sessions_state` cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_state/signed-in"} -->
2. Save the browser state to `sessions-state.json` in the output folder, and to `sessions-state.json` in a `tmp` folder next to this file.
   <!-- step {"saveState":{"path":"sessions-state.json","overwrite":true}} -->
   <!-- step {"saveState":{"path":"sessions-state.json","directory":"tmp","overwrite":true}} -->
3. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_state/signed-out), which replaces the cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_state/signed-out"} -->
4. Load the browser state from `sessions-state.json` in the output folder.
   <!-- step {"loadState":"sessions-state.json"} -->
5. Go to [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_state=signed-in**.
   <!-- step {"goTo":"http://localhost:8092/cookies"} -->
   <!-- step {"find":"sessions_state=signed-in"} -->
6. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_state/signed-out) again, and load the browser state from `tmp/sessions-state.json`.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_state/signed-out"} -->
   <!-- step {"loadState":{"path":"sessions-state.json","directory":"tmp"}} -->
7. Go to [the cookie report](http://localhost:8092/cookies) again, and check that it shows **sessions_state=signed-in**.
   <!-- step {"goTo":"http://localhost:8092/cookies"} -->
   <!-- step {"find":"sessions_state=signed-in"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-state","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":[{"name":"firefox","headless":true,"window":{"width":1280,"height":900},"viewport":{"width":1200,"height":800}}],"browserFallback":"off","retries":2},{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true}}]} */}

# Reuse a signed-in browser state

Run these steps in Firefox and in Chrome.

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_state/signed-in). The server sets the `sessions_state` cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_state/signed-in"} */}
2. Save the browser state to `sessions-state.json` in the output folder, and to `sessions-state.json` in a `tmp` folder next to this file.
   {/* step {"saveState":{"path":"sessions-state.json","overwrite":true}} */}
   {/* step {"saveState":{"path":"sessions-state.json","directory":"tmp","overwrite":true}} */}
3. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_state/signed-out), which replaces the cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_state/signed-out"} */}
4. Load the browser state from `sessions-state.json` in the output folder.
   {/* step {"loadState":"sessions-state.json"} */}
5. Go to [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_state=signed-in**.
   {/* step {"goTo":"http://localhost:8092/cookies"} */}
   {/* step {"find":"sessions_state=signed-in"} */}
6. Go to [the sign-out page](http://localhost:8092/cookies/set/sessions_state/signed-out) again, and load the browser state from `tmp/sessions-state.json`.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_state/signed-out"} */}
   {/* step {"loadState":{"path":"sessions-state.json","directory":"tmp"}} */}
7. Go to [the cookie report](http://localhost:8092/cookies) again, and check that it shows **sessions_state=signed-in**.
   {/* step {"goTo":"http://localhost:8092/cookies"} */}
   {/* step {"find":"sessions_state=signed-in"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Reuse a signed-in browser state

// (test {"testId":"sessions-state","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":[{"name":"firefox","headless":true,"window":{"width":1280,"height":900},"viewport":{"width":1200,"height":800}}],"browserFallback":"off","retries":2},{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true}}]})

Run these steps in Firefox and in Chrome.

. Sign in at http://localhost:8092/cookies/set/sessions_state/signed-in[the sign-in page]. The server sets the `sessions_state` cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_state/signed-in"})
. Save the browser state to `sessions-state.json` in the output folder, and to `sessions-state.json` in a `tmp` folder next to this file.
+
// (step {"saveState":{"path":"sessions-state.json","overwrite":true}})
+
// (step {"saveState":{"path":"sessions-state.json","directory":"tmp","overwrite":true}})
. Go to http://localhost:8092/cookies/set/sessions_state/signed-out[the sign-out page], which replaces the cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_state/signed-out"})
. Load the browser state from `sessions-state.json` in the output folder.
+
// (step {"loadState":"sessions-state.json"})
. Go to http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_state=signed-in*.
+
// (step {"goTo":"http://localhost:8092/cookies"})
+
// (step {"find":"sessions_state=signed-in"})
. Go to http://localhost:8092/cookies/set/sessions_state/signed-out[the sign-out page] again, and load the browser state from `tmp/sessions-state.json`.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_state/signed-out"})
+
// (step {"loadState":{"path":"sessions-state.json","directory":"tmp"}})
. Go to http://localhost:8092/cookies[the cookie report] again, and check that it shows *sessions_state=signed-in*.
+
// (step {"goTo":"http://localhost:8092/cookies"})
+
// (step {"find":"sessions_state=signed-in"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Reuse a signed-in browser state</title></head>
<body>
<!-- test {"testId":"sessions-state","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":[{"name":"firefox","headless":true,"window":{"width":1280,"height":900},"viewport":{"width":1200,"height":800}}],"browserFallback":"off","retries":2},{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true}}]} -->
<h1>Reuse a signed-in browser state</h1>
<p>Run these steps in Firefox and in Chrome.</p>
<ol>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_state/signed-in">the sign-in page</a>. The server sets the <code>sessions_state</code> cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_state/signed-in"} --></li>
  <li>Save the browser state to <code>sessions-state.json</code> in the output folder, and to <code>sessions-state.json</code> in a <code>tmp</code> folder next to this file.
    <!-- step {"saveState":{"path":"sessions-state.json","overwrite":true}} -->
    <!-- step {"saveState":{"path":"sessions-state.json","directory":"tmp","overwrite":true}} --></li>
  <li>Go to <a href="http://localhost:8092/cookies/set/sessions_state/signed-out">the sign-out page</a>, which replaces the cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_state/signed-out"} --></li>
  <li>Load the browser state from <code>sessions-state.json</code> in the output folder.
    <!-- step {"loadState":"sessions-state.json"} --></li>
  <li>Go to <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_state=signed-in</strong>.
    <!-- step {"goTo":"http://localhost:8092/cookies"} -->
    <!-- step {"find":"sessions_state=signed-in"} --></li>
  <li>Go to <a href="http://localhost:8092/cookies/set/sessions_state/signed-out">the sign-out page</a> again, and load the browser state from <code>tmp/sessions-state.json</code>.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_state/signed-out"} -->
    <!-- step {"loadState":{"path":"sessions-state.json","directory":"tmp"}} --></li>
  <li>Go to <a href="http://localhost:8092/cookies">the cookie report</a> again, and check that it shows <strong>sessions_state=signed-in</strong>.
    <!-- step {"goTo":"http://localhost:8092/cookies"} -->
    <!-- step {"find":"sessions_state=signed-in"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Reuse a signed-in browser state
===============================

.. test {"testId":"sessions-state","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":[{"name":"firefox","headless":true,"window":{"width":1280,"height":900},"viewport":{"width":1200,"height":800}}],"browserFallback":"off","retries":2},{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true}}]}

Run these steps in Firefox and in Chrome.

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_state/signed-in>`__. The server sets the ``sessions_state`` cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_state/signed-in"}

#. Save the browser state to ``sessions-state.json`` in the output folder, and to ``sessions-state.json`` in a ``tmp`` folder next to this file.

   .. step {"saveState":{"path":"sessions-state.json","overwrite":true}}

   .. step {"saveState":{"path":"sessions-state.json","directory":"tmp","overwrite":true}}

#. Go to `the sign-out page <http://localhost:8092/cookies/set/sessions_state/signed-out>`__, which replaces the cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_state/signed-out"}

#. Load the browser state from ``sessions-state.json`` in the output folder.

   .. step {"loadState":"sessions-state.json"}

#. Go to `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_state=signed-in**.

   .. step {"goTo":"http://localhost:8092/cookies"}

   .. step {"find":"sessions_state=signed-in"}

#. Go to `the sign-out page <http://localhost:8092/cookies/set/sessions_state/signed-out>`__ again, and load the browser state from ``tmp/sessions-state.json``.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_state/signed-out"}

   .. step {"loadState":{"path":"sessions-state.json","directory":"tmp"}}

#. Go to `the cookie report <http://localhost:8092/cookies>`__ again, and check that it shows **sessions_state=signed-in**.

   .. step {"goTo":"http://localhost:8092/cookies"}

   .. step {"find":"sessions_state=signed-in"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-state">
  <title>Reuse a signed-in browser state</title>
  <taskbody>
    <context><p>Run these steps in Firefox and in Chrome.</p></context>
    <data name="doc-detective" value='test {"testId":"sessions-state","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":[{"name":"firefox","headless":true,"window":{"width":1280,"height":900},"viewport":{"width":1200,"height":800}}],"browserFallback":"off","retries":2},{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true}}]}'/>
    <steps>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_state/signed-in" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_state</codeph> cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_state/signed-in"}'/></info></step>
      <step><cmd>Save the browser state to <codeph>sessions-state.json</codeph> in the output folder, and to <codeph>sessions-state.json</codeph> in a <codeph>tmp</codeph> folder next to this file.</cmd>
        <info><data name="doc-detective" value='step {"saveState":{"path":"sessions-state.json","overwrite":true}}'/><data name="doc-detective" value='step {"saveState":{"path":"sessions-state.json","directory":"tmp","overwrite":true}}'/></info></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies/set/sessions_state/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_state/signed-out"}'/></info></step>
      <step><cmd>Load the browser state from <codeph>sessions-state.json</codeph> in the output folder.</cmd>
        <info><data name="doc-detective" value='step {"loadState":"sessions-state.json"}'/></info></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_state=signed-in</b>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies"}'/><data name="doc-detective" value='step {"find":"sessions_state=signed-in"}'/></info></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies/set/sessions_state/signed-out" scope="external" format="html">the sign-out page</xref> again, and load the browser state from <codeph>tmp/sessions-state.json</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_state/signed-out"}'/><data name="doc-detective" value='step {"loadState":{"path":"sessions-state.json","directory":"tmp"}}'/></info></step>
      <step><cmd>Go to <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref> again, and check that it shows <b>sessions_state=signed-in</b>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies"}'/><data name="doc-detective" value='step {"find":"sessions_state=signed-in"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "runOn": [
    {
      "platforms": [
        "linux",
        "mac",
        "windows"
      ],
      "browsers": [
        {
          "name": "firefox",
          "headless": true,
          "window": {
            "width": 1280,
            "height": 900
          },
          "viewport": {
            "width": 1200,
            "height": 800
          }
        }
      ],
      "browserFallback": "off",
      "retries": 2
    },
    {
      "platforms": [
        "linux",
        "mac",
        "windows"
      ],
      "browsers": {
        "name": "chrome",
        "headless": true
      }
    }
  ],
  "tests": [
    {
      "testId": "sessions-state",
      "steps": [
        {
          "goTo": "http://localhost:8092/cookies/set/sessions_state/signed-in"
        },
        {
          "saveState": {
            "path": "sessions-state.json",
            "overwrite": true
          }
        },
        {
          "saveState": {
            "path": "sessions-state.json",
            "directory": "tmp",
            "overwrite": true
          }
        },
        {
          "goTo": "http://localhost:8092/cookies/set/sessions_state/signed-out"
        },
        {
          "loadState": "sessions-state.json"
        },
        {
          "goTo": "http://localhost:8092/cookies"
        },
        {
          "find": "sessions_state=signed-in"
        },
        {
          "goTo": "http://localhost:8092/cookies/set/sessions_state/signed-out"
        },
        {
          "loadState": {
            "path": "sessions-state.json",
            "directory": "tmp"
          }
        },
        {
          "goTo": "http://localhost:8092/cookies"
        },
        {
          "find": "sessions_state=signed-in"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
runOn:
  - platforms: &a1
      - linux
      - mac
      - windows
    browsers:
      - name: firefox
        headless: true
        window:
          width: 1280
          height: 900
        viewport:
          width: 1200
          height: 800
    browserFallback: off
    retries: 2
  - platforms: *a1
    browsers:
      name: chrome
      headless: true
tests:
  - testId: sessions-state
    steps:
      - goTo: http://localhost:8092/cookies/set/sessions_state/signed-in
      - saveState:
          path: sessions-state.json
          overwrite: true
      - saveState:
          path: sessions-state.json
          directory: tmp
          overwrite: true
      - goTo: http://localhost:8092/cookies/set/sessions_state/signed-out
      - loadState: sessions-state.json
      - goTo: http://localhost:8092/cookies
      - find: sessions_state=signed-in
      - goTo: http://localhost:8092/cookies/set/sessions_state/signed-out
      - loadState:
          path: sessions-state.json
          directory: tmp
      - goTo: http://localhost:8092/cookies
      - find: sessions_state=signed-in
```

### Where the contexts live

The test statement carries `runOn` in the detected and inline variants, so it applies to that test. The standalone specs set `runOn` on the [spec](/reference/schemas/specification), where it applies to every test in the file. A test's own `runOn` overrides the spec's. Both shapes resolve to the same two contexts here.

The Firefox context sets `browserFallback` to `off`, so a run without a working Firefox skips that context rather than running it in another browser. It also sets `retries` to `2`, so a session that breaks mid-run gets two fresh attempts.

The platforms that don't match the host report `SKIPPED`, never `FAIL`.

### Forms in this example

* `saveState` with `path` and `overwrite` writes to `outputDir`. Adding `directory` writes next to the file that holds the test instead.
* `loadState` takes a path in `outputDir` as a string, or an object with `path` and `directory`.
* The string form of `saveState`, such as `"saveState": "sessions-state.json"`, never overwrites a file, so a second run into the same `outputDir` fails. Use the object form with `overwrite` for a test that runs more than once.

### What detection finds

As in the cookie example, each link becomes a `checkLink` step, the "Go to" links also become `goTo` steps, and the bold text becomes a `find` step. `saveState` and `loadState` are statements.

## Compare pages in tabs, windows, and sessions

This procedure uses [`goTo`](/docs/actions/goto) with `newTab`, `newWindow`, and `surface`, [`startSurface`](/docs/actions/startsurface) with an array of [browser descriptors](/reference/schemas/browser-descriptor), [`find`](/docs/actions/find) and [`type`](/docs/actions/type) with a [browser surface](/reference/schemas/browser-surface), and [`closeSurface`](/docs/actions/closesurface) with an array of surfaces.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Compare pages in tabs, windows, and sessions

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Click the Open child in new tab link. The child page opens in a new tab.
3. In the newest tab, check that the page reads "PAGE linked".
4. In a new tab named `report`, load [the report page](http://localhost:8092/multi-tab-child.html?page=report). Then load [the scratch page](http://localhost:8092/multi-tab-child.html?page=scratch) in another new tab.
5. Check that the `report` tab reads "PAGE report", and that the tab showing the scratch page reads "PAGE scratch".
6. In a new window named `settings`, with its first tab named `general`, load [the settings page](http://localhost:8092/multi-tab-child.html?page=settings). Then load [the help page](http://localhost:8092/multi-tab-child.html?page=help) in another new window.
7. Check that the `settings` window and its `general` tab read "PAGE settings", and that the newest window, titled "Child help", reads "PAGE help".
8. In the first window, check that the tab titled "Multi-tab home" still reads "MULTI-TAB HOME".
9. Type `hello` in the echo box of the help window, which is also the newest window, and of the child tab, the second tab opened.
10. Load [the notes page](http://localhost:8092/multi-tab-child.html?page=notes) in a new tab named `notes`, and [the about page](http://localhost:8092/multi-tab-child.html?page=about) in a new window named `about`. Check that each one reads its page name.
11. Start two more Firefox sessions: `reviewer`, with an 800 by 600 viewport, and `editor`, with a 1024 by 768 window. Load [the review page](http://localhost:8092/multi-tab-child.html?page=review) in `reviewer`.
12. In the first session, go back to [the multi-tab page](http://localhost:8092/multi-tab.html), and check that it reads "MULTI-TAB HOME".
13. Close the `report` and `notes` tabs, the scratch tab, the child tab, the help, `settings`, and `about` windows, and the `reviewer` and `editor` sessions.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Compare pages in tabs, windows, and sessions

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Click the Open child in new tab link. The child page opens in a new tab.
3. In the newest tab, check that the page reads "PAGE linked".
4. In a new tab named `report`, load [the report page](http://localhost:8092/multi-tab-child.html?page=report). Then load [the scratch page](http://localhost:8092/multi-tab-child.html?page=scratch) in another new tab.
5. Check that the `report` tab reads "PAGE report", and that the tab showing the scratch page reads "PAGE scratch".
6. In a new window named `settings`, with its first tab named `general`, load [the settings page](http://localhost:8092/multi-tab-child.html?page=settings). Then load [the help page](http://localhost:8092/multi-tab-child.html?page=help) in another new window.
7. Check that the `settings` window and its `general` tab read "PAGE settings", and that the newest window, titled "Child help", reads "PAGE help".
8. In the first window, check that the tab titled "Multi-tab home" still reads "MULTI-TAB HOME".
9. Type `hello` in the echo box of the help window, which is also the newest window, and of the child tab, the second tab opened.
10. Load [the notes page](http://localhost:8092/multi-tab-child.html?page=notes) in a new tab named `notes`, and [the about page](http://localhost:8092/multi-tab-child.html?page=about) in a new window named `about`. Check that each one reads its page name.
11. Start two more Firefox sessions: `reviewer`, with an 800 by 600 viewport, and `editor`, with a 1024 by 768 window. Load [the review page](http://localhost:8092/multi-tab-child.html?page=review) in `reviewer`.
12. In the first session, go back to [the multi-tab page](http://localhost:8092/multi-tab.html), and check that it reads "MULTI-TAB HOME".
13. Close the `report` and `notes` tabs, the scratch tab, the child tab, the help, `settings`, and `about` windows, and the `reviewer` and `editor` sessions.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Compare pages in tabs, windows, and sessions

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Click the Open child in new tab link. The child page opens in a new tab.
. In the newest tab, check that the page reads "PAGE linked".
. In a new tab named `report`, load http://localhost:8092/multi-tab-child.html?page=report[the report page]. Then load http://localhost:8092/multi-tab-child.html?page=scratch[the scratch page] in another new tab.
. Check that the `report` tab reads "PAGE report", and that the tab showing the scratch page reads "PAGE scratch".
. In a new window named `settings`, with its first tab named `general`, load http://localhost:8092/multi-tab-child.html?page=settings[the settings page]. Then load http://localhost:8092/multi-tab-child.html?page=help[the help page] in another new window.
. Check that the `settings` window and its `general` tab read "PAGE settings", and that the newest window, titled "Child help", reads "PAGE help".
. In the first window, check that the tab titled "Multi-tab home" still reads "MULTI-TAB HOME".
. Type `hello` in the echo box of the help window, which is also the newest window, and of the child tab, the second tab opened.
. Load http://localhost:8092/multi-tab-child.html?page=notes[the notes page] in a new tab named `notes`, and http://localhost:8092/multi-tab-child.html?page=about[the about page] in a new window named `about`. Check that each one reads its page name.
. Start two more Firefox sessions: `reviewer`, with an 800 by 600 viewport, and `editor`, with a 1024 by 768 window. Load http://localhost:8092/multi-tab-child.html?page=review[the review page] in `reviewer`.
. In the first session, go back to http://localhost:8092/multi-tab.html[the multi-tab page], and check that it reads "MULTI-TAB HOME".
. Close the `report` and `notes` tabs, the scratch tab, the child tab, the help, `settings`, and `about` windows, and the `reviewer` and `editor` sessions.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Compare pages in tabs, windows, and sessions</title></head>
<body>
<h1>Compare pages in tabs, windows, and sessions</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Click the Open child in new tab link. The child page opens in a new tab.</li>
  <li>In the newest tab, check that the page reads "PAGE linked".</li>
  <li>In a new tab named <code>report</code>, load <a href="http://localhost:8092/multi-tab-child.html?page=report">the report page</a>. Then load <a href="http://localhost:8092/multi-tab-child.html?page=scratch">the scratch page</a> in another new tab.</li>
  <li>Check that the <code>report</code> tab reads "PAGE report", and that the tab showing the scratch page reads "PAGE scratch".</li>
  <li>In a new window named <code>settings</code>, with its first tab named <code>general</code>, load <a href="http://localhost:8092/multi-tab-child.html?page=settings">the settings page</a>. Then load <a href="http://localhost:8092/multi-tab-child.html?page=help">the help page</a> in another new window.</li>
  <li>Check that the <code>settings</code> window and its <code>general</code> tab read "PAGE settings", and that the newest window, titled "Child help", reads "PAGE help".</li>
  <li>In the first window, check that the tab titled "Multi-tab home" still reads "MULTI-TAB HOME".</li>
  <li>Type <code>hello</code> in the echo box of the help window, which is also the newest window, and of the child tab, the second tab opened.</li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=notes">the notes page</a> in a new tab named <code>notes</code>, and <a href="http://localhost:8092/multi-tab-child.html?page=about">the about page</a> in a new window named <code>about</code>. Check that each one reads its page name.</li>
  <li>Start two more Firefox sessions: <code>reviewer</code>, with an 800 by 600 viewport, and <code>editor</code>, with a 1024 by 768 window. Load <a href="http://localhost:8092/multi-tab-child.html?page=review">the review page</a> in <code>reviewer</code>.</li>
  <li>In the first session, go back to <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>, and check that it reads "MULTI-TAB HOME".</li>
  <li>Close the <code>report</code> and <code>notes</code> tabs, the scratch tab, the child tab, the help, <code>settings</code>, and <code>about</code> windows, and the <code>reviewer</code> and <code>editor</code> sessions.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Compare pages in tabs, windows, and sessions
============================================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Click the Open child in new tab link. The child page opens in a new tab.

#. In the newest tab, check that the page reads "PAGE linked".

#. In a new tab named ``report``, load `the report page <http://localhost:8092/multi-tab-child.html?page=report>`__. Then load `the scratch page <http://localhost:8092/multi-tab-child.html?page=scratch>`__ in another new tab.

#. Check that the ``report`` tab reads "PAGE report", and that the tab showing the scratch page reads "PAGE scratch".

#. In a new window named ``settings``, with its first tab named ``general``, load `the settings page <http://localhost:8092/multi-tab-child.html?page=settings>`__. Then load `the help page <http://localhost:8092/multi-tab-child.html?page=help>`__ in another new window.

#. Check that the ``settings`` window and its ``general`` tab read "PAGE settings", and that the newest window, titled "Child help", reads "PAGE help".

#. In the first window, check that the tab titled "Multi-tab home" still reads "MULTI-TAB HOME".

#. Type ``hello`` in the echo box of the help window, which is also the newest window, and of the child tab, the second tab opened.

#. Load `the notes page <http://localhost:8092/multi-tab-child.html?page=notes>`__ in a new tab named ``notes``, and `the about page <http://localhost:8092/multi-tab-child.html?page=about>`__ in a new window named ``about``. Check that each one reads its page name.

#. Start two more Firefox sessions: ``reviewer``, with an 800 by 600 viewport, and ``editor``, with a 1024 by 768 window. Load `the review page <http://localhost:8092/multi-tab-child.html?page=review>`__ in ``reviewer``.

#. In the first session, go back to `the multi-tab page <http://localhost:8092/multi-tab.html>`__, and check that it reads "MULTI-TAB HOME".

#. Close the ``report`` and ``notes`` tabs, the scratch tab, the child tab, the help, ``settings``, and ``about`` windows, and the ``reviewer`` and ``editor`` sessions.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-tabs">
  <title>Compare pages in tabs, windows, and sessions</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Click the Open child in new tab link. The child page opens in a new tab.</cmd></step>
      <step><cmd>In the newest tab, check that the page reads "PAGE linked".</cmd></step>
      <step><cmd>In a new tab named <codeph>report</codeph>, load <xref href="http://localhost:8092/multi-tab-child.html?page=report" scope="external" format="html">the report page</xref>. Then load <xref href="http://localhost:8092/multi-tab-child.html?page=scratch" scope="external" format="html">the scratch page</xref> in another new tab.</cmd></step>
      <step><cmd>Check that the <codeph>report</codeph> tab reads "PAGE report", and that the tab showing the scratch page reads "PAGE scratch".</cmd></step>
      <step><cmd>In a new window named <codeph>settings</codeph>, with its first tab named <codeph>general</codeph>, load <xref href="http://localhost:8092/multi-tab-child.html?page=settings" scope="external" format="html">the settings page</xref>. Then load <xref href="http://localhost:8092/multi-tab-child.html?page=help" scope="external" format="html">the help page</xref> in another new window.</cmd></step>
      <step><cmd>Check that the <codeph>settings</codeph> window and its <codeph>general</codeph> tab read "PAGE settings", and that the newest window, titled "Child help", reads "PAGE help".</cmd></step>
      <step><cmd>In the first window, check that the tab titled "Multi-tab home" still reads "MULTI-TAB HOME".</cmd></step>
      <step><cmd>Type <codeph>hello</codeph> in the echo box of the help window, which is also the newest window, and of the child tab, the second tab opened.</cmd></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=notes" scope="external" format="html">the notes page</xref> in a new tab named <codeph>notes</codeph>, and <xref href="http://localhost:8092/multi-tab-child.html?page=about" scope="external" format="html">the about page</xref> in a new window named <codeph>about</codeph>. Check that each one reads its page name.</cmd></step>
      <step><cmd>Start two more Firefox sessions: <codeph>reviewer</codeph>, with an 800 by 600 viewport, and <codeph>editor</codeph>, with a 1024 by 768 window. Load <xref href="http://localhost:8092/multi-tab-child.html?page=review" scope="external" format="html">the review page</xref> in <codeph>reviewer</codeph>.</cmd></step>
      <step><cmd>In the first session, go back to <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>, and check that it reads "MULTI-TAB HOME".</cmd></step>
      <step><cmd>Close the <codeph>report</codeph> and <codeph>notes</codeph> tabs, the scratch tab, the child tab, the help, <codeph>settings</codeph>, and <codeph>about</codeph> windows, and the <codeph>reviewer</codeph> and <codeph>editor</codeph> sessions.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-tabs","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Compare pages in tabs, windows, and sessions

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Click the Open child in new tab link. The child page opens in a new tab.
   <!-- step {"click":"Open child in new tab"} -->
3. In the newest tab, check that the page reads "PAGE linked".
   <!-- step {"find":{"elementText":"PAGE linked","surface":{"browser":"firefox","tab":{"index":-1}}}} -->
4. In a new tab named `report`, load [the report page](http://localhost:8092/multi-tab-child.html?page=report). Then load [the scratch page](http://localhost:8092/multi-tab-child.html?page=scratch) in another new tab.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=report","newTab":{"name":"report"}}} -->
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch","newTab":true}} -->
5. Check that the `report` tab reads "PAGE report", and that the tab showing the scratch page reads "PAGE scratch".
   <!-- step {"find":{"elementText":"PAGE report","surface":{"browser":"firefox","tab":"report"}}} -->
   <!-- step {"find":{"elementText":"PAGE scratch","surface":{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch"}}}} -->
6. In a new window named `settings`, with its first tab named `general`, load [the settings page](http://localhost:8092/multi-tab-child.html?page=settings). Then load [the help page](http://localhost:8092/multi-tab-child.html?page=help) in another new window.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=settings","newWindow":{"name":"settings","tab":"general"}}} -->
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=help","newWindow":true}} -->
7. Check that the `settings` window and its `general` tab read "PAGE settings", and that the newest window, titled "Child help", reads "PAGE help".
   <!-- step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":"settings"}}} -->
   <!-- step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":{"name":"settings"},"tab":{"name":"general"}}}} -->
   <!-- step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":-1}}} -->
   <!-- step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":{"title":"Child help"}}}} -->
   <!-- step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":{"url":"http://localhost:8092/multi-tab-child.html?page=help"}}}} -->
8. In the first window, check that the tab titled "Multi-tab home" still reads "MULTI-TAB HOME".
   <!-- step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","window":{"index":0},"tab":{"title":"Multi-tab home"}}}} -->
9. Type `hello` in the echo box of the help window, which is also the newest window, and of the child tab, the second tab opened.
   <!-- step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","window":{"url":"http://localhost:8092/multi-tab-child.html?page=help"}}}} -->
   <!-- step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","window":-1}}} -->
   <!-- step {"type":{"keys":" again","selector":"#echo-input","surface":{"browser":"firefox","window":{"index":-1}}}} -->
   <!-- step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","tab":1}}} -->
10. Load [the notes page](http://localhost:8092/multi-tab-child.html?page=notes) in a new tab named `notes`, and [the about page](http://localhost:8092/multi-tab-child.html?page=about) in a new window named `about`. Check that each one reads its page name.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=notes","newTab":"notes"}} -->
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=about","newWindow":"about"}} -->
   <!-- step {"find":{"elementText":"PAGE notes","surface":{"browser":"firefox","tab":"notes"}}} -->
   <!-- step {"find":{"elementText":"PAGE about","surface":{"browser":"firefox","window":"about"}}} -->
11. Start two more Firefox sessions: `reviewer`, with an 800 by 600 viewport, and `editor`, with a 1024 by 768 window. Load [the review page](http://localhost:8092/multi-tab-child.html?page=review) in `reviewer`.
   <!-- step {"startSurface":[{"browser":"firefox","name":"reviewer","headless":true,"viewport":{"width":800,"height":600}},{"browser":"firefox","name":"editor","headless":true,"size":{"width":1024,"height":768}}]} -->
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=review","surface":{"browser":"firefox","name":"reviewer"}}} -->
12. In the first session, go back to [the multi-tab page](http://localhost:8092/multi-tab.html), and check that it reads "MULTI-TAB HOME".
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab.html","surface":"firefox"}} -->
   <!-- step {"find":{"elementText":"MULTI-TAB HOME","surface":"firefox"}} -->
13. Close the `report` and `notes` tabs, the scratch tab, the child tab, the help, `settings`, and `about` windows, and the `reviewer` and `editor` sessions.
   <!-- step {"closeSurface":[{"browser":"firefox","tab":{"name":"report"}},{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch"}},{"browser":"firefox","tab":{"index":1}},{"browser":"firefox","window":{"title":"Child help"}},{"browser":"firefox","window":{"name":"settings"}},{"browser":"firefox","tab":"notes"},{"browser":"firefox","window":"about"},{"browser":"firefox","name":"reviewer"},"editor"]} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-tabs","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Compare pages in tabs, windows, and sessions

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Click the Open child in new tab link. The child page opens in a new tab.
   {/* step {"click":"Open child in new tab"} */}
3. In the newest tab, check that the page reads "PAGE linked".
   {/* step {"find":{"elementText":"PAGE linked","surface":{"browser":"firefox","tab":{"index":-1}}}} */}
4. In a new tab named `report`, load [the report page](http://localhost:8092/multi-tab-child.html?page=report). Then load [the scratch page](http://localhost:8092/multi-tab-child.html?page=scratch) in another new tab.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=report","newTab":{"name":"report"}}} */}
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch","newTab":true}} */}
5. Check that the `report` tab reads "PAGE report", and that the tab showing the scratch page reads "PAGE scratch".
   {/* step {"find":{"elementText":"PAGE report","surface":{"browser":"firefox","tab":"report"}}} */}
   {/* step {"find":{"elementText":"PAGE scratch","surface":{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch"}}}} */}
6. In a new window named `settings`, with its first tab named `general`, load [the settings page](http://localhost:8092/multi-tab-child.html?page=settings). Then load [the help page](http://localhost:8092/multi-tab-child.html?page=help) in another new window.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=settings","newWindow":{"name":"settings","tab":"general"}}} */}
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=help","newWindow":true}} */}
7. Check that the `settings` window and its `general` tab read "PAGE settings", and that the newest window, titled "Child help", reads "PAGE help".
   {/* step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":"settings"}}} */}
   {/* step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":{"name":"settings"},"tab":{"name":"general"}}}} */}
   {/* step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":-1}}} */}
   {/* step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":{"title":"Child help"}}}} */}
   {/* step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":{"url":"http://localhost:8092/multi-tab-child.html?page=help"}}}} */}
8. In the first window, check that the tab titled "Multi-tab home" still reads "MULTI-TAB HOME".
   {/* step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","window":{"index":0},"tab":{"title":"Multi-tab home"}}}} */}
9. Type `hello` in the echo box of the help window, which is also the newest window, and of the child tab, the second tab opened.
   {/* step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","window":{"url":"http://localhost:8092/multi-tab-child.html?page=help"}}}} */}
   {/* step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","window":-1}}} */}
   {/* step {"type":{"keys":" again","selector":"#echo-input","surface":{"browser":"firefox","window":{"index":-1}}}} */}
   {/* step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","tab":1}}} */}
10. Load [the notes page](http://localhost:8092/multi-tab-child.html?page=notes) in a new tab named `notes`, and [the about page](http://localhost:8092/multi-tab-child.html?page=about) in a new window named `about`. Check that each one reads its page name.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=notes","newTab":"notes"}} */}
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=about","newWindow":"about"}} */}
   {/* step {"find":{"elementText":"PAGE notes","surface":{"browser":"firefox","tab":"notes"}}} */}
   {/* step {"find":{"elementText":"PAGE about","surface":{"browser":"firefox","window":"about"}}} */}
11. Start two more Firefox sessions: `reviewer`, with an 800 by 600 viewport, and `editor`, with a 1024 by 768 window. Load [the review page](http://localhost:8092/multi-tab-child.html?page=review) in `reviewer`.
   {/* step {"startSurface":[{"browser":"firefox","name":"reviewer","headless":true,"viewport":{"width":800,"height":600}},{"browser":"firefox","name":"editor","headless":true,"size":{"width":1024,"height":768}}]} */}
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=review","surface":{"browser":"firefox","name":"reviewer"}}} */}
12. In the first session, go back to [the multi-tab page](http://localhost:8092/multi-tab.html), and check that it reads "MULTI-TAB HOME".
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab.html","surface":"firefox"}} */}
   {/* step {"find":{"elementText":"MULTI-TAB HOME","surface":"firefox"}} */}
13. Close the `report` and `notes` tabs, the scratch tab, the child tab, the help, `settings`, and `about` windows, and the `reviewer` and `editor` sessions.
   {/* step {"closeSurface":[{"browser":"firefox","tab":{"name":"report"}},{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch"}},{"browser":"firefox","tab":{"index":1}},{"browser":"firefox","window":{"title":"Child help"}},{"browser":"firefox","window":{"name":"settings"}},{"browser":"firefox","tab":"notes"},{"browser":"firefox","window":"about"},{"browser":"firefox","name":"reviewer"},"editor"]} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Compare pages in tabs, windows, and sessions

// (test {"testId":"sessions-tabs","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Click the Open child in new tab link. The child page opens in a new tab.
+
// (step {"click":"Open child in new tab"})
. In the newest tab, check that the page reads "PAGE linked".
+
// (step {"find":{"elementText":"PAGE linked","surface":{"browser":"firefox","tab":{"index":-1}}}})
. In a new tab named `report`, load http://localhost:8092/multi-tab-child.html?page=report[the report page]. Then load http://localhost:8092/multi-tab-child.html?page=scratch[the scratch page] in another new tab.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=report","newTab":{"name":"report"}}})
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch","newTab":true}})
. Check that the `report` tab reads "PAGE report", and that the tab showing the scratch page reads "PAGE scratch".
+
// (step {"find":{"elementText":"PAGE report","surface":{"browser":"firefox","tab":"report"}}})
+
// (step {"find":{"elementText":"PAGE scratch","surface":{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch"}}}})
. In a new window named `settings`, with its first tab named `general`, load http://localhost:8092/multi-tab-child.html?page=settings[the settings page]. Then load http://localhost:8092/multi-tab-child.html?page=help[the help page] in another new window.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=settings","newWindow":{"name":"settings","tab":"general"}}})
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=help","newWindow":true}})
. Check that the `settings` window and its `general` tab read "PAGE settings", and that the newest window, titled "Child help", reads "PAGE help".
+
// (step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":"settings"}}})
+
// (step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":{"name":"settings"},"tab":{"name":"general"}}}})
+
// (step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":-1}}})
+
// (step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":{"title":"Child help"}}}})
+
// (step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":{"url":"http://localhost:8092/multi-tab-child.html?page=help"}}}})
. In the first window, check that the tab titled "Multi-tab home" still reads "MULTI-TAB HOME".
+
// (step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","window":{"index":0},"tab":{"title":"Multi-tab home"}}}})
. Type `hello` in the echo box of the help window, which is also the newest window, and of the child tab, the second tab opened.
+
// (step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","window":{"url":"http://localhost:8092/multi-tab-child.html?page=help"}}}})
+
// (step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","window":-1}}})
+
// (step {"type":{"keys":" again","selector":"#echo-input","surface":{"browser":"firefox","window":{"index":-1}}}})
+
// (step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","tab":1}}})
. Load http://localhost:8092/multi-tab-child.html?page=notes[the notes page] in a new tab named `notes`, and http://localhost:8092/multi-tab-child.html?page=about[the about page] in a new window named `about`. Check that each one reads its page name.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=notes","newTab":"notes"}})
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=about","newWindow":"about"}})
+
// (step {"find":{"elementText":"PAGE notes","surface":{"browser":"firefox","tab":"notes"}}})
+
// (step {"find":{"elementText":"PAGE about","surface":{"browser":"firefox","window":"about"}}})
. Start two more Firefox sessions: `reviewer`, with an 800 by 600 viewport, and `editor`, with a 1024 by 768 window. Load http://localhost:8092/multi-tab-child.html?page=review[the review page] in `reviewer`.
+
// (step {"startSurface":[{"browser":"firefox","name":"reviewer","headless":true,"viewport":{"width":800,"height":600}},{"browser":"firefox","name":"editor","headless":true,"size":{"width":1024,"height":768}}]})
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=review","surface":{"browser":"firefox","name":"reviewer"}}})
. In the first session, go back to http://localhost:8092/multi-tab.html[the multi-tab page], and check that it reads "MULTI-TAB HOME".
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab.html","surface":"firefox"}})
+
// (step {"find":{"elementText":"MULTI-TAB HOME","surface":"firefox"}})
. Close the `report` and `notes` tabs, the scratch tab, the child tab, the help, `settings`, and `about` windows, and the `reviewer` and `editor` sessions.
+
// (step {"closeSurface":[{"browser":"firefox","tab":{"name":"report"}},{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch"}},{"browser":"firefox","tab":{"index":1}},{"browser":"firefox","window":{"title":"Child help"}},{"browser":"firefox","window":{"name":"settings"}},{"browser":"firefox","tab":"notes"},{"browser":"firefox","window":"about"},{"browser":"firefox","name":"reviewer"},"editor"]})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Compare pages in tabs, windows, and sessions</title></head>
<body>
<!-- test {"testId":"sessions-tabs","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Compare pages in tabs, windows, and sessions</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Click the Open child in new tab link. The child page opens in a new tab.
    <!-- step {"click":"Open child in new tab"} --></li>
  <li>In the newest tab, check that the page reads "PAGE linked".
    <!-- step {"find":{"elementText":"PAGE linked","surface":{"browser":"firefox","tab":{"index":-1}}}} --></li>
  <li>In a new tab named <code>report</code>, load <a href="http://localhost:8092/multi-tab-child.html?page=report">the report page</a>. Then load <a href="http://localhost:8092/multi-tab-child.html?page=scratch">the scratch page</a> in another new tab.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=report","newTab":{"name":"report"}}} -->
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch","newTab":true}} --></li>
  <li>Check that the <code>report</code> tab reads "PAGE report", and that the tab showing the scratch page reads "PAGE scratch".
    <!-- step {"find":{"elementText":"PAGE report","surface":{"browser":"firefox","tab":"report"}}} -->
    <!-- step {"find":{"elementText":"PAGE scratch","surface":{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch"}}}} --></li>
  <li>In a new window named <code>settings</code>, with its first tab named <code>general</code>, load <a href="http://localhost:8092/multi-tab-child.html?page=settings">the settings page</a>. Then load <a href="http://localhost:8092/multi-tab-child.html?page=help">the help page</a> in another new window.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=settings","newWindow":{"name":"settings","tab":"general"}}} -->
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=help","newWindow":true}} --></li>
  <li>Check that the <code>settings</code> window and its <code>general</code> tab read "PAGE settings", and that the newest window, titled "Child help", reads "PAGE help".
    <!-- step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":"settings"}}} -->
    <!-- step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":{"name":"settings"},"tab":{"name":"general"}}}} -->
    <!-- step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":-1}}} -->
    <!-- step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":{"title":"Child help"}}}} -->
    <!-- step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":{"url":"http://localhost:8092/multi-tab-child.html?page=help"}}}} --></li>
  <li>In the first window, check that the tab titled "Multi-tab home" still reads "MULTI-TAB HOME".
    <!-- step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","window":{"index":0},"tab":{"title":"Multi-tab home"}}}} --></li>
  <li>Type <code>hello</code> in the echo box of the help window, which is also the newest window, and of the child tab, the second tab opened.
    <!-- step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","window":{"url":"http://localhost:8092/multi-tab-child.html?page=help"}}}} -->
    <!-- step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","window":-1}}} -->
    <!-- step {"type":{"keys":" again","selector":"#echo-input","surface":{"browser":"firefox","window":{"index":-1}}}} -->
    <!-- step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","tab":1}}} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=notes">the notes page</a> in a new tab named <code>notes</code>, and <a href="http://localhost:8092/multi-tab-child.html?page=about">the about page</a> in a new window named <code>about</code>. Check that each one reads its page name.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=notes","newTab":"notes"}} -->
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=about","newWindow":"about"}} -->
    <!-- step {"find":{"elementText":"PAGE notes","surface":{"browser":"firefox","tab":"notes"}}} -->
    <!-- step {"find":{"elementText":"PAGE about","surface":{"browser":"firefox","window":"about"}}} --></li>
  <li>Start two more Firefox sessions: <code>reviewer</code>, with an 800 by 600 viewport, and <code>editor</code>, with a 1024 by 768 window. Load <a href="http://localhost:8092/multi-tab-child.html?page=review">the review page</a> in <code>reviewer</code>.
    <!-- step {"startSurface":[{"browser":"firefox","name":"reviewer","headless":true,"viewport":{"width":800,"height":600}},{"browser":"firefox","name":"editor","headless":true,"size":{"width":1024,"height":768}}]} -->
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=review","surface":{"browser":"firefox","name":"reviewer"}}} --></li>
  <li>In the first session, go back to <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>, and check that it reads "MULTI-TAB HOME".
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab.html","surface":"firefox"}} -->
    <!-- step {"find":{"elementText":"MULTI-TAB HOME","surface":"firefox"}} --></li>
  <li>Close the <code>report</code> and <code>notes</code> tabs, the scratch tab, the child tab, the help, <code>settings</code>, and <code>about</code> windows, and the <code>reviewer</code> and <code>editor</code> sessions.
    <!-- step {"closeSurface":[{"browser":"firefox","tab":{"name":"report"}},{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch"}},{"browser":"firefox","tab":{"index":1}},{"browser":"firefox","window":{"title":"Child help"}},{"browser":"firefox","window":{"name":"settings"}},{"browser":"firefox","tab":"notes"},{"browser":"firefox","window":"about"},{"browser":"firefox","name":"reviewer"},"editor"]} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Compare pages in tabs, windows, and sessions
============================================

.. test {"testId":"sessions-tabs","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Click the Open child in new tab link. The child page opens in a new tab.

   .. step {"click":"Open child in new tab"}

#. In the newest tab, check that the page reads "PAGE linked".

   .. step {"find":{"elementText":"PAGE linked","surface":{"browser":"firefox","tab":{"index":-1}}}}

#. In a new tab named ``report``, load `the report page <http://localhost:8092/multi-tab-child.html?page=report>`__. Then load `the scratch page <http://localhost:8092/multi-tab-child.html?page=scratch>`__ in another new tab.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=report","newTab":{"name":"report"}}}

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch","newTab":true}}

#. Check that the ``report`` tab reads "PAGE report", and that the tab showing the scratch page reads "PAGE scratch".

   .. step {"find":{"elementText":"PAGE report","surface":{"browser":"firefox","tab":"report"}}}

   .. step {"find":{"elementText":"PAGE scratch","surface":{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch"}}}}

#. In a new window named ``settings``, with its first tab named ``general``, load `the settings page <http://localhost:8092/multi-tab-child.html?page=settings>`__. Then load `the help page <http://localhost:8092/multi-tab-child.html?page=help>`__ in another new window.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=settings","newWindow":{"name":"settings","tab":"general"}}}

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=help","newWindow":true}}

#. Check that the ``settings`` window and its ``general`` tab read "PAGE settings", and that the newest window, titled "Child help", reads "PAGE help".

   .. step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":"settings"}}}

   .. step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":{"name":"settings"},"tab":{"name":"general"}}}}

   .. step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":-1}}}

   .. step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":{"title":"Child help"}}}}

   .. step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":{"url":"http://localhost:8092/multi-tab-child.html?page=help"}}}}

#. In the first window, check that the tab titled "Multi-tab home" still reads "MULTI-TAB HOME".

   .. step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","window":{"index":0},"tab":{"title":"Multi-tab home"}}}}

#. Type ``hello`` in the echo box of the help window, which is also the newest window, and of the child tab, the second tab opened.

   .. step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","window":{"url":"http://localhost:8092/multi-tab-child.html?page=help"}}}}

   .. step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","window":-1}}}

   .. step {"type":{"keys":" again","selector":"#echo-input","surface":{"browser":"firefox","window":{"index":-1}}}}

   .. step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","tab":1}}}

#. Load `the notes page <http://localhost:8092/multi-tab-child.html?page=notes>`__ in a new tab named ``notes``, and `the about page <http://localhost:8092/multi-tab-child.html?page=about>`__ in a new window named ``about``. Check that each one reads its page name.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=notes","newTab":"notes"}}

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=about","newWindow":"about"}}

   .. step {"find":{"elementText":"PAGE notes","surface":{"browser":"firefox","tab":"notes"}}}

   .. step {"find":{"elementText":"PAGE about","surface":{"browser":"firefox","window":"about"}}}

#. Start two more Firefox sessions: ``reviewer``, with an 800 by 600 viewport, and ``editor``, with a 1024 by 768 window. Load `the review page <http://localhost:8092/multi-tab-child.html?page=review>`__ in ``reviewer``.

   .. step {"startSurface":[{"browser":"firefox","name":"reviewer","headless":true,"viewport":{"width":800,"height":600}},{"browser":"firefox","name":"editor","headless":true,"size":{"width":1024,"height":768}}]}

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=review","surface":{"browser":"firefox","name":"reviewer"}}}

#. In the first session, go back to `the multi-tab page <http://localhost:8092/multi-tab.html>`__, and check that it reads "MULTI-TAB HOME".

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab.html","surface":"firefox"}}

   .. step {"find":{"elementText":"MULTI-TAB HOME","surface":"firefox"}}

#. Close the ``report`` and ``notes`` tabs, the scratch tab, the child tab, the help, ``settings``, and ``about`` windows, and the ``reviewer`` and ``editor`` sessions.

   .. step {"closeSurface":[{"browser":"firefox","tab":{"name":"report"}},{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch"}},{"browser":"firefox","tab":{"index":1}},{"browser":"firefox","window":{"title":"Child help"}},{"browser":"firefox","window":{"name":"settings"}},{"browser":"firefox","tab":"notes"},{"browser":"firefox","window":"about"},{"browser":"firefox","name":"reviewer"},"editor"]}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-tabs">
  <title>Compare pages in tabs, windows, and sessions</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-tabs","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Click the Open child in new tab link. The child page opens in a new tab.</cmd>
        <info><data name="doc-detective" value='step {"click":"Open child in new tab"}'/></info></step>
      <step><cmd>In the newest tab, check that the page reads "PAGE linked".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE linked","surface":{"browser":"firefox","tab":{"index":-1}}}}'/></info></step>
      <step><cmd>In a new tab named <codeph>report</codeph>, load <xref href="http://localhost:8092/multi-tab-child.html?page=report" scope="external" format="html">the report page</xref>. Then load <xref href="http://localhost:8092/multi-tab-child.html?page=scratch" scope="external" format="html">the scratch page</xref> in another new tab.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=report","newTab":{"name":"report"}}}'/><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch","newTab":true}}'/></info></step>
      <step><cmd>Check that the <codeph>report</codeph> tab reads "PAGE report", and that the tab showing the scratch page reads "PAGE scratch".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE report","surface":{"browser":"firefox","tab":"report"}}}'/><data name="doc-detective" value='step {"find":{"elementText":"PAGE scratch","surface":{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch"}}}}'/></info></step>
      <step><cmd>In a new window named <codeph>settings</codeph>, with its first tab named <codeph>general</codeph>, load <xref href="http://localhost:8092/multi-tab-child.html?page=settings" scope="external" format="html">the settings page</xref>. Then load <xref href="http://localhost:8092/multi-tab-child.html?page=help" scope="external" format="html">the help page</xref> in another new window.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=settings","newWindow":{"name":"settings","tab":"general"}}}'/><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=help","newWindow":true}}'/></info></step>
      <step><cmd>Check that the <codeph>settings</codeph> window and its <codeph>general</codeph> tab read "PAGE settings", and that the newest window, titled "Child help", reads "PAGE help".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":"settings"}}}'/><data name="doc-detective" value='step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":{"name":"settings"},"tab":{"name":"general"}}}}'/><data name="doc-detective" value='step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":-1}}}'/><data name="doc-detective" value='step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":{"title":"Child help"}}}}'/><data name="doc-detective" value='step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":{"url":"http://localhost:8092/multi-tab-child.html?page=help"}}}}'/></info></step>
      <step><cmd>In the first window, check that the tab titled "Multi-tab home" still reads "MULTI-TAB HOME".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","window":{"index":0},"tab":{"title":"Multi-tab home"}}}}'/></info></step>
      <step><cmd>Type <codeph>hello</codeph> in the echo box of the help window, which is also the newest window, and of the child tab, the second tab opened.</cmd>
        <info><data name="doc-detective" value='step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","window":{"url":"http://localhost:8092/multi-tab-child.html?page=help"}}}}'/><data name="doc-detective" value='step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","window":-1}}}'/><data name="doc-detective" value='step {"type":{"keys":" again","selector":"#echo-input","surface":{"browser":"firefox","window":{"index":-1}}}}'/><data name="doc-detective" value='step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","tab":1}}}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=notes" scope="external" format="html">the notes page</xref> in a new tab named <codeph>notes</codeph>, and <xref href="http://localhost:8092/multi-tab-child.html?page=about" scope="external" format="html">the about page</xref> in a new window named <codeph>about</codeph>. Check that each one reads its page name.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=notes","newTab":"notes"}}'/><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=about","newWindow":"about"}}'/><data name="doc-detective" value='step {"find":{"elementText":"PAGE notes","surface":{"browser":"firefox","tab":"notes"}}}'/><data name="doc-detective" value='step {"find":{"elementText":"PAGE about","surface":{"browser":"firefox","window":"about"}}}'/></info></step>
      <step><cmd>Start two more Firefox sessions: <codeph>reviewer</codeph>, with an 800 by 600 viewport, and <codeph>editor</codeph>, with a 1024 by 768 window. Load <xref href="http://localhost:8092/multi-tab-child.html?page=review" scope="external" format="html">the review page</xref> in <codeph>reviewer</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"startSurface":[{"browser":"firefox","name":"reviewer","headless":true,"viewport":{"width":800,"height":600}},{"browser":"firefox","name":"editor","headless":true,"size":{"width":1024,"height":768}}]}'/><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=review","surface":{"browser":"firefox","name":"reviewer"}}}'/></info></step>
      <step><cmd>In the first session, go back to <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>, and check that it reads "MULTI-TAB HOME".</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab.html","surface":"firefox"}}'/><data name="doc-detective" value='step {"find":{"elementText":"MULTI-TAB HOME","surface":"firefox"}}'/></info></step>
      <step><cmd>Close the <codeph>report</codeph> and <codeph>notes</codeph> tabs, the scratch tab, the child tab, the help, <codeph>settings</codeph>, and <codeph>about</codeph> windows, and the <codeph>reviewer</codeph> and <codeph>editor</codeph> sessions.</cmd>
        <info><data name="doc-detective" value='step {"closeSurface":[{"browser":"firefox","tab":{"name":"report"}},{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch"}},{"browser":"firefox","tab":{"index":1}},{"browser":"firefox","window":{"title":"Child help"}},{"browser":"firefox","window":{"name":"settings"}},{"browser":"firefox","tab":"notes"},{"browser":"firefox","window":"about"},{"browser":"firefox","name":"reviewer"},"editor"]}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-tabs","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Compare pages in tabs, windows, and sessions

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Click the Open child in new tab link. The child page opens in a new tab.
   <!-- step {"click":"Open child in new tab"} -->
3. In the newest tab, check that the page reads "PAGE linked".
   <!-- step {"find":{"elementText":"PAGE linked","surface":{"browser":"firefox","tab":{"index":-1}}}} -->
4. In a new tab named `report`, load [the report page](http://localhost:8092/multi-tab-child.html?page=report). Then load [the scratch page](http://localhost:8092/multi-tab-child.html?page=scratch) in another new tab.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=report","newTab":{"name":"report"}}} -->
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch","newTab":true}} -->
5. Check that the `report` tab reads "PAGE report", and that the tab showing the scratch page reads "PAGE scratch".
   <!-- step {"find":{"elementText":"PAGE report","surface":{"browser":"firefox","tab":"report"}}} -->
   <!-- step {"find":{"elementText":"PAGE scratch","surface":{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch"}}}} -->
6. In a new window named `settings`, with its first tab named `general`, load [the settings page](http://localhost:8092/multi-tab-child.html?page=settings). Then load [the help page](http://localhost:8092/multi-tab-child.html?page=help) in another new window.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=settings","newWindow":{"name":"settings","tab":"general"}}} -->
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=help","newWindow":true}} -->
7. Check that the `settings` window and its `general` tab read "PAGE settings", and that the newest window, titled "Child help", reads "PAGE help".
   <!-- step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":"settings"}}} -->
   <!-- step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":{"name":"settings"},"tab":{"name":"general"}}}} -->
   <!-- step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":-1}}} -->
   <!-- step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":{"title":"Child help"}}}} -->
   <!-- step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":{"url":"http://localhost:8092/multi-tab-child.html?page=help"}}}} -->
8. In the first window, check that the tab titled "Multi-tab home" still reads "MULTI-TAB HOME".
   <!-- step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","window":{"index":0},"tab":{"title":"Multi-tab home"}}}} -->
9. Type `hello` in the echo box of the help window, which is also the newest window, and of the child tab, the second tab opened.
   <!-- step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","window":{"url":"http://localhost:8092/multi-tab-child.html?page=help"}}}} -->
   <!-- step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","window":-1}}} -->
   <!-- step {"type":{"keys":" again","selector":"#echo-input","surface":{"browser":"firefox","window":{"index":-1}}}} -->
   <!-- step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","tab":1}}} -->
10. Load [the notes page](http://localhost:8092/multi-tab-child.html?page=notes) in a new tab named `notes`, and [the about page](http://localhost:8092/multi-tab-child.html?page=about) in a new window named `about`. Check that each one reads its page name.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=notes","newTab":"notes"}} -->
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=about","newWindow":"about"}} -->
   <!-- step {"find":{"elementText":"PAGE notes","surface":{"browser":"firefox","tab":"notes"}}} -->
   <!-- step {"find":{"elementText":"PAGE about","surface":{"browser":"firefox","window":"about"}}} -->
11. Start two more Firefox sessions: `reviewer`, with an 800 by 600 viewport, and `editor`, with a 1024 by 768 window. Load [the review page](http://localhost:8092/multi-tab-child.html?page=review) in `reviewer`.
   <!-- step {"startSurface":[{"browser":"firefox","name":"reviewer","headless":true,"viewport":{"width":800,"height":600}},{"browser":"firefox","name":"editor","headless":true,"size":{"width":1024,"height":768}}]} -->
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=review","surface":{"browser":"firefox","name":"reviewer"}}} -->
12. In the first session, go back to [the multi-tab page](http://localhost:8092/multi-tab.html), and check that it reads "MULTI-TAB HOME".
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab.html","surface":"firefox"}} -->
   <!-- step {"find":{"elementText":"MULTI-TAB HOME","surface":"firefox"}} -->
13. Close the `report` and `notes` tabs, the scratch tab, the child tab, the help, `settings`, and `about` windows, and the `reviewer` and `editor` sessions.
   <!-- step {"closeSurface":[{"browser":"firefox","tab":{"name":"report"}},{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch"}},{"browser":"firefox","tab":{"index":1}},{"browser":"firefox","window":{"title":"Child help"}},{"browser":"firefox","window":{"name":"settings"}},{"browser":"firefox","tab":"notes"},{"browser":"firefox","window":"about"},{"browser":"firefox","name":"reviewer"},"editor"]} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-tabs","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Compare pages in tabs, windows, and sessions

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Click the Open child in new tab link. The child page opens in a new tab.
   {/* step {"click":"Open child in new tab"} */}
3. In the newest tab, check that the page reads "PAGE linked".
   {/* step {"find":{"elementText":"PAGE linked","surface":{"browser":"firefox","tab":{"index":-1}}}} */}
4. In a new tab named `report`, load [the report page](http://localhost:8092/multi-tab-child.html?page=report). Then load [the scratch page](http://localhost:8092/multi-tab-child.html?page=scratch) in another new tab.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=report","newTab":{"name":"report"}}} */}
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch","newTab":true}} */}
5. Check that the `report` tab reads "PAGE report", and that the tab showing the scratch page reads "PAGE scratch".
   {/* step {"find":{"elementText":"PAGE report","surface":{"browser":"firefox","tab":"report"}}} */}
   {/* step {"find":{"elementText":"PAGE scratch","surface":{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch"}}}} */}
6. In a new window named `settings`, with its first tab named `general`, load [the settings page](http://localhost:8092/multi-tab-child.html?page=settings). Then load [the help page](http://localhost:8092/multi-tab-child.html?page=help) in another new window.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=settings","newWindow":{"name":"settings","tab":"general"}}} */}
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=help","newWindow":true}} */}
7. Check that the `settings` window and its `general` tab read "PAGE settings", and that the newest window, titled "Child help", reads "PAGE help".
   {/* step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":"settings"}}} */}
   {/* step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":{"name":"settings"},"tab":{"name":"general"}}}} */}
   {/* step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":-1}}} */}
   {/* step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":{"title":"Child help"}}}} */}
   {/* step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":{"url":"http://localhost:8092/multi-tab-child.html?page=help"}}}} */}
8. In the first window, check that the tab titled "Multi-tab home" still reads "MULTI-TAB HOME".
   {/* step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","window":{"index":0},"tab":{"title":"Multi-tab home"}}}} */}
9. Type `hello` in the echo box of the help window, which is also the newest window, and of the child tab, the second tab opened.
   {/* step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","window":{"url":"http://localhost:8092/multi-tab-child.html?page=help"}}}} */}
   {/* step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","window":-1}}} */}
   {/* step {"type":{"keys":" again","selector":"#echo-input","surface":{"browser":"firefox","window":{"index":-1}}}} */}
   {/* step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","tab":1}}} */}
10. Load [the notes page](http://localhost:8092/multi-tab-child.html?page=notes) in a new tab named `notes`, and [the about page](http://localhost:8092/multi-tab-child.html?page=about) in a new window named `about`. Check that each one reads its page name.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=notes","newTab":"notes"}} */}
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=about","newWindow":"about"}} */}
   {/* step {"find":{"elementText":"PAGE notes","surface":{"browser":"firefox","tab":"notes"}}} */}
   {/* step {"find":{"elementText":"PAGE about","surface":{"browser":"firefox","window":"about"}}} */}
11. Start two more Firefox sessions: `reviewer`, with an 800 by 600 viewport, and `editor`, with a 1024 by 768 window. Load [the review page](http://localhost:8092/multi-tab-child.html?page=review) in `reviewer`.
   {/* step {"startSurface":[{"browser":"firefox","name":"reviewer","headless":true,"viewport":{"width":800,"height":600}},{"browser":"firefox","name":"editor","headless":true,"size":{"width":1024,"height":768}}]} */}
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=review","surface":{"browser":"firefox","name":"reviewer"}}} */}
12. In the first session, go back to [the multi-tab page](http://localhost:8092/multi-tab.html), and check that it reads "MULTI-TAB HOME".
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab.html","surface":"firefox"}} */}
   {/* step {"find":{"elementText":"MULTI-TAB HOME","surface":"firefox"}} */}
13. Close the `report` and `notes` tabs, the scratch tab, the child tab, the help, `settings`, and `about` windows, and the `reviewer` and `editor` sessions.
   {/* step {"closeSurface":[{"browser":"firefox","tab":{"name":"report"}},{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch"}},{"browser":"firefox","tab":{"index":1}},{"browser":"firefox","window":{"title":"Child help"}},{"browser":"firefox","window":{"name":"settings"}},{"browser":"firefox","tab":"notes"},{"browser":"firefox","window":"about"},{"browser":"firefox","name":"reviewer"},"editor"]} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Compare pages in tabs, windows, and sessions

// (test {"testId":"sessions-tabs","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Click the Open child in new tab link. The child page opens in a new tab.
+
// (step {"click":"Open child in new tab"})
. In the newest tab, check that the page reads "PAGE linked".
+
// (step {"find":{"elementText":"PAGE linked","surface":{"browser":"firefox","tab":{"index":-1}}}})
. In a new tab named `report`, load http://localhost:8092/multi-tab-child.html?page=report[the report page]. Then load http://localhost:8092/multi-tab-child.html?page=scratch[the scratch page] in another new tab.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=report","newTab":{"name":"report"}}})
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch","newTab":true}})
. Check that the `report` tab reads "PAGE report", and that the tab showing the scratch page reads "PAGE scratch".
+
// (step {"find":{"elementText":"PAGE report","surface":{"browser":"firefox","tab":"report"}}})
+
// (step {"find":{"elementText":"PAGE scratch","surface":{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch"}}}})
. In a new window named `settings`, with its first tab named `general`, load http://localhost:8092/multi-tab-child.html?page=settings[the settings page]. Then load http://localhost:8092/multi-tab-child.html?page=help[the help page] in another new window.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=settings","newWindow":{"name":"settings","tab":"general"}}})
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=help","newWindow":true}})
. Check that the `settings` window and its `general` tab read "PAGE settings", and that the newest window, titled "Child help", reads "PAGE help".
+
// (step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":"settings"}}})
+
// (step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":{"name":"settings"},"tab":{"name":"general"}}}})
+
// (step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":-1}}})
+
// (step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":{"title":"Child help"}}}})
+
// (step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":{"url":"http://localhost:8092/multi-tab-child.html?page=help"}}}})
. In the first window, check that the tab titled "Multi-tab home" still reads "MULTI-TAB HOME".
+
// (step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","window":{"index":0},"tab":{"title":"Multi-tab home"}}}})
. Type `hello` in the echo box of the help window, which is also the newest window, and of the child tab, the second tab opened.
+
// (step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","window":{"url":"http://localhost:8092/multi-tab-child.html?page=help"}}}})
+
// (step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","window":-1}}})
+
// (step {"type":{"keys":" again","selector":"#echo-input","surface":{"browser":"firefox","window":{"index":-1}}}})
+
// (step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","tab":1}}})
. Load http://localhost:8092/multi-tab-child.html?page=notes[the notes page] in a new tab named `notes`, and http://localhost:8092/multi-tab-child.html?page=about[the about page] in a new window named `about`. Check that each one reads its page name.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=notes","newTab":"notes"}})
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=about","newWindow":"about"}})
+
// (step {"find":{"elementText":"PAGE notes","surface":{"browser":"firefox","tab":"notes"}}})
+
// (step {"find":{"elementText":"PAGE about","surface":{"browser":"firefox","window":"about"}}})
. Start two more Firefox sessions: `reviewer`, with an 800 by 600 viewport, and `editor`, with a 1024 by 768 window. Load http://localhost:8092/multi-tab-child.html?page=review[the review page] in `reviewer`.
+
// (step {"startSurface":[{"browser":"firefox","name":"reviewer","headless":true,"viewport":{"width":800,"height":600}},{"browser":"firefox","name":"editor","headless":true,"size":{"width":1024,"height":768}}]})
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=review","surface":{"browser":"firefox","name":"reviewer"}}})
. In the first session, go back to http://localhost:8092/multi-tab.html[the multi-tab page], and check that it reads "MULTI-TAB HOME".
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab.html","surface":"firefox"}})
+
// (step {"find":{"elementText":"MULTI-TAB HOME","surface":"firefox"}})
. Close the `report` and `notes` tabs, the scratch tab, the child tab, the help, `settings`, and `about` windows, and the `reviewer` and `editor` sessions.
+
// (step {"closeSurface":[{"browser":"firefox","tab":{"name":"report"}},{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch"}},{"browser":"firefox","tab":{"index":1}},{"browser":"firefox","window":{"title":"Child help"}},{"browser":"firefox","window":{"name":"settings"}},{"browser":"firefox","tab":"notes"},{"browser":"firefox","window":"about"},{"browser":"firefox","name":"reviewer"},"editor"]})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Compare pages in tabs, windows, and sessions</title></head>
<body>
<!-- test {"testId":"sessions-tabs","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Compare pages in tabs, windows, and sessions</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Click the Open child in new tab link. The child page opens in a new tab.
    <!-- step {"click":"Open child in new tab"} --></li>
  <li>In the newest tab, check that the page reads "PAGE linked".
    <!-- step {"find":{"elementText":"PAGE linked","surface":{"browser":"firefox","tab":{"index":-1}}}} --></li>
  <li>In a new tab named <code>report</code>, load <a href="http://localhost:8092/multi-tab-child.html?page=report">the report page</a>. Then load <a href="http://localhost:8092/multi-tab-child.html?page=scratch">the scratch page</a> in another new tab.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=report","newTab":{"name":"report"}}} -->
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch","newTab":true}} --></li>
  <li>Check that the <code>report</code> tab reads "PAGE report", and that the tab showing the scratch page reads "PAGE scratch".
    <!-- step {"find":{"elementText":"PAGE report","surface":{"browser":"firefox","tab":"report"}}} -->
    <!-- step {"find":{"elementText":"PAGE scratch","surface":{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch"}}}} --></li>
  <li>In a new window named <code>settings</code>, with its first tab named <code>general</code>, load <a href="http://localhost:8092/multi-tab-child.html?page=settings">the settings page</a>. Then load <a href="http://localhost:8092/multi-tab-child.html?page=help">the help page</a> in another new window.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=settings","newWindow":{"name":"settings","tab":"general"}}} -->
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=help","newWindow":true}} --></li>
  <li>Check that the <code>settings</code> window and its <code>general</code> tab read "PAGE settings", and that the newest window, titled "Child help", reads "PAGE help".
    <!-- step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":"settings"}}} -->
    <!-- step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":{"name":"settings"},"tab":{"name":"general"}}}} -->
    <!-- step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":-1}}} -->
    <!-- step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":{"title":"Child help"}}}} -->
    <!-- step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":{"url":"http://localhost:8092/multi-tab-child.html?page=help"}}}} --></li>
  <li>In the first window, check that the tab titled "Multi-tab home" still reads "MULTI-TAB HOME".
    <!-- step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","window":{"index":0},"tab":{"title":"Multi-tab home"}}}} --></li>
  <li>Type <code>hello</code> in the echo box of the help window, which is also the newest window, and of the child tab, the second tab opened.
    <!-- step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","window":{"url":"http://localhost:8092/multi-tab-child.html?page=help"}}}} -->
    <!-- step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","window":-1}}} -->
    <!-- step {"type":{"keys":" again","selector":"#echo-input","surface":{"browser":"firefox","window":{"index":-1}}}} -->
    <!-- step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","tab":1}}} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=notes">the notes page</a> in a new tab named <code>notes</code>, and <a href="http://localhost:8092/multi-tab-child.html?page=about">the about page</a> in a new window named <code>about</code>. Check that each one reads its page name.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=notes","newTab":"notes"}} -->
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=about","newWindow":"about"}} -->
    <!-- step {"find":{"elementText":"PAGE notes","surface":{"browser":"firefox","tab":"notes"}}} -->
    <!-- step {"find":{"elementText":"PAGE about","surface":{"browser":"firefox","window":"about"}}} --></li>
  <li>Start two more Firefox sessions: <code>reviewer</code>, with an 800 by 600 viewport, and <code>editor</code>, with a 1024 by 768 window. Load <a href="http://localhost:8092/multi-tab-child.html?page=review">the review page</a> in <code>reviewer</code>.
    <!-- step {"startSurface":[{"browser":"firefox","name":"reviewer","headless":true,"viewport":{"width":800,"height":600}},{"browser":"firefox","name":"editor","headless":true,"size":{"width":1024,"height":768}}]} -->
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=review","surface":{"browser":"firefox","name":"reviewer"}}} --></li>
  <li>In the first session, go back to <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>, and check that it reads "MULTI-TAB HOME".
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab.html","surface":"firefox"}} -->
    <!-- step {"find":{"elementText":"MULTI-TAB HOME","surface":"firefox"}} --></li>
  <li>Close the <code>report</code> and <code>notes</code> tabs, the scratch tab, the child tab, the help, <code>settings</code>, and <code>about</code> windows, and the <code>reviewer</code> and <code>editor</code> sessions.
    <!-- step {"closeSurface":[{"browser":"firefox","tab":{"name":"report"}},{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch"}},{"browser":"firefox","tab":{"index":1}},{"browser":"firefox","window":{"title":"Child help"}},{"browser":"firefox","window":{"name":"settings"}},{"browser":"firefox","tab":"notes"},{"browser":"firefox","window":"about"},{"browser":"firefox","name":"reviewer"},"editor"]} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Compare pages in tabs, windows, and sessions
============================================

.. test {"testId":"sessions-tabs","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Click the Open child in new tab link. The child page opens in a new tab.

   .. step {"click":"Open child in new tab"}

#. In the newest tab, check that the page reads "PAGE linked".

   .. step {"find":{"elementText":"PAGE linked","surface":{"browser":"firefox","tab":{"index":-1}}}}

#. In a new tab named ``report``, load `the report page <http://localhost:8092/multi-tab-child.html?page=report>`__. Then load `the scratch page <http://localhost:8092/multi-tab-child.html?page=scratch>`__ in another new tab.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=report","newTab":{"name":"report"}}}

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch","newTab":true}}

#. Check that the ``report`` tab reads "PAGE report", and that the tab showing the scratch page reads "PAGE scratch".

   .. step {"find":{"elementText":"PAGE report","surface":{"browser":"firefox","tab":"report"}}}

   .. step {"find":{"elementText":"PAGE scratch","surface":{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch"}}}}

#. In a new window named ``settings``, with its first tab named ``general``, load `the settings page <http://localhost:8092/multi-tab-child.html?page=settings>`__. Then load `the help page <http://localhost:8092/multi-tab-child.html?page=help>`__ in another new window.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=settings","newWindow":{"name":"settings","tab":"general"}}}

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=help","newWindow":true}}

#. Check that the ``settings`` window and its ``general`` tab read "PAGE settings", and that the newest window, titled "Child help", reads "PAGE help".

   .. step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":"settings"}}}

   .. step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":{"name":"settings"},"tab":{"name":"general"}}}}

   .. step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":-1}}}

   .. step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":{"title":"Child help"}}}}

   .. step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":{"url":"http://localhost:8092/multi-tab-child.html?page=help"}}}}

#. In the first window, check that the tab titled "Multi-tab home" still reads "MULTI-TAB HOME".

   .. step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","window":{"index":0},"tab":{"title":"Multi-tab home"}}}}

#. Type ``hello`` in the echo box of the help window, which is also the newest window, and of the child tab, the second tab opened.

   .. step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","window":{"url":"http://localhost:8092/multi-tab-child.html?page=help"}}}}

   .. step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","window":-1}}}

   .. step {"type":{"keys":" again","selector":"#echo-input","surface":{"browser":"firefox","window":{"index":-1}}}}

   .. step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","tab":1}}}

#. Load `the notes page <http://localhost:8092/multi-tab-child.html?page=notes>`__ in a new tab named ``notes``, and `the about page <http://localhost:8092/multi-tab-child.html?page=about>`__ in a new window named ``about``. Check that each one reads its page name.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=notes","newTab":"notes"}}

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=about","newWindow":"about"}}

   .. step {"find":{"elementText":"PAGE notes","surface":{"browser":"firefox","tab":"notes"}}}

   .. step {"find":{"elementText":"PAGE about","surface":{"browser":"firefox","window":"about"}}}

#. Start two more Firefox sessions: ``reviewer``, with an 800 by 600 viewport, and ``editor``, with a 1024 by 768 window. Load `the review page <http://localhost:8092/multi-tab-child.html?page=review>`__ in ``reviewer``.

   .. step {"startSurface":[{"browser":"firefox","name":"reviewer","headless":true,"viewport":{"width":800,"height":600}},{"browser":"firefox","name":"editor","headless":true,"size":{"width":1024,"height":768}}]}

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=review","surface":{"browser":"firefox","name":"reviewer"}}}

#. In the first session, go back to `the multi-tab page <http://localhost:8092/multi-tab.html>`__, and check that it reads "MULTI-TAB HOME".

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab.html","surface":"firefox"}}

   .. step {"find":{"elementText":"MULTI-TAB HOME","surface":"firefox"}}

#. Close the ``report`` and ``notes`` tabs, the scratch tab, the child tab, the help, ``settings``, and ``about`` windows, and the ``reviewer`` and ``editor`` sessions.

   .. step {"closeSurface":[{"browser":"firefox","tab":{"name":"report"}},{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch"}},{"browser":"firefox","tab":{"index":1}},{"browser":"firefox","window":{"title":"Child help"}},{"browser":"firefox","window":{"name":"settings"}},{"browser":"firefox","tab":"notes"},{"browser":"firefox","window":"about"},{"browser":"firefox","name":"reviewer"},"editor"]}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-tabs">
  <title>Compare pages in tabs, windows, and sessions</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-tabs","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Click the Open child in new tab link. The child page opens in a new tab.</cmd>
        <info><data name="doc-detective" value='step {"click":"Open child in new tab"}'/></info></step>
      <step><cmd>In the newest tab, check that the page reads "PAGE linked".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE linked","surface":{"browser":"firefox","tab":{"index":-1}}}}'/></info></step>
      <step><cmd>In a new tab named <codeph>report</codeph>, load <xref href="http://localhost:8092/multi-tab-child.html?page=report" scope="external" format="html">the report page</xref>. Then load <xref href="http://localhost:8092/multi-tab-child.html?page=scratch" scope="external" format="html">the scratch page</xref> in another new tab.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=report","newTab":{"name":"report"}}}'/><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch","newTab":true}}'/></info></step>
      <step><cmd>Check that the <codeph>report</codeph> tab reads "PAGE report", and that the tab showing the scratch page reads "PAGE scratch".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE report","surface":{"browser":"firefox","tab":"report"}}}'/><data name="doc-detective" value='step {"find":{"elementText":"PAGE scratch","surface":{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch"}}}}'/></info></step>
      <step><cmd>In a new window named <codeph>settings</codeph>, with its first tab named <codeph>general</codeph>, load <xref href="http://localhost:8092/multi-tab-child.html?page=settings" scope="external" format="html">the settings page</xref>. Then load <xref href="http://localhost:8092/multi-tab-child.html?page=help" scope="external" format="html">the help page</xref> in another new window.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=settings","newWindow":{"name":"settings","tab":"general"}}}'/><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=help","newWindow":true}}'/></info></step>
      <step><cmd>Check that the <codeph>settings</codeph> window and its <codeph>general</codeph> tab read "PAGE settings", and that the newest window, titled "Child help", reads "PAGE help".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":"settings"}}}'/><data name="doc-detective" value='step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":{"name":"settings"},"tab":{"name":"general"}}}}'/><data name="doc-detective" value='step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":-1}}}'/><data name="doc-detective" value='step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":{"title":"Child help"}}}}'/><data name="doc-detective" value='step {"find":{"elementText":"PAGE help","surface":{"browser":"firefox","window":{"url":"http://localhost:8092/multi-tab-child.html?page=help"}}}}'/></info></step>
      <step><cmd>In the first window, check that the tab titled "Multi-tab home" still reads "MULTI-TAB HOME".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","window":{"index":0},"tab":{"title":"Multi-tab home"}}}}'/></info></step>
      <step><cmd>Type <codeph>hello</codeph> in the echo box of the help window, which is also the newest window, and of the child tab, the second tab opened.</cmd>
        <info><data name="doc-detective" value='step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","window":{"url":"http://localhost:8092/multi-tab-child.html?page=help"}}}}'/><data name="doc-detective" value='step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","window":-1}}}'/><data name="doc-detective" value='step {"type":{"keys":" again","selector":"#echo-input","surface":{"browser":"firefox","window":{"index":-1}}}}'/><data name="doc-detective" value='step {"type":{"keys":"hello","selector":"#echo-input","surface":{"browser":"firefox","tab":1}}}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=notes" scope="external" format="html">the notes page</xref> in a new tab named <codeph>notes</codeph>, and <xref href="http://localhost:8092/multi-tab-child.html?page=about" scope="external" format="html">the about page</xref> in a new window named <codeph>about</codeph>. Check that each one reads its page name.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=notes","newTab":"notes"}}'/><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=about","newWindow":"about"}}'/><data name="doc-detective" value='step {"find":{"elementText":"PAGE notes","surface":{"browser":"firefox","tab":"notes"}}}'/><data name="doc-detective" value='step {"find":{"elementText":"PAGE about","surface":{"browser":"firefox","window":"about"}}}'/></info></step>
      <step><cmd>Start two more Firefox sessions: <codeph>reviewer</codeph>, with an 800 by 600 viewport, and <codeph>editor</codeph>, with a 1024 by 768 window. Load <xref href="http://localhost:8092/multi-tab-child.html?page=review" scope="external" format="html">the review page</xref> in <codeph>reviewer</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"startSurface":[{"browser":"firefox","name":"reviewer","headless":true,"viewport":{"width":800,"height":600}},{"browser":"firefox","name":"editor","headless":true,"size":{"width":1024,"height":768}}]}'/><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=review","surface":{"browser":"firefox","name":"reviewer"}}}'/></info></step>
      <step><cmd>In the first session, go back to <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>, and check that it reads "MULTI-TAB HOME".</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab.html","surface":"firefox"}}'/><data name="doc-detective" value='step {"find":{"elementText":"MULTI-TAB HOME","surface":"firefox"}}'/></info></step>
      <step><cmd>Close the <codeph>report</codeph> and <codeph>notes</codeph> tabs, the scratch tab, the child tab, the help, <codeph>settings</codeph>, and <codeph>about</codeph> windows, and the <codeph>reviewer</codeph> and <codeph>editor</codeph> sessions.</cmd>
        <info><data name="doc-detective" value='step {"closeSurface":[{"browser":"firefox","tab":{"name":"report"}},{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=scratch"}},{"browser":"firefox","tab":{"index":1}},{"browser":"firefox","window":{"title":"Child help"}},{"browser":"firefox","window":{"name":"settings"}},{"browser":"firefox","tab":"notes"},{"browser":"firefox","window":"about"},{"browser":"firefox","name":"reviewer"},"editor"]}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-tabs",
      "runOn": [
        {
          "browsers": {
            "name": "firefox",
            "headless": true
          },
          "browserFallback": "off"
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "click": "Open child in new tab"
        },
        {
          "find": {
            "elementText": "PAGE linked",
            "surface": {
              "browser": "firefox",
              "tab": {
                "index": -1
              }
            }
          }
        },
        {
          "goTo": {
            "url": "http://localhost:8092/multi-tab-child.html?page=report",
            "newTab": {
              "name": "report"
            }
          }
        },
        {
          "goTo": {
            "url": "http://localhost:8092/multi-tab-child.html?page=scratch",
            "newTab": true
          }
        },
        {
          "find": {
            "elementText": "PAGE report",
            "surface": {
              "browser": "firefox",
              "tab": "report"
            }
          }
        },
        {
          "find": {
            "elementText": "PAGE scratch",
            "surface": {
              "browser": "firefox",
              "tab": {
                "url": "http://localhost:8092/multi-tab-child.html?page=scratch"
              }
            }
          }
        },
        {
          "goTo": {
            "url": "http://localhost:8092/multi-tab-child.html?page=settings",
            "newWindow": {
              "name": "settings",
              "tab": "general"
            }
          }
        },
        {
          "goTo": {
            "url": "http://localhost:8092/multi-tab-child.html?page=help",
            "newWindow": true
          }
        },
        {
          "find": {
            "elementText": "PAGE settings",
            "surface": {
              "browser": "firefox",
              "window": "settings"
            }
          }
        },
        {
          "find": {
            "elementText": "PAGE settings",
            "surface": {
              "browser": "firefox",
              "window": {
                "name": "settings"
              },
              "tab": {
                "name": "general"
              }
            }
          }
        },
        {
          "find": {
            "elementText": "PAGE help",
            "surface": {
              "browser": "firefox",
              "window": -1
            }
          }
        },
        {
          "find": {
            "elementText": "PAGE help",
            "surface": {
              "browser": "firefox",
              "window": {
                "title": "Child help"
              }
            }
          }
        },
        {
          "find": {
            "elementText": "PAGE help",
            "surface": {
              "browser": "firefox",
              "window": {
                "url": "http://localhost:8092/multi-tab-child.html?page=help"
              }
            }
          }
        },
        {
          "find": {
            "elementText": "MULTI-TAB HOME",
            "surface": {
              "browser": "firefox",
              "window": {
                "index": 0
              },
              "tab": {
                "title": "Multi-tab home"
              }
            }
          }
        },
        {
          "type": {
            "keys": "hello",
            "selector": "#echo-input",
            "surface": {
              "browser": "firefox",
              "window": {
                "url": "http://localhost:8092/multi-tab-child.html?page=help"
              }
            }
          }
        },
        {
          "type": {
            "keys": "hello",
            "selector": "#echo-input",
            "surface": {
              "browser": "firefox",
              "window": -1
            }
          }
        },
        {
          "type": {
            "keys": " again",
            "selector": "#echo-input",
            "surface": {
              "browser": "firefox",
              "window": {
                "index": -1
              }
            }
          }
        },
        {
          "type": {
            "keys": "hello",
            "selector": "#echo-input",
            "surface": {
              "browser": "firefox",
              "tab": 1
            }
          }
        },
        {
          "goTo": {
            "url": "http://localhost:8092/multi-tab-child.html?page=notes",
            "newTab": "notes"
          }
        },
        {
          "goTo": {
            "url": "http://localhost:8092/multi-tab-child.html?page=about",
            "newWindow": "about"
          }
        },
        {
          "find": {
            "elementText": "PAGE notes",
            "surface": {
              "browser": "firefox",
              "tab": "notes"
            }
          }
        },
        {
          "find": {
            "elementText": "PAGE about",
            "surface": {
              "browser": "firefox",
              "window": "about"
            }
          }
        },
        {
          "startSurface": [
            {
              "browser": "firefox",
              "name": "reviewer",
              "headless": true,
              "viewport": {
                "width": 800,
                "height": 600
              }
            },
            {
              "browser": "firefox",
              "name": "editor",
              "headless": true,
              "size": {
                "width": 1024,
                "height": 768
              }
            }
          ]
        },
        {
          "goTo": {
            "url": "http://localhost:8092/multi-tab-child.html?page=review",
            "surface": {
              "browser": "firefox",
              "name": "reviewer"
            }
          }
        },
        {
          "goTo": {
            "url": "http://localhost:8092/multi-tab.html",
            "surface": "firefox"
          }
        },
        {
          "find": {
            "elementText": "MULTI-TAB HOME",
            "surface": "firefox"
          }
        },
        {
          "closeSurface": [
            {
              "browser": "firefox",
              "tab": {
                "name": "report"
              }
            },
            {
              "browser": "firefox",
              "tab": {
                "url": "http://localhost:8092/multi-tab-child.html?page=scratch"
              }
            },
            {
              "browser": "firefox",
              "tab": {
                "index": 1
              }
            },
            {
              "browser": "firefox",
              "window": {
                "title": "Child help"
              }
            },
            {
              "browser": "firefox",
              "window": {
                "name": "settings"
              }
            },
            {
              "browser": "firefox",
              "tab": "notes"
            },
            {
              "browser": "firefox",
              "window": "about"
            },
            {
              "browser": "firefox",
              "name": "reviewer"
            },
            "editor"
          ]
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-tabs
    runOn:
      - browsers:
          name: firefox
          headless: true
        browserFallback: off
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - click: Open child in new tab
      - find:
          elementText: PAGE linked
          surface:
            browser: firefox
            tab:
              index: -1
      - goTo:
          url: http://localhost:8092/multi-tab-child.html?page=report
          newTab:
            name: report
      - goTo:
          url: http://localhost:8092/multi-tab-child.html?page=scratch
          newTab: true
      - find:
          elementText: PAGE report
          surface:
            browser: firefox
            tab: report
      - find:
          elementText: PAGE scratch
          surface:
            browser: firefox
            tab:
              url: http://localhost:8092/multi-tab-child.html?page=scratch
      - goTo:
          url: http://localhost:8092/multi-tab-child.html?page=settings
          newWindow:
            name: settings
            tab: general
      - goTo:
          url: http://localhost:8092/multi-tab-child.html?page=help
          newWindow: true
      - find:
          elementText: PAGE settings
          surface:
            browser: firefox
            window: settings
      - find:
          elementText: PAGE settings
          surface:
            browser: firefox
            window:
              name: settings
            tab:
              name: general
      - find:
          elementText: PAGE help
          surface:
            browser: firefox
            window: -1
      - find:
          elementText: PAGE help
          surface:
            browser: firefox
            window:
              title: Child help
      - find:
          elementText: PAGE help
          surface:
            browser: firefox
            window:
              url: http://localhost:8092/multi-tab-child.html?page=help
      - find:
          elementText: MULTI-TAB HOME
          surface:
            browser: firefox
            window:
              index: 0
            tab:
              title: Multi-tab home
      - type:
          keys: hello
          selector: "#echo-input"
          surface:
            browser: firefox
            window:
              url: http://localhost:8092/multi-tab-child.html?page=help
      - type:
          keys: hello
          selector: "#echo-input"
          surface:
            browser: firefox
            window: -1
      - type:
          keys: " again"
          selector: "#echo-input"
          surface:
            browser: firefox
            window:
              index: -1
      - type:
          keys: hello
          selector: "#echo-input"
          surface:
            browser: firefox
            tab: 1
      - goTo:
          url: http://localhost:8092/multi-tab-child.html?page=notes
          newTab: notes
      - goTo:
          url: http://localhost:8092/multi-tab-child.html?page=about
          newWindow: about
      - find:
          elementText: PAGE notes
          surface:
            browser: firefox
            tab: notes
      - find:
          elementText: PAGE about
          surface:
            browser: firefox
            window: about
      - startSurface:
          - browser: firefox
            name: reviewer
            headless: true
            viewport:
              width: 800
              height: 600
          - browser: firefox
            name: editor
            headless: true
            size:
              width: 1024
              height: 768
      - goTo:
          url: http://localhost:8092/multi-tab-child.html?page=review
          surface:
            browser: firefox
            name: reviewer
      - goTo:
          url: http://localhost:8092/multi-tab.html
          surface: firefox
      - find:
          elementText: MULTI-TAB HOME
          surface: firefox
      - closeSurface:
          - browser: firefox
            tab:
              name: report
          - browser: firefox
            tab:
              url: http://localhost:8092/multi-tab-child.html?page=scratch
          - browser: firefox
            tab:
              index: 1
          - browser: firefox
            window:
              title: Child help
          - browser: firefox
            window:
              name: settings
          - browser: firefox
            tab: notes
          - browser: firefox
            window: about
          - browser: firefox
            name: reviewer
          - editor
```

### Opening tabs, windows, and sessions

| Step                                                    | Opens                                                                                                       |
| ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| `"newTab": { "name": "report" }`, `"newTab": "notes"`   | A tab with that name.                                                                                       |
| `"newTab": true`                                        | A tab with no name.                                                                                         |
| `"newWindow": { "name": "settings", "tab": "general" }` | A window named `settings`, with its first tab named `general`.                                              |
| `"newWindow": "about"`                                  | A window with that name.                                                                                    |
| `"newWindow": true`                                     | A window with no name.                                                                                      |
| `"startSurface": [ … ]`                                 | Each browser session in the array: `reviewer` with a set `viewport`, and `editor` with a set window `size`. |

### Selecting a surface

A `window` or `tab` selector takes a number, a name, or an object.

| Selector                                                              | Picks                                        |
| --------------------------------------------------------------------- | -------------------------------------------- |
| `"tab": 1`, `"tab": { "index": 1 }`                                   | The tab at that position in creation order.  |
| `"tab": { "index": -1 }`, `"window": -1`, `"window": { "index": -1 }` | The newest tab or window.                    |
| `"window": { "index": 0 }`                                            | The first window.                            |
| `"tab": "report"`, `"tab": { "name": "report" }`                      | The tab with that name.                      |
| `"window": "settings"`, `"window": { "name": "settings" }`            | The window with that name.                   |
| `"tab": { "title": "…" }`, `"window": { "title": "…" }`               | The tab or window whose title matches.       |
| `"tab": { "url": "…" }`, `"window": { "url": "…" }`                   | The tab or window whose URL matches.         |
| `"firefox"`                                                           | The default Firefox session, by engine name. |
| `{ "browser": "firefox", "name": "reviewer" }`, `"reviewer"`          | The session that `startSurface` named.       |

Browser surface selectors name the engine, so the test pins its context to headless Firefox with `browserFallback` set to `off`. Without Firefox, the test skips rather than addressing an engine that isn't running.

### What detection finds

Each link becomes a `checkLink` step. None of the links follows a navigation verb, so detection opens no pages, and statements hold every navigation, click, and surface step.

## Check what the page sees in an emulated browser

This procedure runs in one [context](/reference/schemas/context), named with `contextId`, whose Chrome [browser](/reference/schemas/browser) sets `colorScheme`, `locale`, `timezone`, `deviceScaleFactor`, `reducedMotion`, and `clock`. [`runBrowserScript`](/docs/actions/runbrowserscript) steps read each setting back from the page.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check what the page sees in an emulated browser

Run these steps in headless Chrome set to dark mode, German, Berlin time, a 2x display, reduced motion, and a fixed clock.

1. Start at [the test site's home page](http://localhost:8092/index.html).
2. Check that the page prefers the dark color scheme and reduced motion.
3. Check that the page's language is `de-DE` and its time zone is `Europe/Berlin`.
4. Check that the device pixel ratio is `2`, and that the clock reads December 3, 2026, 09:00 UTC.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check what the page sees in an emulated browser

Run these steps in headless Chrome set to dark mode, German, Berlin time, a 2x display, reduced motion, and a fixed clock.

1. Start at [the test site's home page](http://localhost:8092/index.html).
2. Check that the page prefers the dark color scheme and reduced motion.
3. Check that the page's language is `de-DE` and its time zone is `Europe/Berlin`.
4. Check that the device pixel ratio is `2`, and that the clock reads December 3, 2026, 09:00 UTC.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check what the page sees in an emulated browser

Run these steps in headless Chrome set to dark mode, German, Berlin time, a 2x display, reduced motion, and a fixed clock.

. Start at http://localhost:8092/index.html[the test site's home page].
. Check that the page prefers the dark color scheme and reduced motion.
. Check that the page's language is `de-DE` and its time zone is `Europe/Berlin`.
. Check that the device pixel ratio is `2`, and that the clock reads December 3, 2026, 09:00 UTC.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check what the page sees in an emulated browser</title></head>
<body>
<h1>Check what the page sees in an emulated browser</h1>
<p>Run these steps in headless Chrome set to dark mode, German, Berlin time, a 2x display, reduced motion, and a fixed clock.</p>
<ol>
  <li>Start at <a href="http://localhost:8092/index.html">the test site's home page</a>.</li>
  <li>Check that the page prefers the dark color scheme and reduced motion.</li>
  <li>Check that the page's language is <code>de-DE</code> and its time zone is <code>Europe/Berlin</code>.</li>
  <li>Check that the device pixel ratio is <code>2</code>, and that the clock reads December 3, 2026, 09:00 UTC.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check what the page sees in an emulated browser
===============================================

Run these steps in headless Chrome set to dark mode, German, Berlin time, a 2x display, reduced motion, and a fixed clock.

#. Start at `the test site's home page <http://localhost:8092/index.html>`__.

#. Check that the page prefers the dark color scheme and reduced motion.

#. Check that the page's language is ``de-DE`` and its time zone is ``Europe/Berlin``.

#. Check that the device pixel ratio is ``2``, and that the clock reads December 3, 2026, 09:00 UTC.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-contexts">
  <title>Check what the page sees in an emulated browser</title>
  <taskbody>
    <context><p>Run these steps in headless Chrome set to dark mode, German, Berlin time, a 2x display, reduced motion, and a fixed clock.</p></context>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/index.html" scope="external" format="html">the test site's home page</xref>.</cmd></step>
      <step><cmd>Check that the page prefers the dark color scheme and reduced motion.</cmd></step>
      <step><cmd>Check that the page's language is <codeph>de-DE</codeph> and its time zone is <codeph>Europe/Berlin</codeph>.</cmd></step>
      <step><cmd>Check that the device pixel ratio is <codeph>2</codeph>, and that the clock reads December 3, 2026, 09:00 UTC.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-contexts","detectSteps":true,"runOn":[{"contextId":"sessions-emulated-chrome","platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"colorScheme":"dark","locale":"de-DE","timezone":"Europe/Berlin","deviceScaleFactor":2,"reducedMotion":"reduce","clock":"2026-12-03T09:00:00Z"}}]} -->

# Check what the page sees in an emulated browser

Run these steps in headless Chrome set to dark mode, German, Berlin time, a 2x display, reduced motion, and a fixed clock.

1. Start at [the test site's home page](http://localhost:8092/index.html).
   <!-- step {"goTo":"http://localhost:8092/index.html"} -->
2. Check that the page prefers the dark color scheme and reduced motion.
   <!-- step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);","output":"true"}} -->
   <!-- step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);","output":"true"}} -->
3. Check that the page's language is `de-DE` and its time zone is `Europe/Berlin`.
   <!-- step {"runBrowserScript":{"script":"return navigator.language;","output":"de-DE"}} -->
   <!-- step {"runBrowserScript":{"script":"return Intl.DateTimeFormat().resolvedOptions().timeZone;","output":"Europe/Berlin"}} -->
4. Check that the device pixel ratio is `2`, and that the clock reads December 3, 2026, 09:00 UTC.
   <!-- step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"2"}} -->
   <!-- step {"runBrowserScript":{"script":"return new Date().toISOString();","output":"/^2026-12-03T09:00/"}} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-contexts","detectSteps":true,"runOn":[{"contextId":"sessions-emulated-chrome","platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"colorScheme":"dark","locale":"de-DE","timezone":"Europe/Berlin","deviceScaleFactor":2,"reducedMotion":"reduce","clock":"2026-12-03T09:00:00Z"}}]} */}

# Check what the page sees in an emulated browser

Run these steps in headless Chrome set to dark mode, German, Berlin time, a 2x display, reduced motion, and a fixed clock.

1. Start at [the test site's home page](http://localhost:8092/index.html).
   {/* step {"goTo":"http://localhost:8092/index.html"} */}
2. Check that the page prefers the dark color scheme and reduced motion.
   {/* step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);","output":"true"}} */}
   {/* step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);","output":"true"}} */}
3. Check that the page's language is `de-DE` and its time zone is `Europe/Berlin`.
   {/* step {"runBrowserScript":{"script":"return navigator.language;","output":"de-DE"}} */}
   {/* step {"runBrowserScript":{"script":"return Intl.DateTimeFormat().resolvedOptions().timeZone;","output":"Europe/Berlin"}} */}
4. Check that the device pixel ratio is `2`, and that the clock reads December 3, 2026, 09:00 UTC.
   {/* step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"2"}} */}
   {/* step {"runBrowserScript":{"script":"return new Date().toISOString();","output":"/^2026-12-03T09:00/"}} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check what the page sees in an emulated browser

// (test {"testId":"sessions-contexts","detectSteps":true,"runOn":[{"contextId":"sessions-emulated-chrome","platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"colorScheme":"dark","locale":"de-DE","timezone":"Europe/Berlin","deviceScaleFactor":2,"reducedMotion":"reduce","clock":"2026-12-03T09:00:00Z"}}]})

Run these steps in headless Chrome set to dark mode, German, Berlin time, a 2x display, reduced motion, and a fixed clock.

. Start at http://localhost:8092/index.html[the test site's home page].
+
// (step {"goTo":"http://localhost:8092/index.html"})
. Check that the page prefers the dark color scheme and reduced motion.
+
// (step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);","output":"true"}})
+
// (step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);","output":"true"}})
. Check that the page's language is `de-DE` and its time zone is `Europe/Berlin`.
+
// (step {"runBrowserScript":{"script":"return navigator.language;","output":"de-DE"}})
+
// (step {"runBrowserScript":{"script":"return Intl.DateTimeFormat().resolvedOptions().timeZone;","output":"Europe/Berlin"}})
. Check that the device pixel ratio is `2`, and that the clock reads December 3, 2026, 09:00 UTC.
+
// (step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"2"}})
+
// (step {"runBrowserScript":{"script":"return new Date().toISOString();","output":"/^2026-12-03T09:00/"}})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check what the page sees in an emulated browser</title></head>
<body>
<!-- test {"testId":"sessions-contexts","detectSteps":true,"runOn":[{"contextId":"sessions-emulated-chrome","platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"colorScheme":"dark","locale":"de-DE","timezone":"Europe/Berlin","deviceScaleFactor":2,"reducedMotion":"reduce","clock":"2026-12-03T09:00:00Z"}}]} -->
<h1>Check what the page sees in an emulated browser</h1>
<p>Run these steps in headless Chrome set to dark mode, German, Berlin time, a 2x display, reduced motion, and a fixed clock.</p>
<ol>
  <li>Start at <a href="http://localhost:8092/index.html">the test site's home page</a>.
    <!-- step {"goTo":"http://localhost:8092/index.html"} --></li>
  <li>Check that the page prefers the dark color scheme and reduced motion.
    <!-- step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);","output":"true"}} -->
    <!-- step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);","output":"true"}} --></li>
  <li>Check that the page's language is <code>de-DE</code> and its time zone is <code>Europe/Berlin</code>.
    <!-- step {"runBrowserScript":{"script":"return navigator.language;","output":"de-DE"}} -->
    <!-- step {"runBrowserScript":{"script":"return Intl.DateTimeFormat().resolvedOptions().timeZone;","output":"Europe/Berlin"}} --></li>
  <li>Check that the device pixel ratio is <code>2</code>, and that the clock reads December 3, 2026, 09:00 UTC.
    <!-- step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"2"}} -->
    <!-- step {"runBrowserScript":{"script":"return new Date().toISOString();","output":"/^2026-12-03T09:00/"}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check what the page sees in an emulated browser
===============================================

.. test {"testId":"sessions-contexts","detectSteps":true,"runOn":[{"contextId":"sessions-emulated-chrome","platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"colorScheme":"dark","locale":"de-DE","timezone":"Europe/Berlin","deviceScaleFactor":2,"reducedMotion":"reduce","clock":"2026-12-03T09:00:00Z"}}]}

Run these steps in headless Chrome set to dark mode, German, Berlin time, a 2x display, reduced motion, and a fixed clock.

#. Start at `the test site's home page <http://localhost:8092/index.html>`__.

   .. step {"goTo":"http://localhost:8092/index.html"}

#. Check that the page prefers the dark color scheme and reduced motion.

   .. step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);","output":"true"}}

   .. step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);","output":"true"}}

#. Check that the page's language is ``de-DE`` and its time zone is ``Europe/Berlin``.

   .. step {"runBrowserScript":{"script":"return navigator.language;","output":"de-DE"}}

   .. step {"runBrowserScript":{"script":"return Intl.DateTimeFormat().resolvedOptions().timeZone;","output":"Europe/Berlin"}}

#. Check that the device pixel ratio is ``2``, and that the clock reads December 3, 2026, 09:00 UTC.

   .. step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"2"}}

   .. step {"runBrowserScript":{"script":"return new Date().toISOString();","output":"/^2026-12-03T09:00/"}}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-contexts">
  <title>Check what the page sees in an emulated browser</title>
  <taskbody>
    <context><p>Run these steps in headless Chrome set to dark mode, German, Berlin time, a 2x display, reduced motion, and a fixed clock.</p></context>
    <data name="doc-detective" value='test {"testId":"sessions-contexts","detectSteps":true,"runOn":[{"contextId":"sessions-emulated-chrome","platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"colorScheme":"dark","locale":"de-DE","timezone":"Europe/Berlin","deviceScaleFactor":2,"reducedMotion":"reduce","clock":"2026-12-03T09:00:00Z"}}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/index.html" scope="external" format="html">the test site's home page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/index.html"}'/></info></step>
      <step><cmd>Check that the page prefers the dark color scheme and reduced motion.</cmd>
        <info><data name="doc-detective" value='step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);","output":"true"}}'/><data name="doc-detective" value='step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);","output":"true"}}'/></info></step>
      <step><cmd>Check that the page's language is <codeph>de-DE</codeph> and its time zone is <codeph>Europe/Berlin</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"runBrowserScript":{"script":"return navigator.language;","output":"de-DE"}}'/><data name="doc-detective" value='step {"runBrowserScript":{"script":"return Intl.DateTimeFormat().resolvedOptions().timeZone;","output":"Europe/Berlin"}}'/></info></step>
      <step><cmd>Check that the device pixel ratio is <codeph>2</codeph>, and that the clock reads December 3, 2026, 09:00 UTC.</cmd>
        <info><data name="doc-detective" value='step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"2"}}'/><data name="doc-detective" value='step {"runBrowserScript":{"script":"return new Date().toISOString();","output":"/^2026-12-03T09:00/"}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-contexts","detectSteps":false,"runOn":[{"contextId":"sessions-emulated-chrome","platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"colorScheme":"dark","locale":"de-DE","timezone":"Europe/Berlin","deviceScaleFactor":2,"reducedMotion":"reduce","clock":"2026-12-03T09:00:00Z"}}]} -->

# Check what the page sees in an emulated browser

Run these steps in headless Chrome set to dark mode, German, Berlin time, a 2x display, reduced motion, and a fixed clock.

1. Start at [the test site's home page](http://localhost:8092/index.html).
   <!-- step {"goTo":"http://localhost:8092/index.html"} -->
2. Check that the page prefers the dark color scheme and reduced motion.
   <!-- step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);","output":"true"}} -->
   <!-- step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);","output":"true"}} -->
3. Check that the page's language is `de-DE` and its time zone is `Europe/Berlin`.
   <!-- step {"runBrowserScript":{"script":"return navigator.language;","output":"de-DE"}} -->
   <!-- step {"runBrowserScript":{"script":"return Intl.DateTimeFormat().resolvedOptions().timeZone;","output":"Europe/Berlin"}} -->
4. Check that the device pixel ratio is `2`, and that the clock reads December 3, 2026, 09:00 UTC.
   <!-- step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"2"}} -->
   <!-- step {"runBrowserScript":{"script":"return new Date().toISOString();","output":"/^2026-12-03T09:00/"}} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-contexts","detectSteps":false,"runOn":[{"contextId":"sessions-emulated-chrome","platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"colorScheme":"dark","locale":"de-DE","timezone":"Europe/Berlin","deviceScaleFactor":2,"reducedMotion":"reduce","clock":"2026-12-03T09:00:00Z"}}]} */}

# Check what the page sees in an emulated browser

Run these steps in headless Chrome set to dark mode, German, Berlin time, a 2x display, reduced motion, and a fixed clock.

1. Start at [the test site's home page](http://localhost:8092/index.html).
   {/* step {"goTo":"http://localhost:8092/index.html"} */}
2. Check that the page prefers the dark color scheme and reduced motion.
   {/* step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);","output":"true"}} */}
   {/* step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);","output":"true"}} */}
3. Check that the page's language is `de-DE` and its time zone is `Europe/Berlin`.
   {/* step {"runBrowserScript":{"script":"return navigator.language;","output":"de-DE"}} */}
   {/* step {"runBrowserScript":{"script":"return Intl.DateTimeFormat().resolvedOptions().timeZone;","output":"Europe/Berlin"}} */}
4. Check that the device pixel ratio is `2`, and that the clock reads December 3, 2026, 09:00 UTC.
   {/* step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"2"}} */}
   {/* step {"runBrowserScript":{"script":"return new Date().toISOString();","output":"/^2026-12-03T09:00/"}} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check what the page sees in an emulated browser

// (test {"testId":"sessions-contexts","detectSteps":false,"runOn":[{"contextId":"sessions-emulated-chrome","platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"colorScheme":"dark","locale":"de-DE","timezone":"Europe/Berlin","deviceScaleFactor":2,"reducedMotion":"reduce","clock":"2026-12-03T09:00:00Z"}}]})

Run these steps in headless Chrome set to dark mode, German, Berlin time, a 2x display, reduced motion, and a fixed clock.

. Start at http://localhost:8092/index.html[the test site's home page].
+
// (step {"goTo":"http://localhost:8092/index.html"})
. Check that the page prefers the dark color scheme and reduced motion.
+
// (step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);","output":"true"}})
+
// (step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);","output":"true"}})
. Check that the page's language is `de-DE` and its time zone is `Europe/Berlin`.
+
// (step {"runBrowserScript":{"script":"return navigator.language;","output":"de-DE"}})
+
// (step {"runBrowserScript":{"script":"return Intl.DateTimeFormat().resolvedOptions().timeZone;","output":"Europe/Berlin"}})
. Check that the device pixel ratio is `2`, and that the clock reads December 3, 2026, 09:00 UTC.
+
// (step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"2"}})
+
// (step {"runBrowserScript":{"script":"return new Date().toISOString();","output":"/^2026-12-03T09:00/"}})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check what the page sees in an emulated browser</title></head>
<body>
<!-- test {"testId":"sessions-contexts","detectSteps":false,"runOn":[{"contextId":"sessions-emulated-chrome","platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"colorScheme":"dark","locale":"de-DE","timezone":"Europe/Berlin","deviceScaleFactor":2,"reducedMotion":"reduce","clock":"2026-12-03T09:00:00Z"}}]} -->
<h1>Check what the page sees in an emulated browser</h1>
<p>Run these steps in headless Chrome set to dark mode, German, Berlin time, a 2x display, reduced motion, and a fixed clock.</p>
<ol>
  <li>Start at <a href="http://localhost:8092/index.html">the test site's home page</a>.
    <!-- step {"goTo":"http://localhost:8092/index.html"} --></li>
  <li>Check that the page prefers the dark color scheme and reduced motion.
    <!-- step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);","output":"true"}} -->
    <!-- step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);","output":"true"}} --></li>
  <li>Check that the page's language is <code>de-DE</code> and its time zone is <code>Europe/Berlin</code>.
    <!-- step {"runBrowserScript":{"script":"return navigator.language;","output":"de-DE"}} -->
    <!-- step {"runBrowserScript":{"script":"return Intl.DateTimeFormat().resolvedOptions().timeZone;","output":"Europe/Berlin"}} --></li>
  <li>Check that the device pixel ratio is <code>2</code>, and that the clock reads December 3, 2026, 09:00 UTC.
    <!-- step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"2"}} -->
    <!-- step {"runBrowserScript":{"script":"return new Date().toISOString();","output":"/^2026-12-03T09:00/"}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check what the page sees in an emulated browser
===============================================

.. test {"testId":"sessions-contexts","detectSteps":false,"runOn":[{"contextId":"sessions-emulated-chrome","platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"colorScheme":"dark","locale":"de-DE","timezone":"Europe/Berlin","deviceScaleFactor":2,"reducedMotion":"reduce","clock":"2026-12-03T09:00:00Z"}}]}

Run these steps in headless Chrome set to dark mode, German, Berlin time, a 2x display, reduced motion, and a fixed clock.

#. Start at `the test site's home page <http://localhost:8092/index.html>`__.

   .. step {"goTo":"http://localhost:8092/index.html"}

#. Check that the page prefers the dark color scheme and reduced motion.

   .. step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);","output":"true"}}

   .. step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);","output":"true"}}

#. Check that the page's language is ``de-DE`` and its time zone is ``Europe/Berlin``.

   .. step {"runBrowserScript":{"script":"return navigator.language;","output":"de-DE"}}

   .. step {"runBrowserScript":{"script":"return Intl.DateTimeFormat().resolvedOptions().timeZone;","output":"Europe/Berlin"}}

#. Check that the device pixel ratio is ``2``, and that the clock reads December 3, 2026, 09:00 UTC.

   .. step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"2"}}

   .. step {"runBrowserScript":{"script":"return new Date().toISOString();","output":"/^2026-12-03T09:00/"}}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-contexts">
  <title>Check what the page sees in an emulated browser</title>
  <taskbody>
    <context><p>Run these steps in headless Chrome set to dark mode, German, Berlin time, a 2x display, reduced motion, and a fixed clock.</p></context>
    <data name="doc-detective" value='test {"testId":"sessions-contexts","detectSteps":false,"runOn":[{"contextId":"sessions-emulated-chrome","platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"colorScheme":"dark","locale":"de-DE","timezone":"Europe/Berlin","deviceScaleFactor":2,"reducedMotion":"reduce","clock":"2026-12-03T09:00:00Z"}}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/index.html" scope="external" format="html">the test site's home page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/index.html"}'/></info></step>
      <step><cmd>Check that the page prefers the dark color scheme and reduced motion.</cmd>
        <info><data name="doc-detective" value='step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);","output":"true"}}'/><data name="doc-detective" value='step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);","output":"true"}}'/></info></step>
      <step><cmd>Check that the page's language is <codeph>de-DE</codeph> and its time zone is <codeph>Europe/Berlin</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"runBrowserScript":{"script":"return navigator.language;","output":"de-DE"}}'/><data name="doc-detective" value='step {"runBrowserScript":{"script":"return Intl.DateTimeFormat().resolvedOptions().timeZone;","output":"Europe/Berlin"}}'/></info></step>
      <step><cmd>Check that the device pixel ratio is <codeph>2</codeph>, and that the clock reads December 3, 2026, 09:00 UTC.</cmd>
        <info><data name="doc-detective" value='step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"2"}}'/><data name="doc-detective" value='step {"runBrowserScript":{"script":"return new Date().toISOString();","output":"/^2026-12-03T09:00/"}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-contexts",
      "runOn": [
        {
          "contextId": "sessions-emulated-chrome",
          "platforms": [
            "linux",
            "mac",
            "windows"
          ],
          "browsers": {
            "name": "chrome",
            "headless": true,
            "colorScheme": "dark",
            "locale": "de-DE",
            "timezone": "Europe/Berlin",
            "deviceScaleFactor": 2,
            "reducedMotion": "reduce",
            "clock": "2026-12-03T09:00:00Z"
          }
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/index.html"
        },
        {
          "runBrowserScript": {
            "script": "return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);",
            "output": "true"
          }
        },
        {
          "runBrowserScript": {
            "script": "return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);",
            "output": "true"
          }
        },
        {
          "runBrowserScript": {
            "script": "return navigator.language;",
            "output": "de-DE"
          }
        },
        {
          "runBrowserScript": {
            "script": "return Intl.DateTimeFormat().resolvedOptions().timeZone;",
            "output": "Europe/Berlin"
          }
        },
        {
          "runBrowserScript": {
            "script": "return String(devicePixelRatio);",
            "output": "2"
          }
        },
        {
          "runBrowserScript": {
            "script": "return new Date().toISOString();",
            "output": "/^2026-12-03T09:00/"
          }
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-contexts
    runOn:
      - contextId: sessions-emulated-chrome
        platforms:
          - linux
          - mac
          - windows
        browsers:
          name: chrome
          headless: true
          colorScheme: dark
          locale: de-DE
          timezone: Europe/Berlin
          deviceScaleFactor: 2
          reducedMotion: reduce
          clock: 2026-12-03T09:00:00Z
    steps:
      - goTo: http://localhost:8092/index.html
      - runBrowserScript:
          script: 'return String(matchMedia("(prefers-color-scheme: dark)").matches);'
          output: "true"
      - runBrowserScript:
          script: 'return String(matchMedia("(prefers-reduced-motion: reduce)").matches);'
          output: "true"
      - runBrowserScript:
          script: return navigator.language;
          output: de-DE
      - runBrowserScript:
          script: return Intl.DateTimeFormat().resolvedOptions().timeZone;
          output: Europe/Berlin
      - runBrowserScript:
          script: return String(devicePixelRatio);
          output: "2"
      - runBrowserScript:
          script: return new Date().toISOString();
          output: /^2026-12-03T09:00/
```

Chrome sets every one of these keys. Firefox sets all but `timezone` and `clock`, and skips a context that asks for either. See [Platforms and browsers](/docs/test-docs/platforms-and-browsers).

### What detection finds

The only link comes after `Start at`, which isn't a navigation verb, so detection adds a `checkLink` step, and a `goTo` statement opens the page.

## Test pages on your own site

This procedure gives [`goTo`](/docs/actions/goto) paths rather than full URLs. The config's `origin` supplies the scheme and host, and `originParams` adds query parameters to each URL it builds.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Test pages on your own site

These steps use paths, not full URLs. The run's config sets the site's origin.

1. Go to `/cookies/set/sessions_origin/visited`.
2. Go to `/cookies`, and check that the page shows `sessions_origin=visited`.
3. Go to `/api/echo`, and check that the response echoes the `from` parameter that the config adds: `"from":"docs"`.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Test pages on your own site

These steps use paths, not full URLs. The run's config sets the site's origin.

1. Go to `/cookies/set/sessions_origin/visited`.
2. Go to `/cookies`, and check that the page shows `sessions_origin=visited`.
3. Go to `/api/echo`, and check that the response echoes the `from` parameter that the config adds: `"from":"docs"`.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Test pages on your own site

These steps use paths, not full URLs. The run's config sets the site's origin.

. Go to `/cookies/set/sessions_origin/visited`.
. Go to `/cookies`, and check that the page shows `sessions_origin=visited`.
. Go to `/api/echo`, and check that the response echoes the `from` parameter that the config adds: `"from":"docs"`.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Test pages on your own site</title></head>
<body>
<h1>Test pages on your own site</h1>
<p>These steps use paths, not full URLs. The run's config sets the site's origin.</p>
<ol>
  <li>Go to <code>/cookies/set/sessions_origin/visited</code>.</li>
  <li>Go to <code>/cookies</code>, and check that the page shows <code>sessions_origin=visited</code>.</li>
  <li>Go to <code>/api/echo</code>, and check that the response echoes the <code>from</code> parameter that the config adds: <code>"from":"docs"</code>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Test pages on your own site
===========================

These steps use paths, not full URLs. The run's config sets the site's origin.

#. Go to ``/cookies/set/sessions_origin/visited``.

#. Go to ``/cookies``, and check that the page shows ``sessions_origin=visited``.

#. Go to ``/api/echo``, and check that the response echoes the ``from`` parameter that the config adds: ``"from":"docs"``.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-origin">
  <title>Test pages on your own site</title>
  <taskbody>
    <context><p>These steps use paths, not full URLs. The run's config sets the site's origin.</p></context>
    <steps>
      <step><cmd>Go to <codeph>/cookies/set/sessions_origin/visited</codeph>.</cmd></step>
      <step><cmd>Go to <codeph>/cookies</codeph>, and check that the page shows <codeph>sessions_origin=visited</codeph>.</cmd></step>
      <step><cmd>Go to <codeph>/api/echo</codeph>, and check that the response echoes the <codeph>from</codeph> parameter that the config adds: <codeph>"from":"docs"</codeph>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-origin","detectSteps":true,"runOn":[{"platforms":["linux","mac"],"browsers":"chrome","requires":{"env":["SESSIONS_ORIGIN"]}}]} -->

# Test pages on your own site

These steps use paths, not full URLs. The run's config sets the site's origin.

1. Go to `/cookies/set/sessions_origin/visited`.
   <!-- step {"goTo":"/cookies/set/sessions_origin/visited"} -->
2. Go to `/cookies`, and check that the page shows `sessions_origin=visited`.
   <!-- step {"goTo":"/cookies"} -->
   <!-- step {"find":"sessions_origin=visited"} -->
3. Go to `/api/echo`, and check that the response echoes the `from` parameter that the config adds: `"from":"docs"`.
   <!-- step {"goTo":"/api/echo"} -->
   <!-- step {"find":"/\"from\":\"docs\"/"} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-origin","detectSteps":true,"runOn":[{"platforms":["linux","mac"],"browsers":"chrome","requires":{"env":["SESSIONS_ORIGIN"]}}]} */}

# Test pages on your own site

These steps use paths, not full URLs. The run's config sets the site's origin.

1. Go to `/cookies/set/sessions_origin/visited`.
   {/* step {"goTo":"/cookies/set/sessions_origin/visited"} */}
2. Go to `/cookies`, and check that the page shows `sessions_origin=visited`.
   {/* step {"goTo":"/cookies"} */}
   {/* step {"find":"sessions_origin=visited"} */}
3. Go to `/api/echo`, and check that the response echoes the `from` parameter that the config adds: `"from":"docs"`.
   {/* step {"goTo":"/api/echo"} */}
   {/* step {"find":"/\"from\":\"docs\"/"} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Test pages on your own site

// (test {"testId":"sessions-origin","detectSteps":true,"runOn":[{"platforms":["linux","mac"],"browsers":"chrome","requires":{"env":["SESSIONS_ORIGIN"]}}]})

These steps use paths, not full URLs. The run's config sets the site's origin.

. Go to `/cookies/set/sessions_origin/visited`.
+
// (step {"goTo":"/cookies/set/sessions_origin/visited"})
. Go to `/cookies`, and check that the page shows `sessions_origin=visited`.
+
// (step {"goTo":"/cookies"})
+
// (step {"find":"sessions_origin=visited"})
. Go to `/api/echo`, and check that the response echoes the `from` parameter that the config adds: `"from":"docs"`.
+
// (step {"goTo":"/api/echo"})
+
// (step {"find":"/\"from\":\"docs\"/"})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Test pages on your own site</title></head>
<body>
<!-- test {"testId":"sessions-origin","detectSteps":true,"runOn":[{"platforms":["linux","mac"],"browsers":"chrome","requires":{"env":["SESSIONS_ORIGIN"]}}]} -->
<h1>Test pages on your own site</h1>
<p>These steps use paths, not full URLs. The run's config sets the site's origin.</p>
<ol>
  <li>Go to <code>/cookies/set/sessions_origin/visited</code>.
    <!-- step {"goTo":"/cookies/set/sessions_origin/visited"} --></li>
  <li>Go to <code>/cookies</code>, and check that the page shows <code>sessions_origin=visited</code>.
    <!-- step {"goTo":"/cookies"} -->
    <!-- step {"find":"sessions_origin=visited"} --></li>
  <li>Go to <code>/api/echo</code>, and check that the response echoes the <code>from</code> parameter that the config adds: <code>"from":"docs"</code>.
    <!-- step {"goTo":"/api/echo"} -->
    <!-- step {"find":"/\"from\":\"docs\"/"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Test pages on your own site
===========================

.. test {"testId":"sessions-origin","detectSteps":true,"runOn":[{"platforms":["linux","mac"],"browsers":"chrome","requires":{"env":["SESSIONS_ORIGIN"]}}]}

These steps use paths, not full URLs. The run's config sets the site's origin.

#. Go to ``/cookies/set/sessions_origin/visited``.

   .. step {"goTo":"/cookies/set/sessions_origin/visited"}

#. Go to ``/cookies``, and check that the page shows ``sessions_origin=visited``.

   .. step {"goTo":"/cookies"}

   .. step {"find":"sessions_origin=visited"}

#. Go to ``/api/echo``, and check that the response echoes the ``from`` parameter that the config adds: ``"from":"docs"``.

   .. step {"goTo":"/api/echo"}

   .. step {"find":"/\"from\":\"docs\"/"}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-origin">
  <title>Test pages on your own site</title>
  <taskbody>
    <context><p>These steps use paths, not full URLs. The run's config sets the site's origin.</p></context>
    <data name="doc-detective" value='test {"testId":"sessions-origin","detectSteps":true,"runOn":[{"platforms":["linux","mac"],"browsers":"chrome","requires":{"env":["SESSIONS_ORIGIN"]}}]}'/>
    <steps>
      <step><cmd>Go to <codeph>/cookies/set/sessions_origin/visited</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"/cookies/set/sessions_origin/visited"}'/></info></step>
      <step><cmd>Go to <codeph>/cookies</codeph>, and check that the page shows <codeph>sessions_origin=visited</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"/cookies"}'/><data name="doc-detective" value='step {"find":"sessions_origin=visited"}'/></info></step>
      <step><cmd>Go to <codeph>/api/echo</codeph>, and check that the response echoes the <codeph>from</codeph> parameter that the config adds: <codeph>"from":"docs"</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"/api/echo"}'/><data name="doc-detective" value='step {"find":"/\"from\":\"docs\"/"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-origin","detectSteps":false,"runOn":[{"platforms":["linux","mac"],"browsers":"chrome","requires":{"env":["SESSIONS_ORIGIN"]}}]} -->

# Test pages on your own site

These steps use paths, not full URLs. The run's config sets the site's origin.

1. Go to `/cookies/set/sessions_origin/visited`.
   <!-- step {"goTo":"/cookies/set/sessions_origin/visited"} -->
2. Go to `/cookies`, and check that the page shows `sessions_origin=visited`.
   <!-- step {"goTo":"/cookies"} -->
   <!-- step {"find":"sessions_origin=visited"} -->
3. Go to `/api/echo`, and check that the response echoes the `from` parameter that the config adds: `"from":"docs"`.
   <!-- step {"goTo":"/api/echo"} -->
   <!-- step {"find":"/\"from\":\"docs\"/"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-origin","detectSteps":false,"runOn":[{"platforms":["linux","mac"],"browsers":"chrome","requires":{"env":["SESSIONS_ORIGIN"]}}]} */}

# Test pages on your own site

These steps use paths, not full URLs. The run's config sets the site's origin.

1. Go to `/cookies/set/sessions_origin/visited`.
   {/* step {"goTo":"/cookies/set/sessions_origin/visited"} */}
2. Go to `/cookies`, and check that the page shows `sessions_origin=visited`.
   {/* step {"goTo":"/cookies"} */}
   {/* step {"find":"sessions_origin=visited"} */}
3. Go to `/api/echo`, and check that the response echoes the `from` parameter that the config adds: `"from":"docs"`.
   {/* step {"goTo":"/api/echo"} */}
   {/* step {"find":"/\"from\":\"docs\"/"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Test pages on your own site

// (test {"testId":"sessions-origin","detectSteps":false,"runOn":[{"platforms":["linux","mac"],"browsers":"chrome","requires":{"env":["SESSIONS_ORIGIN"]}}]})

These steps use paths, not full URLs. The run's config sets the site's origin.

. Go to `/cookies/set/sessions_origin/visited`.
+
// (step {"goTo":"/cookies/set/sessions_origin/visited"})
. Go to `/cookies`, and check that the page shows `sessions_origin=visited`.
+
// (step {"goTo":"/cookies"})
+
// (step {"find":"sessions_origin=visited"})
. Go to `/api/echo`, and check that the response echoes the `from` parameter that the config adds: `"from":"docs"`.
+
// (step {"goTo":"/api/echo"})
+
// (step {"find":"/\"from\":\"docs\"/"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Test pages on your own site</title></head>
<body>
<!-- test {"testId":"sessions-origin","detectSteps":false,"runOn":[{"platforms":["linux","mac"],"browsers":"chrome","requires":{"env":["SESSIONS_ORIGIN"]}}]} -->
<h1>Test pages on your own site</h1>
<p>These steps use paths, not full URLs. The run's config sets the site's origin.</p>
<ol>
  <li>Go to <code>/cookies/set/sessions_origin/visited</code>.
    <!-- step {"goTo":"/cookies/set/sessions_origin/visited"} --></li>
  <li>Go to <code>/cookies</code>, and check that the page shows <code>sessions_origin=visited</code>.
    <!-- step {"goTo":"/cookies"} -->
    <!-- step {"find":"sessions_origin=visited"} --></li>
  <li>Go to <code>/api/echo</code>, and check that the response echoes the <code>from</code> parameter that the config adds: <code>"from":"docs"</code>.
    <!-- step {"goTo":"/api/echo"} -->
    <!-- step {"find":"/\"from\":\"docs\"/"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Test pages on your own site
===========================

.. test {"testId":"sessions-origin","detectSteps":false,"runOn":[{"platforms":["linux","mac"],"browsers":"chrome","requires":{"env":["SESSIONS_ORIGIN"]}}]}

These steps use paths, not full URLs. The run's config sets the site's origin.

#. Go to ``/cookies/set/sessions_origin/visited``.

   .. step {"goTo":"/cookies/set/sessions_origin/visited"}

#. Go to ``/cookies``, and check that the page shows ``sessions_origin=visited``.

   .. step {"goTo":"/cookies"}

   .. step {"find":"sessions_origin=visited"}

#. Go to ``/api/echo``, and check that the response echoes the ``from`` parameter that the config adds: ``"from":"docs"``.

   .. step {"goTo":"/api/echo"}

   .. step {"find":"/\"from\":\"docs\"/"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-origin">
  <title>Test pages on your own site</title>
  <taskbody>
    <context><p>These steps use paths, not full URLs. The run's config sets the site's origin.</p></context>
    <data name="doc-detective" value='test {"testId":"sessions-origin","detectSteps":false,"runOn":[{"platforms":["linux","mac"],"browsers":"chrome","requires":{"env":["SESSIONS_ORIGIN"]}}]}'/>
    <steps>
      <step><cmd>Go to <codeph>/cookies/set/sessions_origin/visited</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"/cookies/set/sessions_origin/visited"}'/></info></step>
      <step><cmd>Go to <codeph>/cookies</codeph>, and check that the page shows <codeph>sessions_origin=visited</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"/cookies"}'/><data name="doc-detective" value='step {"find":"sessions_origin=visited"}'/></info></step>
      <step><cmd>Go to <codeph>/api/echo</codeph>, and check that the response echoes the <codeph>from</codeph> parameter that the config adds: <codeph>"from":"docs"</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"/api/echo"}'/><data name="doc-detective" value='step {"find":"/\"from\":\"docs\"/"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-origin",
      "runOn": [
        {
          "platforms": [
            "linux",
            "mac"
          ],
          "browsers": "chrome",
          "requires": {
            "env": [
              "SESSIONS_ORIGIN"
            ]
          }
        }
      ],
      "steps": [
        {
          "goTo": "/cookies/set/sessions_origin/visited"
        },
        {
          "goTo": "/cookies"
        },
        {
          "find": "sessions_origin=visited"
        },
        {
          "goTo": "/api/echo"
        },
        {
          "find": "/\"from\":\"docs\"/"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-origin
    runOn:
      - platforms:
          - linux
          - mac
        browsers: chrome
        requires:
          env:
            - SESSIONS_ORIGIN
    steps:
      - goTo: /cookies/set/sessions_origin/visited
      - goTo: /cookies
      - find: sessions_origin=visited
      - goTo: /api/echo
      - find: /"from":"docs"/
```

### This example's config

The example's folder holds a `doc-detective.json` and the `sessions.env` file it loads:

**`doc-detective.json`**

```json title="doc-detective.json"
{
  "detectSteps": true,
  "loadVariables": "sessions.env",
  "origin": "$SESSIONS_ORIGIN",
  "originParams": {
    "from": "docs"
  }
}
```

**`sessions.env`**

```bash title="sessions.env"
SESSIONS_ORIGIN=http://localhost:8092
```

`loadVariables` resolves against the config file's folder, and `origin` reads the variable the file sets. The `/api/echo` endpoint returns the query parameters it gets, so the last check passes only when the config adds `from=docs`.

The test's context `requires` the `SESSIONS_ORIGIN` variable. A run with another config, which can't resolve the paths, skips the test rather than failing it.

### What detection finds

The paths are code, not links, so detection adds no steps. Statements hold every step.

## Evaluate expressions in the Node.js REPL

One procedure starts a process with [`runShell`](/docs/actions/runshell) and `background`. The others use [`startSurface`](/docs/actions/startsurface) with a [process descriptor](/reference/schemas/process-descriptor) (one of them passes an array of descriptors). Each then sends keys with [`type`](/docs/actions/type) to a [process surface](/reference/schemas/process-surface) and closes it with [`closeSurface`](/docs/actions/closesurface). The contexts use [`requires`](/reference/schemas/requirements) to skip a test where `node` isn't installed.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Evaluate expressions in the Node.js REPL

## Start the REPL as a surface

1. Start `node -i` in a terminal as a process named `sessions-repl`, and wait for the `>` prompt.
2. In the REPL, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
3. Close the REPL.

## Run the REPL in the background

1. Run `node -i` in the background as a process named `sessions-bg-repl`, and wait for the `>` prompt.
2. In the REPL, enter `Math.pow(2, 10)` and press Enter. Wait at least half a second, and until the REPL prints `1024`.
3. Close the REPL.

## Start a server and a REPL together

1. From the `docs/actions` folder, start `node simple-json-server.cjs` as `sessions-api`, and wait until port `8087` answers. At the same time, start `node -i` in a 100 by 30 terminal as `sessions-client`, and give it a second to start.
2. In the REPL, fetch the server's root URL, and wait for it to print `ok`.
3. Close the REPL and the server.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Evaluate expressions in the Node.js REPL

## Start the REPL as a surface

1. Start `node -i` in a terminal as a process named `sessions-repl`, and wait for the `>` prompt.
2. In the REPL, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
3. Close the REPL.

## Run the REPL in the background

1. Run `node -i` in the background as a process named `sessions-bg-repl`, and wait for the `>` prompt.
2. In the REPL, enter `Math.pow(2, 10)` and press Enter. Wait at least half a second, and until the REPL prints `1024`.
3. Close the REPL.

## Start a server and a REPL together

1. From the `docs/actions` folder, start `node simple-json-server.cjs` as `sessions-api`, and wait until port `8087` answers. At the same time, start `node -i` in a 100 by 30 terminal as `sessions-client`, and give it a second to start.
2. In the REPL, fetch the server's root URL, and wait for it to print `ok`.
3. Close the REPL and the server.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Evaluate expressions in the Node.js REPL

== Start the REPL as a surface

. Start `node -i` in a terminal as a process named `sessions-repl`, and wait for the `>` prompt.
. In the REPL, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
. Close the REPL.

== Run the REPL in the background

. Run `node -i` in the background as a process named `sessions-bg-repl`, and wait for the `>` prompt.
. In the REPL, enter `Math.pow(2, 10)` and press Enter. Wait at least half a second, and until the REPL prints `1024`.
. Close the REPL.

== Start a server and a REPL together

. From the `docs/actions` folder, start `node simple-json-server.cjs` as `sessions-api`, and wait until port `8087` answers. At the same time, start `node -i` in a 100 by 30 terminal as `sessions-client`, and give it a second to start.
. In the REPL, fetch the server's root URL, and wait for it to print `ok`.
. Close the REPL and the server.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Evaluate expressions in the Node.js REPL</title></head>
<body>
<h1>Evaluate expressions in the Node.js REPL</h1>
<h2>Start the REPL as a surface</h2>
<ol>
  <li>Start <code>node -i</code> in a terminal as a process named <code>sessions-repl</code>, and wait for the <code>&gt;</code> prompt.</li>
  <li>In the REPL, enter <code>40 + 2</code> and press Enter. Wait for the REPL to print <code>42</code>.</li>
  <li>Close the REPL.</li>
</ol>
<h2>Run the REPL in the background</h2>
<ol>
  <li>Run <code>node -i</code> in the background as a process named <code>sessions-bg-repl</code>, and wait for the <code>&gt;</code> prompt.</li>
  <li>In the REPL, enter <code>Math.pow(2, 10)</code> and press Enter. Wait at least half a second, and until the REPL prints <code>1024</code>.</li>
  <li>Close the REPL.</li>
</ol>
<h2>Start a server and a REPL together</h2>
<ol>
  <li>From the <code>docs/actions</code> folder, start <code>node simple-json-server.cjs</code> as <code>sessions-api</code>, and wait until port <code>8087</code> answers. At the same time, start <code>node -i</code> in a 100 by 30 terminal as <code>sessions-client</code>, and give it a second to start.</li>
  <li>In the REPL, fetch the server's root URL, and wait for it to print <code>ok</code>.</li>
  <li>Close the REPL and the server.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Evaluate expressions in the Node.js REPL
========================================

Start the REPL as a surface
---------------------------

#. Start ``node -i`` in a terminal as a process named ``sessions-repl``, and wait for the ``>`` prompt.

#. In the REPL, enter ``40 + 2`` and press Enter. Wait for the REPL to print ``42``.

#. Close the REPL.

Run the REPL in the background
------------------------------

#. Run ``node -i`` in the background as a process named ``sessions-bg-repl``, and wait for the ``>`` prompt.

#. In the REPL, enter ``Math.pow(2, 10)`` and press Enter. Wait at least half a second, and until the REPL prints ``1024``.

#. Close the REPL.

Start a server and a REPL together
----------------------------------

#. From the ``docs/actions`` folder, start ``node simple-json-server.cjs`` as ``sessions-api``, and wait until port ``8087`` answers. At the same time, start ``node -i`` in a 100 by 30 terminal as ``sessions-client``, and give it a second to start.

#. In the REPL, fetch the server's root URL, and wait for it to print ``ok``.

#. Close the REPL and the server.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dita PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<dita>
  <topic id="sessions-process">
    <title>Evaluate expressions in the Node.js REPL</title>
  </topic>
  <task id="sessions-process-surface">
    <title>Start the REPL as a surface</title>
    <taskbody>
      <steps>
        <step><cmd>Start <codeph>node -i</codeph> in a terminal as a process named <codeph>sessions-repl</codeph>, and wait for the <codeph>&gt;</codeph> prompt.</cmd></step>
        <step><cmd>In the REPL, enter <codeph>40 + 2</codeph> and press Enter. Wait for the REPL to print <codeph>42</codeph>.</cmd></step>
        <step><cmd>Close the REPL.</cmd></step>
      </steps>
    </taskbody>
  </task>
  <task id="sessions-process-background">
    <title>Run the REPL in the background</title>
    <taskbody>
      <steps>
        <step><cmd>Run <codeph>node -i</codeph> in the background as a process named <codeph>sessions-bg-repl</codeph>, and wait for the <codeph>&gt;</codeph> prompt.</cmd></step>
        <step><cmd>In the REPL, enter <codeph>Math.pow(2, 10)</codeph> and press Enter. Wait at least half a second, and until the REPL prints <codeph>1024</codeph>.</cmd></step>
        <step><cmd>Close the REPL.</cmd></step>
      </steps>
    </taskbody>
  </task>
  <task id="sessions-process-server">
    <title>Start a server and a REPL together</title>
    <taskbody>
      <steps>
        <step><cmd>From the <codeph>docs/actions</codeph> folder, start <codeph>node simple-json-server.cjs</codeph> as <codeph>sessions-api</codeph>, and wait until port <codeph>8087</codeph> answers. At the same time, start <codeph>node -i</codeph> in a 100 by 30 terminal as <codeph>sessions-client</codeph>, and give it a second to start.</cmd></step>
        <step><cmd>In the REPL, fetch the server's root URL, and wait for it to print <codeph>ok</codeph>.</cmd></step>
        <step><cmd>Close the REPL and the server.</cmd></step>
      </steps>
    </taskbody>
  </task>
</dita>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
# Evaluate expressions in the Node.js REPL

## Start the REPL as a surface

<!-- test {"testId":"sessions-process-surface","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]} -->

1. Start `node -i` in a terminal as a process named `sessions-repl`, and wait for the `>` prompt.
   <!-- step {"startSurface":{"process":"node","args":["-i"],"name":"sessions-repl","tty":true,"waitUntil":{"stdio":"/>/"},"timeout":30000}} -->
2. In the REPL, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
   <!-- step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-repl","waitUntil":{"stdio":"/42/"},"timeout":10000}} -->
3. Close the REPL.
   <!-- step {"closeSurface":{"process":"sessions-repl"}} -->

<!-- test end -->

## Run the REPL in the background

<!-- test {"testId":"sessions-process-background","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":{"commands":["node"],"env":["PATH"]}}]} -->

1. Run `node -i` in the background as a process named `sessions-bg-repl`, and wait for the `>` prompt.
   <!-- step {"runShell":{"command":"node -i","background":{"name":"sessions-bg-repl","waitUntil":{"stdio":"/>/"}},"timeout":30000}} -->
2. In the REPL, enter `Math.pow(2, 10)` and press Enter. Wait at least half a second, and until the REPL prints `1024`.
   <!-- step {"type":{"keys":["Math.pow(2, 10)","$ENTER$"],"surface":{"process":"sessions-bg-repl"},"waitUntil":{"stdio":"/1024/","delayMs":500},"timeout":10000}} -->
3. Close the REPL.
   <!-- step {"closeSurface":"sessions-bg-repl"} -->

<!-- test end -->

## Start a server and a REPL together

<!-- test {"testId":"sessions-process-server","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":["node","npm"]}]} -->

1. From the `docs/actions` folder, start `node simple-json-server.cjs` as `sessions-api`, and wait until port `8087` answers. At the same time, start `node -i` in a 100 by 30 terminal as `sessions-client`, and give it a second to start.
   <!-- step {"startSurface":[{"process":"node","args":["simple-json-server.cjs"],"name":"sessions-api","workingDirectory":"../../../fern/pages/docs/actions","waitUntil":{"port":8087,"httpGet":"http://localhost:8087"},"timeout":30000},{"process":"node","args":["-i"],"name":"sessions-client","tty":{"cols":100,"rows":30},"waitUntil":{"delayMs":1000}}]} -->
2. In the REPL, fetch the server's root URL, and wait for it to print `ok`.
   <!-- step {"type":{"keys":["fetch(\"http://localhost:8087\").then((r) => r.text()).then(console.log)","$ENTER$"],"surface":"sessions-client","waitUntil":{"stdio":"/\"status\":\"ok\"/"},"timeout":10000}} -->
3. Close the REPL and the server.
   <!-- step {"closeSurface":["sessions-client",{"process":"sessions-api"}]} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
# Evaluate expressions in the Node.js REPL

## Start the REPL as a surface

{/* test {"testId":"sessions-process-surface","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]} */}

1. Start `node -i` in a terminal as a process named `sessions-repl`, and wait for the `>` prompt.
   {/* step {"startSurface":{"process":"node","args":["-i"],"name":"sessions-repl","tty":true,"waitUntil":{"stdio":"/>/"},"timeout":30000}} */}
2. In the REPL, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
   {/* step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-repl","waitUntil":{"stdio":"/42/"},"timeout":10000}} */}
3. Close the REPL.
   {/* step {"closeSurface":{"process":"sessions-repl"}} */}

{/* test end */}

## Run the REPL in the background

{/* test {"testId":"sessions-process-background","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":{"commands":["node"],"env":["PATH"]}}]} */}

1. Run `node -i` in the background as a process named `sessions-bg-repl`, and wait for the `>` prompt.
   {/* step {"runShell":{"command":"node -i","background":{"name":"sessions-bg-repl","waitUntil":{"stdio":"/>/"}},"timeout":30000}} */}
2. In the REPL, enter `Math.pow(2, 10)` and press Enter. Wait at least half a second, and until the REPL prints `1024`.
   {/* step {"type":{"keys":["Math.pow(2, 10)","$ENTER$"],"surface":{"process":"sessions-bg-repl"},"waitUntil":{"stdio":"/1024/","delayMs":500},"timeout":10000}} */}
3. Close the REPL.
   {/* step {"closeSurface":"sessions-bg-repl"} */}

{/* test end */}

## Start a server and a REPL together

{/* test {"testId":"sessions-process-server","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":["node","npm"]}]} */}

1. From the `docs/actions` folder, start `node simple-json-server.cjs` as `sessions-api`, and wait until port `8087` answers. At the same time, start `node -i` in a 100 by 30 terminal as `sessions-client`, and give it a second to start.
   {/* step {"startSurface":[{"process":"node","args":["simple-json-server.cjs"],"name":"sessions-api","workingDirectory":"../../../fern/pages/docs/actions","waitUntil":{"port":8087,"httpGet":"http://localhost:8087"},"timeout":30000},{"process":"node","args":["-i"],"name":"sessions-client","tty":{"cols":100,"rows":30},"waitUntil":{"delayMs":1000}}]} */}
2. In the REPL, fetch the server's root URL, and wait for it to print `ok`.
   {/* step {"type":{"keys":["fetch(\"http://localhost:8087\").then((r) => r.text()).then(console.log)","$ENTER$"],"surface":"sessions-client","waitUntil":{"stdio":"/\"status\":\"ok\"/"},"timeout":10000}} */}
3. Close the REPL and the server.
   {/* step {"closeSurface":["sessions-client",{"process":"sessions-api"}]} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Evaluate expressions in the Node.js REPL

== Start the REPL as a surface

// (test {"testId":"sessions-process-surface","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]})

. Start `node -i` in a terminal as a process named `sessions-repl`, and wait for the `>` prompt.
+
// (step {"startSurface":{"process":"node","args":["-i"],"name":"sessions-repl","tty":true,"waitUntil":{"stdio":"/>/"},"timeout":30000}})
. In the REPL, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
+
// (step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-repl","waitUntil":{"stdio":"/42/"},"timeout":10000}})
. Close the REPL.
+
// (step {"closeSurface":{"process":"sessions-repl"}})

// (test end)

== Run the REPL in the background

// (test {"testId":"sessions-process-background","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":{"commands":["node"],"env":["PATH"]}}]})

. Run `node -i` in the background as a process named `sessions-bg-repl`, and wait for the `>` prompt.
+
// (step {"runShell":{"command":"node -i","background":{"name":"sessions-bg-repl","waitUntil":{"stdio":"/>/"}},"timeout":30000}})
. In the REPL, enter `Math.pow(2, 10)` and press Enter. Wait at least half a second, and until the REPL prints `1024`.
+
// (step {"type":{"keys":["Math.pow(2, 10)","$ENTER$"],"surface":{"process":"sessions-bg-repl"},"waitUntil":{"stdio":"/1024/","delayMs":500},"timeout":10000}})
. Close the REPL.
+
// (step {"closeSurface":"sessions-bg-repl"})

// (test end)

== Start a server and a REPL together

// (test {"testId":"sessions-process-server","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":["node","npm"]}]})

. From the `docs/actions` folder, start `node simple-json-server.cjs` as `sessions-api`, and wait until port `8087` answers. At the same time, start `node -i` in a 100 by 30 terminal as `sessions-client`, and give it a second to start.
+
// (step {"startSurface":[{"process":"node","args":["simple-json-server.cjs"],"name":"sessions-api","workingDirectory":"../../../fern/pages/docs/actions","waitUntil":{"port":8087,"httpGet":"http://localhost:8087"},"timeout":30000},{"process":"node","args":["-i"],"name":"sessions-client","tty":{"cols":100,"rows":30},"waitUntil":{"delayMs":1000}}]})
. In the REPL, fetch the server's root URL, and wait for it to print `ok`.
+
// (step {"type":{"keys":["fetch(\"http://localhost:8087\").then((r) => r.text()).then(console.log)","$ENTER$"],"surface":"sessions-client","waitUntil":{"stdio":"/\"status\":\"ok\"/"},"timeout":10000}})
. Close the REPL and the server.
+
// (step {"closeSurface":["sessions-client",{"process":"sessions-api"}]})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Evaluate expressions in the Node.js REPL</title></head>
<body>
<h1>Evaluate expressions in the Node.js REPL</h1>
<h2>Start the REPL as a surface</h2>
<!-- test {"testId":"sessions-process-surface","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]} -->
<ol>
  <li>Start <code>node -i</code> in a terminal as a process named <code>sessions-repl</code>, and wait for the <code>&gt;</code> prompt.
    <!-- step {"startSurface":{"process":"node","args":["-i"],"name":"sessions-repl","tty":true,"waitUntil":{"stdio":"/>/"},"timeout":30000}} --></li>
  <li>In the REPL, enter <code>40 + 2</code> and press Enter. Wait for the REPL to print <code>42</code>.
    <!-- step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-repl","waitUntil":{"stdio":"/42/"},"timeout":10000}} --></li>
  <li>Close the REPL.
    <!-- step {"closeSurface":{"process":"sessions-repl"}} --></li>
</ol>
<!-- test end -->
<h2>Run the REPL in the background</h2>
<!-- test {"testId":"sessions-process-background","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":{"commands":["node"],"env":["PATH"]}}]} -->
<ol>
  <li>Run <code>node -i</code> in the background as a process named <code>sessions-bg-repl</code>, and wait for the <code>&gt;</code> prompt.
    <!-- step {"runShell":{"command":"node -i","background":{"name":"sessions-bg-repl","waitUntil":{"stdio":"/>/"}},"timeout":30000}} --></li>
  <li>In the REPL, enter <code>Math.pow(2, 10)</code> and press Enter. Wait at least half a second, and until the REPL prints <code>1024</code>.
    <!-- step {"type":{"keys":["Math.pow(2, 10)","$ENTER$"],"surface":{"process":"sessions-bg-repl"},"waitUntil":{"stdio":"/1024/","delayMs":500},"timeout":10000}} --></li>
  <li>Close the REPL.
    <!-- step {"closeSurface":"sessions-bg-repl"} --></li>
</ol>
<!-- test end -->
<h2>Start a server and a REPL together</h2>
<!-- test {"testId":"sessions-process-server","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":["node","npm"]}]} -->
<ol>
  <li>From the <code>docs/actions</code> folder, start <code>node simple-json-server.cjs</code> as <code>sessions-api</code>, and wait until port <code>8087</code> answers. At the same time, start <code>node -i</code> in a 100 by 30 terminal as <code>sessions-client</code>, and give it a second to start.
    <!-- step {"startSurface":[{"process":"node","args":["simple-json-server.cjs"],"name":"sessions-api","workingDirectory":"../../../fern/pages/docs/actions","waitUntil":{"port":8087,"httpGet":"http://localhost:8087"},"timeout":30000},{"process":"node","args":["-i"],"name":"sessions-client","tty":{"cols":100,"rows":30},"waitUntil":{"delayMs":1000}}]} --></li>
  <li>In the REPL, fetch the server's root URL, and wait for it to print <code>ok</code>.
    <!-- step {"type":{"keys":["fetch(\"http://localhost:8087\").then((r) => r.text()).then(console.log)","$ENTER$"],"surface":"sessions-client","waitUntil":{"stdio":"/\"status\":\"ok\"/"},"timeout":10000}} --></li>
  <li>Close the REPL and the server.
    <!-- step {"closeSurface":["sessions-client",{"process":"sessions-api"}]} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Evaluate expressions in the Node.js REPL
========================================

Start the REPL as a surface
---------------------------

.. test {"testId":"sessions-process-surface","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]}

#. Start ``node -i`` in a terminal as a process named ``sessions-repl``, and wait for the ``>`` prompt.

   .. step {"startSurface":{"process":"node","args":["-i"],"name":"sessions-repl","tty":true,"waitUntil":{"stdio":"/>/"},"timeout":30000}}

#. In the REPL, enter ``40 + 2`` and press Enter. Wait for the REPL to print ``42``.

   .. step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-repl","waitUntil":{"stdio":"/42/"},"timeout":10000}}

#. Close the REPL.

   .. step {"closeSurface":{"process":"sessions-repl"}}

.. test end

Run the REPL in the background
------------------------------

.. test {"testId":"sessions-process-background","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":{"commands":["node"],"env":["PATH"]}}]}

#. Run ``node -i`` in the background as a process named ``sessions-bg-repl``, and wait for the ``>`` prompt.

   .. step {"runShell":{"command":"node -i","background":{"name":"sessions-bg-repl","waitUntil":{"stdio":"/>/"}},"timeout":30000}}

#. In the REPL, enter ``Math.pow(2, 10)`` and press Enter. Wait at least half a second, and until the REPL prints ``1024``.

   .. step {"type":{"keys":["Math.pow(2, 10)","$ENTER$"],"surface":{"process":"sessions-bg-repl"},"waitUntil":{"stdio":"/1024/","delayMs":500},"timeout":10000}}

#. Close the REPL.

   .. step {"closeSurface":"sessions-bg-repl"}

.. test end

Start a server and a REPL together
----------------------------------

.. test {"testId":"sessions-process-server","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":["node","npm"]}]}

#. From the ``docs/actions`` folder, start ``node simple-json-server.cjs`` as ``sessions-api``, and wait until port ``8087`` answers. At the same time, start ``node -i`` in a 100 by 30 terminal as ``sessions-client``, and give it a second to start.

   .. step {"startSurface":[{"process":"node","args":["simple-json-server.cjs"],"name":"sessions-api","workingDirectory":"../../../fern/pages/docs/actions","waitUntil":{"port":8087,"httpGet":"http://localhost:8087"},"timeout":30000},{"process":"node","args":["-i"],"name":"sessions-client","tty":{"cols":100,"rows":30},"waitUntil":{"delayMs":1000}}]}

#. In the REPL, fetch the server's root URL, and wait for it to print ``ok``.

   .. step {"type":{"keys":["fetch(\"http://localhost:8087\").then((r) => r.text()).then(console.log)","$ENTER$"],"surface":"sessions-client","waitUntil":{"stdio":"/\"status\":\"ok\"/"},"timeout":10000}}

#. Close the REPL and the server.

   .. step {"closeSurface":["sessions-client",{"process":"sessions-api"}]}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dita PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<dita>
  <topic id="sessions-process">
    <title>Evaluate expressions in the Node.js REPL</title>
  </topic>
  <task id="sessions-process-surface">
    <title>Start the REPL as a surface</title>
    <taskbody>
      <data name="doc-detective" value='test {"testId":"sessions-process-surface","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]}'/>
      <steps>
        <step><cmd>Start <codeph>node -i</codeph> in a terminal as a process named <codeph>sessions-repl</codeph>, and wait for the <codeph>&gt;</codeph> prompt.</cmd>
          <info><data name="doc-detective" value='step {"startSurface":{"process":"node","args":["-i"],"name":"sessions-repl","tty":true,"waitUntil":{"stdio":"/>/"},"timeout":30000}}'/></info></step>
        <step><cmd>In the REPL, enter <codeph>40 + 2</codeph> and press Enter. Wait for the REPL to print <codeph>42</codeph>.</cmd>
          <info><data name="doc-detective" value='step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-repl","waitUntil":{"stdio":"/42/"},"timeout":10000}}'/></info></step>
        <step><cmd>Close the REPL.</cmd>
          <info><data name="doc-detective" value='step {"closeSurface":{"process":"sessions-repl"}}'/></info></step>
      </steps>
      <data name="doc-detective" value="test end"/>
    </taskbody>
  </task>
  <task id="sessions-process-background">
    <title>Run the REPL in the background</title>
    <taskbody>
      <data name="doc-detective" value='test {"testId":"sessions-process-background","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":{"commands":["node"],"env":["PATH"]}}]}'/>
      <steps>
        <step><cmd>Run <codeph>node -i</codeph> in the background as a process named <codeph>sessions-bg-repl</codeph>, and wait for the <codeph>&gt;</codeph> prompt.</cmd>
          <info><data name="doc-detective" value='step {"runShell":{"command":"node -i","background":{"name":"sessions-bg-repl","waitUntil":{"stdio":"/>/"}},"timeout":30000}}'/></info></step>
        <step><cmd>In the REPL, enter <codeph>Math.pow(2, 10)</codeph> and press Enter. Wait at least half a second, and until the REPL prints <codeph>1024</codeph>.</cmd>
          <info><data name="doc-detective" value='step {"type":{"keys":["Math.pow(2, 10)","$ENTER$"],"surface":{"process":"sessions-bg-repl"},"waitUntil":{"stdio":"/1024/","delayMs":500},"timeout":10000}}'/></info></step>
        <step><cmd>Close the REPL.</cmd>
          <info><data name="doc-detective" value='step {"closeSurface":"sessions-bg-repl"}'/></info></step>
      </steps>
      <data name="doc-detective" value="test end"/>
    </taskbody>
  </task>
  <task id="sessions-process-server">
    <title>Start a server and a REPL together</title>
    <taskbody>
      <data name="doc-detective" value='test {"testId":"sessions-process-server","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":["node","npm"]}]}'/>
      <steps>
        <step><cmd>From the <codeph>docs/actions</codeph> folder, start <codeph>node simple-json-server.cjs</codeph> as <codeph>sessions-api</codeph>, and wait until port <codeph>8087</codeph> answers. At the same time, start <codeph>node -i</codeph> in a 100 by 30 terminal as <codeph>sessions-client</codeph>, and give it a second to start.</cmd>
          <info><data name="doc-detective" value='step {"startSurface":[{"process":"node","args":["simple-json-server.cjs"],"name":"sessions-api","workingDirectory":"../../../fern/pages/docs/actions","waitUntil":{"port":8087,"httpGet":"http://localhost:8087"},"timeout":30000},{"process":"node","args":["-i"],"name":"sessions-client","tty":{"cols":100,"rows":30},"waitUntil":{"delayMs":1000}}]}'/></info></step>
        <step><cmd>In the REPL, fetch the server's root URL, and wait for it to print <codeph>ok</codeph>.</cmd>
          <info><data name="doc-detective" value='step {"type":{"keys":["fetch(\"http://localhost:8087\").then((r) => r.text()).then(console.log)","$ENTER$"],"surface":"sessions-client","waitUntil":{"stdio":"/\"status\":\"ok\"/"},"timeout":10000}}'/></info></step>
        <step><cmd>Close the REPL and the server.</cmd>
          <info><data name="doc-detective" value='step {"closeSurface":["sessions-client",{"process":"sessions-api"}]}'/></info></step>
      </steps>
      <data name="doc-detective" value="test end"/>
    </taskbody>
  </task>
</dita>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
# Evaluate expressions in the Node.js REPL

## Start the REPL as a surface

<!-- test {"testId":"sessions-process-surface","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]} -->

1. Start `node -i` in a terminal as a process named `sessions-repl`, and wait for the `>` prompt.
   <!-- step {"startSurface":{"process":"node","args":["-i"],"name":"sessions-repl","tty":true,"waitUntil":{"stdio":"/>/"},"timeout":30000}} -->
2. In the REPL, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
   <!-- step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-repl","waitUntil":{"stdio":"/42/"},"timeout":10000}} -->
3. Close the REPL.
   <!-- step {"closeSurface":{"process":"sessions-repl"}} -->

<!-- test end -->

## Run the REPL in the background

<!-- test {"testId":"sessions-process-background","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":{"commands":["node"],"env":["PATH"]}}]} -->

1. Run `node -i` in the background as a process named `sessions-bg-repl`, and wait for the `>` prompt.
   <!-- step {"runShell":{"command":"node -i","background":{"name":"sessions-bg-repl","waitUntil":{"stdio":"/>/"}},"timeout":30000}} -->
2. In the REPL, enter `Math.pow(2, 10)` and press Enter. Wait at least half a second, and until the REPL prints `1024`.
   <!-- step {"type":{"keys":["Math.pow(2, 10)","$ENTER$"],"surface":{"process":"sessions-bg-repl"},"waitUntil":{"stdio":"/1024/","delayMs":500},"timeout":10000}} -->
3. Close the REPL.
   <!-- step {"closeSurface":"sessions-bg-repl"} -->

<!-- test end -->

## Start a server and a REPL together

<!-- test {"testId":"sessions-process-server","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":["node","npm"]}]} -->

1. From the `docs/actions` folder, start `node simple-json-server.cjs` as `sessions-api`, and wait until port `8087` answers. At the same time, start `node -i` in a 100 by 30 terminal as `sessions-client`, and give it a second to start.
   <!-- step {"startSurface":[{"process":"node","args":["simple-json-server.cjs"],"name":"sessions-api","workingDirectory":"../../../fern/pages/docs/actions","waitUntil":{"port":8087,"httpGet":"http://localhost:8087"},"timeout":30000},{"process":"node","args":["-i"],"name":"sessions-client","tty":{"cols":100,"rows":30},"waitUntil":{"delayMs":1000}}]} -->
2. In the REPL, fetch the server's root URL, and wait for it to print `ok`.
   <!-- step {"type":{"keys":["fetch(\"http://localhost:8087\").then((r) => r.text()).then(console.log)","$ENTER$"],"surface":"sessions-client","waitUntil":{"stdio":"/\"status\":\"ok\"/"},"timeout":10000}} -->
3. Close the REPL and the server.
   <!-- step {"closeSurface":["sessions-client",{"process":"sessions-api"}]} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
# Evaluate expressions in the Node.js REPL

## Start the REPL as a surface

{/* test {"testId":"sessions-process-surface","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]} */}

1. Start `node -i` in a terminal as a process named `sessions-repl`, and wait for the `>` prompt.
   {/* step {"startSurface":{"process":"node","args":["-i"],"name":"sessions-repl","tty":true,"waitUntil":{"stdio":"/>/"},"timeout":30000}} */}
2. In the REPL, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
   {/* step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-repl","waitUntil":{"stdio":"/42/"},"timeout":10000}} */}
3. Close the REPL.
   {/* step {"closeSurface":{"process":"sessions-repl"}} */}

{/* test end */}

## Run the REPL in the background

{/* test {"testId":"sessions-process-background","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":{"commands":["node"],"env":["PATH"]}}]} */}

1. Run `node -i` in the background as a process named `sessions-bg-repl`, and wait for the `>` prompt.
   {/* step {"runShell":{"command":"node -i","background":{"name":"sessions-bg-repl","waitUntil":{"stdio":"/>/"}},"timeout":30000}} */}
2. In the REPL, enter `Math.pow(2, 10)` and press Enter. Wait at least half a second, and until the REPL prints `1024`.
   {/* step {"type":{"keys":["Math.pow(2, 10)","$ENTER$"],"surface":{"process":"sessions-bg-repl"},"waitUntil":{"stdio":"/1024/","delayMs":500},"timeout":10000}} */}
3. Close the REPL.
   {/* step {"closeSurface":"sessions-bg-repl"} */}

{/* test end */}

## Start a server and a REPL together

{/* test {"testId":"sessions-process-server","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":["node","npm"]}]} */}

1. From the `docs/actions` folder, start `node simple-json-server.cjs` as `sessions-api`, and wait until port `8087` answers. At the same time, start `node -i` in a 100 by 30 terminal as `sessions-client`, and give it a second to start.
   {/* step {"startSurface":[{"process":"node","args":["simple-json-server.cjs"],"name":"sessions-api","workingDirectory":"../../../fern/pages/docs/actions","waitUntil":{"port":8087,"httpGet":"http://localhost:8087"},"timeout":30000},{"process":"node","args":["-i"],"name":"sessions-client","tty":{"cols":100,"rows":30},"waitUntil":{"delayMs":1000}}]} */}
2. In the REPL, fetch the server's root URL, and wait for it to print `ok`.
   {/* step {"type":{"keys":["fetch(\"http://localhost:8087\").then((r) => r.text()).then(console.log)","$ENTER$"],"surface":"sessions-client","waitUntil":{"stdio":"/\"status\":\"ok\"/"},"timeout":10000}} */}
3. Close the REPL and the server.
   {/* step {"closeSurface":["sessions-client",{"process":"sessions-api"}]} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Evaluate expressions in the Node.js REPL

== Start the REPL as a surface

// (test {"testId":"sessions-process-surface","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]})

. Start `node -i` in a terminal as a process named `sessions-repl`, and wait for the `>` prompt.
+
// (step {"startSurface":{"process":"node","args":["-i"],"name":"sessions-repl","tty":true,"waitUntil":{"stdio":"/>/"},"timeout":30000}})
. In the REPL, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
+
// (step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-repl","waitUntil":{"stdio":"/42/"},"timeout":10000}})
. Close the REPL.
+
// (step {"closeSurface":{"process":"sessions-repl"}})

// (test end)

== Run the REPL in the background

// (test {"testId":"sessions-process-background","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":{"commands":["node"],"env":["PATH"]}}]})

. Run `node -i` in the background as a process named `sessions-bg-repl`, and wait for the `>` prompt.
+
// (step {"runShell":{"command":"node -i","background":{"name":"sessions-bg-repl","waitUntil":{"stdio":"/>/"}},"timeout":30000}})
. In the REPL, enter `Math.pow(2, 10)` and press Enter. Wait at least half a second, and until the REPL prints `1024`.
+
// (step {"type":{"keys":["Math.pow(2, 10)","$ENTER$"],"surface":{"process":"sessions-bg-repl"},"waitUntil":{"stdio":"/1024/","delayMs":500},"timeout":10000}})
. Close the REPL.
+
// (step {"closeSurface":"sessions-bg-repl"})

// (test end)

== Start a server and a REPL together

// (test {"testId":"sessions-process-server","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":["node","npm"]}]})

. From the `docs/actions` folder, start `node simple-json-server.cjs` as `sessions-api`, and wait until port `8087` answers. At the same time, start `node -i` in a 100 by 30 terminal as `sessions-client`, and give it a second to start.
+
// (step {"startSurface":[{"process":"node","args":["simple-json-server.cjs"],"name":"sessions-api","workingDirectory":"../../../fern/pages/docs/actions","waitUntil":{"port":8087,"httpGet":"http://localhost:8087"},"timeout":30000},{"process":"node","args":["-i"],"name":"sessions-client","tty":{"cols":100,"rows":30},"waitUntil":{"delayMs":1000}}]})
. In the REPL, fetch the server's root URL, and wait for it to print `ok`.
+
// (step {"type":{"keys":["fetch(\"http://localhost:8087\").then((r) => r.text()).then(console.log)","$ENTER$"],"surface":"sessions-client","waitUntil":{"stdio":"/\"status\":\"ok\"/"},"timeout":10000}})
. Close the REPL and the server.
+
// (step {"closeSurface":["sessions-client",{"process":"sessions-api"}]})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Evaluate expressions in the Node.js REPL</title></head>
<body>
<h1>Evaluate expressions in the Node.js REPL</h1>
<h2>Start the REPL as a surface</h2>
<!-- test {"testId":"sessions-process-surface","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]} -->
<ol>
  <li>Start <code>node -i</code> in a terminal as a process named <code>sessions-repl</code>, and wait for the <code>&gt;</code> prompt.
    <!-- step {"startSurface":{"process":"node","args":["-i"],"name":"sessions-repl","tty":true,"waitUntil":{"stdio":"/>/"},"timeout":30000}} --></li>
  <li>In the REPL, enter <code>40 + 2</code> and press Enter. Wait for the REPL to print <code>42</code>.
    <!-- step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-repl","waitUntil":{"stdio":"/42/"},"timeout":10000}} --></li>
  <li>Close the REPL.
    <!-- step {"closeSurface":{"process":"sessions-repl"}} --></li>
</ol>
<!-- test end -->
<h2>Run the REPL in the background</h2>
<!-- test {"testId":"sessions-process-background","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":{"commands":["node"],"env":["PATH"]}}]} -->
<ol>
  <li>Run <code>node -i</code> in the background as a process named <code>sessions-bg-repl</code>, and wait for the <code>&gt;</code> prompt.
    <!-- step {"runShell":{"command":"node -i","background":{"name":"sessions-bg-repl","waitUntil":{"stdio":"/>/"}},"timeout":30000}} --></li>
  <li>In the REPL, enter <code>Math.pow(2, 10)</code> and press Enter. Wait at least half a second, and until the REPL prints <code>1024</code>.
    <!-- step {"type":{"keys":["Math.pow(2, 10)","$ENTER$"],"surface":{"process":"sessions-bg-repl"},"waitUntil":{"stdio":"/1024/","delayMs":500},"timeout":10000}} --></li>
  <li>Close the REPL.
    <!-- step {"closeSurface":"sessions-bg-repl"} --></li>
</ol>
<!-- test end -->
<h2>Start a server and a REPL together</h2>
<!-- test {"testId":"sessions-process-server","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":["node","npm"]}]} -->
<ol>
  <li>From the <code>docs/actions</code> folder, start <code>node simple-json-server.cjs</code> as <code>sessions-api</code>, and wait until port <code>8087</code> answers. At the same time, start <code>node -i</code> in a 100 by 30 terminal as <code>sessions-client</code>, and give it a second to start.
    <!-- step {"startSurface":[{"process":"node","args":["simple-json-server.cjs"],"name":"sessions-api","workingDirectory":"../../../fern/pages/docs/actions","waitUntil":{"port":8087,"httpGet":"http://localhost:8087"},"timeout":30000},{"process":"node","args":["-i"],"name":"sessions-client","tty":{"cols":100,"rows":30},"waitUntil":{"delayMs":1000}}]} --></li>
  <li>In the REPL, fetch the server's root URL, and wait for it to print <code>ok</code>.
    <!-- step {"type":{"keys":["fetch(\"http://localhost:8087\").then((r) => r.text()).then(console.log)","$ENTER$"],"surface":"sessions-client","waitUntil":{"stdio":"/\"status\":\"ok\"/"},"timeout":10000}} --></li>
  <li>Close the REPL and the server.
    <!-- step {"closeSurface":["sessions-client",{"process":"sessions-api"}]} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Evaluate expressions in the Node.js REPL
========================================

Start the REPL as a surface
---------------------------

.. test {"testId":"sessions-process-surface","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]}

#. Start ``node -i`` in a terminal as a process named ``sessions-repl``, and wait for the ``>`` prompt.

   .. step {"startSurface":{"process":"node","args":["-i"],"name":"sessions-repl","tty":true,"waitUntil":{"stdio":"/>/"},"timeout":30000}}

#. In the REPL, enter ``40 + 2`` and press Enter. Wait for the REPL to print ``42``.

   .. step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-repl","waitUntil":{"stdio":"/42/"},"timeout":10000}}

#. Close the REPL.

   .. step {"closeSurface":{"process":"sessions-repl"}}

.. test end

Run the REPL in the background
------------------------------

.. test {"testId":"sessions-process-background","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":{"commands":["node"],"env":["PATH"]}}]}

#. Run ``node -i`` in the background as a process named ``sessions-bg-repl``, and wait for the ``>`` prompt.

   .. step {"runShell":{"command":"node -i","background":{"name":"sessions-bg-repl","waitUntil":{"stdio":"/>/"}},"timeout":30000}}

#. In the REPL, enter ``Math.pow(2, 10)`` and press Enter. Wait at least half a second, and until the REPL prints ``1024``.

   .. step {"type":{"keys":["Math.pow(2, 10)","$ENTER$"],"surface":{"process":"sessions-bg-repl"},"waitUntil":{"stdio":"/1024/","delayMs":500},"timeout":10000}}

#. Close the REPL.

   .. step {"closeSurface":"sessions-bg-repl"}

.. test end

Start a server and a REPL together
----------------------------------

.. test {"testId":"sessions-process-server","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":["node","npm"]}]}

#. From the ``docs/actions`` folder, start ``node simple-json-server.cjs`` as ``sessions-api``, and wait until port ``8087`` answers. At the same time, start ``node -i`` in a 100 by 30 terminal as ``sessions-client``, and give it a second to start.

   .. step {"startSurface":[{"process":"node","args":["simple-json-server.cjs"],"name":"sessions-api","workingDirectory":"../../../fern/pages/docs/actions","waitUntil":{"port":8087,"httpGet":"http://localhost:8087"},"timeout":30000},{"process":"node","args":["-i"],"name":"sessions-client","tty":{"cols":100,"rows":30},"waitUntil":{"delayMs":1000}}]}

#. In the REPL, fetch the server's root URL, and wait for it to print ``ok``.

   .. step {"type":{"keys":["fetch(\"http://localhost:8087\").then((r) => r.text()).then(console.log)","$ENTER$"],"surface":"sessions-client","waitUntil":{"stdio":"/\"status\":\"ok\"/"},"timeout":10000}}

#. Close the REPL and the server.

   .. step {"closeSurface":["sessions-client",{"process":"sessions-api"}]}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dita PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<dita>
  <topic id="sessions-process">
    <title>Evaluate expressions in the Node.js REPL</title>
  </topic>
  <task id="sessions-process-surface">
    <title>Start the REPL as a surface</title>
    <taskbody>
      <data name="doc-detective" value='test {"testId":"sessions-process-surface","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]}'/>
      <steps>
        <step><cmd>Start <codeph>node -i</codeph> in a terminal as a process named <codeph>sessions-repl</codeph>, and wait for the <codeph>&gt;</codeph> prompt.</cmd>
          <info><data name="doc-detective" value='step {"startSurface":{"process":"node","args":["-i"],"name":"sessions-repl","tty":true,"waitUntil":{"stdio":"/>/"},"timeout":30000}}'/></info></step>
        <step><cmd>In the REPL, enter <codeph>40 + 2</codeph> and press Enter. Wait for the REPL to print <codeph>42</codeph>.</cmd>
          <info><data name="doc-detective" value='step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-repl","waitUntil":{"stdio":"/42/"},"timeout":10000}}'/></info></step>
        <step><cmd>Close the REPL.</cmd>
          <info><data name="doc-detective" value='step {"closeSurface":{"process":"sessions-repl"}}'/></info></step>
      </steps>
      <data name="doc-detective" value="test end"/>
    </taskbody>
  </task>
  <task id="sessions-process-background">
    <title>Run the REPL in the background</title>
    <taskbody>
      <data name="doc-detective" value='test {"testId":"sessions-process-background","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":{"commands":["node"],"env":["PATH"]}}]}'/>
      <steps>
        <step><cmd>Run <codeph>node -i</codeph> in the background as a process named <codeph>sessions-bg-repl</codeph>, and wait for the <codeph>&gt;</codeph> prompt.</cmd>
          <info><data name="doc-detective" value='step {"runShell":{"command":"node -i","background":{"name":"sessions-bg-repl","waitUntil":{"stdio":"/>/"}},"timeout":30000}}'/></info></step>
        <step><cmd>In the REPL, enter <codeph>Math.pow(2, 10)</codeph> and press Enter. Wait at least half a second, and until the REPL prints <codeph>1024</codeph>.</cmd>
          <info><data name="doc-detective" value='step {"type":{"keys":["Math.pow(2, 10)","$ENTER$"],"surface":{"process":"sessions-bg-repl"},"waitUntil":{"stdio":"/1024/","delayMs":500},"timeout":10000}}'/></info></step>
        <step><cmd>Close the REPL.</cmd>
          <info><data name="doc-detective" value='step {"closeSurface":"sessions-bg-repl"}'/></info></step>
      </steps>
      <data name="doc-detective" value="test end"/>
    </taskbody>
  </task>
  <task id="sessions-process-server">
    <title>Start a server and a REPL together</title>
    <taskbody>
      <data name="doc-detective" value='test {"testId":"sessions-process-server","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":["node","npm"]}]}'/>
      <steps>
        <step><cmd>From the <codeph>docs/actions</codeph> folder, start <codeph>node simple-json-server.cjs</codeph> as <codeph>sessions-api</codeph>, and wait until port <codeph>8087</codeph> answers. At the same time, start <codeph>node -i</codeph> in a 100 by 30 terminal as <codeph>sessions-client</codeph>, and give it a second to start.</cmd>
          <info><data name="doc-detective" value='step {"startSurface":[{"process":"node","args":["simple-json-server.cjs"],"name":"sessions-api","workingDirectory":"../../../fern/pages/docs/actions","waitUntil":{"port":8087,"httpGet":"http://localhost:8087"},"timeout":30000},{"process":"node","args":["-i"],"name":"sessions-client","tty":{"cols":100,"rows":30},"waitUntil":{"delayMs":1000}}]}'/></info></step>
        <step><cmd>In the REPL, fetch the server's root URL, and wait for it to print <codeph>ok</codeph>.</cmd>
          <info><data name="doc-detective" value='step {"type":{"keys":["fetch(\"http://localhost:8087\").then((r) => r.text()).then(console.log)","$ENTER$"],"surface":"sessions-client","waitUntil":{"stdio":"/\"status\":\"ok\"/"},"timeout":10000}}'/></info></step>
        <step><cmd>Close the REPL and the server.</cmd>
          <info><data name="doc-detective" value='step {"closeSurface":["sessions-client",{"process":"sessions-api"}]}'/></info></step>
      </steps>
      <data name="doc-detective" value="test end"/>
    </taskbody>
  </task>
</dita>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-process-surface",
      "runOn": [
        {
          "platforms": [
            "linux",
            "mac",
            "windows"
          ],
          "requires": "node"
        }
      ],
      "steps": [
        {
          "startSurface": {
            "process": "node",
            "args": [
              "-i"
            ],
            "name": "sessions-repl",
            "tty": true,
            "waitUntil": {
              "stdio": "/>/"
            },
            "timeout": 30000
          }
        },
        {
          "type": {
            "keys": [
              "40 + 2",
              "$ENTER$"
            ],
            "surface": "sessions-repl",
            "waitUntil": {
              "stdio": "/42/"
            },
            "timeout": 10000
          }
        },
        {
          "closeSurface": {
            "process": "sessions-repl"
          }
        }
      ]
    },
    {
      "testId": "sessions-process-background",
      "runOn": [
        {
          "platforms": [
            "linux",
            "mac",
            "windows"
          ],
          "requires": {
            "commands": [
              "node"
            ],
            "env": [
              "PATH"
            ]
          }
        }
      ],
      "steps": [
        {
          "runShell": {
            "command": "node -i",
            "background": {
              "name": "sessions-bg-repl",
              "waitUntil": {
                "stdio": "/>/"
              }
            },
            "timeout": 30000
          }
        },
        {
          "type": {
            "keys": [
              "Math.pow(2, 10)",
              "$ENTER$"
            ],
            "surface": {
              "process": "sessions-bg-repl"
            },
            "waitUntil": {
              "stdio": "/1024/",
              "delayMs": 500
            },
            "timeout": 10000
          }
        },
        {
          "closeSurface": "sessions-bg-repl"
        }
      ]
    },
    {
      "testId": "sessions-process-server",
      "runOn": [
        {
          "platforms": [
            "linux",
            "mac",
            "windows"
          ],
          "requires": [
            "node",
            "npm"
          ]
        }
      ],
      "steps": [
        {
          "startSurface": [
            {
              "process": "node",
              "args": [
                "simple-json-server.cjs"
              ],
              "name": "sessions-api",
              "workingDirectory": "../../../fern/pages/docs/actions",
              "waitUntil": {
                "port": 8087,
                "httpGet": "http://localhost:8087"
              },
              "timeout": 30000
            },
            {
              "process": "node",
              "args": [
                "-i"
              ],
              "name": "sessions-client",
              "tty": {
                "cols": 100,
                "rows": 30
              },
              "waitUntil": {
                "delayMs": 1000
              }
            }
          ]
        },
        {
          "type": {
            "keys": [
              "fetch(\"http://localhost:8087\").then((r) => r.text()).then(console.log)",
              "$ENTER$"
            ],
            "surface": "sessions-client",
            "waitUntil": {
              "stdio": "/\"status\":\"ok\"/"
            },
            "timeout": 10000
          }
        },
        {
          "closeSurface": [
            "sessions-client",
            {
              "process": "sessions-api"
            }
          ]
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-process-surface
    runOn:
      - platforms: &a1
          - linux
          - mac
          - windows
        requires: node
    steps:
      - startSurface:
          process: node
          args:
            - -i
          name: sessions-repl
          tty: true
          waitUntil:
            stdio: />/
          timeout: 30000
      - type:
          keys:
            - 40 + 2
            - $ENTER$
          surface: sessions-repl
          waitUntil:
            stdio: /42/
          timeout: 10000
      - closeSurface:
          process: sessions-repl
  - testId: sessions-process-background
    runOn:
      - platforms: *a1
        requires:
          commands:
            - node
          env:
            - PATH
    steps:
      - runShell:
          command: node -i
          background:
            name: sessions-bg-repl
            waitUntil:
              stdio: />/
          timeout: 30000
      - type:
          keys:
            - Math.pow(2, 10)
            - $ENTER$
          surface:
            process: sessions-bg-repl
          waitUntil:
            stdio: /1024/
            delayMs: 500
          timeout: 10000
      - closeSurface: sessions-bg-repl
  - testId: sessions-process-server
    runOn:
      - platforms: *a1
        requires:
          - node
          - npm
    steps:
      - startSurface:
          - process: node
            args:
              - simple-json-server.cjs
            name: sessions-api
            workingDirectory: ../../../fern/pages/docs/actions
            waitUntil:
              port: 8087
              httpGet: http://localhost:8087
            timeout: 30000
          - process: node
            args:
              - -i
            name: sessions-client
            tty:
              cols: 100
              rows: 30
            waitUntil:
              delayMs: 1000
      - type:
          keys:
            - fetch("http://localhost:8087").then((r) => r.text()).then(console.log)
            - $ENTER$
          surface: sessions-client
          waitUntil:
            stdio: /"status":"ok"/
          timeout: 10000
      - closeSurface:
          - sessions-client
          - process: sessions-api
```

### Forms in this example

* `requires` takes a command name (`"node"`), an array of command names (`["node", "npm"]`), or an object that lists `commands`, `files`, and `env` variables.
* `tty` runs the process in a terminal: `true` for the default 120 by 30 size, or an object with `cols` and `rows`.
* `waitUntil` holds the step until the process prints a match (`stdio`), a `port` accepts connections, an `httpGet` URL answers, or `delayMs` passes. Conditions in one object must all hold.
* `workingDirectory` sets where the process starts. A relative path resolves against the file that holds the test.
* `type` and `closeSurface` address a process by its name (`"sessions-repl"`) or with the object form (`{ "process": "sessions-bg-repl" }`).

### What detection finds

The prose has no links, bold text, or quoted text after `Type`, so detection adds no steps. Code spans aren't detected, which keeps `40 + 2` from turning into a `type` step without a surface.

## Open a built-in app

These procedures use [`startSurface`](/docs/actions/startsurface) with an [app descriptor](/reference/schemas/app-descriptor), [`click`](/docs/actions/click), [`find`](/docs/actions/find), and [`closeSurface`](/docs/actions/closesurface) with an [app surface](/reference/schemas/app-surface), on Windows, macOS, Android, and iOS. Each test's `runOn` names one platform.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Open a built-in app

## Windows: Character Map

1. Open Character Map, and wait for its Select button.
2. Click **Select**.
3. Check that the window shows the **Copy** button.
4. Check the Copy button again, picking the window by its title, by name, and as the newest window.
5. Close Character Map.

## macOS: Calculator

1. Open Calculator with `SESSIONS_DOCS=1` in its environment, and wait for its `1` button.
2. In the first window, press the `1` button.
3. Close Calculator.

## Android: Settings

1. Open the Settings app, and wait for the Network & internet entry.
2. Tap the Network & internet entry.
3. Check that the screen shows **Internet**.
4. Close the Settings app.

## Android: your own app

1. Install `build/sessions-demo.apk` on a headless Android 14 phone emulator named `sessions-pixel`, open its main activity, and wait for the Welcome screen.
2. Close the app.

## iOS: Settings

1. On the iPhone simulator named `sessions-iphone`, open the Settings app, and wait for the General entry.
2. Tap the General entry.
3. Check that the screen shows **About**.
4. Close the Settings app.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Open a built-in app

## Windows: Character Map

1. Open Character Map, and wait for its Select button.
2. Click **Select**.
3. Check that the window shows the **Copy** button.
4. Check the Copy button again, picking the window by its title, by name, and as the newest window.
5. Close Character Map.

## macOS: Calculator

1. Open Calculator with `SESSIONS_DOCS=1` in its environment, and wait for its `1` button.
2. In the first window, press the `1` button.
3. Close Calculator.

## Android: Settings

1. Open the Settings app, and wait for the Network & internet entry.
2. Tap the Network & internet entry.
3. Check that the screen shows **Internet**.
4. Close the Settings app.

## Android: your own app

1. Install `build/sessions-demo.apk` on a headless Android 14 phone emulator named `sessions-pixel`, open its main activity, and wait for the Welcome screen.
2. Close the app.

## iOS: Settings

1. On the iPhone simulator named `sessions-iphone`, open the Settings app, and wait for the General entry.
2. Tap the General entry.
3. Check that the screen shows **About**.
4. Close the Settings app.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Open a built-in app

== Windows: Character Map

. Open Character Map, and wait for its Select button.
. Click *Select*.
. Check that the window shows the *Copy* button.
. Check the Copy button again, picking the window by its title, by name, and as the newest window.
. Close Character Map.

== macOS: Calculator

. Open Calculator with `SESSIONS_DOCS=1` in its environment, and wait for its `1` button.
. In the first window, press the `1` button.
. Close Calculator.

== Android: Settings

. Open the Settings app, and wait for the Network & internet entry.
. Tap the Network & internet entry.
. Check that the screen shows *Internet*.
. Close the Settings app.

== Android: your own app

. Install `build/sessions-demo.apk` on a headless Android 14 phone emulator named `sessions-pixel`, open its main activity, and wait for the Welcome screen.
. Close the app.

== iOS: Settings

. On the iPhone simulator named `sessions-iphone`, open the Settings app, and wait for the General entry.
. Tap the General entry.
. Check that the screen shows *About*.
. Close the Settings app.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Open a built-in app</title></head>
<body>
<h1>Open a built-in app</h1>
<h2>Windows: Character Map</h2>
<ol>
  <li>Open Character Map, and wait for its Select button.</li>
  <li>Click <strong>Select</strong>.</li>
  <li>Check that the window shows the <strong>Copy</strong> button.</li>
  <li>Check the Copy button again, picking the window by its title, by name, and as the newest window.</li>
  <li>Close Character Map.</li>
</ol>
<h2>macOS: Calculator</h2>
<ol>
  <li>Open Calculator with <code>SESSIONS_DOCS=1</code> in its environment, and wait for its <code>1</code> button.</li>
  <li>In the first window, press the <code>1</code> button.</li>
  <li>Close Calculator.</li>
</ol>
<h2>Android: Settings</h2>
<ol>
  <li>Open the Settings app, and wait for the Network &amp; internet entry.</li>
  <li>Tap the Network &amp; internet entry.</li>
  <li>Check that the screen shows <strong>Internet</strong>.</li>
  <li>Close the Settings app.</li>
</ol>
<h2>Android: your own app</h2>
<ol>
  <li>Install <code>build/sessions-demo.apk</code> on a headless Android 14 phone emulator named <code>sessions-pixel</code>, open its main activity, and wait for the Welcome screen.</li>
  <li>Close the app.</li>
</ol>
<h2>iOS: Settings</h2>
<ol>
  <li>On the iPhone simulator named <code>sessions-iphone</code>, open the Settings app, and wait for the General entry.</li>
  <li>Tap the General entry.</li>
  <li>Check that the screen shows <strong>About</strong>.</li>
  <li>Close the Settings app.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Open a built-in app
===================

Windows: Character Map
----------------------

#. Open Character Map, and wait for its Select button.

#. Click **Select**.

#. Check that the window shows the **Copy** button.

#. Check the Copy button again, picking the window by its title, by name, and as the newest window.

#. Close Character Map.

macOS: Calculator
-----------------

#. Open Calculator with ``SESSIONS_DOCS=1`` in its environment, and wait for its ``1`` button.

#. In the first window, press the ``1`` button.

#. Close Calculator.

Android: Settings
-----------------

#. Open the Settings app, and wait for the Network & internet entry.

#. Tap the Network & internet entry.

#. Check that the screen shows **Internet**.

#. Close the Settings app.

Android: your own app
---------------------

#. Install ``build/sessions-demo.apk`` on a headless Android 14 phone emulator named ``sessions-pixel``, open its main activity, and wait for the Welcome screen.

#. Close the app.

iOS: Settings
-------------

#. On the iPhone simulator named ``sessions-iphone``, open the Settings app, and wait for the General entry.

#. Tap the General entry.

#. Check that the screen shows **About**.

#. Close the Settings app.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dita PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<dita>
  <topic id="sessions-apps">
    <title>Open a built-in app</title>
  </topic>
  <task id="sessions-apps-windows">
    <title>Windows: Character Map</title>
    <taskbody>
      <steps>
        <step><cmd>Open Character Map, and wait for its Select button.</cmd></step>
        <step><cmd>Click <uicontrol>Select</uicontrol>.</cmd></step>
        <step><cmd>Check that the window shows the <b>Copy</b> button.</cmd></step>
        <step><cmd>Check the Copy button again, picking the window by its title, by name, and as the newest window.</cmd></step>
        <step><cmd>Close Character Map.</cmd></step>
      </steps>
    </taskbody>
  </task>
  <task id="sessions-apps-mac">
    <title>macOS: Calculator</title>
    <taskbody>
      <steps>
        <step><cmd>Open Calculator with <codeph>SESSIONS_DOCS=1</codeph> in its environment, and wait for its <codeph>1</codeph> button.</cmd></step>
        <step><cmd>In the first window, press the <codeph>1</codeph> button.</cmd></step>
        <step><cmd>Close Calculator.</cmd></step>
      </steps>
    </taskbody>
  </task>
  <task id="sessions-apps-android">
    <title>Android: Settings</title>
    <taskbody>
      <steps>
        <step><cmd>Open the Settings app, and wait for the Network &amp; internet entry.</cmd></step>
        <step><cmd>Tap the Network &amp; internet entry.</cmd></step>
        <step><cmd>Check that the screen shows <b>Internet</b>.</cmd></step>
        <step><cmd>Close the Settings app.</cmd></step>
      </steps>
    </taskbody>
  </task>
  <task id="sessions-apps-android-install">
    <title>Android: your own app</title>
    <taskbody>
      <steps>
        <step><cmd>Install <codeph>build/sessions-demo.apk</codeph> on a headless Android 14 phone emulator named <codeph>sessions-pixel</codeph>, open its main activity, and wait for the Welcome screen.</cmd></step>
        <step><cmd>Close the app.</cmd></step>
      </steps>
    </taskbody>
  </task>
  <task id="sessions-apps-ios">
    <title>iOS: Settings</title>
    <taskbody>
      <steps>
        <step><cmd>On the iPhone simulator named <codeph>sessions-iphone</codeph>, open the Settings app, and wait for the General entry.</cmd></step>
        <step><cmd>Tap the General entry.</cmd></step>
        <step><cmd>Check that the screen shows <b>About</b>.</cmd></step>
        <step><cmd>Close the Settings app.</cmd></step>
      </steps>
    </taskbody>
  </task>
</dita>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
# Open a built-in app

## Windows: Character Map

<!-- test {"testId":"sessions-apps-windows","detectSteps":true,"runOn":[{"platforms":"windows"}]} -->

1. Open Character Map, and wait for its Select button.
   <!-- step {"startSurface":{"app":"C:\\Windows\\System32\\charmap.exe","name":"charmap","timeout":120000,"waitUntil":{"find":{"elementText":"Select"}}}} -->
2. Click **Select**.
3. Check that the window shows the **Copy** button.
4. Check the Copy button again, picking the window by its title, by name, and as the newest window.
   <!-- step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"title":"Character Map"}}}} -->
   <!-- step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":"Character Map"}}} -->
   <!-- step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"name":"Character Map"}}}} -->
   <!-- step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":-1}}} -->
   <!-- step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"index":-1}}}} -->
   <!-- step {"find":{"elementText":"Copy","surface":{"app":"charmap"}}} -->
5. Close Character Map.
   <!-- step {"closeSurface":{"app":"charmap"}} -->

<!-- test end -->

## macOS: Calculator

<!-- test {"testId":"sessions-apps-mac","detectSteps":true,"runOn":[{"platforms":"mac"}]} -->

1. Open Calculator with `SESSIONS_DOCS=1` in its environment, and wait for its `1` button.
   <!-- step {"startSurface":{"app":"/System/Applications/Calculator.app","name":"calculator","env":{"SESSIONS_DOCS":"1"},"timeout":180000,"waitUntil":{"find":{"elementAria":"1"}}}} -->
2. In the first window, press the `1` button.
   <!-- step {"click":{"elementAria":"1","surface":{"app":"calculator","window":{"index":0}}}} -->
3. Close Calculator.
   <!-- step {"closeSurface":"calculator"} -->

<!-- test end -->

## Android: Settings

<!-- test {"testId":"sessions-apps-android","detectSteps":true,"runOn":[{"platforms":"android"}]} -->

1. Open the Settings app, and wait for the Network & internet entry.
   <!-- step {"startSurface":{"app":"com.android.settings","name":"settings","timeout":180000,"waitUntil":{"find":{"elementText":"Network & internet"}}}} -->
2. Tap the Network & internet entry.
   <!-- step {"click":"Network & internet"} -->
3. Check that the screen shows **Internet**.
4. Close the Settings app.
   <!-- step {"closeSurface":{"app":"settings"}} -->

<!-- test end -->

## Android: your own app

<!-- test {"testId":"sessions-apps-android-install","detectSteps":true,"runOn":[{"platforms":"android","device":"sessions-pixel","requires":{"files":["build/sessions-demo.apk"]}}]} -->

1. Install `build/sessions-demo.apk` on a headless Android 14 phone emulator named `sessions-pixel`, open its main activity, and wait for the Welcome screen.
   <!-- step {"startSurface":{"app":"com.example.sessionsdemo","name":"demo","install":"build/sessions-demo.apk","activity":".MainActivity","device":{"platform":"android","name":"sessions-pixel","deviceType":"phone","osVersion":"14","headless":true},"driverOptions":{"appium:newCommandTimeout":300},"timeout":300000,"waitUntil":{"find":{"elementText":"Welcome"}}}} -->
2. Close the app.
   <!-- step {"closeSurface":{"app":"demo"}} -->

<!-- test end -->

## iOS: Settings

<!-- test {"testId":"sessions-apps-ios","detectSteps":true,"runOn":[{"platforms":"ios","device":{"platform":"ios","name":"sessions-iphone","deviceType":"phone","osVersion":"18.0","headless":true}}]} -->

1. On the iPhone simulator named `sessions-iphone`, open the Settings app, and wait for the General entry.
   <!-- step {"startSurface":{"app":"com.apple.Preferences","name":"preferences","device":"sessions-iphone","timeout":180000,"waitUntil":{"find":{"elementText":"General"}}}} -->
2. Tap the General entry.
   <!-- step {"click":"General"} -->
3. Check that the screen shows **About**.
4. Close the Settings app.
   <!-- step {"closeSurface":{"app":"preferences"}} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
# Open a built-in app

## Windows: Character Map

{/* test {"testId":"sessions-apps-windows","detectSteps":true,"runOn":[{"platforms":"windows"}]} */}

1. Open Character Map, and wait for its Select button.
   {/* step {"startSurface":{"app":"C:\\Windows\\System32\\charmap.exe","name":"charmap","timeout":120000,"waitUntil":{"find":{"elementText":"Select"}}}} */}
2. Click **Select**.
3. Check that the window shows the **Copy** button.
4. Check the Copy button again, picking the window by its title, by name, and as the newest window.
   {/* step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"title":"Character Map"}}}} */}
   {/* step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":"Character Map"}}} */}
   {/* step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"name":"Character Map"}}}} */}
   {/* step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":-1}}} */}
   {/* step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"index":-1}}}} */}
   {/* step {"find":{"elementText":"Copy","surface":{"app":"charmap"}}} */}
5. Close Character Map.
   {/* step {"closeSurface":{"app":"charmap"}} */}

{/* test end */}

## macOS: Calculator

{/* test {"testId":"sessions-apps-mac","detectSteps":true,"runOn":[{"platforms":"mac"}]} */}

1. Open Calculator with `SESSIONS_DOCS=1` in its environment, and wait for its `1` button.
   {/* step {"startSurface":{"app":"/System/Applications/Calculator.app","name":"calculator","env":{"SESSIONS_DOCS":"1"},"timeout":180000,"waitUntil":{"find":{"elementAria":"1"}}}} */}
2. In the first window, press the `1` button.
   {/* step {"click":{"elementAria":"1","surface":{"app":"calculator","window":{"index":0}}}} */}
3. Close Calculator.
   {/* step {"closeSurface":"calculator"} */}

{/* test end */}

## Android: Settings

{/* test {"testId":"sessions-apps-android","detectSteps":true,"runOn":[{"platforms":"android"}]} */}

1. Open the Settings app, and wait for the Network & internet entry.
   {/* step {"startSurface":{"app":"com.android.settings","name":"settings","timeout":180000,"waitUntil":{"find":{"elementText":"Network & internet"}}}} */}
2. Tap the Network & internet entry.
   {/* step {"click":"Network & internet"} */}
3. Check that the screen shows **Internet**.
4. Close the Settings app.
   {/* step {"closeSurface":{"app":"settings"}} */}

{/* test end */}

## Android: your own app

{/* test {"testId":"sessions-apps-android-install","detectSteps":true,"runOn":[{"platforms":"android","device":"sessions-pixel","requires":{"files":["build/sessions-demo.apk"]}}]} */}

1. Install `build/sessions-demo.apk` on a headless Android 14 phone emulator named `sessions-pixel`, open its main activity, and wait for the Welcome screen.
   {/* step {"startSurface":{"app":"com.example.sessionsdemo","name":"demo","install":"build/sessions-demo.apk","activity":".MainActivity","device":{"platform":"android","name":"sessions-pixel","deviceType":"phone","osVersion":"14","headless":true},"driverOptions":{"appium:newCommandTimeout":300},"timeout":300000,"waitUntil":{"find":{"elementText":"Welcome"}}}} */}
2. Close the app.
   {/* step {"closeSurface":{"app":"demo"}} */}

{/* test end */}

## iOS: Settings

{/* test {"testId":"sessions-apps-ios","detectSteps":true,"runOn":[{"platforms":"ios","device":{"platform":"ios","name":"sessions-iphone","deviceType":"phone","osVersion":"18.0","headless":true}}]} */}

1. On the iPhone simulator named `sessions-iphone`, open the Settings app, and wait for the General entry.
   {/* step {"startSurface":{"app":"com.apple.Preferences","name":"preferences","device":"sessions-iphone","timeout":180000,"waitUntil":{"find":{"elementText":"General"}}}} */}
2. Tap the General entry.
   {/* step {"click":"General"} */}
3. Check that the screen shows **About**.
4. Close the Settings app.
   {/* step {"closeSurface":{"app":"preferences"}} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Open a built-in app

== Windows: Character Map

// (test {"testId":"sessions-apps-windows","detectSteps":true,"runOn":[{"platforms":"windows"}]})

. Open Character Map, and wait for its Select button.
+
// (step {"startSurface":{"app":"C:\\Windows\\System32\\charmap.exe","name":"charmap","timeout":120000,"waitUntil":{"find":{"elementText":"Select"}}}})
. Click *Select*.
. Check that the window shows the *Copy* button.
. Check the Copy button again, picking the window by its title, by name, and as the newest window.
+
// (step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"title":"Character Map"}}}})
+
// (step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":"Character Map"}}})
+
// (step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"name":"Character Map"}}}})
+
// (step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":-1}}})
+
// (step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"index":-1}}}})
+
// (step {"find":{"elementText":"Copy","surface":{"app":"charmap"}}})
. Close Character Map.
+
// (step {"closeSurface":{"app":"charmap"}})

// (test end)

== macOS: Calculator

// (test {"testId":"sessions-apps-mac","detectSteps":true,"runOn":[{"platforms":"mac"}]})

. Open Calculator with `SESSIONS_DOCS=1` in its environment, and wait for its `1` button.
+
// (step {"startSurface":{"app":"/System/Applications/Calculator.app","name":"calculator","env":{"SESSIONS_DOCS":"1"},"timeout":180000,"waitUntil":{"find":{"elementAria":"1"}}}})
. In the first window, press the `1` button.
+
// (step {"click":{"elementAria":"1","surface":{"app":"calculator","window":{"index":0}}}})
. Close Calculator.
+
// (step {"closeSurface":"calculator"})

// (test end)

== Android: Settings

// (test {"testId":"sessions-apps-android","detectSteps":true,"runOn":[{"platforms":"android"}]})

. Open the Settings app, and wait for the Network & internet entry.
+
// (step {"startSurface":{"app":"com.android.settings","name":"settings","timeout":180000,"waitUntil":{"find":{"elementText":"Network & internet"}}}})
. Tap the Network & internet entry.
+
// (step {"click":"Network & internet"})
. Check that the screen shows *Internet*.
. Close the Settings app.
+
// (step {"closeSurface":{"app":"settings"}})

// (test end)

== Android: your own app

// (test {"testId":"sessions-apps-android-install","detectSteps":true,"runOn":[{"platforms":"android","device":"sessions-pixel","requires":{"files":["build/sessions-demo.apk"]}}]})

. Install `build/sessions-demo.apk` on a headless Android 14 phone emulator named `sessions-pixel`, open its main activity, and wait for the Welcome screen.
+
// (step {"startSurface":{"app":"com.example.sessionsdemo","name":"demo","install":"build/sessions-demo.apk","activity":".MainActivity","device":{"platform":"android","name":"sessions-pixel","deviceType":"phone","osVersion":"14","headless":true},"driverOptions":{"appium:newCommandTimeout":300},"timeout":300000,"waitUntil":{"find":{"elementText":"Welcome"}}}})
. Close the app.
+
// (step {"closeSurface":{"app":"demo"}})

// (test end)

== iOS: Settings

// (test {"testId":"sessions-apps-ios","detectSteps":true,"runOn":[{"platforms":"ios","device":{"platform":"ios","name":"sessions-iphone","deviceType":"phone","osVersion":"18.0","headless":true}}]})

. On the iPhone simulator named `sessions-iphone`, open the Settings app, and wait for the General entry.
+
// (step {"startSurface":{"app":"com.apple.Preferences","name":"preferences","device":"sessions-iphone","timeout":180000,"waitUntil":{"find":{"elementText":"General"}}}})
. Tap the General entry.
+
// (step {"click":"General"})
. Check that the screen shows *About*.
. Close the Settings app.
+
// (step {"closeSurface":{"app":"preferences"}})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Open a built-in app</title></head>
<body>
<h1>Open a built-in app</h1>
<h2>Windows: Character Map</h2>
<!-- test {"testId":"sessions-apps-windows","detectSteps":true,"runOn":[{"platforms":"windows"}]} -->
<ol>
  <li>Open Character Map, and wait for its Select button.
    <!-- step {"startSurface":{"app":"C:\\Windows\\System32\\charmap.exe","name":"charmap","timeout":120000,"waitUntil":{"find":{"elementText":"Select"}}}} --></li>
  <li>Click <strong>Select</strong>.</li>
  <li>Check that the window shows the <strong>Copy</strong> button.</li>
  <li>Check the Copy button again, picking the window by its title, by name, and as the newest window.
    <!-- step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"title":"Character Map"}}}} -->
    <!-- step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":"Character Map"}}} -->
    <!-- step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"name":"Character Map"}}}} -->
    <!-- step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":-1}}} -->
    <!-- step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"index":-1}}}} -->
    <!-- step {"find":{"elementText":"Copy","surface":{"app":"charmap"}}} --></li>
  <li>Close Character Map.
    <!-- step {"closeSurface":{"app":"charmap"}} --></li>
</ol>
<!-- test end -->
<h2>macOS: Calculator</h2>
<!-- test {"testId":"sessions-apps-mac","detectSteps":true,"runOn":[{"platforms":"mac"}]} -->
<ol>
  <li>Open Calculator with <code>SESSIONS_DOCS=1</code> in its environment, and wait for its <code>1</code> button.
    <!-- step {"startSurface":{"app":"/System/Applications/Calculator.app","name":"calculator","env":{"SESSIONS_DOCS":"1"},"timeout":180000,"waitUntil":{"find":{"elementAria":"1"}}}} --></li>
  <li>In the first window, press the <code>1</code> button.
    <!-- step {"click":{"elementAria":"1","surface":{"app":"calculator","window":{"index":0}}}} --></li>
  <li>Close Calculator.
    <!-- step {"closeSurface":"calculator"} --></li>
</ol>
<!-- test end -->
<h2>Android: Settings</h2>
<!-- test {"testId":"sessions-apps-android","detectSteps":true,"runOn":[{"platforms":"android"}]} -->
<ol>
  <li>Open the Settings app, and wait for the Network &amp; internet entry.
    <!-- step {"startSurface":{"app":"com.android.settings","name":"settings","timeout":180000,"waitUntil":{"find":{"elementText":"Network & internet"}}}} --></li>
  <li>Tap the Network &amp; internet entry.
    <!-- step {"click":"Network & internet"} --></li>
  <li>Check that the screen shows <strong>Internet</strong>.</li>
  <li>Close the Settings app.
    <!-- step {"closeSurface":{"app":"settings"}} --></li>
</ol>
<!-- test end -->
<h2>Android: your own app</h2>
<!-- test {"testId":"sessions-apps-android-install","detectSteps":true,"runOn":[{"platforms":"android","device":"sessions-pixel","requires":{"files":["build/sessions-demo.apk"]}}]} -->
<ol>
  <li>Install <code>build/sessions-demo.apk</code> on a headless Android 14 phone emulator named <code>sessions-pixel</code>, open its main activity, and wait for the Welcome screen.
    <!-- step {"startSurface":{"app":"com.example.sessionsdemo","name":"demo","install":"build/sessions-demo.apk","activity":".MainActivity","device":{"platform":"android","name":"sessions-pixel","deviceType":"phone","osVersion":"14","headless":true},"driverOptions":{"appium:newCommandTimeout":300},"timeout":300000,"waitUntil":{"find":{"elementText":"Welcome"}}}} --></li>
  <li>Close the app.
    <!-- step {"closeSurface":{"app":"demo"}} --></li>
</ol>
<!-- test end -->
<h2>iOS: Settings</h2>
<!-- test {"testId":"sessions-apps-ios","detectSteps":true,"runOn":[{"platforms":"ios","device":{"platform":"ios","name":"sessions-iphone","deviceType":"phone","osVersion":"18.0","headless":true}}]} -->
<ol>
  <li>On the iPhone simulator named <code>sessions-iphone</code>, open the Settings app, and wait for the General entry.
    <!-- step {"startSurface":{"app":"com.apple.Preferences","name":"preferences","device":"sessions-iphone","timeout":180000,"waitUntil":{"find":{"elementText":"General"}}}} --></li>
  <li>Tap the General entry.
    <!-- step {"click":"General"} --></li>
  <li>Check that the screen shows <strong>About</strong>.</li>
  <li>Close the Settings app.
    <!-- step {"closeSurface":{"app":"preferences"}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Open a built-in app
===================

Windows: Character Map
----------------------

.. test {"testId":"sessions-apps-windows","detectSteps":true,"runOn":[{"platforms":"windows"}]}

#. Open Character Map, and wait for its Select button.

   .. step {"startSurface":{"app":"C:\\Windows\\System32\\charmap.exe","name":"charmap","timeout":120000,"waitUntil":{"find":{"elementText":"Select"}}}}

#. Click **Select**.

#. Check that the window shows the **Copy** button.

#. Check the Copy button again, picking the window by its title, by name, and as the newest window.

   .. step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"title":"Character Map"}}}}

   .. step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":"Character Map"}}}

   .. step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"name":"Character Map"}}}}

   .. step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":-1}}}

   .. step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"index":-1}}}}

   .. step {"find":{"elementText":"Copy","surface":{"app":"charmap"}}}

#. Close Character Map.

   .. step {"closeSurface":{"app":"charmap"}}

.. test end

macOS: Calculator
-----------------

.. test {"testId":"sessions-apps-mac","detectSteps":true,"runOn":[{"platforms":"mac"}]}

#. Open Calculator with ``SESSIONS_DOCS=1`` in its environment, and wait for its ``1`` button.

   .. step {"startSurface":{"app":"/System/Applications/Calculator.app","name":"calculator","env":{"SESSIONS_DOCS":"1"},"timeout":180000,"waitUntil":{"find":{"elementAria":"1"}}}}

#. In the first window, press the ``1`` button.

   .. step {"click":{"elementAria":"1","surface":{"app":"calculator","window":{"index":0}}}}

#. Close Calculator.

   .. step {"closeSurface":"calculator"}

.. test end

Android: Settings
-----------------

.. test {"testId":"sessions-apps-android","detectSteps":true,"runOn":[{"platforms":"android"}]}

#. Open the Settings app, and wait for the Network & internet entry.

   .. step {"startSurface":{"app":"com.android.settings","name":"settings","timeout":180000,"waitUntil":{"find":{"elementText":"Network & internet"}}}}

#. Tap the Network & internet entry.

   .. step {"click":"Network & internet"}

#. Check that the screen shows **Internet**.

#. Close the Settings app.

   .. step {"closeSurface":{"app":"settings"}}

.. test end

Android: your own app
---------------------

.. test {"testId":"sessions-apps-android-install","detectSteps":true,"runOn":[{"platforms":"android","device":"sessions-pixel","requires":{"files":["build/sessions-demo.apk"]}}]}

#. Install ``build/sessions-demo.apk`` on a headless Android 14 phone emulator named ``sessions-pixel``, open its main activity, and wait for the Welcome screen.

   .. step {"startSurface":{"app":"com.example.sessionsdemo","name":"demo","install":"build/sessions-demo.apk","activity":".MainActivity","device":{"platform":"android","name":"sessions-pixel","deviceType":"phone","osVersion":"14","headless":true},"driverOptions":{"appium:newCommandTimeout":300},"timeout":300000,"waitUntil":{"find":{"elementText":"Welcome"}}}}

#. Close the app.

   .. step {"closeSurface":{"app":"demo"}}

.. test end

iOS: Settings
-------------

.. test {"testId":"sessions-apps-ios","detectSteps":true,"runOn":[{"platforms":"ios","device":{"platform":"ios","name":"sessions-iphone","deviceType":"phone","osVersion":"18.0","headless":true}}]}

#. On the iPhone simulator named ``sessions-iphone``, open the Settings app, and wait for the General entry.

   .. step {"startSurface":{"app":"com.apple.Preferences","name":"preferences","device":"sessions-iphone","timeout":180000,"waitUntil":{"find":{"elementText":"General"}}}}

#. Tap the General entry.

   .. step {"click":"General"}

#. Check that the screen shows **About**.

#. Close the Settings app.

   .. step {"closeSurface":{"app":"preferences"}}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dita PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<dita>
  <topic id="sessions-apps">
    <title>Open a built-in app</title>
  </topic>
  <task id="sessions-apps-windows">
    <title>Windows: Character Map</title>
    <taskbody>
      <data name="doc-detective" value='test {"testId":"sessions-apps-windows","detectSteps":true,"runOn":[{"platforms":"windows"}]}'/>
      <steps>
        <step><cmd>Open Character Map, and wait for its Select button.</cmd>
          <info><data name="doc-detective" value='step {"startSurface":{"app":"C:\\Windows\\System32\\charmap.exe","name":"charmap","timeout":120000,"waitUntil":{"find":{"elementText":"Select"}}}}'/></info></step>
        <step><cmd>Click <uicontrol>Select</uicontrol>.</cmd></step>
        <step><cmd>Check that the window shows the <b>Copy</b> button.</cmd></step>
        <step><cmd>Check the Copy button again, picking the window by its title, by name, and as the newest window.</cmd>
          <info><data name="doc-detective" value='step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"title":"Character Map"}}}}'/><data name="doc-detective" value='step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":"Character Map"}}}'/><data name="doc-detective" value='step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"name":"Character Map"}}}}'/><data name="doc-detective" value='step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":-1}}}'/><data name="doc-detective" value='step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"index":-1}}}}'/><data name="doc-detective" value='step {"find":{"elementText":"Copy","surface":{"app":"charmap"}}}'/></info></step>
        <step><cmd>Close Character Map.</cmd>
          <info><data name="doc-detective" value='step {"closeSurface":{"app":"charmap"}}'/></info></step>
      </steps>
      <data name="doc-detective" value="test end"/>
    </taskbody>
  </task>
  <task id="sessions-apps-mac">
    <title>macOS: Calculator</title>
    <taskbody>
      <data name="doc-detective" value='test {"testId":"sessions-apps-mac","detectSteps":true,"runOn":[{"platforms":"mac"}]}'/>
      <steps>
        <step><cmd>Open Calculator with <codeph>SESSIONS_DOCS=1</codeph> in its environment, and wait for its <codeph>1</codeph> button.</cmd>
          <info><data name="doc-detective" value='step {"startSurface":{"app":"/System/Applications/Calculator.app","name":"calculator","env":{"SESSIONS_DOCS":"1"},"timeout":180000,"waitUntil":{"find":{"elementAria":"1"}}}}'/></info></step>
        <step><cmd>In the first window, press the <codeph>1</codeph> button.</cmd>
          <info><data name="doc-detective" value='step {"click":{"elementAria":"1","surface":{"app":"calculator","window":{"index":0}}}}'/></info></step>
        <step><cmd>Close Calculator.</cmd>
          <info><data name="doc-detective" value='step {"closeSurface":"calculator"}'/></info></step>
      </steps>
      <data name="doc-detective" value="test end"/>
    </taskbody>
  </task>
  <task id="sessions-apps-android">
    <title>Android: Settings</title>
    <taskbody>
      <data name="doc-detective" value='test {"testId":"sessions-apps-android","detectSteps":true,"runOn":[{"platforms":"android"}]}'/>
      <steps>
        <step><cmd>Open the Settings app, and wait for the Network &amp; internet entry.</cmd>
          <info><data name="doc-detective" value='step {"startSurface":{"app":"com.android.settings","name":"settings","timeout":180000,"waitUntil":{"find":{"elementText":"Network &amp; internet"}}}}'/></info></step>
        <step><cmd>Tap the Network &amp; internet entry.</cmd>
          <info><data name="doc-detective" value='step {"click":"Network &amp; internet"}'/></info></step>
        <step><cmd>Check that the screen shows <b>Internet</b>.</cmd></step>
        <step><cmd>Close the Settings app.</cmd>
          <info><data name="doc-detective" value='step {"closeSurface":{"app":"settings"}}'/></info></step>
      </steps>
      <data name="doc-detective" value="test end"/>
    </taskbody>
  </task>
  <task id="sessions-apps-android-install">
    <title>Android: your own app</title>
    <taskbody>
      <data name="doc-detective" value='test {"testId":"sessions-apps-android-install","detectSteps":true,"runOn":[{"platforms":"android","device":"sessions-pixel","requires":{"files":["build/sessions-demo.apk"]}}]}'/>
      <steps>
        <step><cmd>Install <codeph>build/sessions-demo.apk</codeph> on a headless Android 14 phone emulator named <codeph>sessions-pixel</codeph>, open its main activity, and wait for the Welcome screen.</cmd>
          <info><data name="doc-detective" value='step {"startSurface":{"app":"com.example.sessionsdemo","name":"demo","install":"build/sessions-demo.apk","activity":".MainActivity","device":{"platform":"android","name":"sessions-pixel","deviceType":"phone","osVersion":"14","headless":true},"driverOptions":{"appium:newCommandTimeout":300},"timeout":300000,"waitUntil":{"find":{"elementText":"Welcome"}}}}'/></info></step>
        <step><cmd>Close the app.</cmd>
          <info><data name="doc-detective" value='step {"closeSurface":{"app":"demo"}}'/></info></step>
      </steps>
      <data name="doc-detective" value="test end"/>
    </taskbody>
  </task>
  <task id="sessions-apps-ios">
    <title>iOS: Settings</title>
    <taskbody>
      <data name="doc-detective" value='test {"testId":"sessions-apps-ios","detectSteps":true,"runOn":[{"platforms":"ios","device":{"platform":"ios","name":"sessions-iphone","deviceType":"phone","osVersion":"18.0","headless":true}}]}'/>
      <steps>
        <step><cmd>On the iPhone simulator named <codeph>sessions-iphone</codeph>, open the Settings app, and wait for the General entry.</cmd>
          <info><data name="doc-detective" value='step {"startSurface":{"app":"com.apple.Preferences","name":"preferences","device":"sessions-iphone","timeout":180000,"waitUntil":{"find":{"elementText":"General"}}}}'/></info></step>
        <step><cmd>Tap the General entry.</cmd>
          <info><data name="doc-detective" value='step {"click":"General"}'/></info></step>
        <step><cmd>Check that the screen shows <b>About</b>.</cmd></step>
        <step><cmd>Close the Settings app.</cmd>
          <info><data name="doc-detective" value='step {"closeSurface":{"app":"preferences"}}'/></info></step>
      </steps>
      <data name="doc-detective" value="test end"/>
    </taskbody>
  </task>
</dita>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
# Open a built-in app

## Windows: Character Map

<!-- test {"testId":"sessions-apps-windows","detectSteps":false,"runOn":[{"platforms":"windows"}]} -->

1. Open Character Map, and wait for its Select button.
   <!-- step {"startSurface":{"app":"C:\\Windows\\System32\\charmap.exe","name":"charmap","timeout":120000,"waitUntil":{"find":{"elementText":"Select"}}}} -->
2. Click **Select**.
   <!-- step {"click":"Select"} -->
3. Check that the window shows the **Copy** button.
   <!-- step {"find":"Copy"} -->
4. Check the Copy button again, picking the window by its title, by name, and as the newest window.
   <!-- step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"title":"Character Map"}}}} -->
   <!-- step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":"Character Map"}}} -->
   <!-- step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"name":"Character Map"}}}} -->
   <!-- step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":-1}}} -->
   <!-- step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"index":-1}}}} -->
   <!-- step {"find":{"elementText":"Copy","surface":{"app":"charmap"}}} -->
5. Close Character Map.
   <!-- step {"closeSurface":{"app":"charmap"}} -->

<!-- test end -->

## macOS: Calculator

<!-- test {"testId":"sessions-apps-mac","detectSteps":false,"runOn":[{"platforms":"mac"}]} -->

1. Open Calculator with `SESSIONS_DOCS=1` in its environment, and wait for its `1` button.
   <!-- step {"startSurface":{"app":"/System/Applications/Calculator.app","name":"calculator","env":{"SESSIONS_DOCS":"1"},"timeout":180000,"waitUntil":{"find":{"elementAria":"1"}}}} -->
2. In the first window, press the `1` button.
   <!-- step {"click":{"elementAria":"1","surface":{"app":"calculator","window":{"index":0}}}} -->
3. Close Calculator.
   <!-- step {"closeSurface":"calculator"} -->

<!-- test end -->

## Android: Settings

<!-- test {"testId":"sessions-apps-android","detectSteps":false,"runOn":[{"platforms":"android"}]} -->

1. Open the Settings app, and wait for the Network & internet entry.
   <!-- step {"startSurface":{"app":"com.android.settings","name":"settings","timeout":180000,"waitUntil":{"find":{"elementText":"Network & internet"}}}} -->
2. Tap the Network & internet entry.
   <!-- step {"click":"Network & internet"} -->
3. Check that the screen shows **Internet**.
   <!-- step {"find":"Internet"} -->
4. Close the Settings app.
   <!-- step {"closeSurface":{"app":"settings"}} -->

<!-- test end -->

## Android: your own app

<!-- test {"testId":"sessions-apps-android-install","detectSteps":false,"runOn":[{"platforms":"android","device":"sessions-pixel","requires":{"files":["build/sessions-demo.apk"]}}]} -->

1. Install `build/sessions-demo.apk` on a headless Android 14 phone emulator named `sessions-pixel`, open its main activity, and wait for the Welcome screen.
   <!-- step {"startSurface":{"app":"com.example.sessionsdemo","name":"demo","install":"build/sessions-demo.apk","activity":".MainActivity","device":{"platform":"android","name":"sessions-pixel","deviceType":"phone","osVersion":"14","headless":true},"driverOptions":{"appium:newCommandTimeout":300},"timeout":300000,"waitUntil":{"find":{"elementText":"Welcome"}}}} -->
2. Close the app.
   <!-- step {"closeSurface":{"app":"demo"}} -->

<!-- test end -->

## iOS: Settings

<!-- test {"testId":"sessions-apps-ios","detectSteps":false,"runOn":[{"platforms":"ios","device":{"platform":"ios","name":"sessions-iphone","deviceType":"phone","osVersion":"18.0","headless":true}}]} -->

1. On the iPhone simulator named `sessions-iphone`, open the Settings app, and wait for the General entry.
   <!-- step {"startSurface":{"app":"com.apple.Preferences","name":"preferences","device":"sessions-iphone","timeout":180000,"waitUntil":{"find":{"elementText":"General"}}}} -->
2. Tap the General entry.
   <!-- step {"click":"General"} -->
3. Check that the screen shows **About**.
   <!-- step {"find":"About"} -->
4. Close the Settings app.
   <!-- step {"closeSurface":{"app":"preferences"}} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
# Open a built-in app

## Windows: Character Map

{/* test {"testId":"sessions-apps-windows","detectSteps":false,"runOn":[{"platforms":"windows"}]} */}

1. Open Character Map, and wait for its Select button.
   {/* step {"startSurface":{"app":"C:\\Windows\\System32\\charmap.exe","name":"charmap","timeout":120000,"waitUntil":{"find":{"elementText":"Select"}}}} */}
2. Click **Select**.
   {/* step {"click":"Select"} */}
3. Check that the window shows the **Copy** button.
   {/* step {"find":"Copy"} */}
4. Check the Copy button again, picking the window by its title, by name, and as the newest window.
   {/* step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"title":"Character Map"}}}} */}
   {/* step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":"Character Map"}}} */}
   {/* step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"name":"Character Map"}}}} */}
   {/* step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":-1}}} */}
   {/* step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"index":-1}}}} */}
   {/* step {"find":{"elementText":"Copy","surface":{"app":"charmap"}}} */}
5. Close Character Map.
   {/* step {"closeSurface":{"app":"charmap"}} */}

{/* test end */}

## macOS: Calculator

{/* test {"testId":"sessions-apps-mac","detectSteps":false,"runOn":[{"platforms":"mac"}]} */}

1. Open Calculator with `SESSIONS_DOCS=1` in its environment, and wait for its `1` button.
   {/* step {"startSurface":{"app":"/System/Applications/Calculator.app","name":"calculator","env":{"SESSIONS_DOCS":"1"},"timeout":180000,"waitUntil":{"find":{"elementAria":"1"}}}} */}
2. In the first window, press the `1` button.
   {/* step {"click":{"elementAria":"1","surface":{"app":"calculator","window":{"index":0}}}} */}
3. Close Calculator.
   {/* step {"closeSurface":"calculator"} */}

{/* test end */}

## Android: Settings

{/* test {"testId":"sessions-apps-android","detectSteps":false,"runOn":[{"platforms":"android"}]} */}

1. Open the Settings app, and wait for the Network & internet entry.
   {/* step {"startSurface":{"app":"com.android.settings","name":"settings","timeout":180000,"waitUntil":{"find":{"elementText":"Network & internet"}}}} */}
2. Tap the Network & internet entry.
   {/* step {"click":"Network & internet"} */}
3. Check that the screen shows **Internet**.
   {/* step {"find":"Internet"} */}
4. Close the Settings app.
   {/* step {"closeSurface":{"app":"settings"}} */}

{/* test end */}

## Android: your own app

{/* test {"testId":"sessions-apps-android-install","detectSteps":false,"runOn":[{"platforms":"android","device":"sessions-pixel","requires":{"files":["build/sessions-demo.apk"]}}]} */}

1. Install `build/sessions-demo.apk` on a headless Android 14 phone emulator named `sessions-pixel`, open its main activity, and wait for the Welcome screen.
   {/* step {"startSurface":{"app":"com.example.sessionsdemo","name":"demo","install":"build/sessions-demo.apk","activity":".MainActivity","device":{"platform":"android","name":"sessions-pixel","deviceType":"phone","osVersion":"14","headless":true},"driverOptions":{"appium:newCommandTimeout":300},"timeout":300000,"waitUntil":{"find":{"elementText":"Welcome"}}}} */}
2. Close the app.
   {/* step {"closeSurface":{"app":"demo"}} */}

{/* test end */}

## iOS: Settings

{/* test {"testId":"sessions-apps-ios","detectSteps":false,"runOn":[{"platforms":"ios","device":{"platform":"ios","name":"sessions-iphone","deviceType":"phone","osVersion":"18.0","headless":true}}]} */}

1. On the iPhone simulator named `sessions-iphone`, open the Settings app, and wait for the General entry.
   {/* step {"startSurface":{"app":"com.apple.Preferences","name":"preferences","device":"sessions-iphone","timeout":180000,"waitUntil":{"find":{"elementText":"General"}}}} */}
2. Tap the General entry.
   {/* step {"click":"General"} */}
3. Check that the screen shows **About**.
   {/* step {"find":"About"} */}
4. Close the Settings app.
   {/* step {"closeSurface":{"app":"preferences"}} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Open a built-in app

== Windows: Character Map

// (test {"testId":"sessions-apps-windows","detectSteps":false,"runOn":[{"platforms":"windows"}]})

. Open Character Map, and wait for its Select button.
+
// (step {"startSurface":{"app":"C:\\Windows\\System32\\charmap.exe","name":"charmap","timeout":120000,"waitUntil":{"find":{"elementText":"Select"}}}})
. Click *Select*.
+
// (step {"click":"Select"})
. Check that the window shows the *Copy* button.
+
// (step {"find":"Copy"})
. Check the Copy button again, picking the window by its title, by name, and as the newest window.
+
// (step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"title":"Character Map"}}}})
+
// (step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":"Character Map"}}})
+
// (step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"name":"Character Map"}}}})
+
// (step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":-1}}})
+
// (step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"index":-1}}}})
+
// (step {"find":{"elementText":"Copy","surface":{"app":"charmap"}}})
. Close Character Map.
+
// (step {"closeSurface":{"app":"charmap"}})

// (test end)

== macOS: Calculator

// (test {"testId":"sessions-apps-mac","detectSteps":false,"runOn":[{"platforms":"mac"}]})

. Open Calculator with `SESSIONS_DOCS=1` in its environment, and wait for its `1` button.
+
// (step {"startSurface":{"app":"/System/Applications/Calculator.app","name":"calculator","env":{"SESSIONS_DOCS":"1"},"timeout":180000,"waitUntil":{"find":{"elementAria":"1"}}}})
. In the first window, press the `1` button.
+
// (step {"click":{"elementAria":"1","surface":{"app":"calculator","window":{"index":0}}}})
. Close Calculator.
+
// (step {"closeSurface":"calculator"})

// (test end)

== Android: Settings

// (test {"testId":"sessions-apps-android","detectSteps":false,"runOn":[{"platforms":"android"}]})

. Open the Settings app, and wait for the Network & internet entry.
+
// (step {"startSurface":{"app":"com.android.settings","name":"settings","timeout":180000,"waitUntil":{"find":{"elementText":"Network & internet"}}}})
. Tap the Network & internet entry.
+
// (step {"click":"Network & internet"})
. Check that the screen shows *Internet*.
+
// (step {"find":"Internet"})
. Close the Settings app.
+
// (step {"closeSurface":{"app":"settings"}})

// (test end)

== Android: your own app

// (test {"testId":"sessions-apps-android-install","detectSteps":false,"runOn":[{"platforms":"android","device":"sessions-pixel","requires":{"files":["build/sessions-demo.apk"]}}]})

. Install `build/sessions-demo.apk` on a headless Android 14 phone emulator named `sessions-pixel`, open its main activity, and wait for the Welcome screen.
+
// (step {"startSurface":{"app":"com.example.sessionsdemo","name":"demo","install":"build/sessions-demo.apk","activity":".MainActivity","device":{"platform":"android","name":"sessions-pixel","deviceType":"phone","osVersion":"14","headless":true},"driverOptions":{"appium:newCommandTimeout":300},"timeout":300000,"waitUntil":{"find":{"elementText":"Welcome"}}}})
. Close the app.
+
// (step {"closeSurface":{"app":"demo"}})

// (test end)

== iOS: Settings

// (test {"testId":"sessions-apps-ios","detectSteps":false,"runOn":[{"platforms":"ios","device":{"platform":"ios","name":"sessions-iphone","deviceType":"phone","osVersion":"18.0","headless":true}}]})

. On the iPhone simulator named `sessions-iphone`, open the Settings app, and wait for the General entry.
+
// (step {"startSurface":{"app":"com.apple.Preferences","name":"preferences","device":"sessions-iphone","timeout":180000,"waitUntil":{"find":{"elementText":"General"}}}})
. Tap the General entry.
+
// (step {"click":"General"})
. Check that the screen shows *About*.
+
// (step {"find":"About"})
. Close the Settings app.
+
// (step {"closeSurface":{"app":"preferences"}})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Open a built-in app</title></head>
<body>
<h1>Open a built-in app</h1>
<h2>Windows: Character Map</h2>
<!-- test {"testId":"sessions-apps-windows","detectSteps":false,"runOn":[{"platforms":"windows"}]} -->
<ol>
  <li>Open Character Map, and wait for its Select button.
    <!-- step {"startSurface":{"app":"C:\\Windows\\System32\\charmap.exe","name":"charmap","timeout":120000,"waitUntil":{"find":{"elementText":"Select"}}}} --></li>
  <li>Click <strong>Select</strong>.
    <!-- step {"click":"Select"} --></li>
  <li>Check that the window shows the <strong>Copy</strong> button.
    <!-- step {"find":"Copy"} --></li>
  <li>Check the Copy button again, picking the window by its title, by name, and as the newest window.
    <!-- step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"title":"Character Map"}}}} -->
    <!-- step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":"Character Map"}}} -->
    <!-- step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"name":"Character Map"}}}} -->
    <!-- step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":-1}}} -->
    <!-- step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"index":-1}}}} -->
    <!-- step {"find":{"elementText":"Copy","surface":{"app":"charmap"}}} --></li>
  <li>Close Character Map.
    <!-- step {"closeSurface":{"app":"charmap"}} --></li>
</ol>
<!-- test end -->
<h2>macOS: Calculator</h2>
<!-- test {"testId":"sessions-apps-mac","detectSteps":false,"runOn":[{"platforms":"mac"}]} -->
<ol>
  <li>Open Calculator with <code>SESSIONS_DOCS=1</code> in its environment, and wait for its <code>1</code> button.
    <!-- step {"startSurface":{"app":"/System/Applications/Calculator.app","name":"calculator","env":{"SESSIONS_DOCS":"1"},"timeout":180000,"waitUntil":{"find":{"elementAria":"1"}}}} --></li>
  <li>In the first window, press the <code>1</code> button.
    <!-- step {"click":{"elementAria":"1","surface":{"app":"calculator","window":{"index":0}}}} --></li>
  <li>Close Calculator.
    <!-- step {"closeSurface":"calculator"} --></li>
</ol>
<!-- test end -->
<h2>Android: Settings</h2>
<!-- test {"testId":"sessions-apps-android","detectSteps":false,"runOn":[{"platforms":"android"}]} -->
<ol>
  <li>Open the Settings app, and wait for the Network &amp; internet entry.
    <!-- step {"startSurface":{"app":"com.android.settings","name":"settings","timeout":180000,"waitUntil":{"find":{"elementText":"Network & internet"}}}} --></li>
  <li>Tap the Network &amp; internet entry.
    <!-- step {"click":"Network & internet"} --></li>
  <li>Check that the screen shows <strong>Internet</strong>.
    <!-- step {"find":"Internet"} --></li>
  <li>Close the Settings app.
    <!-- step {"closeSurface":{"app":"settings"}} --></li>
</ol>
<!-- test end -->
<h2>Android: your own app</h2>
<!-- test {"testId":"sessions-apps-android-install","detectSteps":false,"runOn":[{"platforms":"android","device":"sessions-pixel","requires":{"files":["build/sessions-demo.apk"]}}]} -->
<ol>
  <li>Install <code>build/sessions-demo.apk</code> on a headless Android 14 phone emulator named <code>sessions-pixel</code>, open its main activity, and wait for the Welcome screen.
    <!-- step {"startSurface":{"app":"com.example.sessionsdemo","name":"demo","install":"build/sessions-demo.apk","activity":".MainActivity","device":{"platform":"android","name":"sessions-pixel","deviceType":"phone","osVersion":"14","headless":true},"driverOptions":{"appium:newCommandTimeout":300},"timeout":300000,"waitUntil":{"find":{"elementText":"Welcome"}}}} --></li>
  <li>Close the app.
    <!-- step {"closeSurface":{"app":"demo"}} --></li>
</ol>
<!-- test end -->
<h2>iOS: Settings</h2>
<!-- test {"testId":"sessions-apps-ios","detectSteps":false,"runOn":[{"platforms":"ios","device":{"platform":"ios","name":"sessions-iphone","deviceType":"phone","osVersion":"18.0","headless":true}}]} -->
<ol>
  <li>On the iPhone simulator named <code>sessions-iphone</code>, open the Settings app, and wait for the General entry.
    <!-- step {"startSurface":{"app":"com.apple.Preferences","name":"preferences","device":"sessions-iphone","timeout":180000,"waitUntil":{"find":{"elementText":"General"}}}} --></li>
  <li>Tap the General entry.
    <!-- step {"click":"General"} --></li>
  <li>Check that the screen shows <strong>About</strong>.
    <!-- step {"find":"About"} --></li>
  <li>Close the Settings app.
    <!-- step {"closeSurface":{"app":"preferences"}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Open a built-in app
===================

Windows: Character Map
----------------------

.. test {"testId":"sessions-apps-windows","detectSteps":false,"runOn":[{"platforms":"windows"}]}

#. Open Character Map, and wait for its Select button.

   .. step {"startSurface":{"app":"C:\\Windows\\System32\\charmap.exe","name":"charmap","timeout":120000,"waitUntil":{"find":{"elementText":"Select"}}}}

#. Click **Select**.

   .. step {"click":"Select"}

#. Check that the window shows the **Copy** button.

   .. step {"find":"Copy"}

#. Check the Copy button again, picking the window by its title, by name, and as the newest window.

   .. step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"title":"Character Map"}}}}

   .. step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":"Character Map"}}}

   .. step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"name":"Character Map"}}}}

   .. step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":-1}}}

   .. step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"index":-1}}}}

   .. step {"find":{"elementText":"Copy","surface":{"app":"charmap"}}}

#. Close Character Map.

   .. step {"closeSurface":{"app":"charmap"}}

.. test end

macOS: Calculator
-----------------

.. test {"testId":"sessions-apps-mac","detectSteps":false,"runOn":[{"platforms":"mac"}]}

#. Open Calculator with ``SESSIONS_DOCS=1`` in its environment, and wait for its ``1`` button.

   .. step {"startSurface":{"app":"/System/Applications/Calculator.app","name":"calculator","env":{"SESSIONS_DOCS":"1"},"timeout":180000,"waitUntil":{"find":{"elementAria":"1"}}}}

#. In the first window, press the ``1`` button.

   .. step {"click":{"elementAria":"1","surface":{"app":"calculator","window":{"index":0}}}}

#. Close Calculator.

   .. step {"closeSurface":"calculator"}

.. test end

Android: Settings
-----------------

.. test {"testId":"sessions-apps-android","detectSteps":false,"runOn":[{"platforms":"android"}]}

#. Open the Settings app, and wait for the Network & internet entry.

   .. step {"startSurface":{"app":"com.android.settings","name":"settings","timeout":180000,"waitUntil":{"find":{"elementText":"Network & internet"}}}}

#. Tap the Network & internet entry.

   .. step {"click":"Network & internet"}

#. Check that the screen shows **Internet**.

   .. step {"find":"Internet"}

#. Close the Settings app.

   .. step {"closeSurface":{"app":"settings"}}

.. test end

Android: your own app
---------------------

.. test {"testId":"sessions-apps-android-install","detectSteps":false,"runOn":[{"platforms":"android","device":"sessions-pixel","requires":{"files":["build/sessions-demo.apk"]}}]}

#. Install ``build/sessions-demo.apk`` on a headless Android 14 phone emulator named ``sessions-pixel``, open its main activity, and wait for the Welcome screen.

   .. step {"startSurface":{"app":"com.example.sessionsdemo","name":"demo","install":"build/sessions-demo.apk","activity":".MainActivity","device":{"platform":"android","name":"sessions-pixel","deviceType":"phone","osVersion":"14","headless":true},"driverOptions":{"appium:newCommandTimeout":300},"timeout":300000,"waitUntil":{"find":{"elementText":"Welcome"}}}}

#. Close the app.

   .. step {"closeSurface":{"app":"demo"}}

.. test end

iOS: Settings
-------------

.. test {"testId":"sessions-apps-ios","detectSteps":false,"runOn":[{"platforms":"ios","device":{"platform":"ios","name":"sessions-iphone","deviceType":"phone","osVersion":"18.0","headless":true}}]}

#. On the iPhone simulator named ``sessions-iphone``, open the Settings app, and wait for the General entry.

   .. step {"startSurface":{"app":"com.apple.Preferences","name":"preferences","device":"sessions-iphone","timeout":180000,"waitUntil":{"find":{"elementText":"General"}}}}

#. Tap the General entry.

   .. step {"click":"General"}

#. Check that the screen shows **About**.

   .. step {"find":"About"}

#. Close the Settings app.

   .. step {"closeSurface":{"app":"preferences"}}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dita PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<dita>
  <topic id="sessions-apps">
    <title>Open a built-in app</title>
  </topic>
  <task id="sessions-apps-windows">
    <title>Windows: Character Map</title>
    <taskbody>
      <data name="doc-detective" value='test {"testId":"sessions-apps-windows","detectSteps":false,"runOn":[{"platforms":"windows"}]}'/>
      <steps>
        <step><cmd>Open Character Map, and wait for its Select button.</cmd>
          <info><data name="doc-detective" value='step {"startSurface":{"app":"C:\\Windows\\System32\\charmap.exe","name":"charmap","timeout":120000,"waitUntil":{"find":{"elementText":"Select"}}}}'/></info></step>
        <step><cmd>Click <uicontrol>Select</uicontrol>.</cmd>
          <info><data name="doc-detective" value='step {"click":"Select"}'/></info></step>
        <step><cmd>Check that the window shows the <b>Copy</b> button.</cmd>
          <info><data name="doc-detective" value='step {"find":"Copy"}'/></info></step>
        <step><cmd>Check the Copy button again, picking the window by its title, by name, and as the newest window.</cmd>
          <info><data name="doc-detective" value='step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"title":"Character Map"}}}}'/><data name="doc-detective" value='step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":"Character Map"}}}'/><data name="doc-detective" value='step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"name":"Character Map"}}}}'/><data name="doc-detective" value='step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":-1}}}'/><data name="doc-detective" value='step {"find":{"elementText":"Copy","surface":{"app":"charmap","window":{"index":-1}}}}'/><data name="doc-detective" value='step {"find":{"elementText":"Copy","surface":{"app":"charmap"}}}'/></info></step>
        <step><cmd>Close Character Map.</cmd>
          <info><data name="doc-detective" value='step {"closeSurface":{"app":"charmap"}}'/></info></step>
      </steps>
      <data name="doc-detective" value="test end"/>
    </taskbody>
  </task>
  <task id="sessions-apps-mac">
    <title>macOS: Calculator</title>
    <taskbody>
      <data name="doc-detective" value='test {"testId":"sessions-apps-mac","detectSteps":false,"runOn":[{"platforms":"mac"}]}'/>
      <steps>
        <step><cmd>Open Calculator with <codeph>SESSIONS_DOCS=1</codeph> in its environment, and wait for its <codeph>1</codeph> button.</cmd>
          <info><data name="doc-detective" value='step {"startSurface":{"app":"/System/Applications/Calculator.app","name":"calculator","env":{"SESSIONS_DOCS":"1"},"timeout":180000,"waitUntil":{"find":{"elementAria":"1"}}}}'/></info></step>
        <step><cmd>In the first window, press the <codeph>1</codeph> button.</cmd>
          <info><data name="doc-detective" value='step {"click":{"elementAria":"1","surface":{"app":"calculator","window":{"index":0}}}}'/></info></step>
        <step><cmd>Close Calculator.</cmd>
          <info><data name="doc-detective" value='step {"closeSurface":"calculator"}'/></info></step>
      </steps>
      <data name="doc-detective" value="test end"/>
    </taskbody>
  </task>
  <task id="sessions-apps-android">
    <title>Android: Settings</title>
    <taskbody>
      <data name="doc-detective" value='test {"testId":"sessions-apps-android","detectSteps":false,"runOn":[{"platforms":"android"}]}'/>
      <steps>
        <step><cmd>Open the Settings app, and wait for the Network &amp; internet entry.</cmd>
          <info><data name="doc-detective" value='step {"startSurface":{"app":"com.android.settings","name":"settings","timeout":180000,"waitUntil":{"find":{"elementText":"Network &amp; internet"}}}}'/></info></step>
        <step><cmd>Tap the Network &amp; internet entry.</cmd>
          <info><data name="doc-detective" value='step {"click":"Network &amp; internet"}'/></info></step>
        <step><cmd>Check that the screen shows <b>Internet</b>.</cmd>
          <info><data name="doc-detective" value='step {"find":"Internet"}'/></info></step>
        <step><cmd>Close the Settings app.</cmd>
          <info><data name="doc-detective" value='step {"closeSurface":{"app":"settings"}}'/></info></step>
      </steps>
      <data name="doc-detective" value="test end"/>
    </taskbody>
  </task>
  <task id="sessions-apps-android-install">
    <title>Android: your own app</title>
    <taskbody>
      <data name="doc-detective" value='test {"testId":"sessions-apps-android-install","detectSteps":false,"runOn":[{"platforms":"android","device":"sessions-pixel","requires":{"files":["build/sessions-demo.apk"]}}]}'/>
      <steps>
        <step><cmd>Install <codeph>build/sessions-demo.apk</codeph> on a headless Android 14 phone emulator named <codeph>sessions-pixel</codeph>, open its main activity, and wait for the Welcome screen.</cmd>
          <info><data name="doc-detective" value='step {"startSurface":{"app":"com.example.sessionsdemo","name":"demo","install":"build/sessions-demo.apk","activity":".MainActivity","device":{"platform":"android","name":"sessions-pixel","deviceType":"phone","osVersion":"14","headless":true},"driverOptions":{"appium:newCommandTimeout":300},"timeout":300000,"waitUntil":{"find":{"elementText":"Welcome"}}}}'/></info></step>
        <step><cmd>Close the app.</cmd>
          <info><data name="doc-detective" value='step {"closeSurface":{"app":"demo"}}'/></info></step>
      </steps>
      <data name="doc-detective" value="test end"/>
    </taskbody>
  </task>
  <task id="sessions-apps-ios">
    <title>iOS: Settings</title>
    <taskbody>
      <data name="doc-detective" value='test {"testId":"sessions-apps-ios","detectSteps":false,"runOn":[{"platforms":"ios","device":{"platform":"ios","name":"sessions-iphone","deviceType":"phone","osVersion":"18.0","headless":true}}]}'/>
      <steps>
        <step><cmd>On the iPhone simulator named <codeph>sessions-iphone</codeph>, open the Settings app, and wait for the General entry.</cmd>
          <info><data name="doc-detective" value='step {"startSurface":{"app":"com.apple.Preferences","name":"preferences","device":"sessions-iphone","timeout":180000,"waitUntil":{"find":{"elementText":"General"}}}}'/></info></step>
        <step><cmd>Tap the General entry.</cmd>
          <info><data name="doc-detective" value='step {"click":"General"}'/></info></step>
        <step><cmd>Check that the screen shows <b>About</b>.</cmd>
          <info><data name="doc-detective" value='step {"find":"About"}'/></info></step>
        <step><cmd>Close the Settings app.</cmd>
          <info><data name="doc-detective" value='step {"closeSurface":{"app":"preferences"}}'/></info></step>
      </steps>
      <data name="doc-detective" value="test end"/>
    </taskbody>
  </task>
</dita>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-apps-windows",
      "runOn": [
        {
          "platforms": "windows"
        }
      ],
      "steps": [
        {
          "startSurface": {
            "app": "C:\\Windows\\System32\\charmap.exe",
            "name": "charmap",
            "timeout": 120000,
            "waitUntil": {
              "find": {
                "elementText": "Select"
              }
            }
          }
        },
        {
          "click": "Select"
        },
        {
          "find": "Copy"
        },
        {
          "find": {
            "elementText": "Copy",
            "surface": {
              "app": "charmap",
              "window": {
                "title": "Character Map"
              }
            }
          }
        },
        {
          "find": {
            "elementText": "Copy",
            "surface": {
              "app": "charmap",
              "window": "Character Map"
            }
          }
        },
        {
          "find": {
            "elementText": "Copy",
            "surface": {
              "app": "charmap",
              "window": {
                "name": "Character Map"
              }
            }
          }
        },
        {
          "find": {
            "elementText": "Copy",
            "surface": {
              "app": "charmap",
              "window": -1
            }
          }
        },
        {
          "find": {
            "elementText": "Copy",
            "surface": {
              "app": "charmap",
              "window": {
                "index": -1
              }
            }
          }
        },
        {
          "find": {
            "elementText": "Copy",
            "surface": {
              "app": "charmap"
            }
          }
        },
        {
          "closeSurface": {
            "app": "charmap"
          }
        }
      ]
    },
    {
      "testId": "sessions-apps-mac",
      "runOn": [
        {
          "platforms": "mac"
        }
      ],
      "steps": [
        {
          "startSurface": {
            "app": "/System/Applications/Calculator.app",
            "name": "calculator",
            "env": {
              "SESSIONS_DOCS": "1"
            },
            "timeout": 180000,
            "waitUntil": {
              "find": {
                "elementAria": "1"
              }
            }
          }
        },
        {
          "click": {
            "elementAria": "1",
            "surface": {
              "app": "calculator",
              "window": {
                "index": 0
              }
            }
          }
        },
        {
          "closeSurface": "calculator"
        }
      ]
    },
    {
      "testId": "sessions-apps-android",
      "runOn": [
        {
          "platforms": "android"
        }
      ],
      "steps": [
        {
          "startSurface": {
            "app": "com.android.settings",
            "name": "settings",
            "timeout": 180000,
            "waitUntil": {
              "find": {
                "elementText": "Network & internet"
              }
            }
          }
        },
        {
          "click": "Network & internet"
        },
        {
          "find": "Internet"
        },
        {
          "closeSurface": {
            "app": "settings"
          }
        }
      ]
    },
    {
      "testId": "sessions-apps-android-install",
      "runOn": [
        {
          "platforms": "android",
          "device": "sessions-pixel",
          "requires": {
            "files": [
              "build/sessions-demo.apk"
            ]
          }
        }
      ],
      "steps": [
        {
          "startSurface": {
            "app": "com.example.sessionsdemo",
            "name": "demo",
            "install": "build/sessions-demo.apk",
            "activity": ".MainActivity",
            "device": {
              "platform": "android",
              "name": "sessions-pixel",
              "deviceType": "phone",
              "osVersion": "14",
              "headless": true
            },
            "driverOptions": {
              "appium:newCommandTimeout": 300
            },
            "timeout": 300000,
            "waitUntil": {
              "find": {
                "elementText": "Welcome"
              }
            }
          }
        },
        {
          "closeSurface": {
            "app": "demo"
          }
        }
      ]
    },
    {
      "testId": "sessions-apps-ios",
      "runOn": [
        {
          "platforms": "ios",
          "device": {
            "platform": "ios",
            "name": "sessions-iphone",
            "deviceType": "phone",
            "osVersion": "18.0",
            "headless": true
          }
        }
      ],
      "steps": [
        {
          "startSurface": {
            "app": "com.apple.Preferences",
            "name": "preferences",
            "device": "sessions-iphone",
            "timeout": 180000,
            "waitUntil": {
              "find": {
                "elementText": "General"
              }
            }
          }
        },
        {
          "click": "General"
        },
        {
          "find": "About"
        },
        {
          "closeSurface": {
            "app": "preferences"
          }
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-apps-windows
    runOn:
      - platforms: windows
    steps:
      - startSurface:
          app: C:\Windows\System32\charmap.exe
          name: charmap
          timeout: 120000
          waitUntil:
            find:
              elementText: Select
      - click: Select
      - find: Copy
      - find:
          elementText: Copy
          surface:
            app: charmap
            window:
              title: Character Map
      - find:
          elementText: Copy
          surface:
            app: charmap
            window: Character Map
      - find:
          elementText: Copy
          surface:
            app: charmap
            window:
              name: Character Map
      - find:
          elementText: Copy
          surface:
            app: charmap
            window: -1
      - find:
          elementText: Copy
          surface:
            app: charmap
            window:
              index: -1
      - find:
          elementText: Copy
          surface:
            app: charmap
      - closeSurface:
          app: charmap
  - testId: sessions-apps-mac
    runOn:
      - platforms: mac
    steps:
      - startSurface:
          app: /System/Applications/Calculator.app
          name: calculator
          env:
            SESSIONS_DOCS: "1"
          timeout: 180000
          waitUntil:
            find:
              elementAria: "1"
      - click:
          elementAria: "1"
          surface:
            app: calculator
            window:
              index: 0
      - closeSurface: calculator
  - testId: sessions-apps-android
    runOn:
      - platforms: android
    steps:
      - startSurface:
          app: com.android.settings
          name: settings
          timeout: 180000
          waitUntil:
            find:
              elementText: Network & internet
      - click: Network & internet
      - find: Internet
      - closeSurface:
          app: settings
  - testId: sessions-apps-android-install
    runOn:
      - platforms: android
        device: sessions-pixel
        requires:
          files:
            - build/sessions-demo.apk
    steps:
      - startSurface:
          app: com.example.sessionsdemo
          name: demo
          install: build/sessions-demo.apk
          activity: .MainActivity
          device:
            platform: android
            name: sessions-pixel
            deviceType: phone
            osVersion: "14"
            headless: true
          driverOptions:
            appium:newCommandTimeout: 300
          timeout: 300000
          waitUntil:
            find:
              elementText: Welcome
      - closeSurface:
          app: demo
  - testId: sessions-apps-ios
    runOn:
      - platforms: ios
        device:
          platform: ios
          name: sessions-iphone
          deviceType: phone
          osVersion: "18.0"
          headless: true
    steps:
      - startSurface:
          app: com.apple.Preferences
          name: preferences
          device: sessions-iphone
          timeout: 180000
          waitUntil:
            find:
              elementText: General
      - click: General
      - find: About
      - closeSurface:
          app: preferences
```

### Where each test runs

| Test                 | Runs on                                                                      | Elsewhere |
| -------------------- | ---------------------------------------------------------------------------- | --------- |
| Character Map        | Windows                                                                      | `SKIPPED` |
| Calculator           | macOS, with Accessibility permission for the process that runs Doc Detective | `SKIPPED` |
| Android Settings     | A host with the Android toolchain (`doc-detective install android`)          | `SKIPPED` |
| Your own Android app | A host with the Android toolchain and the app's `build/sessions-demo.apk`    | `SKIPPED` |
| iOS Settings         | macOS with Xcode and Simulator tooling                                       | `SKIPPED` |

The Android app test needs your own app, so its context `requires` the APK file and skips without it.

For setup on each platform, see the native app guides, starting with [Native Windows apps](/docs/test-docs/native-windows-apps).

### Forms in this example

* An app `window` selector takes a title as a string, `{ "title" }` or `{ "name" }` criteria, `-1` or `{ "index": -1 }` for the newest window, or a position such as `{ "index": 0 }`. Positions from the start work on macOS only.
* `env` sets environment variables for a macOS app.
* `install`, `activity`, and `driverOptions` install an Android app, open one of its activities, and pass options to the automation driver.
* `device` on `startSurface` names the device as a string, or describes it as a [device descriptor](/reference/schemas/device-descriptor) with `platform`, `name`, `deviceType`, `osVersion`, and `headless`. The context's own `device` takes the same two forms and sets the default for the context.

### What detection finds

On Windows, `Click **Select**` becomes a `click` step and a `find` step for `Select`, and the bold `Copy`, `Internet`, and `About` become `find` steps. The mobile procedures say `Tap`, and a statement holds that click, because after the tap the screen no longer shows the entry's label. A detected `find` for the label would fail.

In DITA, `<uicontrol>` marks the control to click, as in [Navigation and interaction](/reference/docs-as-tests/navigation-interaction).

## `saveCookie` and `loadCookie` permutations

### `"saveCookie": "<name>"`

**Varies:** `saveCookie and loadCookie` · **Value:** `"sessions_pname"` · **Effect:** a bare cookie name saves the cookie to, and loads it from, the environment variable of the same name.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Keep a cookie in an environment variable

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pname/signed-in). The server sets the `sessions_pname` cookie.
2. Save the `sessions_pname` cookie to the `sessions_pname` environment variable.
3. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pname/signed-out), which replaces the cookie.
4. Load the cookie from the `sessions_pname` environment variable.
5. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pname=signed-in**.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Keep a cookie in an environment variable

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pname/signed-in). The server sets the `sessions_pname` cookie.
2. Save the `sessions_pname` cookie to the `sessions_pname` environment variable.
3. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pname/signed-out), which replaces the cookie.
4. Load the cookie from the `sessions_pname` environment variable.
5. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pname=signed-in**.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Keep a cookie in an environment variable

. Sign in at http://localhost:8092/cookies/set/sessions_pname/signed-in[the sign-in page]. The server sets the `sessions_pname` cookie.
. Save the `sessions_pname` cookie to the `sessions_pname` environment variable.
. Sign out at http://localhost:8092/cookies/set/sessions_pname/signed-out[the sign-out page], which replaces the cookie.
. Load the cookie from the `sessions_pname` environment variable.
. Open http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_pname=signed-in*.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Keep a cookie in an environment variable</title></head>
<body>
<h1>Keep a cookie in an environment variable</h1>
<ol>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_pname/signed-in">the sign-in page</a>. The server sets the <code>sessions_pname</code> cookie.</li>
  <li>Save the <code>sessions_pname</code> cookie to the <code>sessions_pname</code> environment variable.</li>
  <li>Sign out at <a href="http://localhost:8092/cookies/set/sessions_pname/signed-out">the sign-out page</a>, which replaces the cookie.</li>
  <li>Load the cookie from the <code>sessions_pname</code> environment variable.</li>
  <li>Open <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_pname=signed-in</strong>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Keep a cookie in an environment variable
========================================

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_pname/signed-in>`__. The server sets the ``sessions_pname`` cookie.

#. Save the ``sessions_pname`` cookie to the ``sessions_pname`` environment variable.

#. Sign out at `the sign-out page <http://localhost:8092/cookies/set/sessions_pname/signed-out>`__, which replaces the cookie.

#. Load the cookie from the ``sessions_pname`` environment variable.

#. Open `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_pname=signed-in**.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-cookie-form-name">
  <title>Keep a cookie in an environment variable</title>
  <taskbody>
    <steps>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_pname/signed-in" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_pname</codeph> cookie.</cmd></step>
      <step><cmd>Save the <codeph>sessions_pname</codeph> cookie to the <codeph>sessions_pname</codeph> environment variable.</cmd></step>
      <step><cmd>Sign out at <xref href="http://localhost:8092/cookies/set/sessions_pname/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd></step>
      <step><cmd>Load the cookie from the <codeph>sessions_pname</codeph> environment variable.</cmd></step>
      <step><cmd>Open <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_pname=signed-in</b>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-cookie-form-name","detectSteps":true} -->

# Keep a cookie in an environment variable

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pname/signed-in). The server sets the `sessions_pname` cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pname/signed-in"} -->
2. Save the `sessions_pname` cookie to the `sessions_pname` environment variable.
   <!-- step {"saveCookie":"sessions_pname"} -->
3. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pname/signed-out), which replaces the cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pname/signed-out"} -->
4. Load the cookie from the `sessions_pname` environment variable.
   <!-- step {"loadCookie":"sessions_pname"} -->
5. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pname=signed-in**.

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-cookie-form-name","detectSteps":true} */}

# Keep a cookie in an environment variable

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pname/signed-in). The server sets the `sessions_pname` cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pname/signed-in"} */}
2. Save the `sessions_pname` cookie to the `sessions_pname` environment variable.
   {/* step {"saveCookie":"sessions_pname"} */}
3. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pname/signed-out), which replaces the cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pname/signed-out"} */}
4. Load the cookie from the `sessions_pname` environment variable.
   {/* step {"loadCookie":"sessions_pname"} */}
5. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pname=signed-in**.

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Keep a cookie in an environment variable

// (test {"testId":"sessions-cookie-form-name","detectSteps":true})

. Sign in at http://localhost:8092/cookies/set/sessions_pname/signed-in[the sign-in page]. The server sets the `sessions_pname` cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pname/signed-in"})
. Save the `sessions_pname` cookie to the `sessions_pname` environment variable.
+
// (step {"saveCookie":"sessions_pname"})
. Sign out at http://localhost:8092/cookies/set/sessions_pname/signed-out[the sign-out page], which replaces the cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pname/signed-out"})
. Load the cookie from the `sessions_pname` environment variable.
+
// (step {"loadCookie":"sessions_pname"})
. Open http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_pname=signed-in*.

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Keep a cookie in an environment variable</title></head>
<body>
<!-- test {"testId":"sessions-cookie-form-name","detectSteps":true} -->
<h1>Keep a cookie in an environment variable</h1>
<ol>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_pname/signed-in">the sign-in page</a>. The server sets the <code>sessions_pname</code> cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pname/signed-in"} --></li>
  <li>Save the <code>sessions_pname</code> cookie to the <code>sessions_pname</code> environment variable.
    <!-- step {"saveCookie":"sessions_pname"} --></li>
  <li>Sign out at <a href="http://localhost:8092/cookies/set/sessions_pname/signed-out">the sign-out page</a>, which replaces the cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pname/signed-out"} --></li>
  <li>Load the cookie from the <code>sessions_pname</code> environment variable.
    <!-- step {"loadCookie":"sessions_pname"} --></li>
  <li>Open <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_pname=signed-in</strong>.</li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Keep a cookie in an environment variable
========================================

.. test {"testId":"sessions-cookie-form-name","detectSteps":true}

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_pname/signed-in>`__. The server sets the ``sessions_pname`` cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pname/signed-in"}

#. Save the ``sessions_pname`` cookie to the ``sessions_pname`` environment variable.

   .. step {"saveCookie":"sessions_pname"}

#. Sign out at `the sign-out page <http://localhost:8092/cookies/set/sessions_pname/signed-out>`__, which replaces the cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pname/signed-out"}

#. Load the cookie from the ``sessions_pname`` environment variable.

   .. step {"loadCookie":"sessions_pname"}

#. Open `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_pname=signed-in**.

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-cookie-form-name">
  <title>Keep a cookie in an environment variable</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-cookie-form-name","detectSteps":true}'/>
    <steps>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_pname/signed-in" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_pname</codeph> cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pname/signed-in"}'/></info></step>
      <step><cmd>Save the <codeph>sessions_pname</codeph> cookie to the <codeph>sessions_pname</codeph> environment variable.</cmd>
        <info><data name="doc-detective" value='step {"saveCookie":"sessions_pname"}'/></info></step>
      <step><cmd>Sign out at <xref href="http://localhost:8092/cookies/set/sessions_pname/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pname/signed-out"}'/></info></step>
      <step><cmd>Load the cookie from the <codeph>sessions_pname</codeph> environment variable.</cmd>
        <info><data name="doc-detective" value='step {"loadCookie":"sessions_pname"}'/></info></step>
      <step><cmd>Open <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_pname=signed-in</b>.</cmd></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-cookie-form-name","detectSteps":false} -->

# Keep a cookie in an environment variable

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pname/signed-in). The server sets the `sessions_pname` cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pname/signed-in"} -->
2. Save the `sessions_pname` cookie to the `sessions_pname` environment variable.
   <!-- step {"saveCookie":"sessions_pname"} -->
3. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pname/signed-out), which replaces the cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pname/signed-out"} -->
4. Load the cookie from the `sessions_pname` environment variable.
   <!-- step {"loadCookie":"sessions_pname"} -->
5. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pname=signed-in**.
   <!-- step {"goTo":"http://localhost:8092/cookies"} -->
   <!-- step {"find":"sessions_pname=signed-in"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-cookie-form-name","detectSteps":false} */}

# Keep a cookie in an environment variable

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pname/signed-in). The server sets the `sessions_pname` cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pname/signed-in"} */}
2. Save the `sessions_pname` cookie to the `sessions_pname` environment variable.
   {/* step {"saveCookie":"sessions_pname"} */}
3. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pname/signed-out), which replaces the cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pname/signed-out"} */}
4. Load the cookie from the `sessions_pname` environment variable.
   {/* step {"loadCookie":"sessions_pname"} */}
5. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pname=signed-in**.
   {/* step {"goTo":"http://localhost:8092/cookies"} */}
   {/* step {"find":"sessions_pname=signed-in"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Keep a cookie in an environment variable

// (test {"testId":"sessions-cookie-form-name","detectSteps":false})

. Sign in at http://localhost:8092/cookies/set/sessions_pname/signed-in[the sign-in page]. The server sets the `sessions_pname` cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pname/signed-in"})
. Save the `sessions_pname` cookie to the `sessions_pname` environment variable.
+
// (step {"saveCookie":"sessions_pname"})
. Sign out at http://localhost:8092/cookies/set/sessions_pname/signed-out[the sign-out page], which replaces the cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pname/signed-out"})
. Load the cookie from the `sessions_pname` environment variable.
+
// (step {"loadCookie":"sessions_pname"})
. Open http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_pname=signed-in*.
+
// (step {"goTo":"http://localhost:8092/cookies"})
+
// (step {"find":"sessions_pname=signed-in"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Keep a cookie in an environment variable</title></head>
<body>
<!-- test {"testId":"sessions-cookie-form-name","detectSteps":false} -->
<h1>Keep a cookie in an environment variable</h1>
<ol>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_pname/signed-in">the sign-in page</a>. The server sets the <code>sessions_pname</code> cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pname/signed-in"} --></li>
  <li>Save the <code>sessions_pname</code> cookie to the <code>sessions_pname</code> environment variable.
    <!-- step {"saveCookie":"sessions_pname"} --></li>
  <li>Sign out at <a href="http://localhost:8092/cookies/set/sessions_pname/signed-out">the sign-out page</a>, which replaces the cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pname/signed-out"} --></li>
  <li>Load the cookie from the <code>sessions_pname</code> environment variable.
    <!-- step {"loadCookie":"sessions_pname"} --></li>
  <li>Open <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_pname=signed-in</strong>.
    <!-- step {"goTo":"http://localhost:8092/cookies"} -->
    <!-- step {"find":"sessions_pname=signed-in"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Keep a cookie in an environment variable
========================================

.. test {"testId":"sessions-cookie-form-name","detectSteps":false}

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_pname/signed-in>`__. The server sets the ``sessions_pname`` cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pname/signed-in"}

#. Save the ``sessions_pname`` cookie to the ``sessions_pname`` environment variable.

   .. step {"saveCookie":"sessions_pname"}

#. Sign out at `the sign-out page <http://localhost:8092/cookies/set/sessions_pname/signed-out>`__, which replaces the cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pname/signed-out"}

#. Load the cookie from the ``sessions_pname`` environment variable.

   .. step {"loadCookie":"sessions_pname"}

#. Open `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_pname=signed-in**.

   .. step {"goTo":"http://localhost:8092/cookies"}

   .. step {"find":"sessions_pname=signed-in"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-cookie-form-name">
  <title>Keep a cookie in an environment variable</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-cookie-form-name","detectSteps":false}'/>
    <steps>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_pname/signed-in" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_pname</codeph> cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pname/signed-in"}'/></info></step>
      <step><cmd>Save the <codeph>sessions_pname</codeph> cookie to the <codeph>sessions_pname</codeph> environment variable.</cmd>
        <info><data name="doc-detective" value='step {"saveCookie":"sessions_pname"}'/></info></step>
      <step><cmd>Sign out at <xref href="http://localhost:8092/cookies/set/sessions_pname/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pname/signed-out"}'/></info></step>
      <step><cmd>Load the cookie from the <codeph>sessions_pname</codeph> environment variable.</cmd>
        <info><data name="doc-detective" value='step {"loadCookie":"sessions_pname"}'/></info></step>
      <step><cmd>Open <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_pname=signed-in</b>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies"}'/><data name="doc-detective" value='step {"find":"sessions_pname=signed-in"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-cookie-form-name",
      "steps": [
        {
          "goTo": "http://localhost:8092/cookies/set/sessions_pname/signed-in"
        },
        {
          "saveCookie": "sessions_pname"
        },
        {
          "goTo": "http://localhost:8092/cookies/set/sessions_pname/signed-out"
        },
        {
          "loadCookie": "sessions_pname"
        },
        {
          "goTo": "http://localhost:8092/cookies"
        },
        {
          "find": "sessions_pname=signed-in"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-cookie-form-name
    steps:
      - goTo: http://localhost:8092/cookies/set/sessions_pname/signed-in
      - saveCookie: sessions_pname
      - goTo: http://localhost:8092/cookies/set/sessions_pname/signed-out
      - loadCookie: sessions_pname
      - goTo: http://localhost:8092/cookies
      - find: sessions_pname=signed-in
```

### `"saveCookie": "<name>.txt"`

**Varies:** `saveCookie and loadCookie` · **Value:** `"sessions_ptxt.txt"` · **Effect:** a path ending in `.txt` saves the cookie named for the file to that file in `outputDir`, and never overwrites one that exists.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Keep a cookie in a file

1. Delete any `sessions_ptxt.txt` that an earlier run left in the output folder.
2. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_ptxt/signed-in). The server sets the `sessions_ptxt` cookie.
3. Save the `sessions_ptxt` cookie to `sessions_ptxt.txt`.
4. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_ptxt/signed-out), which replaces the cookie.
5. Load the cookie from `sessions_ptxt.txt`.
6. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_ptxt=signed-in**.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Keep a cookie in a file

1. Delete any `sessions_ptxt.txt` that an earlier run left in the output folder.
2. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_ptxt/signed-in). The server sets the `sessions_ptxt` cookie.
3. Save the `sessions_ptxt` cookie to `sessions_ptxt.txt`.
4. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_ptxt/signed-out), which replaces the cookie.
5. Load the cookie from `sessions_ptxt.txt`.
6. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_ptxt=signed-in**.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Keep a cookie in a file

. Delete any `sessions_ptxt.txt` that an earlier run left in the output folder.
. Sign in at http://localhost:8092/cookies/set/sessions_ptxt/signed-in[the sign-in page]. The server sets the `sessions_ptxt` cookie.
. Save the `sessions_ptxt` cookie to `sessions_ptxt.txt`.
. Sign out at http://localhost:8092/cookies/set/sessions_ptxt/signed-out[the sign-out page], which replaces the cookie.
. Load the cookie from `sessions_ptxt.txt`.
. Open http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_ptxt=signed-in*.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Keep a cookie in a file</title></head>
<body>
<h1>Keep a cookie in a file</h1>
<ol>
  <li>Delete any <code>sessions_ptxt.txt</code> that an earlier run left in the output folder.</li>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_ptxt/signed-in">the sign-in page</a>. The server sets the <code>sessions_ptxt</code> cookie.</li>
  <li>Save the <code>sessions_ptxt</code> cookie to <code>sessions_ptxt.txt</code>.</li>
  <li>Sign out at <a href="http://localhost:8092/cookies/set/sessions_ptxt/signed-out">the sign-out page</a>, which replaces the cookie.</li>
  <li>Load the cookie from <code>sessions_ptxt.txt</code>.</li>
  <li>Open <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_ptxt=signed-in</strong>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Keep a cookie in a file
=======================

#. Delete any ``sessions_ptxt.txt`` that an earlier run left in the output folder.

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_ptxt/signed-in>`__. The server sets the ``sessions_ptxt`` cookie.

#. Save the ``sessions_ptxt`` cookie to ``sessions_ptxt.txt``.

#. Sign out at `the sign-out page <http://localhost:8092/cookies/set/sessions_ptxt/signed-out>`__, which replaces the cookie.

#. Load the cookie from ``sessions_ptxt.txt``.

#. Open `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_ptxt=signed-in**.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-cookie-form-txt">
  <title>Keep a cookie in a file</title>
  <taskbody>
    <steps>
      <step><cmd>Delete any <codeph>sessions_ptxt.txt</codeph> that an earlier run left in the output folder.</cmd></step>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_ptxt/signed-in" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_ptxt</codeph> cookie.</cmd></step>
      <step><cmd>Save the <codeph>sessions_ptxt</codeph> cookie to <codeph>sessions_ptxt.txt</codeph>.</cmd></step>
      <step><cmd>Sign out at <xref href="http://localhost:8092/cookies/set/sessions_ptxt/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd></step>
      <step><cmd>Load the cookie from <codeph>sessions_ptxt.txt</codeph>.</cmd></step>
      <step><cmd>Open <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_ptxt=signed-in</b>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-cookie-form-txt","detectSteps":true} -->

# Keep a cookie in a file

1. Delete any `sessions_ptxt.txt` that an earlier run left in the output folder.
   <!-- step {"runShell":"node -e \"require('fs').rmSync('docs/docs-as-tests/examples/.dd-output/sessions_ptxt.txt', { force: true })\""} -->
2. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_ptxt/signed-in). The server sets the `sessions_ptxt` cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_ptxt/signed-in"} -->
3. Save the `sessions_ptxt` cookie to `sessions_ptxt.txt`.
   <!-- step {"saveCookie":"sessions_ptxt.txt"} -->
4. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_ptxt/signed-out), which replaces the cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_ptxt/signed-out"} -->
5. Load the cookie from `sessions_ptxt.txt`.
   <!-- step {"loadCookie":"sessions_ptxt.txt"} -->
6. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_ptxt=signed-in**.

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-cookie-form-txt","detectSteps":true} */}

# Keep a cookie in a file

1. Delete any `sessions_ptxt.txt` that an earlier run left in the output folder.
   {/* step {"runShell":"node -e \"require('fs').rmSync('docs/docs-as-tests/examples/.dd-output/sessions_ptxt.txt', { force: true })\""} */}
2. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_ptxt/signed-in). The server sets the `sessions_ptxt` cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_ptxt/signed-in"} */}
3. Save the `sessions_ptxt` cookie to `sessions_ptxt.txt`.
   {/* step {"saveCookie":"sessions_ptxt.txt"} */}
4. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_ptxt/signed-out), which replaces the cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_ptxt/signed-out"} */}
5. Load the cookie from `sessions_ptxt.txt`.
   {/* step {"loadCookie":"sessions_ptxt.txt"} */}
6. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_ptxt=signed-in**.

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Keep a cookie in a file

// (test {"testId":"sessions-cookie-form-txt","detectSteps":true})

. Delete any `sessions_ptxt.txt` that an earlier run left in the output folder.
+
// (step {"runShell":"node -e \"require('fs').rmSync('docs/docs-as-tests/examples/.dd-output/sessions_ptxt.txt', { force: true })\""})
. Sign in at http://localhost:8092/cookies/set/sessions_ptxt/signed-in[the sign-in page]. The server sets the `sessions_ptxt` cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_ptxt/signed-in"})
. Save the `sessions_ptxt` cookie to `sessions_ptxt.txt`.
+
// (step {"saveCookie":"sessions_ptxt.txt"})
. Sign out at http://localhost:8092/cookies/set/sessions_ptxt/signed-out[the sign-out page], which replaces the cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_ptxt/signed-out"})
. Load the cookie from `sessions_ptxt.txt`.
+
// (step {"loadCookie":"sessions_ptxt.txt"})
. Open http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_ptxt=signed-in*.

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Keep a cookie in a file</title></head>
<body>
<!-- test {"testId":"sessions-cookie-form-txt","detectSteps":true} -->
<h1>Keep a cookie in a file</h1>
<ol>
  <li>Delete any <code>sessions_ptxt.txt</code> that an earlier run left in the output folder.
    <!-- step {"runShell":"node -e \"require('fs').rmSync('docs/docs-as-tests/examples/.dd-output/sessions_ptxt.txt', { force: true })\""} --></li>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_ptxt/signed-in">the sign-in page</a>. The server sets the <code>sessions_ptxt</code> cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_ptxt/signed-in"} --></li>
  <li>Save the <code>sessions_ptxt</code> cookie to <code>sessions_ptxt.txt</code>.
    <!-- step {"saveCookie":"sessions_ptxt.txt"} --></li>
  <li>Sign out at <a href="http://localhost:8092/cookies/set/sessions_ptxt/signed-out">the sign-out page</a>, which replaces the cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_ptxt/signed-out"} --></li>
  <li>Load the cookie from <code>sessions_ptxt.txt</code>.
    <!-- step {"loadCookie":"sessions_ptxt.txt"} --></li>
  <li>Open <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_ptxt=signed-in</strong>.</li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Keep a cookie in a file
=======================

.. test {"testId":"sessions-cookie-form-txt","detectSteps":true}

#. Delete any ``sessions_ptxt.txt`` that an earlier run left in the output folder.

   .. step {"runShell":"node -e \"require('fs').rmSync('docs/docs-as-tests/examples/.dd-output/sessions_ptxt.txt', { force: true })\""}

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_ptxt/signed-in>`__. The server sets the ``sessions_ptxt`` cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_ptxt/signed-in"}

#. Save the ``sessions_ptxt`` cookie to ``sessions_ptxt.txt``.

   .. step {"saveCookie":"sessions_ptxt.txt"}

#. Sign out at `the sign-out page <http://localhost:8092/cookies/set/sessions_ptxt/signed-out>`__, which replaces the cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_ptxt/signed-out"}

#. Load the cookie from ``sessions_ptxt.txt``.

   .. step {"loadCookie":"sessions_ptxt.txt"}

#. Open `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_ptxt=signed-in**.

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-cookie-form-txt">
  <title>Keep a cookie in a file</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-cookie-form-txt","detectSteps":true}'/>
    <steps>
      <step><cmd>Delete any <codeph>sessions_ptxt.txt</codeph> that an earlier run left in the output folder.</cmd>
        <info><data name="doc-detective" value='step {"runShell":"node -e \"require(&apos;fs&apos;).rmSync(&apos;docs/docs-as-tests/examples/.dd-output/sessions_ptxt.txt&apos;, { force: true })\""}'/></info></step>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_ptxt/signed-in" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_ptxt</codeph> cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_ptxt/signed-in"}'/></info></step>
      <step><cmd>Save the <codeph>sessions_ptxt</codeph> cookie to <codeph>sessions_ptxt.txt</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"saveCookie":"sessions_ptxt.txt"}'/></info></step>
      <step><cmd>Sign out at <xref href="http://localhost:8092/cookies/set/sessions_ptxt/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_ptxt/signed-out"}'/></info></step>
      <step><cmd>Load the cookie from <codeph>sessions_ptxt.txt</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"loadCookie":"sessions_ptxt.txt"}'/></info></step>
      <step><cmd>Open <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_ptxt=signed-in</b>.</cmd></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-cookie-form-txt","detectSteps":false} -->

# Keep a cookie in a file

1. Delete any `sessions_ptxt.txt` that an earlier run left in the output folder.
   <!-- step {"runShell":"node -e \"require('fs').rmSync('docs/docs-as-tests/examples/.dd-output/sessions_ptxt.txt', { force: true })\""} -->
2. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_ptxt/signed-in). The server sets the `sessions_ptxt` cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_ptxt/signed-in"} -->
3. Save the `sessions_ptxt` cookie to `sessions_ptxt.txt`.
   <!-- step {"saveCookie":"sessions_ptxt.txt"} -->
4. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_ptxt/signed-out), which replaces the cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_ptxt/signed-out"} -->
5. Load the cookie from `sessions_ptxt.txt`.
   <!-- step {"loadCookie":"sessions_ptxt.txt"} -->
6. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_ptxt=signed-in**.
   <!-- step {"goTo":"http://localhost:8092/cookies"} -->
   <!-- step {"find":"sessions_ptxt=signed-in"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-cookie-form-txt","detectSteps":false} */}

# Keep a cookie in a file

1. Delete any `sessions_ptxt.txt` that an earlier run left in the output folder.
   {/* step {"runShell":"node -e \"require('fs').rmSync('docs/docs-as-tests/examples/.dd-output/sessions_ptxt.txt', { force: true })\""} */}
2. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_ptxt/signed-in). The server sets the `sessions_ptxt` cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_ptxt/signed-in"} */}
3. Save the `sessions_ptxt` cookie to `sessions_ptxt.txt`.
   {/* step {"saveCookie":"sessions_ptxt.txt"} */}
4. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_ptxt/signed-out), which replaces the cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_ptxt/signed-out"} */}
5. Load the cookie from `sessions_ptxt.txt`.
   {/* step {"loadCookie":"sessions_ptxt.txt"} */}
6. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_ptxt=signed-in**.
   {/* step {"goTo":"http://localhost:8092/cookies"} */}
   {/* step {"find":"sessions_ptxt=signed-in"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Keep a cookie in a file

// (test {"testId":"sessions-cookie-form-txt","detectSteps":false})

. Delete any `sessions_ptxt.txt` that an earlier run left in the output folder.
+
// (step {"runShell":"node -e \"require('fs').rmSync('docs/docs-as-tests/examples/.dd-output/sessions_ptxt.txt', { force: true })\""})
. Sign in at http://localhost:8092/cookies/set/sessions_ptxt/signed-in[the sign-in page]. The server sets the `sessions_ptxt` cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_ptxt/signed-in"})
. Save the `sessions_ptxt` cookie to `sessions_ptxt.txt`.
+
// (step {"saveCookie":"sessions_ptxt.txt"})
. Sign out at http://localhost:8092/cookies/set/sessions_ptxt/signed-out[the sign-out page], which replaces the cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_ptxt/signed-out"})
. Load the cookie from `sessions_ptxt.txt`.
+
// (step {"loadCookie":"sessions_ptxt.txt"})
. Open http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_ptxt=signed-in*.
+
// (step {"goTo":"http://localhost:8092/cookies"})
+
// (step {"find":"sessions_ptxt=signed-in"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Keep a cookie in a file</title></head>
<body>
<!-- test {"testId":"sessions-cookie-form-txt","detectSteps":false} -->
<h1>Keep a cookie in a file</h1>
<ol>
  <li>Delete any <code>sessions_ptxt.txt</code> that an earlier run left in the output folder.
    <!-- step {"runShell":"node -e \"require('fs').rmSync('docs/docs-as-tests/examples/.dd-output/sessions_ptxt.txt', { force: true })\""} --></li>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_ptxt/signed-in">the sign-in page</a>. The server sets the <code>sessions_ptxt</code> cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_ptxt/signed-in"} --></li>
  <li>Save the <code>sessions_ptxt</code> cookie to <code>sessions_ptxt.txt</code>.
    <!-- step {"saveCookie":"sessions_ptxt.txt"} --></li>
  <li>Sign out at <a href="http://localhost:8092/cookies/set/sessions_ptxt/signed-out">the sign-out page</a>, which replaces the cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_ptxt/signed-out"} --></li>
  <li>Load the cookie from <code>sessions_ptxt.txt</code>.
    <!-- step {"loadCookie":"sessions_ptxt.txt"} --></li>
  <li>Open <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_ptxt=signed-in</strong>.
    <!-- step {"goTo":"http://localhost:8092/cookies"} -->
    <!-- step {"find":"sessions_ptxt=signed-in"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Keep a cookie in a file
=======================

.. test {"testId":"sessions-cookie-form-txt","detectSteps":false}

#. Delete any ``sessions_ptxt.txt`` that an earlier run left in the output folder.

   .. step {"runShell":"node -e \"require('fs').rmSync('docs/docs-as-tests/examples/.dd-output/sessions_ptxt.txt', { force: true })\""}

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_ptxt/signed-in>`__. The server sets the ``sessions_ptxt`` cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_ptxt/signed-in"}

#. Save the ``sessions_ptxt`` cookie to ``sessions_ptxt.txt``.

   .. step {"saveCookie":"sessions_ptxt.txt"}

#. Sign out at `the sign-out page <http://localhost:8092/cookies/set/sessions_ptxt/signed-out>`__, which replaces the cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_ptxt/signed-out"}

#. Load the cookie from ``sessions_ptxt.txt``.

   .. step {"loadCookie":"sessions_ptxt.txt"}

#. Open `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_ptxt=signed-in**.

   .. step {"goTo":"http://localhost:8092/cookies"}

   .. step {"find":"sessions_ptxt=signed-in"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-cookie-form-txt">
  <title>Keep a cookie in a file</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-cookie-form-txt","detectSteps":false}'/>
    <steps>
      <step><cmd>Delete any <codeph>sessions_ptxt.txt</codeph> that an earlier run left in the output folder.</cmd>
        <info><data name="doc-detective" value='step {"runShell":"node -e \"require(&apos;fs&apos;).rmSync(&apos;docs/docs-as-tests/examples/.dd-output/sessions_ptxt.txt&apos;, { force: true })\""}'/></info></step>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_ptxt/signed-in" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_ptxt</codeph> cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_ptxt/signed-in"}'/></info></step>
      <step><cmd>Save the <codeph>sessions_ptxt</codeph> cookie to <codeph>sessions_ptxt.txt</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"saveCookie":"sessions_ptxt.txt"}'/></info></step>
      <step><cmd>Sign out at <xref href="http://localhost:8092/cookies/set/sessions_ptxt/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_ptxt/signed-out"}'/></info></step>
      <step><cmd>Load the cookie from <codeph>sessions_ptxt.txt</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"loadCookie":"sessions_ptxt.txt"}'/></info></step>
      <step><cmd>Open <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_ptxt=signed-in</b>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies"}'/><data name="doc-detective" value='step {"find":"sessions_ptxt=signed-in"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-cookie-form-txt",
      "steps": [
        {
          "runShell": "node -e \"require('fs').rmSync('docs/docs-as-tests/examples/.dd-output/sessions_ptxt.txt', { force: true })\""
        },
        {
          "goTo": "http://localhost:8092/cookies/set/sessions_ptxt/signed-in"
        },
        {
          "saveCookie": "sessions_ptxt.txt"
        },
        {
          "goTo": "http://localhost:8092/cookies/set/sessions_ptxt/signed-out"
        },
        {
          "loadCookie": "sessions_ptxt.txt"
        },
        {
          "goTo": "http://localhost:8092/cookies"
        },
        {
          "find": "sessions_ptxt=signed-in"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-cookie-form-txt
    steps:
      - runShell: "node -e \"require('fs').rmSync('docs/docs-as-tests/examples/.dd-output/sessions_ptxt.txt', { force: true })\""
      - goTo: http://localhost:8092/cookies/set/sessions_ptxt/signed-in
      - saveCookie: sessions_ptxt.txt
      - goTo: http://localhost:8092/cookies/set/sessions_ptxt/signed-out
      - loadCookie: sessions_ptxt.txt
      - goTo: http://localhost:8092/cookies
      - find: sessions_ptxt=signed-in
```

### `"overwrite": true`

**Varies:** `saveCookie.overwrite` · **Value:** `true` · **Effect:** a second save to the same file replaces it, so the later value wins.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Replace a saved cookie

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pover/first). The server sets the `sessions_pover` cookie.
2. Save the `sessions_pover` cookie to `sessions_pover.txt`, replacing any earlier file.
3. Sign in again at [the second sign-in page](http://localhost:8092/cookies/set/sessions_pover/second), and save the cookie to the same file.
4. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pover/signed-out), which replaces the cookie.
5. Load the cookie from `sessions_pover.txt`.
6. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pover=second**.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Replace a saved cookie

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pover/first). The server sets the `sessions_pover` cookie.
2. Save the `sessions_pover` cookie to `sessions_pover.txt`, replacing any earlier file.
3. Sign in again at [the second sign-in page](http://localhost:8092/cookies/set/sessions_pover/second), and save the cookie to the same file.
4. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pover/signed-out), which replaces the cookie.
5. Load the cookie from `sessions_pover.txt`.
6. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pover=second**.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Replace a saved cookie

. Sign in at http://localhost:8092/cookies/set/sessions_pover/first[the sign-in page]. The server sets the `sessions_pover` cookie.
. Save the `sessions_pover` cookie to `sessions_pover.txt`, replacing any earlier file.
. Sign in again at http://localhost:8092/cookies/set/sessions_pover/second[the second sign-in page], and save the cookie to the same file.
. Sign out at http://localhost:8092/cookies/set/sessions_pover/signed-out[the sign-out page], which replaces the cookie.
. Load the cookie from `sessions_pover.txt`.
. Open http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_pover=second*.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Replace a saved cookie</title></head>
<body>
<h1>Replace a saved cookie</h1>
<ol>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_pover/first">the sign-in page</a>. The server sets the <code>sessions_pover</code> cookie.</li>
  <li>Save the <code>sessions_pover</code> cookie to <code>sessions_pover.txt</code>, replacing any earlier file.</li>
  <li>Sign in again at <a href="http://localhost:8092/cookies/set/sessions_pover/second">the second sign-in page</a>, and save the cookie to the same file.</li>
  <li>Sign out at <a href="http://localhost:8092/cookies/set/sessions_pover/signed-out">the sign-out page</a>, which replaces the cookie.</li>
  <li>Load the cookie from <code>sessions_pover.txt</code>.</li>
  <li>Open <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_pover=second</strong>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Replace a saved cookie
======================

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_pover/first>`__. The server sets the ``sessions_pover`` cookie.

#. Save the ``sessions_pover`` cookie to ``sessions_pover.txt``, replacing any earlier file.

#. Sign in again at `the second sign-in page <http://localhost:8092/cookies/set/sessions_pover/second>`__, and save the cookie to the same file.

#. Sign out at `the sign-out page <http://localhost:8092/cookies/set/sessions_pover/signed-out>`__, which replaces the cookie.

#. Load the cookie from ``sessions_pover.txt``.

#. Open `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_pover=second**.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-cookie-overwrite-true">
  <title>Replace a saved cookie</title>
  <taskbody>
    <steps>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_pover/first" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_pover</codeph> cookie.</cmd></step>
      <step><cmd>Save the <codeph>sessions_pover</codeph> cookie to <codeph>sessions_pover.txt</codeph>, replacing any earlier file.</cmd></step>
      <step><cmd>Sign in again at <xref href="http://localhost:8092/cookies/set/sessions_pover/second" scope="external" format="html">the second sign-in page</xref>, and save the cookie to the same file.</cmd></step>
      <step><cmd>Sign out at <xref href="http://localhost:8092/cookies/set/sessions_pover/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd></step>
      <step><cmd>Load the cookie from <codeph>sessions_pover.txt</codeph>.</cmd></step>
      <step><cmd>Open <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_pover=second</b>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-cookie-overwrite-true","detectSteps":true} -->

# Replace a saved cookie

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pover/first). The server sets the `sessions_pover` cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/first"} -->
2. Save the `sessions_pover` cookie to `sessions_pover.txt`, replacing any earlier file.
   <!-- step {"saveCookie":{"name":"sessions_pover","path":"sessions_pover.txt","overwrite":true}} -->
3. Sign in again at [the second sign-in page](http://localhost:8092/cookies/set/sessions_pover/second), and save the cookie to the same file.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/second"} -->
   <!-- step {"saveCookie":{"name":"sessions_pover","path":"sessions_pover.txt","overwrite":true}} -->
4. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pover/signed-out), which replaces the cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/signed-out"} -->
5. Load the cookie from `sessions_pover.txt`.
   <!-- step {"loadCookie":{"name":"sessions_pover","path":"sessions_pover.txt"}} -->
6. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pover=second**.

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-cookie-overwrite-true","detectSteps":true} */}

# Replace a saved cookie

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pover/first). The server sets the `sessions_pover` cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/first"} */}
2. Save the `sessions_pover` cookie to `sessions_pover.txt`, replacing any earlier file.
   {/* step {"saveCookie":{"name":"sessions_pover","path":"sessions_pover.txt","overwrite":true}} */}
3. Sign in again at [the second sign-in page](http://localhost:8092/cookies/set/sessions_pover/second), and save the cookie to the same file.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/second"} */}
   {/* step {"saveCookie":{"name":"sessions_pover","path":"sessions_pover.txt","overwrite":true}} */}
4. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pover/signed-out), which replaces the cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/signed-out"} */}
5. Load the cookie from `sessions_pover.txt`.
   {/* step {"loadCookie":{"name":"sessions_pover","path":"sessions_pover.txt"}} */}
6. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pover=second**.

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Replace a saved cookie

// (test {"testId":"sessions-cookie-overwrite-true","detectSteps":true})

. Sign in at http://localhost:8092/cookies/set/sessions_pover/first[the sign-in page]. The server sets the `sessions_pover` cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/first"})
. Save the `sessions_pover` cookie to `sessions_pover.txt`, replacing any earlier file.
+
// (step {"saveCookie":{"name":"sessions_pover","path":"sessions_pover.txt","overwrite":true}})
. Sign in again at http://localhost:8092/cookies/set/sessions_pover/second[the second sign-in page], and save the cookie to the same file.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/second"})
+
// (step {"saveCookie":{"name":"sessions_pover","path":"sessions_pover.txt","overwrite":true}})
. Sign out at http://localhost:8092/cookies/set/sessions_pover/signed-out[the sign-out page], which replaces the cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/signed-out"})
. Load the cookie from `sessions_pover.txt`.
+
// (step {"loadCookie":{"name":"sessions_pover","path":"sessions_pover.txt"}})
. Open http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_pover=second*.

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Replace a saved cookie</title></head>
<body>
<!-- test {"testId":"sessions-cookie-overwrite-true","detectSteps":true} -->
<h1>Replace a saved cookie</h1>
<ol>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_pover/first">the sign-in page</a>. The server sets the <code>sessions_pover</code> cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/first"} --></li>
  <li>Save the <code>sessions_pover</code> cookie to <code>sessions_pover.txt</code>, replacing any earlier file.
    <!-- step {"saveCookie":{"name":"sessions_pover","path":"sessions_pover.txt","overwrite":true}} --></li>
  <li>Sign in again at <a href="http://localhost:8092/cookies/set/sessions_pover/second">the second sign-in page</a>, and save the cookie to the same file.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/second"} -->
    <!-- step {"saveCookie":{"name":"sessions_pover","path":"sessions_pover.txt","overwrite":true}} --></li>
  <li>Sign out at <a href="http://localhost:8092/cookies/set/sessions_pover/signed-out">the sign-out page</a>, which replaces the cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/signed-out"} --></li>
  <li>Load the cookie from <code>sessions_pover.txt</code>.
    <!-- step {"loadCookie":{"name":"sessions_pover","path":"sessions_pover.txt"}} --></li>
  <li>Open <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_pover=second</strong>.</li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Replace a saved cookie
======================

.. test {"testId":"sessions-cookie-overwrite-true","detectSteps":true}

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_pover/first>`__. The server sets the ``sessions_pover`` cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/first"}

#. Save the ``sessions_pover`` cookie to ``sessions_pover.txt``, replacing any earlier file.

   .. step {"saveCookie":{"name":"sessions_pover","path":"sessions_pover.txt","overwrite":true}}

#. Sign in again at `the second sign-in page <http://localhost:8092/cookies/set/sessions_pover/second>`__, and save the cookie to the same file.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/second"}

   .. step {"saveCookie":{"name":"sessions_pover","path":"sessions_pover.txt","overwrite":true}}

#. Sign out at `the sign-out page <http://localhost:8092/cookies/set/sessions_pover/signed-out>`__, which replaces the cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/signed-out"}

#. Load the cookie from ``sessions_pover.txt``.

   .. step {"loadCookie":{"name":"sessions_pover","path":"sessions_pover.txt"}}

#. Open `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_pover=second**.

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-cookie-overwrite-true">
  <title>Replace a saved cookie</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-cookie-overwrite-true","detectSteps":true}'/>
    <steps>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_pover/first" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_pover</codeph> cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/first"}'/></info></step>
      <step><cmd>Save the <codeph>sessions_pover</codeph> cookie to <codeph>sessions_pover.txt</codeph>, replacing any earlier file.</cmd>
        <info><data name="doc-detective" value='step {"saveCookie":{"name":"sessions_pover","path":"sessions_pover.txt","overwrite":true}}'/></info></step>
      <step><cmd>Sign in again at <xref href="http://localhost:8092/cookies/set/sessions_pover/second" scope="external" format="html">the second sign-in page</xref>, and save the cookie to the same file.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/second"}'/><data name="doc-detective" value='step {"saveCookie":{"name":"sessions_pover","path":"sessions_pover.txt","overwrite":true}}'/></info></step>
      <step><cmd>Sign out at <xref href="http://localhost:8092/cookies/set/sessions_pover/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/signed-out"}'/></info></step>
      <step><cmd>Load the cookie from <codeph>sessions_pover.txt</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"loadCookie":{"name":"sessions_pover","path":"sessions_pover.txt"}}'/></info></step>
      <step><cmd>Open <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_pover=second</b>.</cmd></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-cookie-overwrite-true","detectSteps":false} -->

# Replace a saved cookie

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pover/first). The server sets the `sessions_pover` cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/first"} -->
2. Save the `sessions_pover` cookie to `sessions_pover.txt`, replacing any earlier file.
   <!-- step {"saveCookie":{"name":"sessions_pover","path":"sessions_pover.txt","overwrite":true}} -->
3. Sign in again at [the second sign-in page](http://localhost:8092/cookies/set/sessions_pover/second), and save the cookie to the same file.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/second"} -->
   <!-- step {"saveCookie":{"name":"sessions_pover","path":"sessions_pover.txt","overwrite":true}} -->
4. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pover/signed-out), which replaces the cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/signed-out"} -->
5. Load the cookie from `sessions_pover.txt`.
   <!-- step {"loadCookie":{"name":"sessions_pover","path":"sessions_pover.txt"}} -->
6. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pover=second**.
   <!-- step {"goTo":"http://localhost:8092/cookies"} -->
   <!-- step {"find":"sessions_pover=second"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-cookie-overwrite-true","detectSteps":false} */}

# Replace a saved cookie

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pover/first). The server sets the `sessions_pover` cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/first"} */}
2. Save the `sessions_pover` cookie to `sessions_pover.txt`, replacing any earlier file.
   {/* step {"saveCookie":{"name":"sessions_pover","path":"sessions_pover.txt","overwrite":true}} */}
3. Sign in again at [the second sign-in page](http://localhost:8092/cookies/set/sessions_pover/second), and save the cookie to the same file.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/second"} */}
   {/* step {"saveCookie":{"name":"sessions_pover","path":"sessions_pover.txt","overwrite":true}} */}
4. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pover/signed-out), which replaces the cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/signed-out"} */}
5. Load the cookie from `sessions_pover.txt`.
   {/* step {"loadCookie":{"name":"sessions_pover","path":"sessions_pover.txt"}} */}
6. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pover=second**.
   {/* step {"goTo":"http://localhost:8092/cookies"} */}
   {/* step {"find":"sessions_pover=second"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Replace a saved cookie

// (test {"testId":"sessions-cookie-overwrite-true","detectSteps":false})

. Sign in at http://localhost:8092/cookies/set/sessions_pover/first[the sign-in page]. The server sets the `sessions_pover` cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/first"})
. Save the `sessions_pover` cookie to `sessions_pover.txt`, replacing any earlier file.
+
// (step {"saveCookie":{"name":"sessions_pover","path":"sessions_pover.txt","overwrite":true}})
. Sign in again at http://localhost:8092/cookies/set/sessions_pover/second[the second sign-in page], and save the cookie to the same file.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/second"})
+
// (step {"saveCookie":{"name":"sessions_pover","path":"sessions_pover.txt","overwrite":true}})
. Sign out at http://localhost:8092/cookies/set/sessions_pover/signed-out[the sign-out page], which replaces the cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/signed-out"})
. Load the cookie from `sessions_pover.txt`.
+
// (step {"loadCookie":{"name":"sessions_pover","path":"sessions_pover.txt"}})
. Open http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_pover=second*.
+
// (step {"goTo":"http://localhost:8092/cookies"})
+
// (step {"find":"sessions_pover=second"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Replace a saved cookie</title></head>
<body>
<!-- test {"testId":"sessions-cookie-overwrite-true","detectSteps":false} -->
<h1>Replace a saved cookie</h1>
<ol>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_pover/first">the sign-in page</a>. The server sets the <code>sessions_pover</code> cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/first"} --></li>
  <li>Save the <code>sessions_pover</code> cookie to <code>sessions_pover.txt</code>, replacing any earlier file.
    <!-- step {"saveCookie":{"name":"sessions_pover","path":"sessions_pover.txt","overwrite":true}} --></li>
  <li>Sign in again at <a href="http://localhost:8092/cookies/set/sessions_pover/second">the second sign-in page</a>, and save the cookie to the same file.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/second"} -->
    <!-- step {"saveCookie":{"name":"sessions_pover","path":"sessions_pover.txt","overwrite":true}} --></li>
  <li>Sign out at <a href="http://localhost:8092/cookies/set/sessions_pover/signed-out">the sign-out page</a>, which replaces the cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/signed-out"} --></li>
  <li>Load the cookie from <code>sessions_pover.txt</code>.
    <!-- step {"loadCookie":{"name":"sessions_pover","path":"sessions_pover.txt"}} --></li>
  <li>Open <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_pover=second</strong>.
    <!-- step {"goTo":"http://localhost:8092/cookies"} -->
    <!-- step {"find":"sessions_pover=second"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Replace a saved cookie
======================

.. test {"testId":"sessions-cookie-overwrite-true","detectSteps":false}

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_pover/first>`__. The server sets the ``sessions_pover`` cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/first"}

#. Save the ``sessions_pover`` cookie to ``sessions_pover.txt``, replacing any earlier file.

   .. step {"saveCookie":{"name":"sessions_pover","path":"sessions_pover.txt","overwrite":true}}

#. Sign in again at `the second sign-in page <http://localhost:8092/cookies/set/sessions_pover/second>`__, and save the cookie to the same file.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/second"}

   .. step {"saveCookie":{"name":"sessions_pover","path":"sessions_pover.txt","overwrite":true}}

#. Sign out at `the sign-out page <http://localhost:8092/cookies/set/sessions_pover/signed-out>`__, which replaces the cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/signed-out"}

#. Load the cookie from ``sessions_pover.txt``.

   .. step {"loadCookie":{"name":"sessions_pover","path":"sessions_pover.txt"}}

#. Open `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_pover=second**.

   .. step {"goTo":"http://localhost:8092/cookies"}

   .. step {"find":"sessions_pover=second"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-cookie-overwrite-true">
  <title>Replace a saved cookie</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-cookie-overwrite-true","detectSteps":false}'/>
    <steps>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_pover/first" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_pover</codeph> cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/first"}'/></info></step>
      <step><cmd>Save the <codeph>sessions_pover</codeph> cookie to <codeph>sessions_pover.txt</codeph>, replacing any earlier file.</cmd>
        <info><data name="doc-detective" value='step {"saveCookie":{"name":"sessions_pover","path":"sessions_pover.txt","overwrite":true}}'/></info></step>
      <step><cmd>Sign in again at <xref href="http://localhost:8092/cookies/set/sessions_pover/second" scope="external" format="html">the second sign-in page</xref>, and save the cookie to the same file.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/second"}'/><data name="doc-detective" value='step {"saveCookie":{"name":"sessions_pover","path":"sessions_pover.txt","overwrite":true}}'/></info></step>
      <step><cmd>Sign out at <xref href="http://localhost:8092/cookies/set/sessions_pover/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pover/signed-out"}'/></info></step>
      <step><cmd>Load the cookie from <codeph>sessions_pover.txt</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"loadCookie":{"name":"sessions_pover","path":"sessions_pover.txt"}}'/></info></step>
      <step><cmd>Open <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_pover=second</b>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies"}'/><data name="doc-detective" value='step {"find":"sessions_pover=second"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-cookie-overwrite-true",
      "steps": [
        {
          "goTo": "http://localhost:8092/cookies/set/sessions_pover/first"
        },
        {
          "saveCookie": {
            "name": "sessions_pover",
            "path": "sessions_pover.txt",
            "overwrite": true
          }
        },
        {
          "goTo": "http://localhost:8092/cookies/set/sessions_pover/second"
        },
        {
          "saveCookie": {
            "name": "sessions_pover",
            "path": "sessions_pover.txt",
            "overwrite": true
          }
        },
        {
          "goTo": "http://localhost:8092/cookies/set/sessions_pover/signed-out"
        },
        {
          "loadCookie": {
            "name": "sessions_pover",
            "path": "sessions_pover.txt"
          }
        },
        {
          "goTo": "http://localhost:8092/cookies"
        },
        {
          "find": "sessions_pover=second"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-cookie-overwrite-true
    steps:
      - goTo: http://localhost:8092/cookies/set/sessions_pover/first
      - saveCookie:
          name: sessions_pover
          path: sessions_pover.txt
          overwrite: true
      - goTo: http://localhost:8092/cookies/set/sessions_pover/second
      - saveCookie:
          name: sessions_pover
          path: sessions_pover.txt
          overwrite: true
      - goTo: http://localhost:8092/cookies/set/sessions_pover/signed-out
      - loadCookie:
          name: sessions_pover
          path: sessions_pover.txt
      - goTo: http://localhost:8092/cookies
      - find: sessions_pover=second
```

### `"domain": "localhost"`

**Varies:** `saveCookie.domain and loadCookie.domain` · **Value:** `"localhost"` · **Effect:** saves and loads only the cookie set for that domain.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Keep the cookie for one domain

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pdomain/signed-in). The server sets the `sessions_pdomain` cookie.
2. Save the `localhost` cookie named `sessions_pdomain` to `sessions_pdomain.txt`.
3. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pdomain/signed-out), which replaces the cookie.
4. Load the `localhost` cookie from `sessions_pdomain.txt`.
5. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pdomain=signed-in**.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Keep the cookie for one domain

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pdomain/signed-in). The server sets the `sessions_pdomain` cookie.
2. Save the `localhost` cookie named `sessions_pdomain` to `sessions_pdomain.txt`.
3. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pdomain/signed-out), which replaces the cookie.
4. Load the `localhost` cookie from `sessions_pdomain.txt`.
5. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pdomain=signed-in**.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Keep the cookie for one domain

. Sign in at http://localhost:8092/cookies/set/sessions_pdomain/signed-in[the sign-in page]. The server sets the `sessions_pdomain` cookie.
. Save the `localhost` cookie named `sessions_pdomain` to `sessions_pdomain.txt`.
. Sign out at http://localhost:8092/cookies/set/sessions_pdomain/signed-out[the sign-out page], which replaces the cookie.
. Load the `localhost` cookie from `sessions_pdomain.txt`.
. Open http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_pdomain=signed-in*.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Keep the cookie for one domain</title></head>
<body>
<h1>Keep the cookie for one domain</h1>
<ol>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_pdomain/signed-in">the sign-in page</a>. The server sets the <code>sessions_pdomain</code> cookie.</li>
  <li>Save the <code>localhost</code> cookie named <code>sessions_pdomain</code> to <code>sessions_pdomain.txt</code>.</li>
  <li>Sign out at <a href="http://localhost:8092/cookies/set/sessions_pdomain/signed-out">the sign-out page</a>, which replaces the cookie.</li>
  <li>Load the <code>localhost</code> cookie from <code>sessions_pdomain.txt</code>.</li>
  <li>Open <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_pdomain=signed-in</strong>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Keep the cookie for one domain
==============================

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_pdomain/signed-in>`__. The server sets the ``sessions_pdomain`` cookie.

#. Save the ``localhost`` cookie named ``sessions_pdomain`` to ``sessions_pdomain.txt``.

#. Sign out at `the sign-out page <http://localhost:8092/cookies/set/sessions_pdomain/signed-out>`__, which replaces the cookie.

#. Load the ``localhost`` cookie from ``sessions_pdomain.txt``.

#. Open `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_pdomain=signed-in**.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-cookie-domain">
  <title>Keep the cookie for one domain</title>
  <taskbody>
    <steps>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_pdomain/signed-in" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_pdomain</codeph> cookie.</cmd></step>
      <step><cmd>Save the <codeph>localhost</codeph> cookie named <codeph>sessions_pdomain</codeph> to <codeph>sessions_pdomain.txt</codeph>.</cmd></step>
      <step><cmd>Sign out at <xref href="http://localhost:8092/cookies/set/sessions_pdomain/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd></step>
      <step><cmd>Load the <codeph>localhost</codeph> cookie from <codeph>sessions_pdomain.txt</codeph>.</cmd></step>
      <step><cmd>Open <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_pdomain=signed-in</b>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-cookie-domain","detectSteps":true} -->

# Keep the cookie for one domain

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pdomain/signed-in). The server sets the `sessions_pdomain` cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pdomain/signed-in"} -->
2. Save the `localhost` cookie named `sessions_pdomain` to `sessions_pdomain.txt`.
   <!-- step {"saveCookie":{"name":"sessions_pdomain","path":"sessions_pdomain.txt","domain":"localhost","overwrite":true}} -->
3. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pdomain/signed-out), which replaces the cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pdomain/signed-out"} -->
4. Load the `localhost` cookie from `sessions_pdomain.txt`.
   <!-- step {"loadCookie":{"name":"sessions_pdomain","path":"sessions_pdomain.txt","domain":"localhost"}} -->
5. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pdomain=signed-in**.

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-cookie-domain","detectSteps":true} */}

# Keep the cookie for one domain

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pdomain/signed-in). The server sets the `sessions_pdomain` cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pdomain/signed-in"} */}
2. Save the `localhost` cookie named `sessions_pdomain` to `sessions_pdomain.txt`.
   {/* step {"saveCookie":{"name":"sessions_pdomain","path":"sessions_pdomain.txt","domain":"localhost","overwrite":true}} */}
3. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pdomain/signed-out), which replaces the cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pdomain/signed-out"} */}
4. Load the `localhost` cookie from `sessions_pdomain.txt`.
   {/* step {"loadCookie":{"name":"sessions_pdomain","path":"sessions_pdomain.txt","domain":"localhost"}} */}
5. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pdomain=signed-in**.

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Keep the cookie for one domain

// (test {"testId":"sessions-cookie-domain","detectSteps":true})

. Sign in at http://localhost:8092/cookies/set/sessions_pdomain/signed-in[the sign-in page]. The server sets the `sessions_pdomain` cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pdomain/signed-in"})
. Save the `localhost` cookie named `sessions_pdomain` to `sessions_pdomain.txt`.
+
// (step {"saveCookie":{"name":"sessions_pdomain","path":"sessions_pdomain.txt","domain":"localhost","overwrite":true}})
. Sign out at http://localhost:8092/cookies/set/sessions_pdomain/signed-out[the sign-out page], which replaces the cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pdomain/signed-out"})
. Load the `localhost` cookie from `sessions_pdomain.txt`.
+
// (step {"loadCookie":{"name":"sessions_pdomain","path":"sessions_pdomain.txt","domain":"localhost"}})
. Open http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_pdomain=signed-in*.

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Keep the cookie for one domain</title></head>
<body>
<!-- test {"testId":"sessions-cookie-domain","detectSteps":true} -->
<h1>Keep the cookie for one domain</h1>
<ol>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_pdomain/signed-in">the sign-in page</a>. The server sets the <code>sessions_pdomain</code> cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pdomain/signed-in"} --></li>
  <li>Save the <code>localhost</code> cookie named <code>sessions_pdomain</code> to <code>sessions_pdomain.txt</code>.
    <!-- step {"saveCookie":{"name":"sessions_pdomain","path":"sessions_pdomain.txt","domain":"localhost","overwrite":true}} --></li>
  <li>Sign out at <a href="http://localhost:8092/cookies/set/sessions_pdomain/signed-out">the sign-out page</a>, which replaces the cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pdomain/signed-out"} --></li>
  <li>Load the <code>localhost</code> cookie from <code>sessions_pdomain.txt</code>.
    <!-- step {"loadCookie":{"name":"sessions_pdomain","path":"sessions_pdomain.txt","domain":"localhost"}} --></li>
  <li>Open <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_pdomain=signed-in</strong>.</li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Keep the cookie for one domain
==============================

.. test {"testId":"sessions-cookie-domain","detectSteps":true}

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_pdomain/signed-in>`__. The server sets the ``sessions_pdomain`` cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pdomain/signed-in"}

#. Save the ``localhost`` cookie named ``sessions_pdomain`` to ``sessions_pdomain.txt``.

   .. step {"saveCookie":{"name":"sessions_pdomain","path":"sessions_pdomain.txt","domain":"localhost","overwrite":true}}

#. Sign out at `the sign-out page <http://localhost:8092/cookies/set/sessions_pdomain/signed-out>`__, which replaces the cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pdomain/signed-out"}

#. Load the ``localhost`` cookie from ``sessions_pdomain.txt``.

   .. step {"loadCookie":{"name":"sessions_pdomain","path":"sessions_pdomain.txt","domain":"localhost"}}

#. Open `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_pdomain=signed-in**.

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-cookie-domain">
  <title>Keep the cookie for one domain</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-cookie-domain","detectSteps":true}'/>
    <steps>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_pdomain/signed-in" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_pdomain</codeph> cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pdomain/signed-in"}'/></info></step>
      <step><cmd>Save the <codeph>localhost</codeph> cookie named <codeph>sessions_pdomain</codeph> to <codeph>sessions_pdomain.txt</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"saveCookie":{"name":"sessions_pdomain","path":"sessions_pdomain.txt","domain":"localhost","overwrite":true}}'/></info></step>
      <step><cmd>Sign out at <xref href="http://localhost:8092/cookies/set/sessions_pdomain/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pdomain/signed-out"}'/></info></step>
      <step><cmd>Load the <codeph>localhost</codeph> cookie from <codeph>sessions_pdomain.txt</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"loadCookie":{"name":"sessions_pdomain","path":"sessions_pdomain.txt","domain":"localhost"}}'/></info></step>
      <step><cmd>Open <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_pdomain=signed-in</b>.</cmd></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-cookie-domain","detectSteps":false} -->

# Keep the cookie for one domain

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pdomain/signed-in). The server sets the `sessions_pdomain` cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pdomain/signed-in"} -->
2. Save the `localhost` cookie named `sessions_pdomain` to `sessions_pdomain.txt`.
   <!-- step {"saveCookie":{"name":"sessions_pdomain","path":"sessions_pdomain.txt","domain":"localhost","overwrite":true}} -->
3. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pdomain/signed-out), which replaces the cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pdomain/signed-out"} -->
4. Load the `localhost` cookie from `sessions_pdomain.txt`.
   <!-- step {"loadCookie":{"name":"sessions_pdomain","path":"sessions_pdomain.txt","domain":"localhost"}} -->
5. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pdomain=signed-in**.
   <!-- step {"goTo":"http://localhost:8092/cookies"} -->
   <!-- step {"find":"sessions_pdomain=signed-in"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-cookie-domain","detectSteps":false} */}

# Keep the cookie for one domain

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pdomain/signed-in). The server sets the `sessions_pdomain` cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pdomain/signed-in"} */}
2. Save the `localhost` cookie named `sessions_pdomain` to `sessions_pdomain.txt`.
   {/* step {"saveCookie":{"name":"sessions_pdomain","path":"sessions_pdomain.txt","domain":"localhost","overwrite":true}} */}
3. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pdomain/signed-out), which replaces the cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pdomain/signed-out"} */}
4. Load the `localhost` cookie from `sessions_pdomain.txt`.
   {/* step {"loadCookie":{"name":"sessions_pdomain","path":"sessions_pdomain.txt","domain":"localhost"}} */}
5. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pdomain=signed-in**.
   {/* step {"goTo":"http://localhost:8092/cookies"} */}
   {/* step {"find":"sessions_pdomain=signed-in"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Keep the cookie for one domain

// (test {"testId":"sessions-cookie-domain","detectSteps":false})

. Sign in at http://localhost:8092/cookies/set/sessions_pdomain/signed-in[the sign-in page]. The server sets the `sessions_pdomain` cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pdomain/signed-in"})
. Save the `localhost` cookie named `sessions_pdomain` to `sessions_pdomain.txt`.
+
// (step {"saveCookie":{"name":"sessions_pdomain","path":"sessions_pdomain.txt","domain":"localhost","overwrite":true}})
. Sign out at http://localhost:8092/cookies/set/sessions_pdomain/signed-out[the sign-out page], which replaces the cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pdomain/signed-out"})
. Load the `localhost` cookie from `sessions_pdomain.txt`.
+
// (step {"loadCookie":{"name":"sessions_pdomain","path":"sessions_pdomain.txt","domain":"localhost"}})
. Open http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_pdomain=signed-in*.
+
// (step {"goTo":"http://localhost:8092/cookies"})
+
// (step {"find":"sessions_pdomain=signed-in"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Keep the cookie for one domain</title></head>
<body>
<!-- test {"testId":"sessions-cookie-domain","detectSteps":false} -->
<h1>Keep the cookie for one domain</h1>
<ol>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_pdomain/signed-in">the sign-in page</a>. The server sets the <code>sessions_pdomain</code> cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pdomain/signed-in"} --></li>
  <li>Save the <code>localhost</code> cookie named <code>sessions_pdomain</code> to <code>sessions_pdomain.txt</code>.
    <!-- step {"saveCookie":{"name":"sessions_pdomain","path":"sessions_pdomain.txt","domain":"localhost","overwrite":true}} --></li>
  <li>Sign out at <a href="http://localhost:8092/cookies/set/sessions_pdomain/signed-out">the sign-out page</a>, which replaces the cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pdomain/signed-out"} --></li>
  <li>Load the <code>localhost</code> cookie from <code>sessions_pdomain.txt</code>.
    <!-- step {"loadCookie":{"name":"sessions_pdomain","path":"sessions_pdomain.txt","domain":"localhost"}} --></li>
  <li>Open <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_pdomain=signed-in</strong>.
    <!-- step {"goTo":"http://localhost:8092/cookies"} -->
    <!-- step {"find":"sessions_pdomain=signed-in"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Keep the cookie for one domain
==============================

.. test {"testId":"sessions-cookie-domain","detectSteps":false}

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_pdomain/signed-in>`__. The server sets the ``sessions_pdomain`` cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pdomain/signed-in"}

#. Save the ``localhost`` cookie named ``sessions_pdomain`` to ``sessions_pdomain.txt``.

   .. step {"saveCookie":{"name":"sessions_pdomain","path":"sessions_pdomain.txt","domain":"localhost","overwrite":true}}

#. Sign out at `the sign-out page <http://localhost:8092/cookies/set/sessions_pdomain/signed-out>`__, which replaces the cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pdomain/signed-out"}

#. Load the ``localhost`` cookie from ``sessions_pdomain.txt``.

   .. step {"loadCookie":{"name":"sessions_pdomain","path":"sessions_pdomain.txt","domain":"localhost"}}

#. Open `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_pdomain=signed-in**.

   .. step {"goTo":"http://localhost:8092/cookies"}

   .. step {"find":"sessions_pdomain=signed-in"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-cookie-domain">
  <title>Keep the cookie for one domain</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-cookie-domain","detectSteps":false}'/>
    <steps>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_pdomain/signed-in" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_pdomain</codeph> cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pdomain/signed-in"}'/></info></step>
      <step><cmd>Save the <codeph>localhost</codeph> cookie named <codeph>sessions_pdomain</codeph> to <codeph>sessions_pdomain.txt</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"saveCookie":{"name":"sessions_pdomain","path":"sessions_pdomain.txt","domain":"localhost","overwrite":true}}'/></info></step>
      <step><cmd>Sign out at <xref href="http://localhost:8092/cookies/set/sessions_pdomain/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pdomain/signed-out"}'/></info></step>
      <step><cmd>Load the <codeph>localhost</codeph> cookie from <codeph>sessions_pdomain.txt</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"loadCookie":{"name":"sessions_pdomain","path":"sessions_pdomain.txt","domain":"localhost"}}'/></info></step>
      <step><cmd>Open <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_pdomain=signed-in</b>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies"}'/><data name="doc-detective" value='step {"find":"sessions_pdomain=signed-in"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-cookie-domain",
      "steps": [
        {
          "goTo": "http://localhost:8092/cookies/set/sessions_pdomain/signed-in"
        },
        {
          "saveCookie": {
            "name": "sessions_pdomain",
            "path": "sessions_pdomain.txt",
            "domain": "localhost",
            "overwrite": true
          }
        },
        {
          "goTo": "http://localhost:8092/cookies/set/sessions_pdomain/signed-out"
        },
        {
          "loadCookie": {
            "name": "sessions_pdomain",
            "path": "sessions_pdomain.txt",
            "domain": "localhost"
          }
        },
        {
          "goTo": "http://localhost:8092/cookies"
        },
        {
          "find": "sessions_pdomain=signed-in"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-cookie-domain
    steps:
      - goTo: http://localhost:8092/cookies/set/sessions_pdomain/signed-in
      - saveCookie:
          name: sessions_pdomain
          path: sessions_pdomain.txt
          domain: localhost
          overwrite: true
      - goTo: http://localhost:8092/cookies/set/sessions_pdomain/signed-out
      - loadCookie:
          name: sessions_pdomain
          path: sessions_pdomain.txt
          domain: localhost
      - goTo: http://localhost:8092/cookies
      - find: sessions_pdomain=signed-in
```

### `"variable": "SESSIONS_PVAR"`

**Varies:** `saveCookie.variable and loadCookie.variable` · **Value:** `"SESSIONS_PVAR"` · **Effect:** the cookie goes to an environment variable whose name differs from the cookie's.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Keep a cookie in a named variable

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pvar/signed-in). The server sets the `sessions_pvar` cookie.
2. Save the `sessions_pvar` cookie to the `SESSIONS_PVAR` environment variable.
3. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pvar/signed-out), which replaces the cookie.
4. Load the cookie from `SESSIONS_PVAR`.
5. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pvar=signed-in**.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Keep a cookie in a named variable

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pvar/signed-in). The server sets the `sessions_pvar` cookie.
2. Save the `sessions_pvar` cookie to the `SESSIONS_PVAR` environment variable.
3. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pvar/signed-out), which replaces the cookie.
4. Load the cookie from `SESSIONS_PVAR`.
5. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pvar=signed-in**.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Keep a cookie in a named variable

. Sign in at http://localhost:8092/cookies/set/sessions_pvar/signed-in[the sign-in page]. The server sets the `sessions_pvar` cookie.
. Save the `sessions_pvar` cookie to the `SESSIONS_PVAR` environment variable.
. Sign out at http://localhost:8092/cookies/set/sessions_pvar/signed-out[the sign-out page], which replaces the cookie.
. Load the cookie from `SESSIONS_PVAR`.
. Open http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_pvar=signed-in*.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Keep a cookie in a named variable</title></head>
<body>
<h1>Keep a cookie in a named variable</h1>
<ol>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_pvar/signed-in">the sign-in page</a>. The server sets the <code>sessions_pvar</code> cookie.</li>
  <li>Save the <code>sessions_pvar</code> cookie to the <code>SESSIONS_PVAR</code> environment variable.</li>
  <li>Sign out at <a href="http://localhost:8092/cookies/set/sessions_pvar/signed-out">the sign-out page</a>, which replaces the cookie.</li>
  <li>Load the cookie from <code>SESSIONS_PVAR</code>.</li>
  <li>Open <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_pvar=signed-in</strong>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Keep a cookie in a named variable
=================================

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_pvar/signed-in>`__. The server sets the ``sessions_pvar`` cookie.

#. Save the ``sessions_pvar`` cookie to the ``SESSIONS_PVAR`` environment variable.

#. Sign out at `the sign-out page <http://localhost:8092/cookies/set/sessions_pvar/signed-out>`__, which replaces the cookie.

#. Load the cookie from ``SESSIONS_PVAR``.

#. Open `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_pvar=signed-in**.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-cookie-variable">
  <title>Keep a cookie in a named variable</title>
  <taskbody>
    <steps>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_pvar/signed-in" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_pvar</codeph> cookie.</cmd></step>
      <step><cmd>Save the <codeph>sessions_pvar</codeph> cookie to the <codeph>SESSIONS_PVAR</codeph> environment variable.</cmd></step>
      <step><cmd>Sign out at <xref href="http://localhost:8092/cookies/set/sessions_pvar/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd></step>
      <step><cmd>Load the cookie from <codeph>SESSIONS_PVAR</codeph>.</cmd></step>
      <step><cmd>Open <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_pvar=signed-in</b>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-cookie-variable","detectSteps":true} -->

# Keep a cookie in a named variable

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pvar/signed-in). The server sets the `sessions_pvar` cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pvar/signed-in"} -->
2. Save the `sessions_pvar` cookie to the `SESSIONS_PVAR` environment variable.
   <!-- step {"saveCookie":{"name":"sessions_pvar","variable":"SESSIONS_PVAR"}} -->
3. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pvar/signed-out), which replaces the cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pvar/signed-out"} -->
4. Load the cookie from `SESSIONS_PVAR`.
   <!-- step {"loadCookie":{"name":"sessions_pvar","variable":"SESSIONS_PVAR"}} -->
5. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pvar=signed-in**.

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-cookie-variable","detectSteps":true} */}

# Keep a cookie in a named variable

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pvar/signed-in). The server sets the `sessions_pvar` cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pvar/signed-in"} */}
2. Save the `sessions_pvar` cookie to the `SESSIONS_PVAR` environment variable.
   {/* step {"saveCookie":{"name":"sessions_pvar","variable":"SESSIONS_PVAR"}} */}
3. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pvar/signed-out), which replaces the cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pvar/signed-out"} */}
4. Load the cookie from `SESSIONS_PVAR`.
   {/* step {"loadCookie":{"name":"sessions_pvar","variable":"SESSIONS_PVAR"}} */}
5. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pvar=signed-in**.

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Keep a cookie in a named variable

// (test {"testId":"sessions-cookie-variable","detectSteps":true})

. Sign in at http://localhost:8092/cookies/set/sessions_pvar/signed-in[the sign-in page]. The server sets the `sessions_pvar` cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pvar/signed-in"})
. Save the `sessions_pvar` cookie to the `SESSIONS_PVAR` environment variable.
+
// (step {"saveCookie":{"name":"sessions_pvar","variable":"SESSIONS_PVAR"}})
. Sign out at http://localhost:8092/cookies/set/sessions_pvar/signed-out[the sign-out page], which replaces the cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pvar/signed-out"})
. Load the cookie from `SESSIONS_PVAR`.
+
// (step {"loadCookie":{"name":"sessions_pvar","variable":"SESSIONS_PVAR"}})
. Open http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_pvar=signed-in*.

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Keep a cookie in a named variable</title></head>
<body>
<!-- test {"testId":"sessions-cookie-variable","detectSteps":true} -->
<h1>Keep a cookie in a named variable</h1>
<ol>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_pvar/signed-in">the sign-in page</a>. The server sets the <code>sessions_pvar</code> cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pvar/signed-in"} --></li>
  <li>Save the <code>sessions_pvar</code> cookie to the <code>SESSIONS_PVAR</code> environment variable.
    <!-- step {"saveCookie":{"name":"sessions_pvar","variable":"SESSIONS_PVAR"}} --></li>
  <li>Sign out at <a href="http://localhost:8092/cookies/set/sessions_pvar/signed-out">the sign-out page</a>, which replaces the cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pvar/signed-out"} --></li>
  <li>Load the cookie from <code>SESSIONS_PVAR</code>.
    <!-- step {"loadCookie":{"name":"sessions_pvar","variable":"SESSIONS_PVAR"}} --></li>
  <li>Open <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_pvar=signed-in</strong>.</li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Keep a cookie in a named variable
=================================

.. test {"testId":"sessions-cookie-variable","detectSteps":true}

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_pvar/signed-in>`__. The server sets the ``sessions_pvar`` cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pvar/signed-in"}

#. Save the ``sessions_pvar`` cookie to the ``SESSIONS_PVAR`` environment variable.

   .. step {"saveCookie":{"name":"sessions_pvar","variable":"SESSIONS_PVAR"}}

#. Sign out at `the sign-out page <http://localhost:8092/cookies/set/sessions_pvar/signed-out>`__, which replaces the cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pvar/signed-out"}

#. Load the cookie from ``SESSIONS_PVAR``.

   .. step {"loadCookie":{"name":"sessions_pvar","variable":"SESSIONS_PVAR"}}

#. Open `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_pvar=signed-in**.

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-cookie-variable">
  <title>Keep a cookie in a named variable</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-cookie-variable","detectSteps":true}'/>
    <steps>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_pvar/signed-in" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_pvar</codeph> cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pvar/signed-in"}'/></info></step>
      <step><cmd>Save the <codeph>sessions_pvar</codeph> cookie to the <codeph>SESSIONS_PVAR</codeph> environment variable.</cmd>
        <info><data name="doc-detective" value='step {"saveCookie":{"name":"sessions_pvar","variable":"SESSIONS_PVAR"}}'/></info></step>
      <step><cmd>Sign out at <xref href="http://localhost:8092/cookies/set/sessions_pvar/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pvar/signed-out"}'/></info></step>
      <step><cmd>Load the cookie from <codeph>SESSIONS_PVAR</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"loadCookie":{"name":"sessions_pvar","variable":"SESSIONS_PVAR"}}'/></info></step>
      <step><cmd>Open <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_pvar=signed-in</b>.</cmd></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-cookie-variable","detectSteps":false} -->

# Keep a cookie in a named variable

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pvar/signed-in). The server sets the `sessions_pvar` cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pvar/signed-in"} -->
2. Save the `sessions_pvar` cookie to the `SESSIONS_PVAR` environment variable.
   <!-- step {"saveCookie":{"name":"sessions_pvar","variable":"SESSIONS_PVAR"}} -->
3. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pvar/signed-out), which replaces the cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pvar/signed-out"} -->
4. Load the cookie from `SESSIONS_PVAR`.
   <!-- step {"loadCookie":{"name":"sessions_pvar","variable":"SESSIONS_PVAR"}} -->
5. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pvar=signed-in**.
   <!-- step {"goTo":"http://localhost:8092/cookies"} -->
   <!-- step {"find":"sessions_pvar=signed-in"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-cookie-variable","detectSteps":false} */}

# Keep a cookie in a named variable

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pvar/signed-in). The server sets the `sessions_pvar` cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pvar/signed-in"} */}
2. Save the `sessions_pvar` cookie to the `SESSIONS_PVAR` environment variable.
   {/* step {"saveCookie":{"name":"sessions_pvar","variable":"SESSIONS_PVAR"}} */}
3. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pvar/signed-out), which replaces the cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pvar/signed-out"} */}
4. Load the cookie from `SESSIONS_PVAR`.
   {/* step {"loadCookie":{"name":"sessions_pvar","variable":"SESSIONS_PVAR"}} */}
5. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pvar=signed-in**.
   {/* step {"goTo":"http://localhost:8092/cookies"} */}
   {/* step {"find":"sessions_pvar=signed-in"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Keep a cookie in a named variable

// (test {"testId":"sessions-cookie-variable","detectSteps":false})

. Sign in at http://localhost:8092/cookies/set/sessions_pvar/signed-in[the sign-in page]. The server sets the `sessions_pvar` cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pvar/signed-in"})
. Save the `sessions_pvar` cookie to the `SESSIONS_PVAR` environment variable.
+
// (step {"saveCookie":{"name":"sessions_pvar","variable":"SESSIONS_PVAR"}})
. Sign out at http://localhost:8092/cookies/set/sessions_pvar/signed-out[the sign-out page], which replaces the cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pvar/signed-out"})
. Load the cookie from `SESSIONS_PVAR`.
+
// (step {"loadCookie":{"name":"sessions_pvar","variable":"SESSIONS_PVAR"}})
. Open http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_pvar=signed-in*.
+
// (step {"goTo":"http://localhost:8092/cookies"})
+
// (step {"find":"sessions_pvar=signed-in"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Keep a cookie in a named variable</title></head>
<body>
<!-- test {"testId":"sessions-cookie-variable","detectSteps":false} -->
<h1>Keep a cookie in a named variable</h1>
<ol>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_pvar/signed-in">the sign-in page</a>. The server sets the <code>sessions_pvar</code> cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pvar/signed-in"} --></li>
  <li>Save the <code>sessions_pvar</code> cookie to the <code>SESSIONS_PVAR</code> environment variable.
    <!-- step {"saveCookie":{"name":"sessions_pvar","variable":"SESSIONS_PVAR"}} --></li>
  <li>Sign out at <a href="http://localhost:8092/cookies/set/sessions_pvar/signed-out">the sign-out page</a>, which replaces the cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pvar/signed-out"} --></li>
  <li>Load the cookie from <code>SESSIONS_PVAR</code>.
    <!-- step {"loadCookie":{"name":"sessions_pvar","variable":"SESSIONS_PVAR"}} --></li>
  <li>Open <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_pvar=signed-in</strong>.
    <!-- step {"goTo":"http://localhost:8092/cookies"} -->
    <!-- step {"find":"sessions_pvar=signed-in"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Keep a cookie in a named variable
=================================

.. test {"testId":"sessions-cookie-variable","detectSteps":false}

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_pvar/signed-in>`__. The server sets the ``sessions_pvar`` cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pvar/signed-in"}

#. Save the ``sessions_pvar`` cookie to the ``SESSIONS_PVAR`` environment variable.

   .. step {"saveCookie":{"name":"sessions_pvar","variable":"SESSIONS_PVAR"}}

#. Sign out at `the sign-out page <http://localhost:8092/cookies/set/sessions_pvar/signed-out>`__, which replaces the cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pvar/signed-out"}

#. Load the cookie from ``SESSIONS_PVAR``.

   .. step {"loadCookie":{"name":"sessions_pvar","variable":"SESSIONS_PVAR"}}

#. Open `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_pvar=signed-in**.

   .. step {"goTo":"http://localhost:8092/cookies"}

   .. step {"find":"sessions_pvar=signed-in"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-cookie-variable">
  <title>Keep a cookie in a named variable</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-cookie-variable","detectSteps":false}'/>
    <steps>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_pvar/signed-in" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_pvar</codeph> cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pvar/signed-in"}'/></info></step>
      <step><cmd>Save the <codeph>sessions_pvar</codeph> cookie to the <codeph>SESSIONS_PVAR</codeph> environment variable.</cmd>
        <info><data name="doc-detective" value='step {"saveCookie":{"name":"sessions_pvar","variable":"SESSIONS_PVAR"}}'/></info></step>
      <step><cmd>Sign out at <xref href="http://localhost:8092/cookies/set/sessions_pvar/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pvar/signed-out"}'/></info></step>
      <step><cmd>Load the cookie from <codeph>SESSIONS_PVAR</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"loadCookie":{"name":"sessions_pvar","variable":"SESSIONS_PVAR"}}'/></info></step>
      <step><cmd>Open <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_pvar=signed-in</b>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies"}'/><data name="doc-detective" value='step {"find":"sessions_pvar=signed-in"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-cookie-variable",
      "steps": [
        {
          "goTo": "http://localhost:8092/cookies/set/sessions_pvar/signed-in"
        },
        {
          "saveCookie": {
            "name": "sessions_pvar",
            "variable": "SESSIONS_PVAR"
          }
        },
        {
          "goTo": "http://localhost:8092/cookies/set/sessions_pvar/signed-out"
        },
        {
          "loadCookie": {
            "name": "sessions_pvar",
            "variable": "SESSIONS_PVAR"
          }
        },
        {
          "goTo": "http://localhost:8092/cookies"
        },
        {
          "find": "sessions_pvar=signed-in"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-cookie-variable
    steps:
      - goTo: http://localhost:8092/cookies/set/sessions_pvar/signed-in
      - saveCookie:
          name: sessions_pvar
          variable: SESSIONS_PVAR
      - goTo: http://localhost:8092/cookies/set/sessions_pvar/signed-out
      - loadCookie:
          name: sessions_pvar
          variable: SESSIONS_PVAR
      - goTo: http://localhost:8092/cookies
      - find: sessions_pvar=signed-in
```

## `saveState` and `loadState` permutations

### `"saveState": "<file>.json"`

**Varies:** `saveState and loadState` · **Value:** `"sessions-pstate.json"` · **Effect:** the string form saves to and loads from `outputDir`, and the save never overwrites a file that exists.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Keep the browser state in a file

1. Delete any `sessions-pstate.json` that an earlier run left in the output folder.
2. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pstate/signed-in). The server sets the `sessions_pstate` cookie.
3. Save the browser state to `sessions-pstate.json`.
4. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pstate/signed-out), which replaces the cookie.
5. Load the browser state from `sessions-pstate.json`.
6. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pstate=signed-in**.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Keep the browser state in a file

1. Delete any `sessions-pstate.json` that an earlier run left in the output folder.
2. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pstate/signed-in). The server sets the `sessions_pstate` cookie.
3. Save the browser state to `sessions-pstate.json`.
4. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pstate/signed-out), which replaces the cookie.
5. Load the browser state from `sessions-pstate.json`.
6. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pstate=signed-in**.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Keep the browser state in a file

. Delete any `sessions-pstate.json` that an earlier run left in the output folder.
. Sign in at http://localhost:8092/cookies/set/sessions_pstate/signed-in[the sign-in page]. The server sets the `sessions_pstate` cookie.
. Save the browser state to `sessions-pstate.json`.
. Sign out at http://localhost:8092/cookies/set/sessions_pstate/signed-out[the sign-out page], which replaces the cookie.
. Load the browser state from `sessions-pstate.json`.
. Open http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_pstate=signed-in*.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Keep the browser state in a file</title></head>
<body>
<h1>Keep the browser state in a file</h1>
<ol>
  <li>Delete any <code>sessions-pstate.json</code> that an earlier run left in the output folder.</li>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_pstate/signed-in">the sign-in page</a>. The server sets the <code>sessions_pstate</code> cookie.</li>
  <li>Save the browser state to <code>sessions-pstate.json</code>.</li>
  <li>Sign out at <a href="http://localhost:8092/cookies/set/sessions_pstate/signed-out">the sign-out page</a>, which replaces the cookie.</li>
  <li>Load the browser state from <code>sessions-pstate.json</code>.</li>
  <li>Open <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_pstate=signed-in</strong>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Keep the browser state in a file
================================

#. Delete any ``sessions-pstate.json`` that an earlier run left in the output folder.

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_pstate/signed-in>`__. The server sets the ``sessions_pstate`` cookie.

#. Save the browser state to ``sessions-pstate.json``.

#. Sign out at `the sign-out page <http://localhost:8092/cookies/set/sessions_pstate/signed-out>`__, which replaces the cookie.

#. Load the browser state from ``sessions-pstate.json``.

#. Open `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_pstate=signed-in**.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-state-form-string">
  <title>Keep the browser state in a file</title>
  <taskbody>
    <steps>
      <step><cmd>Delete any <codeph>sessions-pstate.json</codeph> that an earlier run left in the output folder.</cmd></step>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_pstate/signed-in" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_pstate</codeph> cookie.</cmd></step>
      <step><cmd>Save the browser state to <codeph>sessions-pstate.json</codeph>.</cmd></step>
      <step><cmd>Sign out at <xref href="http://localhost:8092/cookies/set/sessions_pstate/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd></step>
      <step><cmd>Load the browser state from <codeph>sessions-pstate.json</codeph>.</cmd></step>
      <step><cmd>Open <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_pstate=signed-in</b>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-state-form-string","detectSteps":true} -->

# Keep the browser state in a file

1. Delete any `sessions-pstate.json` that an earlier run left in the output folder.
   <!-- step {"runShell":"node -e \"require('fs').rmSync('docs/docs-as-tests/examples/.dd-output/sessions-pstate.json', { force: true })\""} -->
2. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pstate/signed-in). The server sets the `sessions_pstate` cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pstate/signed-in"} -->
3. Save the browser state to `sessions-pstate.json`.
   <!-- step {"saveState":"sessions-pstate.json"} -->
4. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pstate/signed-out), which replaces the cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pstate/signed-out"} -->
5. Load the browser state from `sessions-pstate.json`.
   <!-- step {"loadState":"sessions-pstate.json"} -->
6. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pstate=signed-in**.

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-state-form-string","detectSteps":true} */}

# Keep the browser state in a file

1. Delete any `sessions-pstate.json` that an earlier run left in the output folder.
   {/* step {"runShell":"node -e \"require('fs').rmSync('docs/docs-as-tests/examples/.dd-output/sessions-pstate.json', { force: true })\""} */}
2. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pstate/signed-in). The server sets the `sessions_pstate` cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pstate/signed-in"} */}
3. Save the browser state to `sessions-pstate.json`.
   {/* step {"saveState":"sessions-pstate.json"} */}
4. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pstate/signed-out), which replaces the cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pstate/signed-out"} */}
5. Load the browser state from `sessions-pstate.json`.
   {/* step {"loadState":"sessions-pstate.json"} */}
6. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pstate=signed-in**.

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Keep the browser state in a file

// (test {"testId":"sessions-state-form-string","detectSteps":true})

. Delete any `sessions-pstate.json` that an earlier run left in the output folder.
+
// (step {"runShell":"node -e \"require('fs').rmSync('docs/docs-as-tests/examples/.dd-output/sessions-pstate.json', { force: true })\""})
. Sign in at http://localhost:8092/cookies/set/sessions_pstate/signed-in[the sign-in page]. The server sets the `sessions_pstate` cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pstate/signed-in"})
. Save the browser state to `sessions-pstate.json`.
+
// (step {"saveState":"sessions-pstate.json"})
. Sign out at http://localhost:8092/cookies/set/sessions_pstate/signed-out[the sign-out page], which replaces the cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pstate/signed-out"})
. Load the browser state from `sessions-pstate.json`.
+
// (step {"loadState":"sessions-pstate.json"})
. Open http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_pstate=signed-in*.

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Keep the browser state in a file</title></head>
<body>
<!-- test {"testId":"sessions-state-form-string","detectSteps":true} -->
<h1>Keep the browser state in a file</h1>
<ol>
  <li>Delete any <code>sessions-pstate.json</code> that an earlier run left in the output folder.
    <!-- step {"runShell":"node -e \"require('fs').rmSync('docs/docs-as-tests/examples/.dd-output/sessions-pstate.json', { force: true })\""} --></li>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_pstate/signed-in">the sign-in page</a>. The server sets the <code>sessions_pstate</code> cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pstate/signed-in"} --></li>
  <li>Save the browser state to <code>sessions-pstate.json</code>.
    <!-- step {"saveState":"sessions-pstate.json"} --></li>
  <li>Sign out at <a href="http://localhost:8092/cookies/set/sessions_pstate/signed-out">the sign-out page</a>, which replaces the cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pstate/signed-out"} --></li>
  <li>Load the browser state from <code>sessions-pstate.json</code>.
    <!-- step {"loadState":"sessions-pstate.json"} --></li>
  <li>Open <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_pstate=signed-in</strong>.</li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Keep the browser state in a file
================================

.. test {"testId":"sessions-state-form-string","detectSteps":true}

#. Delete any ``sessions-pstate.json`` that an earlier run left in the output folder.

   .. step {"runShell":"node -e \"require('fs').rmSync('docs/docs-as-tests/examples/.dd-output/sessions-pstate.json', { force: true })\""}

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_pstate/signed-in>`__. The server sets the ``sessions_pstate`` cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pstate/signed-in"}

#. Save the browser state to ``sessions-pstate.json``.

   .. step {"saveState":"sessions-pstate.json"}

#. Sign out at `the sign-out page <http://localhost:8092/cookies/set/sessions_pstate/signed-out>`__, which replaces the cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pstate/signed-out"}

#. Load the browser state from ``sessions-pstate.json``.

   .. step {"loadState":"sessions-pstate.json"}

#. Open `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_pstate=signed-in**.

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-state-form-string">
  <title>Keep the browser state in a file</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-state-form-string","detectSteps":true}'/>
    <steps>
      <step><cmd>Delete any <codeph>sessions-pstate.json</codeph> that an earlier run left in the output folder.</cmd>
        <info><data name="doc-detective" value='step {"runShell":"node -e \"require(&apos;fs&apos;).rmSync(&apos;docs/docs-as-tests/examples/.dd-output/sessions-pstate.json&apos;, { force: true })\""}'/></info></step>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_pstate/signed-in" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_pstate</codeph> cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pstate/signed-in"}'/></info></step>
      <step><cmd>Save the browser state to <codeph>sessions-pstate.json</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"saveState":"sessions-pstate.json"}'/></info></step>
      <step><cmd>Sign out at <xref href="http://localhost:8092/cookies/set/sessions_pstate/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pstate/signed-out"}'/></info></step>
      <step><cmd>Load the browser state from <codeph>sessions-pstate.json</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"loadState":"sessions-pstate.json"}'/></info></step>
      <step><cmd>Open <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_pstate=signed-in</b>.</cmd></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-state-form-string","detectSteps":false} -->

# Keep the browser state in a file

1. Delete any `sessions-pstate.json` that an earlier run left in the output folder.
   <!-- step {"runShell":"node -e \"require('fs').rmSync('docs/docs-as-tests/examples/.dd-output/sessions-pstate.json', { force: true })\""} -->
2. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pstate/signed-in). The server sets the `sessions_pstate` cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pstate/signed-in"} -->
3. Save the browser state to `sessions-pstate.json`.
   <!-- step {"saveState":"sessions-pstate.json"} -->
4. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pstate/signed-out), which replaces the cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pstate/signed-out"} -->
5. Load the browser state from `sessions-pstate.json`.
   <!-- step {"loadState":"sessions-pstate.json"} -->
6. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pstate=signed-in**.
   <!-- step {"goTo":"http://localhost:8092/cookies"} -->
   <!-- step {"find":"sessions_pstate=signed-in"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-state-form-string","detectSteps":false} */}

# Keep the browser state in a file

1. Delete any `sessions-pstate.json` that an earlier run left in the output folder.
   {/* step {"runShell":"node -e \"require('fs').rmSync('docs/docs-as-tests/examples/.dd-output/sessions-pstate.json', { force: true })\""} */}
2. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pstate/signed-in). The server sets the `sessions_pstate` cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pstate/signed-in"} */}
3. Save the browser state to `sessions-pstate.json`.
   {/* step {"saveState":"sessions-pstate.json"} */}
4. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pstate/signed-out), which replaces the cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pstate/signed-out"} */}
5. Load the browser state from `sessions-pstate.json`.
   {/* step {"loadState":"sessions-pstate.json"} */}
6. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pstate=signed-in**.
   {/* step {"goTo":"http://localhost:8092/cookies"} */}
   {/* step {"find":"sessions_pstate=signed-in"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Keep the browser state in a file

// (test {"testId":"sessions-state-form-string","detectSteps":false})

. Delete any `sessions-pstate.json` that an earlier run left in the output folder.
+
// (step {"runShell":"node -e \"require('fs').rmSync('docs/docs-as-tests/examples/.dd-output/sessions-pstate.json', { force: true })\""})
. Sign in at http://localhost:8092/cookies/set/sessions_pstate/signed-in[the sign-in page]. The server sets the `sessions_pstate` cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pstate/signed-in"})
. Save the browser state to `sessions-pstate.json`.
+
// (step {"saveState":"sessions-pstate.json"})
. Sign out at http://localhost:8092/cookies/set/sessions_pstate/signed-out[the sign-out page], which replaces the cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pstate/signed-out"})
. Load the browser state from `sessions-pstate.json`.
+
// (step {"loadState":"sessions-pstate.json"})
. Open http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_pstate=signed-in*.
+
// (step {"goTo":"http://localhost:8092/cookies"})
+
// (step {"find":"sessions_pstate=signed-in"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Keep the browser state in a file</title></head>
<body>
<!-- test {"testId":"sessions-state-form-string","detectSteps":false} -->
<h1>Keep the browser state in a file</h1>
<ol>
  <li>Delete any <code>sessions-pstate.json</code> that an earlier run left in the output folder.
    <!-- step {"runShell":"node -e \"require('fs').rmSync('docs/docs-as-tests/examples/.dd-output/sessions-pstate.json', { force: true })\""} --></li>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_pstate/signed-in">the sign-in page</a>. The server sets the <code>sessions_pstate</code> cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pstate/signed-in"} --></li>
  <li>Save the browser state to <code>sessions-pstate.json</code>.
    <!-- step {"saveState":"sessions-pstate.json"} --></li>
  <li>Sign out at <a href="http://localhost:8092/cookies/set/sessions_pstate/signed-out">the sign-out page</a>, which replaces the cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pstate/signed-out"} --></li>
  <li>Load the browser state from <code>sessions-pstate.json</code>.
    <!-- step {"loadState":"sessions-pstate.json"} --></li>
  <li>Open <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_pstate=signed-in</strong>.
    <!-- step {"goTo":"http://localhost:8092/cookies"} -->
    <!-- step {"find":"sessions_pstate=signed-in"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Keep the browser state in a file
================================

.. test {"testId":"sessions-state-form-string","detectSteps":false}

#. Delete any ``sessions-pstate.json`` that an earlier run left in the output folder.

   .. step {"runShell":"node -e \"require('fs').rmSync('docs/docs-as-tests/examples/.dd-output/sessions-pstate.json', { force: true })\""}

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_pstate/signed-in>`__. The server sets the ``sessions_pstate`` cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pstate/signed-in"}

#. Save the browser state to ``sessions-pstate.json``.

   .. step {"saveState":"sessions-pstate.json"}

#. Sign out at `the sign-out page <http://localhost:8092/cookies/set/sessions_pstate/signed-out>`__, which replaces the cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pstate/signed-out"}

#. Load the browser state from ``sessions-pstate.json``.

   .. step {"loadState":"sessions-pstate.json"}

#. Open `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_pstate=signed-in**.

   .. step {"goTo":"http://localhost:8092/cookies"}

   .. step {"find":"sessions_pstate=signed-in"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-state-form-string">
  <title>Keep the browser state in a file</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-state-form-string","detectSteps":false}'/>
    <steps>
      <step><cmd>Delete any <codeph>sessions-pstate.json</codeph> that an earlier run left in the output folder.</cmd>
        <info><data name="doc-detective" value='step {"runShell":"node -e \"require(&apos;fs&apos;).rmSync(&apos;docs/docs-as-tests/examples/.dd-output/sessions-pstate.json&apos;, { force: true })\""}'/></info></step>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_pstate/signed-in" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_pstate</codeph> cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pstate/signed-in"}'/></info></step>
      <step><cmd>Save the browser state to <codeph>sessions-pstate.json</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"saveState":"sessions-pstate.json"}'/></info></step>
      <step><cmd>Sign out at <xref href="http://localhost:8092/cookies/set/sessions_pstate/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pstate/signed-out"}'/></info></step>
      <step><cmd>Load the browser state from <codeph>sessions-pstate.json</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"loadState":"sessions-pstate.json"}'/></info></step>
      <step><cmd>Open <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_pstate=signed-in</b>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies"}'/><data name="doc-detective" value='step {"find":"sessions_pstate=signed-in"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-state-form-string",
      "steps": [
        {
          "runShell": "node -e \"require('fs').rmSync('docs/docs-as-tests/examples/.dd-output/sessions-pstate.json', { force: true })\""
        },
        {
          "goTo": "http://localhost:8092/cookies/set/sessions_pstate/signed-in"
        },
        {
          "saveState": "sessions-pstate.json"
        },
        {
          "goTo": "http://localhost:8092/cookies/set/sessions_pstate/signed-out"
        },
        {
          "loadState": "sessions-pstate.json"
        },
        {
          "goTo": "http://localhost:8092/cookies"
        },
        {
          "find": "sessions_pstate=signed-in"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-state-form-string
    steps:
      - runShell: "node -e \"require('fs').rmSync('docs/docs-as-tests/examples/.dd-output/sessions-pstate.json', { force: true })\""
      - goTo: http://localhost:8092/cookies/set/sessions_pstate/signed-in
      - saveState: sessions-pstate.json
      - goTo: http://localhost:8092/cookies/set/sessions_pstate/signed-out
      - loadState: sessions-pstate.json
      - goTo: http://localhost:8092/cookies
      - find: sessions_pstate=signed-in
```

### `"overwrite": true`

**Varies:** `saveState.overwrite` · **Value:** `true` · **Effect:** the object form with `overwrite` replaces an earlier file, so the test can run again into the same `outputDir`.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Replace a saved browser state

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pstateo/signed-in). The server sets the `sessions_pstateo` cookie.
2. Save the browser state to `sessions-pstateo.json`, replacing any earlier file.
3. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pstateo/signed-out), which replaces the cookie.
4. Load the browser state from `sessions-pstateo.json`.
5. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pstateo=signed-in**.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Replace a saved browser state

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pstateo/signed-in). The server sets the `sessions_pstateo` cookie.
2. Save the browser state to `sessions-pstateo.json`, replacing any earlier file.
3. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pstateo/signed-out), which replaces the cookie.
4. Load the browser state from `sessions-pstateo.json`.
5. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pstateo=signed-in**.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Replace a saved browser state

. Sign in at http://localhost:8092/cookies/set/sessions_pstateo/signed-in[the sign-in page]. The server sets the `sessions_pstateo` cookie.
. Save the browser state to `sessions-pstateo.json`, replacing any earlier file.
. Sign out at http://localhost:8092/cookies/set/sessions_pstateo/signed-out[the sign-out page], which replaces the cookie.
. Load the browser state from `sessions-pstateo.json`.
. Open http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_pstateo=signed-in*.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Replace a saved browser state</title></head>
<body>
<h1>Replace a saved browser state</h1>
<ol>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_pstateo/signed-in">the sign-in page</a>. The server sets the <code>sessions_pstateo</code> cookie.</li>
  <li>Save the browser state to <code>sessions-pstateo.json</code>, replacing any earlier file.</li>
  <li>Sign out at <a href="http://localhost:8092/cookies/set/sessions_pstateo/signed-out">the sign-out page</a>, which replaces the cookie.</li>
  <li>Load the browser state from <code>sessions-pstateo.json</code>.</li>
  <li>Open <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_pstateo=signed-in</strong>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Replace a saved browser state
=============================

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_pstateo/signed-in>`__. The server sets the ``sessions_pstateo`` cookie.

#. Save the browser state to ``sessions-pstateo.json``, replacing any earlier file.

#. Sign out at `the sign-out page <http://localhost:8092/cookies/set/sessions_pstateo/signed-out>`__, which replaces the cookie.

#. Load the browser state from ``sessions-pstateo.json``.

#. Open `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_pstateo=signed-in**.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-state-overwrite-true">
  <title>Replace a saved browser state</title>
  <taskbody>
    <steps>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_pstateo/signed-in" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_pstateo</codeph> cookie.</cmd></step>
      <step><cmd>Save the browser state to <codeph>sessions-pstateo.json</codeph>, replacing any earlier file.</cmd></step>
      <step><cmd>Sign out at <xref href="http://localhost:8092/cookies/set/sessions_pstateo/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd></step>
      <step><cmd>Load the browser state from <codeph>sessions-pstateo.json</codeph>.</cmd></step>
      <step><cmd>Open <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_pstateo=signed-in</b>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-state-overwrite-true","detectSteps":true} -->

# Replace a saved browser state

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pstateo/signed-in). The server sets the `sessions_pstateo` cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pstateo/signed-in"} -->
2. Save the browser state to `sessions-pstateo.json`, replacing any earlier file.
   <!-- step {"saveState":{"path":"sessions-pstateo.json","overwrite":true}} -->
3. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pstateo/signed-out), which replaces the cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pstateo/signed-out"} -->
4. Load the browser state from `sessions-pstateo.json`.
   <!-- step {"loadState":{"path":"sessions-pstateo.json"}} -->
5. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pstateo=signed-in**.

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-state-overwrite-true","detectSteps":true} */}

# Replace a saved browser state

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pstateo/signed-in). The server sets the `sessions_pstateo` cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pstateo/signed-in"} */}
2. Save the browser state to `sessions-pstateo.json`, replacing any earlier file.
   {/* step {"saveState":{"path":"sessions-pstateo.json","overwrite":true}} */}
3. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pstateo/signed-out), which replaces the cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pstateo/signed-out"} */}
4. Load the browser state from `sessions-pstateo.json`.
   {/* step {"loadState":{"path":"sessions-pstateo.json"}} */}
5. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pstateo=signed-in**.

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Replace a saved browser state

// (test {"testId":"sessions-state-overwrite-true","detectSteps":true})

. Sign in at http://localhost:8092/cookies/set/sessions_pstateo/signed-in[the sign-in page]. The server sets the `sessions_pstateo` cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pstateo/signed-in"})
. Save the browser state to `sessions-pstateo.json`, replacing any earlier file.
+
// (step {"saveState":{"path":"sessions-pstateo.json","overwrite":true}})
. Sign out at http://localhost:8092/cookies/set/sessions_pstateo/signed-out[the sign-out page], which replaces the cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pstateo/signed-out"})
. Load the browser state from `sessions-pstateo.json`.
+
// (step {"loadState":{"path":"sessions-pstateo.json"}})
. Open http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_pstateo=signed-in*.

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Replace a saved browser state</title></head>
<body>
<!-- test {"testId":"sessions-state-overwrite-true","detectSteps":true} -->
<h1>Replace a saved browser state</h1>
<ol>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_pstateo/signed-in">the sign-in page</a>. The server sets the <code>sessions_pstateo</code> cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pstateo/signed-in"} --></li>
  <li>Save the browser state to <code>sessions-pstateo.json</code>, replacing any earlier file.
    <!-- step {"saveState":{"path":"sessions-pstateo.json","overwrite":true}} --></li>
  <li>Sign out at <a href="http://localhost:8092/cookies/set/sessions_pstateo/signed-out">the sign-out page</a>, which replaces the cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pstateo/signed-out"} --></li>
  <li>Load the browser state from <code>sessions-pstateo.json</code>.
    <!-- step {"loadState":{"path":"sessions-pstateo.json"}} --></li>
  <li>Open <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_pstateo=signed-in</strong>.</li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Replace a saved browser state
=============================

.. test {"testId":"sessions-state-overwrite-true","detectSteps":true}

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_pstateo/signed-in>`__. The server sets the ``sessions_pstateo`` cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pstateo/signed-in"}

#. Save the browser state to ``sessions-pstateo.json``, replacing any earlier file.

   .. step {"saveState":{"path":"sessions-pstateo.json","overwrite":true}}

#. Sign out at `the sign-out page <http://localhost:8092/cookies/set/sessions_pstateo/signed-out>`__, which replaces the cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pstateo/signed-out"}

#. Load the browser state from ``sessions-pstateo.json``.

   .. step {"loadState":{"path":"sessions-pstateo.json"}}

#. Open `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_pstateo=signed-in**.

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-state-overwrite-true">
  <title>Replace a saved browser state</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-state-overwrite-true","detectSteps":true}'/>
    <steps>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_pstateo/signed-in" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_pstateo</codeph> cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pstateo/signed-in"}'/></info></step>
      <step><cmd>Save the browser state to <codeph>sessions-pstateo.json</codeph>, replacing any earlier file.</cmd>
        <info><data name="doc-detective" value='step {"saveState":{"path":"sessions-pstateo.json","overwrite":true}}'/></info></step>
      <step><cmd>Sign out at <xref href="http://localhost:8092/cookies/set/sessions_pstateo/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pstateo/signed-out"}'/></info></step>
      <step><cmd>Load the browser state from <codeph>sessions-pstateo.json</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"loadState":{"path":"sessions-pstateo.json"}}'/></info></step>
      <step><cmd>Open <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_pstateo=signed-in</b>.</cmd></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-state-overwrite-true","detectSteps":false} -->

# Replace a saved browser state

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pstateo/signed-in). The server sets the `sessions_pstateo` cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pstateo/signed-in"} -->
2. Save the browser state to `sessions-pstateo.json`, replacing any earlier file.
   <!-- step {"saveState":{"path":"sessions-pstateo.json","overwrite":true}} -->
3. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pstateo/signed-out), which replaces the cookie.
   <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pstateo/signed-out"} -->
4. Load the browser state from `sessions-pstateo.json`.
   <!-- step {"loadState":{"path":"sessions-pstateo.json"}} -->
5. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pstateo=signed-in**.
   <!-- step {"goTo":"http://localhost:8092/cookies"} -->
   <!-- step {"find":"sessions_pstateo=signed-in"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-state-overwrite-true","detectSteps":false} */}

# Replace a saved browser state

1. Sign in at [the sign-in page](http://localhost:8092/cookies/set/sessions_pstateo/signed-in). The server sets the `sessions_pstateo` cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pstateo/signed-in"} */}
2. Save the browser state to `sessions-pstateo.json`, replacing any earlier file.
   {/* step {"saveState":{"path":"sessions-pstateo.json","overwrite":true}} */}
3. Sign out at [the sign-out page](http://localhost:8092/cookies/set/sessions_pstateo/signed-out), which replaces the cookie.
   {/* step {"goTo":"http://localhost:8092/cookies/set/sessions_pstateo/signed-out"} */}
4. Load the browser state from `sessions-pstateo.json`.
   {/* step {"loadState":{"path":"sessions-pstateo.json"}} */}
5. Open [the cookie report](http://localhost:8092/cookies), and check that it shows **sessions_pstateo=signed-in**.
   {/* step {"goTo":"http://localhost:8092/cookies"} */}
   {/* step {"find":"sessions_pstateo=signed-in"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Replace a saved browser state

// (test {"testId":"sessions-state-overwrite-true","detectSteps":false})

. Sign in at http://localhost:8092/cookies/set/sessions_pstateo/signed-in[the sign-in page]. The server sets the `sessions_pstateo` cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pstateo/signed-in"})
. Save the browser state to `sessions-pstateo.json`, replacing any earlier file.
+
// (step {"saveState":{"path":"sessions-pstateo.json","overwrite":true}})
. Sign out at http://localhost:8092/cookies/set/sessions_pstateo/signed-out[the sign-out page], which replaces the cookie.
+
// (step {"goTo":"http://localhost:8092/cookies/set/sessions_pstateo/signed-out"})
. Load the browser state from `sessions-pstateo.json`.
+
// (step {"loadState":{"path":"sessions-pstateo.json"}})
. Open http://localhost:8092/cookies[the cookie report], and check that it shows *sessions_pstateo=signed-in*.
+
// (step {"goTo":"http://localhost:8092/cookies"})
+
// (step {"find":"sessions_pstateo=signed-in"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Replace a saved browser state</title></head>
<body>
<!-- test {"testId":"sessions-state-overwrite-true","detectSteps":false} -->
<h1>Replace a saved browser state</h1>
<ol>
  <li>Sign in at <a href="http://localhost:8092/cookies/set/sessions_pstateo/signed-in">the sign-in page</a>. The server sets the <code>sessions_pstateo</code> cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pstateo/signed-in"} --></li>
  <li>Save the browser state to <code>sessions-pstateo.json</code>, replacing any earlier file.
    <!-- step {"saveState":{"path":"sessions-pstateo.json","overwrite":true}} --></li>
  <li>Sign out at <a href="http://localhost:8092/cookies/set/sessions_pstateo/signed-out">the sign-out page</a>, which replaces the cookie.
    <!-- step {"goTo":"http://localhost:8092/cookies/set/sessions_pstateo/signed-out"} --></li>
  <li>Load the browser state from <code>sessions-pstateo.json</code>.
    <!-- step {"loadState":{"path":"sessions-pstateo.json"}} --></li>
  <li>Open <a href="http://localhost:8092/cookies">the cookie report</a>, and check that it shows <strong>sessions_pstateo=signed-in</strong>.
    <!-- step {"goTo":"http://localhost:8092/cookies"} -->
    <!-- step {"find":"sessions_pstateo=signed-in"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Replace a saved browser state
=============================

.. test {"testId":"sessions-state-overwrite-true","detectSteps":false}

#. Sign in at `the sign-in page <http://localhost:8092/cookies/set/sessions_pstateo/signed-in>`__. The server sets the ``sessions_pstateo`` cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pstateo/signed-in"}

#. Save the browser state to ``sessions-pstateo.json``, replacing any earlier file.

   .. step {"saveState":{"path":"sessions-pstateo.json","overwrite":true}}

#. Sign out at `the sign-out page <http://localhost:8092/cookies/set/sessions_pstateo/signed-out>`__, which replaces the cookie.

   .. step {"goTo":"http://localhost:8092/cookies/set/sessions_pstateo/signed-out"}

#. Load the browser state from ``sessions-pstateo.json``.

   .. step {"loadState":{"path":"sessions-pstateo.json"}}

#. Open `the cookie report <http://localhost:8092/cookies>`__, and check that it shows **sessions_pstateo=signed-in**.

   .. step {"goTo":"http://localhost:8092/cookies"}

   .. step {"find":"sessions_pstateo=signed-in"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-state-overwrite-true">
  <title>Replace a saved browser state</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-state-overwrite-true","detectSteps":false}'/>
    <steps>
      <step><cmd>Sign in at <xref href="http://localhost:8092/cookies/set/sessions_pstateo/signed-in" scope="external" format="html">the sign-in page</xref>. The server sets the <codeph>sessions_pstateo</codeph> cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pstateo/signed-in"}'/></info></step>
      <step><cmd>Save the browser state to <codeph>sessions-pstateo.json</codeph>, replacing any earlier file.</cmd>
        <info><data name="doc-detective" value='step {"saveState":{"path":"sessions-pstateo.json","overwrite":true}}'/></info></step>
      <step><cmd>Sign out at <xref href="http://localhost:8092/cookies/set/sessions_pstateo/signed-out" scope="external" format="html">the sign-out page</xref>, which replaces the cookie.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies/set/sessions_pstateo/signed-out"}'/></info></step>
      <step><cmd>Load the browser state from <codeph>sessions-pstateo.json</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"loadState":{"path":"sessions-pstateo.json"}}'/></info></step>
      <step><cmd>Open <xref href="http://localhost:8092/cookies" scope="external" format="html">the cookie report</xref>, and check that it shows <b>sessions_pstateo=signed-in</b>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/cookies"}'/><data name="doc-detective" value='step {"find":"sessions_pstateo=signed-in"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-state-overwrite-true",
      "steps": [
        {
          "goTo": "http://localhost:8092/cookies/set/sessions_pstateo/signed-in"
        },
        {
          "saveState": {
            "path": "sessions-pstateo.json",
            "overwrite": true
          }
        },
        {
          "goTo": "http://localhost:8092/cookies/set/sessions_pstateo/signed-out"
        },
        {
          "loadState": {
            "path": "sessions-pstateo.json"
          }
        },
        {
          "goTo": "http://localhost:8092/cookies"
        },
        {
          "find": "sessions_pstateo=signed-in"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-state-overwrite-true
    steps:
      - goTo: http://localhost:8092/cookies/set/sessions_pstateo/signed-in
      - saveState:
          path: sessions-pstateo.json
          overwrite: true
      - goTo: http://localhost:8092/cookies/set/sessions_pstateo/signed-out
      - loadState:
          path: sessions-pstateo.json
      - goTo: http://localhost:8092/cookies
      - find: sessions_pstateo=signed-in
```

## `runOn` `platforms` permutations

### `"platforms": "windows"`

**Varies:** `runOn[].platforms` · **Value:** `"windows"` · **Effect:** the test runs on Windows and reports `SKIPPED` on every other platform.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check the page on Windows

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page reads **MULTI-TAB HOME**.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check the page on Windows

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page reads **MULTI-TAB HOME**.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check the page on Windows

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Check that the page reads *MULTI-TAB HOME*.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page on Windows</title></head>
<body>
<h1>Check the page on Windows</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Check that the page reads <strong>MULTI-TAB HOME</strong>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check the page on Windows
=========================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Check that the page reads **MULTI-TAB HOME**.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-platforms-windows">
  <title>Check the page on Windows</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Check that the page reads <b>MULTI-TAB HOME</b>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-runon-platforms-windows","detectSteps":true,"runOn":[{"platforms":"windows"}]} -->

# Check the page on Windows

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page reads **MULTI-TAB HOME**.

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-runon-platforms-windows","detectSteps":true,"runOn":[{"platforms":"windows"}]} */}

# Check the page on Windows

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page reads **MULTI-TAB HOME**.

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check the page on Windows

// (test {"testId":"sessions-runon-platforms-windows","detectSteps":true,"runOn":[{"platforms":"windows"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page reads *MULTI-TAB HOME*.

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page on Windows</title></head>
<body>
<!-- test {"testId":"sessions-runon-platforms-windows","detectSteps":true,"runOn":[{"platforms":"windows"}]} -->
<h1>Check the page on Windows</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page reads <strong>MULTI-TAB HOME</strong>.</li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check the page on Windows
=========================

.. test {"testId":"sessions-runon-platforms-windows","detectSteps":true,"runOn":[{"platforms":"windows"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page reads **MULTI-TAB HOME**.

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-platforms-windows">
  <title>Check the page on Windows</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-platforms-windows","detectSteps":true,"runOn":[{"platforms":"windows"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page reads <b>MULTI-TAB HOME</b>.</cmd></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-runon-platforms-windows","detectSteps":false,"runOn":[{"platforms":"windows"}]} -->

# Check the page on Windows

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page reads **MULTI-TAB HOME**.
   <!-- step {"find":"MULTI-TAB HOME"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-runon-platforms-windows","detectSteps":false,"runOn":[{"platforms":"windows"}]} */}

# Check the page on Windows

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page reads **MULTI-TAB HOME**.
   {/* step {"find":"MULTI-TAB HOME"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check the page on Windows

// (test {"testId":"sessions-runon-platforms-windows","detectSteps":false,"runOn":[{"platforms":"windows"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page reads *MULTI-TAB HOME*.
+
// (step {"find":"MULTI-TAB HOME"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page on Windows</title></head>
<body>
<!-- test {"testId":"sessions-runon-platforms-windows","detectSteps":false,"runOn":[{"platforms":"windows"}]} -->
<h1>Check the page on Windows</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page reads <strong>MULTI-TAB HOME</strong>.
    <!-- step {"find":"MULTI-TAB HOME"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check the page on Windows
=========================

.. test {"testId":"sessions-runon-platforms-windows","detectSteps":false,"runOn":[{"platforms":"windows"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page reads **MULTI-TAB HOME**.

   .. step {"find":"MULTI-TAB HOME"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-platforms-windows">
  <title>Check the page on Windows</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-platforms-windows","detectSteps":false,"runOn":[{"platforms":"windows"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page reads <b>MULTI-TAB HOME</b>.</cmd>
        <info><data name="doc-detective" value='step {"find":"MULTI-TAB HOME"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-runon-platforms-windows",
      "runOn": [
        {
          "platforms": "windows"
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "find": "MULTI-TAB HOME"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-runon-platforms-windows
    runOn:
      - platforms: windows
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - find: MULTI-TAB HOME
```

### `"platforms": ["linux", "mac"]`

**Varies:** `runOn[].platforms` · **Value:** `["linux", "mac"]` · **Effect:** an array runs the test on each listed platform the host matches, and skips the rest.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check the page on Linux and macOS

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page reads **MULTI-TAB HOME**.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check the page on Linux and macOS

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page reads **MULTI-TAB HOME**.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check the page on Linux and macOS

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Check that the page reads *MULTI-TAB HOME*.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page on Linux and macOS</title></head>
<body>
<h1>Check the page on Linux and macOS</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Check that the page reads <strong>MULTI-TAB HOME</strong>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check the page on Linux and macOS
=================================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Check that the page reads **MULTI-TAB HOME**.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-platforms-array">
  <title>Check the page on Linux and macOS</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Check that the page reads <b>MULTI-TAB HOME</b>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-runon-platforms-array","detectSteps":true,"runOn":[{"platforms":["linux","mac"]}]} -->

# Check the page on Linux and macOS

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page reads **MULTI-TAB HOME**.

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-runon-platforms-array","detectSteps":true,"runOn":[{"platforms":["linux","mac"]}]} */}

# Check the page on Linux and macOS

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page reads **MULTI-TAB HOME**.

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check the page on Linux and macOS

// (test {"testId":"sessions-runon-platforms-array","detectSteps":true,"runOn":[{"platforms":["linux","mac"]}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page reads *MULTI-TAB HOME*.

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page on Linux and macOS</title></head>
<body>
<!-- test {"testId":"sessions-runon-platforms-array","detectSteps":true,"runOn":[{"platforms":["linux","mac"]}]} -->
<h1>Check the page on Linux and macOS</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page reads <strong>MULTI-TAB HOME</strong>.</li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check the page on Linux and macOS
=================================

.. test {"testId":"sessions-runon-platforms-array","detectSteps":true,"runOn":[{"platforms":["linux","mac"]}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page reads **MULTI-TAB HOME**.

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-platforms-array">
  <title>Check the page on Linux and macOS</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-platforms-array","detectSteps":true,"runOn":[{"platforms":["linux","mac"]}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page reads <b>MULTI-TAB HOME</b>.</cmd></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-runon-platforms-array","detectSteps":false,"runOn":[{"platforms":["linux","mac"]}]} -->

# Check the page on Linux and macOS

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page reads **MULTI-TAB HOME**.
   <!-- step {"find":"MULTI-TAB HOME"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-runon-platforms-array","detectSteps":false,"runOn":[{"platforms":["linux","mac"]}]} */}

# Check the page on Linux and macOS

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page reads **MULTI-TAB HOME**.
   {/* step {"find":"MULTI-TAB HOME"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check the page on Linux and macOS

// (test {"testId":"sessions-runon-platforms-array","detectSteps":false,"runOn":[{"platforms":["linux","mac"]}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page reads *MULTI-TAB HOME*.
+
// (step {"find":"MULTI-TAB HOME"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page on Linux and macOS</title></head>
<body>
<!-- test {"testId":"sessions-runon-platforms-array","detectSteps":false,"runOn":[{"platforms":["linux","mac"]}]} -->
<h1>Check the page on Linux and macOS</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page reads <strong>MULTI-TAB HOME</strong>.
    <!-- step {"find":"MULTI-TAB HOME"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check the page on Linux and macOS
=================================

.. test {"testId":"sessions-runon-platforms-array","detectSteps":false,"runOn":[{"platforms":["linux","mac"]}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page reads **MULTI-TAB HOME**.

   .. step {"find":"MULTI-TAB HOME"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-platforms-array">
  <title>Check the page on Linux and macOS</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-platforms-array","detectSteps":false,"runOn":[{"platforms":["linux","mac"]}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page reads <b>MULTI-TAB HOME</b>.</cmd>
        <info><data name="doc-detective" value='step {"find":"MULTI-TAB HOME"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-runon-platforms-array",
      "runOn": [
        {
          "platforms": [
            "linux",
            "mac"
          ]
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "find": "MULTI-TAB HOME"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-runon-platforms-array
    runOn:
      - platforms:
          - linux
          - mac
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - find: MULTI-TAB HOME
```

## `runOn` `browsers` permutations

### `"browsers": "firefox"`

**Varies:** `runOn[].browsers` · **Value:** `"firefox"` · **Effect:** a browser name runs the test in that browser, headless by default.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check the page in Firefox

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page reads **MULTI-TAB HOME**.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check the page in Firefox

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page reads **MULTI-TAB HOME**.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check the page in Firefox

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Check that the page reads *MULTI-TAB HOME*.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page in Firefox</title></head>
<body>
<h1>Check the page in Firefox</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Check that the page reads <strong>MULTI-TAB HOME</strong>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check the page in Firefox
=========================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Check that the page reads **MULTI-TAB HOME**.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-browsers-string">
  <title>Check the page in Firefox</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Check that the page reads <b>MULTI-TAB HOME</b>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-runon-browsers-string","detectSteps":true,"runOn":[{"browsers":"firefox"}]} -->

# Check the page in Firefox

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page reads **MULTI-TAB HOME**.

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-runon-browsers-string","detectSteps":true,"runOn":[{"browsers":"firefox"}]} */}

# Check the page in Firefox

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page reads **MULTI-TAB HOME**.

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check the page in Firefox

// (test {"testId":"sessions-runon-browsers-string","detectSteps":true,"runOn":[{"browsers":"firefox"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page reads *MULTI-TAB HOME*.

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page in Firefox</title></head>
<body>
<!-- test {"testId":"sessions-runon-browsers-string","detectSteps":true,"runOn":[{"browsers":"firefox"}]} -->
<h1>Check the page in Firefox</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page reads <strong>MULTI-TAB HOME</strong>.</li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check the page in Firefox
=========================

.. test {"testId":"sessions-runon-browsers-string","detectSteps":true,"runOn":[{"browsers":"firefox"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page reads **MULTI-TAB HOME**.

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-browsers-string">
  <title>Check the page in Firefox</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-browsers-string","detectSteps":true,"runOn":[{"browsers":"firefox"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page reads <b>MULTI-TAB HOME</b>.</cmd></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-runon-browsers-string","detectSteps":false,"runOn":[{"browsers":"firefox"}]} -->

# Check the page in Firefox

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page reads **MULTI-TAB HOME**.
   <!-- step {"find":"MULTI-TAB HOME"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-runon-browsers-string","detectSteps":false,"runOn":[{"browsers":"firefox"}]} */}

# Check the page in Firefox

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page reads **MULTI-TAB HOME**.
   {/* step {"find":"MULTI-TAB HOME"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check the page in Firefox

// (test {"testId":"sessions-runon-browsers-string","detectSteps":false,"runOn":[{"browsers":"firefox"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page reads *MULTI-TAB HOME*.
+
// (step {"find":"MULTI-TAB HOME"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page in Firefox</title></head>
<body>
<!-- test {"testId":"sessions-runon-browsers-string","detectSteps":false,"runOn":[{"browsers":"firefox"}]} -->
<h1>Check the page in Firefox</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page reads <strong>MULTI-TAB HOME</strong>.
    <!-- step {"find":"MULTI-TAB HOME"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check the page in Firefox
=========================

.. test {"testId":"sessions-runon-browsers-string","detectSteps":false,"runOn":[{"browsers":"firefox"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page reads **MULTI-TAB HOME**.

   .. step {"find":"MULTI-TAB HOME"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-browsers-string">
  <title>Check the page in Firefox</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-browsers-string","detectSteps":false,"runOn":[{"browsers":"firefox"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page reads <b>MULTI-TAB HOME</b>.</cmd>
        <info><data name="doc-detective" value='step {"find":"MULTI-TAB HOME"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-runon-browsers-string",
      "runOn": [
        {
          "browsers": "firefox"
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "find": "MULTI-TAB HOME"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-runon-browsers-string
    runOn:
      - browsers: firefox
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - find: MULTI-TAB HOME
```

### `"browsers": ["firefox", "chrome"]`

**Varies:** `runOn[].browsers` · **Value:** `["firefox", "chrome"]` · **Effect:** an array runs the whole test once per browser.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check the page in Firefox and Chrome

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page reads **MULTI-TAB HOME**.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check the page in Firefox and Chrome

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page reads **MULTI-TAB HOME**.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check the page in Firefox and Chrome

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Check that the page reads *MULTI-TAB HOME*.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page in Firefox and Chrome</title></head>
<body>
<h1>Check the page in Firefox and Chrome</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Check that the page reads <strong>MULTI-TAB HOME</strong>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check the page in Firefox and Chrome
====================================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Check that the page reads **MULTI-TAB HOME**.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-browsers-array">
  <title>Check the page in Firefox and Chrome</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Check that the page reads <b>MULTI-TAB HOME</b>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-runon-browsers-array","detectSteps":true,"runOn":[{"browsers":["firefox","chrome"]}]} -->

# Check the page in Firefox and Chrome

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page reads **MULTI-TAB HOME**.

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-runon-browsers-array","detectSteps":true,"runOn":[{"browsers":["firefox","chrome"]}]} */}

# Check the page in Firefox and Chrome

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page reads **MULTI-TAB HOME**.

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check the page in Firefox and Chrome

// (test {"testId":"sessions-runon-browsers-array","detectSteps":true,"runOn":[{"browsers":["firefox","chrome"]}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page reads *MULTI-TAB HOME*.

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page in Firefox and Chrome</title></head>
<body>
<!-- test {"testId":"sessions-runon-browsers-array","detectSteps":true,"runOn":[{"browsers":["firefox","chrome"]}]} -->
<h1>Check the page in Firefox and Chrome</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page reads <strong>MULTI-TAB HOME</strong>.</li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check the page in Firefox and Chrome
====================================

.. test {"testId":"sessions-runon-browsers-array","detectSteps":true,"runOn":[{"browsers":["firefox","chrome"]}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page reads **MULTI-TAB HOME**.

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-browsers-array">
  <title>Check the page in Firefox and Chrome</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-browsers-array","detectSteps":true,"runOn":[{"browsers":["firefox","chrome"]}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page reads <b>MULTI-TAB HOME</b>.</cmd></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-runon-browsers-array","detectSteps":false,"runOn":[{"browsers":["firefox","chrome"]}]} -->

# Check the page in Firefox and Chrome

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page reads **MULTI-TAB HOME**.
   <!-- step {"find":"MULTI-TAB HOME"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-runon-browsers-array","detectSteps":false,"runOn":[{"browsers":["firefox","chrome"]}]} */}

# Check the page in Firefox and Chrome

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page reads **MULTI-TAB HOME**.
   {/* step {"find":"MULTI-TAB HOME"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check the page in Firefox and Chrome

// (test {"testId":"sessions-runon-browsers-array","detectSteps":false,"runOn":[{"browsers":["firefox","chrome"]}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page reads *MULTI-TAB HOME*.
+
// (step {"find":"MULTI-TAB HOME"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page in Firefox and Chrome</title></head>
<body>
<!-- test {"testId":"sessions-runon-browsers-array","detectSteps":false,"runOn":[{"browsers":["firefox","chrome"]}]} -->
<h1>Check the page in Firefox and Chrome</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page reads <strong>MULTI-TAB HOME</strong>.
    <!-- step {"find":"MULTI-TAB HOME"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check the page in Firefox and Chrome
====================================

.. test {"testId":"sessions-runon-browsers-array","detectSteps":false,"runOn":[{"browsers":["firefox","chrome"]}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page reads **MULTI-TAB HOME**.

   .. step {"find":"MULTI-TAB HOME"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-browsers-array">
  <title>Check the page in Firefox and Chrome</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-browsers-array","detectSteps":false,"runOn":[{"browsers":["firefox","chrome"]}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page reads <b>MULTI-TAB HOME</b>.</cmd>
        <info><data name="doc-detective" value='step {"find":"MULTI-TAB HOME"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-runon-browsers-array",
      "runOn": [
        {
          "browsers": [
            "firefox",
            "chrome"
          ]
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "find": "MULTI-TAB HOME"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-runon-browsers-array
    runOn:
      - browsers:
          - firefox
          - chrome
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - find: MULTI-TAB HOME
```

### `"headless": false`

**Varies:** `runOn[].browsers.headless` · **Value:** `false` · **Effect:** the browser opens a visible window, so the context runs only where there's a display, here Windows and macOS.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Watch the check in a visible Chrome window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page reads **MULTI-TAB HOME**.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Watch the check in a visible Chrome window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page reads **MULTI-TAB HOME**.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Watch the check in a visible Chrome window

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Check that the page reads *MULTI-TAB HOME*.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Watch the check in a visible Chrome window</title></head>
<body>
<h1>Watch the check in a visible Chrome window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Check that the page reads <strong>MULTI-TAB HOME</strong>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Watch the check in a visible Chrome window
==========================================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Check that the page reads **MULTI-TAB HOME**.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-browsers-headed">
  <title>Watch the check in a visible Chrome window</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Check that the page reads <b>MULTI-TAB HOME</b>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-runon-browsers-headed","detectSteps":true,"runOn":[{"platforms":["windows","mac"],"browsers":{"name":"chrome","headless":false}}]} -->

# Watch the check in a visible Chrome window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page reads **MULTI-TAB HOME**.

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-runon-browsers-headed","detectSteps":true,"runOn":[{"platforms":["windows","mac"],"browsers":{"name":"chrome","headless":false}}]} */}

# Watch the check in a visible Chrome window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page reads **MULTI-TAB HOME**.

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Watch the check in a visible Chrome window

// (test {"testId":"sessions-runon-browsers-headed","detectSteps":true,"runOn":[{"platforms":["windows","mac"],"browsers":{"name":"chrome","headless":false}}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page reads *MULTI-TAB HOME*.

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Watch the check in a visible Chrome window</title></head>
<body>
<!-- test {"testId":"sessions-runon-browsers-headed","detectSteps":true,"runOn":[{"platforms":["windows","mac"],"browsers":{"name":"chrome","headless":false}}]} -->
<h1>Watch the check in a visible Chrome window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page reads <strong>MULTI-TAB HOME</strong>.</li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Watch the check in a visible Chrome window
==========================================

.. test {"testId":"sessions-runon-browsers-headed","detectSteps":true,"runOn":[{"platforms":["windows","mac"],"browsers":{"name":"chrome","headless":false}}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page reads **MULTI-TAB HOME**.

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-browsers-headed">
  <title>Watch the check in a visible Chrome window</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-browsers-headed","detectSteps":true,"runOn":[{"platforms":["windows","mac"],"browsers":{"name":"chrome","headless":false}}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page reads <b>MULTI-TAB HOME</b>.</cmd></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-runon-browsers-headed","detectSteps":false,"runOn":[{"platforms":["windows","mac"],"browsers":{"name":"chrome","headless":false}}]} -->

# Watch the check in a visible Chrome window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page reads **MULTI-TAB HOME**.
   <!-- step {"find":"MULTI-TAB HOME"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-runon-browsers-headed","detectSteps":false,"runOn":[{"platforms":["windows","mac"],"browsers":{"name":"chrome","headless":false}}]} */}

# Watch the check in a visible Chrome window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page reads **MULTI-TAB HOME**.
   {/* step {"find":"MULTI-TAB HOME"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Watch the check in a visible Chrome window

// (test {"testId":"sessions-runon-browsers-headed","detectSteps":false,"runOn":[{"platforms":["windows","mac"],"browsers":{"name":"chrome","headless":false}}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page reads *MULTI-TAB HOME*.
+
// (step {"find":"MULTI-TAB HOME"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Watch the check in a visible Chrome window</title></head>
<body>
<!-- test {"testId":"sessions-runon-browsers-headed","detectSteps":false,"runOn":[{"platforms":["windows","mac"],"browsers":{"name":"chrome","headless":false}}]} -->
<h1>Watch the check in a visible Chrome window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page reads <strong>MULTI-TAB HOME</strong>.
    <!-- step {"find":"MULTI-TAB HOME"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Watch the check in a visible Chrome window
==========================================

.. test {"testId":"sessions-runon-browsers-headed","detectSteps":false,"runOn":[{"platforms":["windows","mac"],"browsers":{"name":"chrome","headless":false}}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page reads **MULTI-TAB HOME**.

   .. step {"find":"MULTI-TAB HOME"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-browsers-headed">
  <title>Watch the check in a visible Chrome window</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-browsers-headed","detectSteps":false,"runOn":[{"platforms":["windows","mac"],"browsers":{"name":"chrome","headless":false}}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page reads <b>MULTI-TAB HOME</b>.</cmd>
        <info><data name="doc-detective" value='step {"find":"MULTI-TAB HOME"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-runon-browsers-headed",
      "runOn": [
        {
          "platforms": [
            "windows",
            "mac"
          ],
          "browsers": {
            "name": "chrome",
            "headless": false
          }
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "find": "MULTI-TAB HOME"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-runon-browsers-headed
    runOn:
      - platforms:
          - windows
          - mac
        browsers:
          name: chrome
          headless: false
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - find: MULTI-TAB HOME
```

## `runOn` browser option permutations

### `"colorScheme": "dark"`

**Varies:** `runOn[].browsers.colorScheme` · **Value:** `"dark"` · **Effect:** the page's `prefers-color-scheme` media query matches `dark`.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check the page in dark mode

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page prefers the dark color scheme.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check the page in dark mode

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page prefers the dark color scheme.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check the page in dark mode

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Check that the page prefers the dark color scheme.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page in dark mode</title></head>
<body>
<h1>Check the page in dark mode</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Check that the page prefers the dark color scheme.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check the page in dark mode
===========================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Check that the page prefers the dark color scheme.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-colorscheme">
  <title>Check the page in dark mode</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Check that the page prefers the dark color scheme.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-runon-colorscheme","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"colorScheme":"dark"}}]} -->

# Check the page in dark mode

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page prefers the dark color scheme.
   <!-- step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);","output":"true"}} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-runon-colorscheme","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"colorScheme":"dark"}}]} */}

# Check the page in dark mode

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page prefers the dark color scheme.
   {/* step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);","output":"true"}} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check the page in dark mode

// (test {"testId":"sessions-runon-colorscheme","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"colorScheme":"dark"}}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page prefers the dark color scheme.
+
// (step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);","output":"true"}})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page in dark mode</title></head>
<body>
<!-- test {"testId":"sessions-runon-colorscheme","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"colorScheme":"dark"}}]} -->
<h1>Check the page in dark mode</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page prefers the dark color scheme.
    <!-- step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);","output":"true"}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check the page in dark mode
===========================

.. test {"testId":"sessions-runon-colorscheme","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"colorScheme":"dark"}}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page prefers the dark color scheme.

   .. step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);","output":"true"}}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-colorscheme">
  <title>Check the page in dark mode</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-colorscheme","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"colorScheme":"dark"}}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page prefers the dark color scheme.</cmd>
        <info><data name="doc-detective" value='step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);","output":"true"}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-runon-colorscheme","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"colorScheme":"dark"}}]} -->

# Check the page in dark mode

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page prefers the dark color scheme.
   <!-- step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);","output":"true"}} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-runon-colorscheme","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"colorScheme":"dark"}}]} */}

# Check the page in dark mode

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page prefers the dark color scheme.
   {/* step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);","output":"true"}} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check the page in dark mode

// (test {"testId":"sessions-runon-colorscheme","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"colorScheme":"dark"}}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page prefers the dark color scheme.
+
// (step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);","output":"true"}})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page in dark mode</title></head>
<body>
<!-- test {"testId":"sessions-runon-colorscheme","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"colorScheme":"dark"}}]} -->
<h1>Check the page in dark mode</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page prefers the dark color scheme.
    <!-- step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);","output":"true"}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check the page in dark mode
===========================

.. test {"testId":"sessions-runon-colorscheme","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"colorScheme":"dark"}}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page prefers the dark color scheme.

   .. step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);","output":"true"}}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-colorscheme">
  <title>Check the page in dark mode</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-colorscheme","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"colorScheme":"dark"}}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page prefers the dark color scheme.</cmd>
        <info><data name="doc-detective" value='step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);","output":"true"}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-runon-colorscheme",
      "runOn": [
        {
          "platforms": [
            "linux",
            "mac",
            "windows"
          ],
          "browsers": {
            "name": "chrome",
            "headless": true,
            "colorScheme": "dark"
          }
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "runBrowserScript": {
            "script": "return String(matchMedia(\"(prefers-color-scheme: dark)\").matches);",
            "output": "true"
          }
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-runon-colorscheme
    runOn:
      - platforms:
          - linux
          - mac
          - windows
        browsers:
          name: chrome
          headless: true
          colorScheme: dark
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - runBrowserScript:
          script: 'return String(matchMedia("(prefers-color-scheme: dark)").matches);'
          output: "true"
```

### `"locale": "de-DE"`

**Varies:** `runOn[].browsers.locale` · **Value:** `"de-DE"` · **Effect:** `navigator.language` and `Intl` formatting use German.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check the page in German

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page's language is `de-DE`.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check the page in German

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page's language is `de-DE`.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check the page in German

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Check that the page's language is `de-DE`.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page in German</title></head>
<body>
<h1>Check the page in German</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Check that the page's language is <code>de-DE</code>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check the page in German
========================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Check that the page's language is ``de-DE``.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-locale">
  <title>Check the page in German</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Check that the page's language is <codeph>de-DE</codeph>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-runon-locale","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"locale":"de-DE"}}]} -->

# Check the page in German

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page's language is `de-DE`.
   <!-- step {"runBrowserScript":{"script":"return navigator.language;","output":"de-DE"}} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-runon-locale","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"locale":"de-DE"}}]} */}

# Check the page in German

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page's language is `de-DE`.
   {/* step {"runBrowserScript":{"script":"return navigator.language;","output":"de-DE"}} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check the page in German

// (test {"testId":"sessions-runon-locale","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"locale":"de-DE"}}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page's language is `de-DE`.
+
// (step {"runBrowserScript":{"script":"return navigator.language;","output":"de-DE"}})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page in German</title></head>
<body>
<!-- test {"testId":"sessions-runon-locale","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"locale":"de-DE"}}]} -->
<h1>Check the page in German</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page's language is <code>de-DE</code>.
    <!-- step {"runBrowserScript":{"script":"return navigator.language;","output":"de-DE"}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check the page in German
========================

.. test {"testId":"sessions-runon-locale","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"locale":"de-DE"}}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page's language is ``de-DE``.

   .. step {"runBrowserScript":{"script":"return navigator.language;","output":"de-DE"}}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-locale">
  <title>Check the page in German</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-locale","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"locale":"de-DE"}}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page's language is <codeph>de-DE</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"runBrowserScript":{"script":"return navigator.language;","output":"de-DE"}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-runon-locale","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"locale":"de-DE"}}]} -->

# Check the page in German

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page's language is `de-DE`.
   <!-- step {"runBrowserScript":{"script":"return navigator.language;","output":"de-DE"}} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-runon-locale","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"locale":"de-DE"}}]} */}

# Check the page in German

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page's language is `de-DE`.
   {/* step {"runBrowserScript":{"script":"return navigator.language;","output":"de-DE"}} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check the page in German

// (test {"testId":"sessions-runon-locale","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"locale":"de-DE"}}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page's language is `de-DE`.
+
// (step {"runBrowserScript":{"script":"return navigator.language;","output":"de-DE"}})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page in German</title></head>
<body>
<!-- test {"testId":"sessions-runon-locale","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"locale":"de-DE"}}]} -->
<h1>Check the page in German</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page's language is <code>de-DE</code>.
    <!-- step {"runBrowserScript":{"script":"return navigator.language;","output":"de-DE"}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check the page in German
========================

.. test {"testId":"sessions-runon-locale","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"locale":"de-DE"}}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page's language is ``de-DE``.

   .. step {"runBrowserScript":{"script":"return navigator.language;","output":"de-DE"}}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-locale">
  <title>Check the page in German</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-locale","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"locale":"de-DE"}}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page's language is <codeph>de-DE</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"runBrowserScript":{"script":"return navigator.language;","output":"de-DE"}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-runon-locale",
      "runOn": [
        {
          "platforms": [
            "linux",
            "mac",
            "windows"
          ],
          "browsers": {
            "name": "chrome",
            "headless": true,
            "locale": "de-DE"
          }
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "runBrowserScript": {
            "script": "return navigator.language;",
            "output": "de-DE"
          }
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-runon-locale
    runOn:
      - platforms:
          - linux
          - mac
          - windows
        browsers:
          name: chrome
          headless: true
          locale: de-DE
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - runBrowserScript:
          script: return navigator.language;
          output: de-DE
```

### `"timezone": "Europe/Berlin"`

**Varies:** `runOn[].browsers.timezone` · **Value:** `"Europe/Berlin"` · **Effect:** `Date` and `Intl` use Berlin time.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check the page on Berlin time

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page's time zone is `Europe/Berlin`.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check the page on Berlin time

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page's time zone is `Europe/Berlin`.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check the page on Berlin time

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Check that the page's time zone is `Europe/Berlin`.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page on Berlin time</title></head>
<body>
<h1>Check the page on Berlin time</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Check that the page's time zone is <code>Europe/Berlin</code>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check the page on Berlin time
=============================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Check that the page's time zone is ``Europe/Berlin``.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-timezone">
  <title>Check the page on Berlin time</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Check that the page's time zone is <codeph>Europe/Berlin</codeph>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-runon-timezone","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"timezone":"Europe/Berlin"}}]} -->

# Check the page on Berlin time

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page's time zone is `Europe/Berlin`.
   <!-- step {"runBrowserScript":{"script":"return Intl.DateTimeFormat().resolvedOptions().timeZone;","output":"Europe/Berlin"}} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-runon-timezone","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"timezone":"Europe/Berlin"}}]} */}

# Check the page on Berlin time

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page's time zone is `Europe/Berlin`.
   {/* step {"runBrowserScript":{"script":"return Intl.DateTimeFormat().resolvedOptions().timeZone;","output":"Europe/Berlin"}} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check the page on Berlin time

// (test {"testId":"sessions-runon-timezone","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"timezone":"Europe/Berlin"}}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page's time zone is `Europe/Berlin`.
+
// (step {"runBrowserScript":{"script":"return Intl.DateTimeFormat().resolvedOptions().timeZone;","output":"Europe/Berlin"}})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page on Berlin time</title></head>
<body>
<!-- test {"testId":"sessions-runon-timezone","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"timezone":"Europe/Berlin"}}]} -->
<h1>Check the page on Berlin time</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page's time zone is <code>Europe/Berlin</code>.
    <!-- step {"runBrowserScript":{"script":"return Intl.DateTimeFormat().resolvedOptions().timeZone;","output":"Europe/Berlin"}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check the page on Berlin time
=============================

.. test {"testId":"sessions-runon-timezone","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"timezone":"Europe/Berlin"}}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page's time zone is ``Europe/Berlin``.

   .. step {"runBrowserScript":{"script":"return Intl.DateTimeFormat().resolvedOptions().timeZone;","output":"Europe/Berlin"}}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-timezone">
  <title>Check the page on Berlin time</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-timezone","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"timezone":"Europe/Berlin"}}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page's time zone is <codeph>Europe/Berlin</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"runBrowserScript":{"script":"return Intl.DateTimeFormat().resolvedOptions().timeZone;","output":"Europe/Berlin"}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-runon-timezone","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"timezone":"Europe/Berlin"}}]} -->

# Check the page on Berlin time

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page's time zone is `Europe/Berlin`.
   <!-- step {"runBrowserScript":{"script":"return Intl.DateTimeFormat().resolvedOptions().timeZone;","output":"Europe/Berlin"}} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-runon-timezone","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"timezone":"Europe/Berlin"}}]} */}

# Check the page on Berlin time

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page's time zone is `Europe/Berlin`.
   {/* step {"runBrowserScript":{"script":"return Intl.DateTimeFormat().resolvedOptions().timeZone;","output":"Europe/Berlin"}} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check the page on Berlin time

// (test {"testId":"sessions-runon-timezone","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"timezone":"Europe/Berlin"}}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page's time zone is `Europe/Berlin`.
+
// (step {"runBrowserScript":{"script":"return Intl.DateTimeFormat().resolvedOptions().timeZone;","output":"Europe/Berlin"}})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page on Berlin time</title></head>
<body>
<!-- test {"testId":"sessions-runon-timezone","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"timezone":"Europe/Berlin"}}]} -->
<h1>Check the page on Berlin time</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page's time zone is <code>Europe/Berlin</code>.
    <!-- step {"runBrowserScript":{"script":"return Intl.DateTimeFormat().resolvedOptions().timeZone;","output":"Europe/Berlin"}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check the page on Berlin time
=============================

.. test {"testId":"sessions-runon-timezone","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"timezone":"Europe/Berlin"}}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page's time zone is ``Europe/Berlin``.

   .. step {"runBrowserScript":{"script":"return Intl.DateTimeFormat().resolvedOptions().timeZone;","output":"Europe/Berlin"}}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-timezone">
  <title>Check the page on Berlin time</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-timezone","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"timezone":"Europe/Berlin"}}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page's time zone is <codeph>Europe/Berlin</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"runBrowserScript":{"script":"return Intl.DateTimeFormat().resolvedOptions().timeZone;","output":"Europe/Berlin"}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-runon-timezone",
      "runOn": [
        {
          "platforms": [
            "linux",
            "mac",
            "windows"
          ],
          "browsers": {
            "name": "chrome",
            "headless": true,
            "timezone": "Europe/Berlin"
          }
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "runBrowserScript": {
            "script": "return Intl.DateTimeFormat().resolvedOptions().timeZone;",
            "output": "Europe/Berlin"
          }
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-runon-timezone
    runOn:
      - platforms:
          - linux
          - mac
          - windows
        browsers:
          name: chrome
          headless: true
          timezone: Europe/Berlin
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - runBrowserScript:
          script: return Intl.DateTimeFormat().resolvedOptions().timeZone;
          output: Europe/Berlin
```

### `"deviceScaleFactor": 2`

**Varies:** `runOn[].browsers.deviceScaleFactor` · **Value:** `2` · **Effect:** `devicePixelRatio` is `2`, as on a high-density display.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check the page on a 2x display

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the device pixel ratio is `2`.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check the page on a 2x display

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the device pixel ratio is `2`.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check the page on a 2x display

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Check that the device pixel ratio is `2`.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page on a 2x display</title></head>
<body>
<h1>Check the page on a 2x display</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Check that the device pixel ratio is <code>2</code>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check the page on a 2x display
==============================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Check that the device pixel ratio is ``2``.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-devicescalefactor">
  <title>Check the page on a 2x display</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Check that the device pixel ratio is <codeph>2</codeph>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-runon-devicescalefactor","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"deviceScaleFactor":2}}]} -->

# Check the page on a 2x display

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the device pixel ratio is `2`.
   <!-- step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"2"}} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-runon-devicescalefactor","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"deviceScaleFactor":2}}]} */}

# Check the page on a 2x display

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the device pixel ratio is `2`.
   {/* step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"2"}} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check the page on a 2x display

// (test {"testId":"sessions-runon-devicescalefactor","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"deviceScaleFactor":2}}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the device pixel ratio is `2`.
+
// (step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"2"}})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page on a 2x display</title></head>
<body>
<!-- test {"testId":"sessions-runon-devicescalefactor","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"deviceScaleFactor":2}}]} -->
<h1>Check the page on a 2x display</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the device pixel ratio is <code>2</code>.
    <!-- step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"2"}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check the page on a 2x display
==============================

.. test {"testId":"sessions-runon-devicescalefactor","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"deviceScaleFactor":2}}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the device pixel ratio is ``2``.

   .. step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"2"}}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-devicescalefactor">
  <title>Check the page on a 2x display</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-devicescalefactor","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"deviceScaleFactor":2}}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the device pixel ratio is <codeph>2</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"2"}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-runon-devicescalefactor","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"deviceScaleFactor":2}}]} -->

# Check the page on a 2x display

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the device pixel ratio is `2`.
   <!-- step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"2"}} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-runon-devicescalefactor","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"deviceScaleFactor":2}}]} */}

# Check the page on a 2x display

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the device pixel ratio is `2`.
   {/* step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"2"}} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check the page on a 2x display

// (test {"testId":"sessions-runon-devicescalefactor","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"deviceScaleFactor":2}}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the device pixel ratio is `2`.
+
// (step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"2"}})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page on a 2x display</title></head>
<body>
<!-- test {"testId":"sessions-runon-devicescalefactor","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"deviceScaleFactor":2}}]} -->
<h1>Check the page on a 2x display</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the device pixel ratio is <code>2</code>.
    <!-- step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"2"}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check the page on a 2x display
==============================

.. test {"testId":"sessions-runon-devicescalefactor","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"deviceScaleFactor":2}}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the device pixel ratio is ``2``.

   .. step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"2"}}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-devicescalefactor">
  <title>Check the page on a 2x display</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-devicescalefactor","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"deviceScaleFactor":2}}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the device pixel ratio is <codeph>2</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"2"}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-runon-devicescalefactor",
      "runOn": [
        {
          "platforms": [
            "linux",
            "mac",
            "windows"
          ],
          "browsers": {
            "name": "chrome",
            "headless": true,
            "deviceScaleFactor": 2
          }
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "runBrowserScript": {
            "script": "return String(devicePixelRatio);",
            "output": "2"
          }
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-runon-devicescalefactor
    runOn:
      - platforms:
          - linux
          - mac
          - windows
        browsers:
          name: chrome
          headless: true
          deviceScaleFactor: 2
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - runBrowserScript:
          script: return String(devicePixelRatio);
          output: "2"
```

### `"reducedMotion": "reduce"`

**Varies:** `runOn[].browsers.reducedMotion` · **Value:** `"reduce"` · **Effect:** the page's `prefers-reduced-motion` media query matches `reduce`.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check the page with reduced motion

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page prefers reduced motion.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check the page with reduced motion

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page prefers reduced motion.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check the page with reduced motion

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Check that the page prefers reduced motion.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page with reduced motion</title></head>
<body>
<h1>Check the page with reduced motion</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Check that the page prefers reduced motion.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check the page with reduced motion
==================================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Check that the page prefers reduced motion.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-reducedmotion">
  <title>Check the page with reduced motion</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Check that the page prefers reduced motion.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-runon-reducedmotion","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"reducedMotion":"reduce"}}]} -->

# Check the page with reduced motion

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page prefers reduced motion.
   <!-- step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);","output":"true"}} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-runon-reducedmotion","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"reducedMotion":"reduce"}}]} */}

# Check the page with reduced motion

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page prefers reduced motion.
   {/* step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);","output":"true"}} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check the page with reduced motion

// (test {"testId":"sessions-runon-reducedmotion","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"reducedMotion":"reduce"}}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page prefers reduced motion.
+
// (step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);","output":"true"}})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page with reduced motion</title></head>
<body>
<!-- test {"testId":"sessions-runon-reducedmotion","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"reducedMotion":"reduce"}}]} -->
<h1>Check the page with reduced motion</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page prefers reduced motion.
    <!-- step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);","output":"true"}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check the page with reduced motion
==================================

.. test {"testId":"sessions-runon-reducedmotion","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"reducedMotion":"reduce"}}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page prefers reduced motion.

   .. step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);","output":"true"}}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-reducedmotion">
  <title>Check the page with reduced motion</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-reducedmotion","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"reducedMotion":"reduce"}}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page prefers reduced motion.</cmd>
        <info><data name="doc-detective" value='step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);","output":"true"}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-runon-reducedmotion","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"reducedMotion":"reduce"}}]} -->

# Check the page with reduced motion

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page prefers reduced motion.
   <!-- step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);","output":"true"}} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-runon-reducedmotion","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"reducedMotion":"reduce"}}]} */}

# Check the page with reduced motion

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page prefers reduced motion.
   {/* step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);","output":"true"}} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check the page with reduced motion

// (test {"testId":"sessions-runon-reducedmotion","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"reducedMotion":"reduce"}}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page prefers reduced motion.
+
// (step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);","output":"true"}})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page with reduced motion</title></head>
<body>
<!-- test {"testId":"sessions-runon-reducedmotion","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"reducedMotion":"reduce"}}]} -->
<h1>Check the page with reduced motion</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page prefers reduced motion.
    <!-- step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);","output":"true"}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check the page with reduced motion
==================================

.. test {"testId":"sessions-runon-reducedmotion","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"reducedMotion":"reduce"}}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page prefers reduced motion.

   .. step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);","output":"true"}}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-reducedmotion">
  <title>Check the page with reduced motion</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-reducedmotion","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"reducedMotion":"reduce"}}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page prefers reduced motion.</cmd>
        <info><data name="doc-detective" value='step {"runBrowserScript":{"script":"return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);","output":"true"}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-runon-reducedmotion",
      "runOn": [
        {
          "platforms": [
            "linux",
            "mac",
            "windows"
          ],
          "browsers": {
            "name": "chrome",
            "headless": true,
            "reducedMotion": "reduce"
          }
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "runBrowserScript": {
            "script": "return String(matchMedia(\"(prefers-reduced-motion: reduce)\").matches);",
            "output": "true"
          }
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-runon-reducedmotion
    runOn:
      - platforms:
          - linux
          - mac
          - windows
        browsers:
          name: chrome
          headless: true
          reducedMotion: reduce
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - runBrowserScript:
          script: 'return String(matchMedia("(prefers-reduced-motion: reduce)").matches);'
          output: "true"
```

### `"clock": "2026-12-03T09:00:00Z"`

**Varies:** `runOn[].browsers.clock` · **Value:** `"2026-12-03T09:00:00Z"` · **Effect:** `Date.now()` and `new Date()` stay at that instant.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check the page at a fixed time

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page's clock reads 3 December 2026, 09:00 UTC.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check the page at a fixed time

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page's clock reads 3 December 2026, 09:00 UTC.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check the page at a fixed time

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Check that the page's clock reads 3 December 2026, 09:00 UTC.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page at a fixed time</title></head>
<body>
<h1>Check the page at a fixed time</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Check that the page's clock reads 3 December 2026, 09:00 UTC.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check the page at a fixed time
==============================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Check that the page's clock reads 3 December 2026, 09:00 UTC.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-clock">
  <title>Check the page at a fixed time</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Check that the page's clock reads 3 December 2026, 09:00 UTC.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-runon-clock","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"clock":"2026-12-03T09:00:00Z"}}]} -->

# Check the page at a fixed time

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page's clock reads 3 December 2026, 09:00 UTC.
   <!-- step {"runBrowserScript":{"script":"return new Date().toISOString();","output":"/^2026-12-03T09:00/"}} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-runon-clock","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"clock":"2026-12-03T09:00:00Z"}}]} */}

# Check the page at a fixed time

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page's clock reads 3 December 2026, 09:00 UTC.
   {/* step {"runBrowserScript":{"script":"return new Date().toISOString();","output":"/^2026-12-03T09:00/"}} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check the page at a fixed time

// (test {"testId":"sessions-runon-clock","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"clock":"2026-12-03T09:00:00Z"}}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page's clock reads 3 December 2026, 09:00 UTC.
+
// (step {"runBrowserScript":{"script":"return new Date().toISOString();","output":"/^2026-12-03T09:00/"}})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page at a fixed time</title></head>
<body>
<!-- test {"testId":"sessions-runon-clock","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"clock":"2026-12-03T09:00:00Z"}}]} -->
<h1>Check the page at a fixed time</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page's clock reads 3 December 2026, 09:00 UTC.
    <!-- step {"runBrowserScript":{"script":"return new Date().toISOString();","output":"/^2026-12-03T09:00/"}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check the page at a fixed time
==============================

.. test {"testId":"sessions-runon-clock","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"clock":"2026-12-03T09:00:00Z"}}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page's clock reads 3 December 2026, 09:00 UTC.

   .. step {"runBrowserScript":{"script":"return new Date().toISOString();","output":"/^2026-12-03T09:00/"}}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-clock">
  <title>Check the page at a fixed time</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-clock","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"clock":"2026-12-03T09:00:00Z"}}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page's clock reads 3 December 2026, 09:00 UTC.</cmd>
        <info><data name="doc-detective" value='step {"runBrowserScript":{"script":"return new Date().toISOString();","output":"/^2026-12-03T09:00/"}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-runon-clock","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"clock":"2026-12-03T09:00:00Z"}}]} -->

# Check the page at a fixed time

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page's clock reads 3 December 2026, 09:00 UTC.
   <!-- step {"runBrowserScript":{"script":"return new Date().toISOString();","output":"/^2026-12-03T09:00/"}} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-runon-clock","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"clock":"2026-12-03T09:00:00Z"}}]} */}

# Check the page at a fixed time

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page's clock reads 3 December 2026, 09:00 UTC.
   {/* step {"runBrowserScript":{"script":"return new Date().toISOString();","output":"/^2026-12-03T09:00/"}} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check the page at a fixed time

// (test {"testId":"sessions-runon-clock","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"clock":"2026-12-03T09:00:00Z"}}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page's clock reads 3 December 2026, 09:00 UTC.
+
// (step {"runBrowserScript":{"script":"return new Date().toISOString();","output":"/^2026-12-03T09:00/"}})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page at a fixed time</title></head>
<body>
<!-- test {"testId":"sessions-runon-clock","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"clock":"2026-12-03T09:00:00Z"}}]} -->
<h1>Check the page at a fixed time</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page's clock reads 3 December 2026, 09:00 UTC.
    <!-- step {"runBrowserScript":{"script":"return new Date().toISOString();","output":"/^2026-12-03T09:00/"}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check the page at a fixed time
==============================

.. test {"testId":"sessions-runon-clock","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"clock":"2026-12-03T09:00:00Z"}}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page's clock reads 3 December 2026, 09:00 UTC.

   .. step {"runBrowserScript":{"script":"return new Date().toISOString();","output":"/^2026-12-03T09:00/"}}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-clock">
  <title>Check the page at a fixed time</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-clock","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"clock":"2026-12-03T09:00:00Z"}}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page's clock reads 3 December 2026, 09:00 UTC.</cmd>
        <info><data name="doc-detective" value='step {"runBrowserScript":{"script":"return new Date().toISOString();","output":"/^2026-12-03T09:00/"}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-runon-clock",
      "runOn": [
        {
          "platforms": [
            "linux",
            "mac",
            "windows"
          ],
          "browsers": {
            "name": "chrome",
            "headless": true,
            "clock": "2026-12-03T09:00:00Z"
          }
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "runBrowserScript": {
            "script": "return new Date().toISOString();",
            "output": "/^2026-12-03T09:00/"
          }
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-runon-clock
    runOn:
      - platforms:
          - linux
          - mac
          - windows
        browsers:
          name: chrome
          headless: true
          clock: 2026-12-03T09:00:00Z
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - runBrowserScript:
          script: return new Date().toISOString();
          output: /^2026-12-03T09:00/
```

## `runOn` `matrix` permutations

### `"matrix": { "locale": ["en-US", "de-DE"] }`

**Varies:** `runOn[].matrix` · **Value:** `{ "locale": ["en-US", "de-DE"] }` · **Effect:** runs the test once per locale. `$$matrix.locale` in the browser's `locale` and in the step's `output` becomes the value under test.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check the page in two languages

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page's language is the locale under test, `en-US` or `de-DE`.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check the page in two languages

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page's language is the locale under test, `en-US` or `de-DE`.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check the page in two languages

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Check that the page's language is the locale under test, `en-US` or `de-DE`.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page in two languages</title></head>
<body>
<h1>Check the page in two languages</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Check that the page's language is the locale under test, <code>en-US</code> or <code>de-DE</code>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check the page in two languages
===============================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Check that the page's language is the locale under test, ``en-US`` or ``de-DE``.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-matrix">
  <title>Check the page in two languages</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Check that the page's language is the locale under test, <codeph>en-US</codeph> or <codeph>de-DE</codeph>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-runon-matrix","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"locale":"$$matrix.locale"},"matrix":{"locale":["en-US","de-DE"]}}]} -->

# Check the page in two languages

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page's language is the locale under test, `en-US` or `de-DE`.
   <!-- step {"runBrowserScript":{"script":"return navigator.language;","output":"$$matrix.locale"}} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-runon-matrix","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"locale":"$$matrix.locale"},"matrix":{"locale":["en-US","de-DE"]}}]} */}

# Check the page in two languages

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page's language is the locale under test, `en-US` or `de-DE`.
   {/* step {"runBrowserScript":{"script":"return navigator.language;","output":"$$matrix.locale"}} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check the page in two languages

// (test {"testId":"sessions-runon-matrix","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"locale":"$$matrix.locale"},"matrix":{"locale":["en-US","de-DE"]}}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page's language is the locale under test, `en-US` or `de-DE`.
+
// (step {"runBrowserScript":{"script":"return navigator.language;","output":"$$matrix.locale"}})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page in two languages</title></head>
<body>
<!-- test {"testId":"sessions-runon-matrix","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"locale":"$$matrix.locale"},"matrix":{"locale":["en-US","de-DE"]}}]} -->
<h1>Check the page in two languages</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page's language is the locale under test, <code>en-US</code> or <code>de-DE</code>.
    <!-- step {"runBrowserScript":{"script":"return navigator.language;","output":"$$matrix.locale"}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check the page in two languages
===============================

.. test {"testId":"sessions-runon-matrix","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"locale":"$$matrix.locale"},"matrix":{"locale":["en-US","de-DE"]}}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page's language is the locale under test, ``en-US`` or ``de-DE``.

   .. step {"runBrowserScript":{"script":"return navigator.language;","output":"$$matrix.locale"}}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-matrix">
  <title>Check the page in two languages</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-matrix","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"locale":"$$matrix.locale"},"matrix":{"locale":["en-US","de-DE"]}}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page's language is the locale under test, <codeph>en-US</codeph> or <codeph>de-DE</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"runBrowserScript":{"script":"return navigator.language;","output":"$$matrix.locale"}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-runon-matrix","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"locale":"$$matrix.locale"},"matrix":{"locale":["en-US","de-DE"]}}]} -->

# Check the page in two languages

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page's language is the locale under test, `en-US` or `de-DE`.
   <!-- step {"runBrowserScript":{"script":"return navigator.language;","output":"$$matrix.locale"}} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-runon-matrix","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"locale":"$$matrix.locale"},"matrix":{"locale":["en-US","de-DE"]}}]} */}

# Check the page in two languages

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page's language is the locale under test, `en-US` or `de-DE`.
   {/* step {"runBrowserScript":{"script":"return navigator.language;","output":"$$matrix.locale"}} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check the page in two languages

// (test {"testId":"sessions-runon-matrix","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"locale":"$$matrix.locale"},"matrix":{"locale":["en-US","de-DE"]}}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page's language is the locale under test, `en-US` or `de-DE`.
+
// (step {"runBrowserScript":{"script":"return navigator.language;","output":"$$matrix.locale"}})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page in two languages</title></head>
<body>
<!-- test {"testId":"sessions-runon-matrix","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"locale":"$$matrix.locale"},"matrix":{"locale":["en-US","de-DE"]}}]} -->
<h1>Check the page in two languages</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page's language is the locale under test, <code>en-US</code> or <code>de-DE</code>.
    <!-- step {"runBrowserScript":{"script":"return navigator.language;","output":"$$matrix.locale"}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check the page in two languages
===============================

.. test {"testId":"sessions-runon-matrix","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"locale":"$$matrix.locale"},"matrix":{"locale":["en-US","de-DE"]}}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page's language is the locale under test, ``en-US`` or ``de-DE``.

   .. step {"runBrowserScript":{"script":"return navigator.language;","output":"$$matrix.locale"}}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-matrix">
  <title>Check the page in two languages</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-matrix","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"locale":"$$matrix.locale"},"matrix":{"locale":["en-US","de-DE"]}}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page's language is the locale under test, <codeph>en-US</codeph> or <codeph>de-DE</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"runBrowserScript":{"script":"return navigator.language;","output":"$$matrix.locale"}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-runon-matrix",
      "runOn": [
        {
          "platforms": [
            "linux",
            "mac",
            "windows"
          ],
          "browsers": {
            "name": "chrome",
            "headless": true,
            "locale": "$$matrix.locale"
          },
          "matrix": {
            "locale": [
              "en-US",
              "de-DE"
            ]
          }
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "runBrowserScript": {
            "script": "return navigator.language;",
            "output": "$$matrix.locale"
          }
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-runon-matrix
    runOn:
      - platforms:
          - linux
          - mac
          - windows
        browsers:
          name: chrome
          headless: true
          locale: $$matrix.locale
        matrix:
          locale:
            - en-US
            - de-DE
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - runBrowserScript:
          script: return navigator.language;
          output: $$matrix.locale
```

### `"deviceScaleFactor": "$$matrix.dpr"`

**Varies:** `runOn[].browsers.deviceScaleFactor` · **Value:** `"$$matrix.dpr"`, with `"matrix": { "dpr": [1, 2] }` · **Effect:** runs the test once per value, and `devicePixelRatio` is `1`, then `2`.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check the page at two pixel densities

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the device pixel ratio is the density under test, `1` or `2`.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check the page at two pixel densities

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the device pixel ratio is the density under test, `1` or `2`.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check the page at two pixel densities

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Check that the device pixel ratio is the density under test, `1` or `2`.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page at two pixel densities</title></head>
<body>
<h1>Check the page at two pixel densities</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Check that the device pixel ratio is the density under test, <code>1</code> or <code>2</code>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check the page at two pixel densities
=====================================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Check that the device pixel ratio is the density under test, ``1`` or ``2``.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-devicescalefactor-matrix">
  <title>Check the page at two pixel densities</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Check that the device pixel ratio is the density under test, <codeph>1</codeph> or <codeph>2</codeph>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-runon-devicescalefactor-matrix","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"deviceScaleFactor":"$$matrix.dpr"},"matrix":{"dpr":[1,2]}}]} -->

# Check the page at two pixel densities

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the device pixel ratio is the density under test, `1` or `2`.
   <!-- step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"/^$$matrix.dpr$/"}} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-runon-devicescalefactor-matrix","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"deviceScaleFactor":"$$matrix.dpr"},"matrix":{"dpr":[1,2]}}]} */}

# Check the page at two pixel densities

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the device pixel ratio is the density under test, `1` or `2`.
   {/* step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"/^$$matrix.dpr$/"}} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check the page at two pixel densities

// (test {"testId":"sessions-runon-devicescalefactor-matrix","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"deviceScaleFactor":"$$matrix.dpr"},"matrix":{"dpr":[1,2]}}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the device pixel ratio is the density under test, `1` or `2`.
+
// (step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"/^$$matrix.dpr$/"}})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page at two pixel densities</title></head>
<body>
<!-- test {"testId":"sessions-runon-devicescalefactor-matrix","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"deviceScaleFactor":"$$matrix.dpr"},"matrix":{"dpr":[1,2]}}]} -->
<h1>Check the page at two pixel densities</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the device pixel ratio is the density under test, <code>1</code> or <code>2</code>.
    <!-- step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"/^$$matrix.dpr$/"}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check the page at two pixel densities
=====================================

.. test {"testId":"sessions-runon-devicescalefactor-matrix","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"deviceScaleFactor":"$$matrix.dpr"},"matrix":{"dpr":[1,2]}}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the device pixel ratio is the density under test, ``1`` or ``2``.

   .. step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"/^$$matrix.dpr$/"}}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-devicescalefactor-matrix">
  <title>Check the page at two pixel densities</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-devicescalefactor-matrix","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"deviceScaleFactor":"$$matrix.dpr"},"matrix":{"dpr":[1,2]}}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the device pixel ratio is the density under test, <codeph>1</codeph> or <codeph>2</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"/^$$matrix.dpr$/"}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-runon-devicescalefactor-matrix","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"deviceScaleFactor":"$$matrix.dpr"},"matrix":{"dpr":[1,2]}}]} -->

# Check the page at two pixel densities

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the device pixel ratio is the density under test, `1` or `2`.
   <!-- step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"/^$$matrix.dpr$/"}} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-runon-devicescalefactor-matrix","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"deviceScaleFactor":"$$matrix.dpr"},"matrix":{"dpr":[1,2]}}]} */}

# Check the page at two pixel densities

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the device pixel ratio is the density under test, `1` or `2`.
   {/* step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"/^$$matrix.dpr$/"}} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check the page at two pixel densities

// (test {"testId":"sessions-runon-devicescalefactor-matrix","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"deviceScaleFactor":"$$matrix.dpr"},"matrix":{"dpr":[1,2]}}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the device pixel ratio is the density under test, `1` or `2`.
+
// (step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"/^$$matrix.dpr$/"}})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page at two pixel densities</title></head>
<body>
<!-- test {"testId":"sessions-runon-devicescalefactor-matrix","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"deviceScaleFactor":"$$matrix.dpr"},"matrix":{"dpr":[1,2]}}]} -->
<h1>Check the page at two pixel densities</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the device pixel ratio is the density under test, <code>1</code> or <code>2</code>.
    <!-- step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"/^$$matrix.dpr$/"}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check the page at two pixel densities
=====================================

.. test {"testId":"sessions-runon-devicescalefactor-matrix","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"deviceScaleFactor":"$$matrix.dpr"},"matrix":{"dpr":[1,2]}}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the device pixel ratio is the density under test, ``1`` or ``2``.

   .. step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"/^$$matrix.dpr$/"}}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-devicescalefactor-matrix">
  <title>Check the page at two pixel densities</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-devicescalefactor-matrix","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"browsers":{"name":"chrome","headless":true,"deviceScaleFactor":"$$matrix.dpr"},"matrix":{"dpr":[1,2]}}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the device pixel ratio is the density under test, <codeph>1</codeph> or <codeph>2</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"runBrowserScript":{"script":"return String(devicePixelRatio);","output":"/^$$matrix.dpr$/"}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-runon-devicescalefactor-matrix",
      "runOn": [
        {
          "platforms": [
            "linux",
            "mac",
            "windows"
          ],
          "browsers": {
            "name": "chrome",
            "headless": true,
            "deviceScaleFactor": "$$matrix.dpr"
          },
          "matrix": {
            "dpr": [
              1,
              2
            ]
          }
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "runBrowserScript": {
            "script": "return String(devicePixelRatio);",
            "output": "/^$$matrix.dpr$/"
          }
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-runon-devicescalefactor-matrix
    runOn:
      - platforms:
          - linux
          - mac
          - windows
        browsers:
          name: chrome
          headless: true
          deviceScaleFactor: $$matrix.dpr
        matrix:
          dpr:
            - 1
            - 2
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - runBrowserScript:
          script: return String(devicePixelRatio);
          output: /^$$matrix.dpr$/
```

## `runOn` `requires` permutations

### `"requires": "node"`

**Varies:** `runOn[].requires` · **Value:** `"node"` · **Effect:** a command name must be on `PATH`, or the context is `SKIPPED`.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check Node.js, if it's installed

1. Run `node --version`.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check Node.js, if it's installed

1. Run `node --version`.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check Node.js, if it's installed

. Run `node --version`.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check Node.js, if it's installed</title></head>
<body>
<h1>Check Node.js, if it's installed</h1>
<ol>
  <li>Run <code>node --version</code>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check Node.js, if it's installed
================================

#. Run ``node --version``.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-requires-string">
  <title>Check Node.js, if it's installed</title>
  <taskbody>
    <steps>
      <step><cmd>Run <codeph>node --version</codeph>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-runon-requires-string","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]} -->

# Check Node.js, if it's installed

1. Run `node --version`.
   <!-- step {"runShell":"node --version"} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-runon-requires-string","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]} */}

# Check Node.js, if it's installed

1. Run `node --version`.
   {/* step {"runShell":"node --version"} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check Node.js, if it's installed

// (test {"testId":"sessions-runon-requires-string","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]})

. Run `node --version`.
+
// (step {"runShell":"node --version"})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check Node.js, if it's installed</title></head>
<body>
<!-- test {"testId":"sessions-runon-requires-string","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]} -->
<h1>Check Node.js, if it's installed</h1>
<ol>
  <li>Run <code>node --version</code>.
    <!-- step {"runShell":"node --version"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check Node.js, if it's installed
================================

.. test {"testId":"sessions-runon-requires-string","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]}

#. Run ``node --version``.

   .. step {"runShell":"node --version"}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-requires-string">
  <title>Check Node.js, if it's installed</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-requires-string","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]}'/>
    <steps>
      <step><cmd>Run <codeph>node --version</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"runShell":"node --version"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-runon-requires-string","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]} -->

# Check Node.js, if it's installed

1. Run `node --version`.
   <!-- step {"runShell":"node --version"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-runon-requires-string","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]} */}

# Check Node.js, if it's installed

1. Run `node --version`.
   {/* step {"runShell":"node --version"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check Node.js, if it's installed

// (test {"testId":"sessions-runon-requires-string","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]})

. Run `node --version`.
+
// (step {"runShell":"node --version"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check Node.js, if it's installed</title></head>
<body>
<!-- test {"testId":"sessions-runon-requires-string","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]} -->
<h1>Check Node.js, if it's installed</h1>
<ol>
  <li>Run <code>node --version</code>.
    <!-- step {"runShell":"node --version"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check Node.js, if it's installed
================================

.. test {"testId":"sessions-runon-requires-string","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]}

#. Run ``node --version``.

   .. step {"runShell":"node --version"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-requires-string">
  <title>Check Node.js, if it's installed</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-requires-string","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]}'/>
    <steps>
      <step><cmd>Run <codeph>node --version</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"runShell":"node --version"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-runon-requires-string",
      "runOn": [
        {
          "platforms": [
            "linux",
            "mac",
            "windows"
          ],
          "requires": "node"
        }
      ],
      "steps": [
        {
          "runShell": "node --version"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-runon-requires-string
    runOn:
      - platforms:
          - linux
          - mac
          - windows
        requires: node
    steps:
      - runShell: node --version
```

### `"requires": ["node", "npm"]`

**Varies:** `runOn[].requires` · **Value:** `["node", "npm"]` · **Effect:** every command in the array must be on `PATH`.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check Node.js and npm, if both are installed

1. Run `node --version`.
2. Run `npm --version`.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check Node.js and npm, if both are installed

1. Run `node --version`.
2. Run `npm --version`.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check Node.js and npm, if both are installed

. Run `node --version`.
. Run `npm --version`.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check Node.js and npm, if both are installed</title></head>
<body>
<h1>Check Node.js and npm, if both are installed</h1>
<ol>
  <li>Run <code>node --version</code>.</li>
  <li>Run <code>npm --version</code>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check Node.js and npm, if both are installed
============================================

#. Run ``node --version``.

#. Run ``npm --version``.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-requires-array">
  <title>Check Node.js and npm, if both are installed</title>
  <taskbody>
    <steps>
      <step><cmd>Run <codeph>node --version</codeph>.</cmd></step>
      <step><cmd>Run <codeph>npm --version</codeph>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-runon-requires-array","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":["node","npm"]}]} -->

# Check Node.js and npm, if both are installed

1. Run `node --version`.
   <!-- step {"runShell":"node --version"} -->
2. Run `npm --version`.
   <!-- step {"runShell":"npm --version"} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-runon-requires-array","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":["node","npm"]}]} */}

# Check Node.js and npm, if both are installed

1. Run `node --version`.
   {/* step {"runShell":"node --version"} */}
2. Run `npm --version`.
   {/* step {"runShell":"npm --version"} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check Node.js and npm, if both are installed

// (test {"testId":"sessions-runon-requires-array","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":["node","npm"]}]})

. Run `node --version`.
+
// (step {"runShell":"node --version"})
. Run `npm --version`.
+
// (step {"runShell":"npm --version"})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check Node.js and npm, if both are installed</title></head>
<body>
<!-- test {"testId":"sessions-runon-requires-array","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":["node","npm"]}]} -->
<h1>Check Node.js and npm, if both are installed</h1>
<ol>
  <li>Run <code>node --version</code>.
    <!-- step {"runShell":"node --version"} --></li>
  <li>Run <code>npm --version</code>.
    <!-- step {"runShell":"npm --version"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check Node.js and npm, if both are installed
============================================

.. test {"testId":"sessions-runon-requires-array","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":["node","npm"]}]}

#. Run ``node --version``.

   .. step {"runShell":"node --version"}

#. Run ``npm --version``.

   .. step {"runShell":"npm --version"}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-requires-array">
  <title>Check Node.js and npm, if both are installed</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-requires-array","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":["node","npm"]}]}'/>
    <steps>
      <step><cmd>Run <codeph>node --version</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"runShell":"node --version"}'/></info></step>
      <step><cmd>Run <codeph>npm --version</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"runShell":"npm --version"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-runon-requires-array","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":["node","npm"]}]} -->

# Check Node.js and npm, if both are installed

1. Run `node --version`.
   <!-- step {"runShell":"node --version"} -->
2. Run `npm --version`.
   <!-- step {"runShell":"npm --version"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-runon-requires-array","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":["node","npm"]}]} */}

# Check Node.js and npm, if both are installed

1. Run `node --version`.
   {/* step {"runShell":"node --version"} */}
2. Run `npm --version`.
   {/* step {"runShell":"npm --version"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check Node.js and npm, if both are installed

// (test {"testId":"sessions-runon-requires-array","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":["node","npm"]}]})

. Run `node --version`.
+
// (step {"runShell":"node --version"})
. Run `npm --version`.
+
// (step {"runShell":"npm --version"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check Node.js and npm, if both are installed</title></head>
<body>
<!-- test {"testId":"sessions-runon-requires-array","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":["node","npm"]}]} -->
<h1>Check Node.js and npm, if both are installed</h1>
<ol>
  <li>Run <code>node --version</code>.
    <!-- step {"runShell":"node --version"} --></li>
  <li>Run <code>npm --version</code>.
    <!-- step {"runShell":"npm --version"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check Node.js and npm, if both are installed
============================================

.. test {"testId":"sessions-runon-requires-array","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":["node","npm"]}]}

#. Run ``node --version``.

   .. step {"runShell":"node --version"}

#. Run ``npm --version``.

   .. step {"runShell":"npm --version"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-requires-array">
  <title>Check Node.js and npm, if both are installed</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-requires-array","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":["node","npm"]}]}'/>
    <steps>
      <step><cmd>Run <codeph>node --version</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"runShell":"node --version"}'/></info></step>
      <step><cmd>Run <codeph>npm --version</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"runShell":"npm --version"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-runon-requires-array",
      "runOn": [
        {
          "platforms": [
            "linux",
            "mac",
            "windows"
          ],
          "requires": [
            "node",
            "npm"
          ]
        }
      ],
      "steps": [
        {
          "runShell": "node --version"
        },
        {
          "runShell": "npm --version"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-runon-requires-array
    runOn:
      - platforms:
          - linux
          - mac
          - windows
        requires:
          - node
          - npm
    steps:
      - runShell: node --version
      - runShell: npm --version
```

### `"requires": { "commands": [...], "env": [...] }`, unmet

**Varies:** `runOn[].requires` · **Value:** `{ "commands": ["sessions-missing-tool"], "env": ["PATH"] }` · **Effect:** an object checks commands, files, and environment variables together, and one unmet entry skips the context instead of failing it.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Run a tool only where it's installed

1. Run `sessions-missing-tool --version`.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Run a tool only where it's installed

1. Run `sessions-missing-tool --version`.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Run a tool only where it's installed

. Run `sessions-missing-tool --version`.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Run a tool only where it's installed</title></head>
<body>
<h1>Run a tool only where it's installed</h1>
<ol>
  <li>Run <code>sessions-missing-tool --version</code>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Run a tool only where it's installed
====================================

#. Run ``sessions-missing-tool --version``.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-requires-unmet">
  <title>Run a tool only where it's installed</title>
  <taskbody>
    <steps>
      <step><cmd>Run <codeph>sessions-missing-tool --version</codeph>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-runon-requires-unmet","detectSteps":true,"runOn":[{"platforms":["linux","mac"],"requires":{"commands":["sessions-missing-tool"],"env":["PATH"]}}]} -->

# Run a tool only where it's installed

1. Run `sessions-missing-tool --version`.
   <!-- step {"runShell":"sessions-missing-tool --version"} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-runon-requires-unmet","detectSteps":true,"runOn":[{"platforms":["linux","mac"],"requires":{"commands":["sessions-missing-tool"],"env":["PATH"]}}]} */}

# Run a tool only where it's installed

1. Run `sessions-missing-tool --version`.
   {/* step {"runShell":"sessions-missing-tool --version"} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Run a tool only where it's installed

// (test {"testId":"sessions-runon-requires-unmet","detectSteps":true,"runOn":[{"platforms":["linux","mac"],"requires":{"commands":["sessions-missing-tool"],"env":["PATH"]}}]})

. Run `sessions-missing-tool --version`.
+
// (step {"runShell":"sessions-missing-tool --version"})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Run a tool only where it's installed</title></head>
<body>
<!-- test {"testId":"sessions-runon-requires-unmet","detectSteps":true,"runOn":[{"platforms":["linux","mac"],"requires":{"commands":["sessions-missing-tool"],"env":["PATH"]}}]} -->
<h1>Run a tool only where it's installed</h1>
<ol>
  <li>Run <code>sessions-missing-tool --version</code>.
    <!-- step {"runShell":"sessions-missing-tool --version"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Run a tool only where it's installed
====================================

.. test {"testId":"sessions-runon-requires-unmet","detectSteps":true,"runOn":[{"platforms":["linux","mac"],"requires":{"commands":["sessions-missing-tool"],"env":["PATH"]}}]}

#. Run ``sessions-missing-tool --version``.

   .. step {"runShell":"sessions-missing-tool --version"}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-requires-unmet">
  <title>Run a tool only where it's installed</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-requires-unmet","detectSteps":true,"runOn":[{"platforms":["linux","mac"],"requires":{"commands":["sessions-missing-tool"],"env":["PATH"]}}]}'/>
    <steps>
      <step><cmd>Run <codeph>sessions-missing-tool --version</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"runShell":"sessions-missing-tool --version"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-runon-requires-unmet","detectSteps":false,"runOn":[{"platforms":["linux","mac"],"requires":{"commands":["sessions-missing-tool"],"env":["PATH"]}}]} -->

# Run a tool only where it's installed

1. Run `sessions-missing-tool --version`.
   <!-- step {"runShell":"sessions-missing-tool --version"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-runon-requires-unmet","detectSteps":false,"runOn":[{"platforms":["linux","mac"],"requires":{"commands":["sessions-missing-tool"],"env":["PATH"]}}]} */}

# Run a tool only where it's installed

1. Run `sessions-missing-tool --version`.
   {/* step {"runShell":"sessions-missing-tool --version"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Run a tool only where it's installed

// (test {"testId":"sessions-runon-requires-unmet","detectSteps":false,"runOn":[{"platforms":["linux","mac"],"requires":{"commands":["sessions-missing-tool"],"env":["PATH"]}}]})

. Run `sessions-missing-tool --version`.
+
// (step {"runShell":"sessions-missing-tool --version"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Run a tool only where it's installed</title></head>
<body>
<!-- test {"testId":"sessions-runon-requires-unmet","detectSteps":false,"runOn":[{"platforms":["linux","mac"],"requires":{"commands":["sessions-missing-tool"],"env":["PATH"]}}]} -->
<h1>Run a tool only where it's installed</h1>
<ol>
  <li>Run <code>sessions-missing-tool --version</code>.
    <!-- step {"runShell":"sessions-missing-tool --version"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Run a tool only where it's installed
====================================

.. test {"testId":"sessions-runon-requires-unmet","detectSteps":false,"runOn":[{"platforms":["linux","mac"],"requires":{"commands":["sessions-missing-tool"],"env":["PATH"]}}]}

#. Run ``sessions-missing-tool --version``.

   .. step {"runShell":"sessions-missing-tool --version"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-requires-unmet">
  <title>Run a tool only where it's installed</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-requires-unmet","detectSteps":false,"runOn":[{"platforms":["linux","mac"],"requires":{"commands":["sessions-missing-tool"],"env":["PATH"]}}]}'/>
    <steps>
      <step><cmd>Run <codeph>sessions-missing-tool --version</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"runShell":"sessions-missing-tool --version"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-runon-requires-unmet",
      "runOn": [
        {
          "platforms": [
            "linux",
            "mac"
          ],
          "requires": {
            "commands": [
              "sessions-missing-tool"
            ],
            "env": [
              "PATH"
            ]
          }
        }
      ],
      "steps": [
        {
          "runShell": "sessions-missing-tool --version"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-runon-requires-unmet
    runOn:
      - platforms:
          - linux
          - mac
        requires:
          commands:
            - sessions-missing-tool
          env:
            - PATH
    steps:
      - runShell: sessions-missing-tool --version
```

## `runOn` `browserFallback` and `retries` permutations

### `"browserFallback": "auto"`

**Varies:** `runOn[].browserFallback` · **Value:** `"auto"` · **Effect:** without a working Firefox, the context runs in another available browser and reports `WARNING` instead of `PASS`.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check the page in Firefox

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page reads **MULTI-TAB HOME**.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check the page in Firefox

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page reads **MULTI-TAB HOME**.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check the page in Firefox

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Check that the page reads *MULTI-TAB HOME*.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page in Firefox</title></head>
<body>
<h1>Check the page in Firefox</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Check that the page reads <strong>MULTI-TAB HOME</strong>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check the page in Firefox
=========================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Check that the page reads **MULTI-TAB HOME**.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-fallback-auto">
  <title>Check the page in Firefox</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Check that the page reads <b>MULTI-TAB HOME</b>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-runon-fallback-auto","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"auto"}]} -->

# Check the page in Firefox

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page reads **MULTI-TAB HOME**.

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-runon-fallback-auto","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"auto"}]} */}

# Check the page in Firefox

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page reads **MULTI-TAB HOME**.

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check the page in Firefox

// (test {"testId":"sessions-runon-fallback-auto","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"auto"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page reads *MULTI-TAB HOME*.

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page in Firefox</title></head>
<body>
<!-- test {"testId":"sessions-runon-fallback-auto","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"auto"}]} -->
<h1>Check the page in Firefox</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page reads <strong>MULTI-TAB HOME</strong>.</li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check the page in Firefox
=========================

.. test {"testId":"sessions-runon-fallback-auto","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"auto"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page reads **MULTI-TAB HOME**.

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-fallback-auto">
  <title>Check the page in Firefox</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-fallback-auto","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"auto"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page reads <b>MULTI-TAB HOME</b>.</cmd></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-runon-fallback-auto","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"auto"}]} -->

# Check the page in Firefox

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page reads **MULTI-TAB HOME**.
   <!-- step {"find":"MULTI-TAB HOME"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-runon-fallback-auto","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"auto"}]} */}

# Check the page in Firefox

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page reads **MULTI-TAB HOME**.
   {/* step {"find":"MULTI-TAB HOME"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check the page in Firefox

// (test {"testId":"sessions-runon-fallback-auto","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"auto"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page reads *MULTI-TAB HOME*.
+
// (step {"find":"MULTI-TAB HOME"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page in Firefox</title></head>
<body>
<!-- test {"testId":"sessions-runon-fallback-auto","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"auto"}]} -->
<h1>Check the page in Firefox</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page reads <strong>MULTI-TAB HOME</strong>.
    <!-- step {"find":"MULTI-TAB HOME"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check the page in Firefox
=========================

.. test {"testId":"sessions-runon-fallback-auto","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"auto"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page reads **MULTI-TAB HOME**.

   .. step {"find":"MULTI-TAB HOME"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-fallback-auto">
  <title>Check the page in Firefox</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-fallback-auto","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"auto"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page reads <b>MULTI-TAB HOME</b>.</cmd>
        <info><data name="doc-detective" value='step {"find":"MULTI-TAB HOME"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-runon-fallback-auto",
      "runOn": [
        {
          "browsers": {
            "name": "firefox",
            "headless": true
          },
          "browserFallback": "auto"
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "find": "MULTI-TAB HOME"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-runon-fallback-auto
    runOn:
      - browsers:
          name: firefox
          headless: true
        browserFallback: auto
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - find: MULTI-TAB HOME
```

### `"browserFallback": "explicit"` with `"retries": 0`

**Varies:** `runOn[].browserFallback and runOn[].retries` · **Value:** `"explicit", 0` · **Effect:** without a working Firefox, the context is `SKIPPED`, because the test names Firefox. `retries: 0` also turns off re-runs after a broken session.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check the page in Firefox

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page reads **MULTI-TAB HOME**.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check the page in Firefox

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page reads **MULTI-TAB HOME**.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check the page in Firefox

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Check that the page reads *MULTI-TAB HOME*.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page in Firefox</title></head>
<body>
<h1>Check the page in Firefox</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Check that the page reads <strong>MULTI-TAB HOME</strong>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check the page in Firefox
=========================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Check that the page reads **MULTI-TAB HOME**.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-fallback-explicit">
  <title>Check the page in Firefox</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Check that the page reads <b>MULTI-TAB HOME</b>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-runon-fallback-explicit","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"explicit","retries":0}]} -->

# Check the page in Firefox

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page reads **MULTI-TAB HOME**.

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-runon-fallback-explicit","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"explicit","retries":0}]} */}

# Check the page in Firefox

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page reads **MULTI-TAB HOME**.

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check the page in Firefox

// (test {"testId":"sessions-runon-fallback-explicit","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"explicit","retries":0}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page reads *MULTI-TAB HOME*.

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page in Firefox</title></head>
<body>
<!-- test {"testId":"sessions-runon-fallback-explicit","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"explicit","retries":0}]} -->
<h1>Check the page in Firefox</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page reads <strong>MULTI-TAB HOME</strong>.</li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check the page in Firefox
=========================

.. test {"testId":"sessions-runon-fallback-explicit","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"explicit","retries":0}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page reads **MULTI-TAB HOME**.

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-fallback-explicit">
  <title>Check the page in Firefox</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-fallback-explicit","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"explicit","retries":0}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page reads <b>MULTI-TAB HOME</b>.</cmd></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-runon-fallback-explicit","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"explicit","retries":0}]} -->

# Check the page in Firefox

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page reads **MULTI-TAB HOME**.
   <!-- step {"find":"MULTI-TAB HOME"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-runon-fallback-explicit","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"explicit","retries":0}]} */}

# Check the page in Firefox

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page reads **MULTI-TAB HOME**.
   {/* step {"find":"MULTI-TAB HOME"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check the page in Firefox

// (test {"testId":"sessions-runon-fallback-explicit","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"explicit","retries":0}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page reads *MULTI-TAB HOME*.
+
// (step {"find":"MULTI-TAB HOME"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page in Firefox</title></head>
<body>
<!-- test {"testId":"sessions-runon-fallback-explicit","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"explicit","retries":0}]} -->
<h1>Check the page in Firefox</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page reads <strong>MULTI-TAB HOME</strong>.
    <!-- step {"find":"MULTI-TAB HOME"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check the page in Firefox
=========================

.. test {"testId":"sessions-runon-fallback-explicit","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"explicit","retries":0}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page reads **MULTI-TAB HOME**.

   .. step {"find":"MULTI-TAB HOME"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-fallback-explicit">
  <title>Check the page in Firefox</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-fallback-explicit","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"explicit","retries":0}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page reads <b>MULTI-TAB HOME</b>.</cmd>
        <info><data name="doc-detective" value='step {"find":"MULTI-TAB HOME"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-runon-fallback-explicit",
      "runOn": [
        {
          "browsers": {
            "name": "firefox",
            "headless": true
          },
          "browserFallback": "explicit",
          "retries": 0
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "find": "MULTI-TAB HOME"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-runon-fallback-explicit
    runOn:
      - browsers:
          name: firefox
          headless: true
        browserFallback: explicit
        retries: 0
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - find: MULTI-TAB HOME
```

### `"browserFallback": "off"`

**Varies:** `runOn[].browserFallback` · **Value:** `"off"` · **Effect:** the context never falls back to another browser, and is `SKIPPED` without a working Firefox.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check the page in Firefox

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page reads **MULTI-TAB HOME**.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check the page in Firefox

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Check that the page reads **MULTI-TAB HOME**.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check the page in Firefox

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Check that the page reads *MULTI-TAB HOME*.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page in Firefox</title></head>
<body>
<h1>Check the page in Firefox</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Check that the page reads <strong>MULTI-TAB HOME</strong>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check the page in Firefox
=========================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Check that the page reads **MULTI-TAB HOME**.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-fallback-off">
  <title>Check the page in Firefox</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Check that the page reads <b>MULTI-TAB HOME</b>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-runon-fallback-off","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Check the page in Firefox

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page reads **MULTI-TAB HOME**.

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-runon-fallback-off","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Check the page in Firefox

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page reads **MULTI-TAB HOME**.

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check the page in Firefox

// (test {"testId":"sessions-runon-fallback-off","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page reads *MULTI-TAB HOME*.

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page in Firefox</title></head>
<body>
<!-- test {"testId":"sessions-runon-fallback-off","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Check the page in Firefox</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page reads <strong>MULTI-TAB HOME</strong>.</li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check the page in Firefox
=========================

.. test {"testId":"sessions-runon-fallback-off","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page reads **MULTI-TAB HOME**.

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-fallback-off">
  <title>Check the page in Firefox</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-fallback-off","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page reads <b>MULTI-TAB HOME</b>.</cmd></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-runon-fallback-off","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Check the page in Firefox

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Check that the page reads **MULTI-TAB HOME**.
   <!-- step {"find":"MULTI-TAB HOME"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-runon-fallback-off","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Check the page in Firefox

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Check that the page reads **MULTI-TAB HOME**.
   {/* step {"find":"MULTI-TAB HOME"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check the page in Firefox

// (test {"testId":"sessions-runon-fallback-off","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Check that the page reads *MULTI-TAB HOME*.
+
// (step {"find":"MULTI-TAB HOME"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check the page in Firefox</title></head>
<body>
<!-- test {"testId":"sessions-runon-fallback-off","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Check the page in Firefox</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Check that the page reads <strong>MULTI-TAB HOME</strong>.
    <!-- step {"find":"MULTI-TAB HOME"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check the page in Firefox
=========================

.. test {"testId":"sessions-runon-fallback-off","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Check that the page reads **MULTI-TAB HOME**.

   .. step {"find":"MULTI-TAB HOME"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-runon-fallback-off">
  <title>Check the page in Firefox</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-runon-fallback-off","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page reads <b>MULTI-TAB HOME</b>.</cmd>
        <info><data name="doc-detective" value='step {"find":"MULTI-TAB HOME"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-runon-fallback-off",
      "runOn": [
        {
          "browsers": {
            "name": "firefox",
            "headless": true
          },
          "browserFallback": "off"
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "find": "MULTI-TAB HOME"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-runon-fallback-off
    runOn:
      - browsers:
          name: firefox
          headless: true
        browserFallback: off
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - find: MULTI-TAB HOME
```

## `goTo` `newTab` and `newWindow` permutations

### `"newTab": true`, `"newWindow": true`

**Varies:** `goTo.newTab and goTo.newWindow` · **Value:** `true` · **Effect:** each opens an unnamed tab or window and makes it active.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Open pages in a new tab and a new window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Load [the tab page](http://localhost:8092/multi-tab-child.html?page=tab) in a new tab.
3. Check that the page reads "PAGE tab".
4. Load [the window page](http://localhost:8092/multi-tab-child.html?page=window) in a new window.
5. Check that the page reads "PAGE window".
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Open pages in a new tab and a new window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Load [the tab page](http://localhost:8092/multi-tab-child.html?page=tab) in a new tab.
3. Check that the page reads "PAGE tab".
4. Load [the window page](http://localhost:8092/multi-tab-child.html?page=window) in a new window.
5. Check that the page reads "PAGE window".
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Open pages in a new tab and a new window

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Load http://localhost:8092/multi-tab-child.html?page=tab[the tab page] in a new tab.
. Check that the page reads "PAGE tab".
. Load http://localhost:8092/multi-tab-child.html?page=window[the window page] in a new window.
. Check that the page reads "PAGE window".
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Open pages in a new tab and a new window</title></head>
<body>
<h1>Open pages in a new tab and a new window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=tab">the tab page</a> in a new tab.</li>
  <li>Check that the page reads "PAGE tab".</li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=window">the window page</a> in a new window.</li>
  <li>Check that the page reads "PAGE window".</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Open pages in a new tab and a new window
========================================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Load `the tab page <http://localhost:8092/multi-tab-child.html?page=tab>`__ in a new tab.

#. Check that the page reads "PAGE tab".

#. Load `the window page <http://localhost:8092/multi-tab-child.html?page=window>`__ in a new window.

#. Check that the page reads "PAGE window".
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-goto-new-boolean">
  <title>Open pages in a new tab and a new window</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=tab" scope="external" format="html">the tab page</xref> in a new tab.</cmd></step>
      <step><cmd>Check that the page reads "PAGE tab".</cmd></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=window" scope="external" format="html">the window page</xref> in a new window.</cmd></step>
      <step><cmd>Check that the page reads "PAGE window".</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-goto-new-boolean","detectSteps":true} -->

# Open pages in a new tab and a new window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Load [the tab page](http://localhost:8092/multi-tab-child.html?page=tab) in a new tab.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=tab","newTab":true}} -->
3. Check that the page reads "PAGE tab".
   <!-- step {"find":"PAGE tab"} -->
4. Load [the window page](http://localhost:8092/multi-tab-child.html?page=window) in a new window.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=window","newWindow":true}} -->
5. Check that the page reads "PAGE window".
   <!-- step {"find":"PAGE window"} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-goto-new-boolean","detectSteps":true} */}

# Open pages in a new tab and a new window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Load [the tab page](http://localhost:8092/multi-tab-child.html?page=tab) in a new tab.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=tab","newTab":true}} */}
3. Check that the page reads "PAGE tab".
   {/* step {"find":"PAGE tab"} */}
4. Load [the window page](http://localhost:8092/multi-tab-child.html?page=window) in a new window.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=window","newWindow":true}} */}
5. Check that the page reads "PAGE window".
   {/* step {"find":"PAGE window"} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Open pages in a new tab and a new window

// (test {"testId":"sessions-goto-new-boolean","detectSteps":true})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Load http://localhost:8092/multi-tab-child.html?page=tab[the tab page] in a new tab.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=tab","newTab":true}})
. Check that the page reads "PAGE tab".
+
// (step {"find":"PAGE tab"})
. Load http://localhost:8092/multi-tab-child.html?page=window[the window page] in a new window.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=window","newWindow":true}})
. Check that the page reads "PAGE window".
+
// (step {"find":"PAGE window"})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Open pages in a new tab and a new window</title></head>
<body>
<!-- test {"testId":"sessions-goto-new-boolean","detectSteps":true} -->
<h1>Open pages in a new tab and a new window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=tab">the tab page</a> in a new tab.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=tab","newTab":true}} --></li>
  <li>Check that the page reads "PAGE tab".
    <!-- step {"find":"PAGE tab"} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=window">the window page</a> in a new window.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=window","newWindow":true}} --></li>
  <li>Check that the page reads "PAGE window".
    <!-- step {"find":"PAGE window"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Open pages in a new tab and a new window
========================================

.. test {"testId":"sessions-goto-new-boolean","detectSteps":true}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Load `the tab page <http://localhost:8092/multi-tab-child.html?page=tab>`__ in a new tab.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=tab","newTab":true}}

#. Check that the page reads "PAGE tab".

   .. step {"find":"PAGE tab"}

#. Load `the window page <http://localhost:8092/multi-tab-child.html?page=window>`__ in a new window.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=window","newWindow":true}}

#. Check that the page reads "PAGE window".

   .. step {"find":"PAGE window"}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-goto-new-boolean">
  <title>Open pages in a new tab and a new window</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-goto-new-boolean","detectSteps":true}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=tab" scope="external" format="html">the tab page</xref> in a new tab.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=tab","newTab":true}}'/></info></step>
      <step><cmd>Check that the page reads "PAGE tab".</cmd>
        <info><data name="doc-detective" value='step {"find":"PAGE tab"}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=window" scope="external" format="html">the window page</xref> in a new window.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=window","newWindow":true}}'/></info></step>
      <step><cmd>Check that the page reads "PAGE window".</cmd>
        <info><data name="doc-detective" value='step {"find":"PAGE window"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-goto-new-boolean","detectSteps":false} -->

# Open pages in a new tab and a new window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Load [the tab page](http://localhost:8092/multi-tab-child.html?page=tab) in a new tab.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=tab","newTab":true}} -->
3. Check that the page reads "PAGE tab".
   <!-- step {"find":"PAGE tab"} -->
4. Load [the window page](http://localhost:8092/multi-tab-child.html?page=window) in a new window.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=window","newWindow":true}} -->
5. Check that the page reads "PAGE window".
   <!-- step {"find":"PAGE window"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-goto-new-boolean","detectSteps":false} */}

# Open pages in a new tab and a new window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Load [the tab page](http://localhost:8092/multi-tab-child.html?page=tab) in a new tab.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=tab","newTab":true}} */}
3. Check that the page reads "PAGE tab".
   {/* step {"find":"PAGE tab"} */}
4. Load [the window page](http://localhost:8092/multi-tab-child.html?page=window) in a new window.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=window","newWindow":true}} */}
5. Check that the page reads "PAGE window".
   {/* step {"find":"PAGE window"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Open pages in a new tab and a new window

// (test {"testId":"sessions-goto-new-boolean","detectSteps":false})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Load http://localhost:8092/multi-tab-child.html?page=tab[the tab page] in a new tab.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=tab","newTab":true}})
. Check that the page reads "PAGE tab".
+
// (step {"find":"PAGE tab"})
. Load http://localhost:8092/multi-tab-child.html?page=window[the window page] in a new window.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=window","newWindow":true}})
. Check that the page reads "PAGE window".
+
// (step {"find":"PAGE window"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Open pages in a new tab and a new window</title></head>
<body>
<!-- test {"testId":"sessions-goto-new-boolean","detectSteps":false} -->
<h1>Open pages in a new tab and a new window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=tab">the tab page</a> in a new tab.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=tab","newTab":true}} --></li>
  <li>Check that the page reads "PAGE tab".
    <!-- step {"find":"PAGE tab"} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=window">the window page</a> in a new window.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=window","newWindow":true}} --></li>
  <li>Check that the page reads "PAGE window".
    <!-- step {"find":"PAGE window"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Open pages in a new tab and a new window
========================================

.. test {"testId":"sessions-goto-new-boolean","detectSteps":false}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Load `the tab page <http://localhost:8092/multi-tab-child.html?page=tab>`__ in a new tab.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=tab","newTab":true}}

#. Check that the page reads "PAGE tab".

   .. step {"find":"PAGE tab"}

#. Load `the window page <http://localhost:8092/multi-tab-child.html?page=window>`__ in a new window.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=window","newWindow":true}}

#. Check that the page reads "PAGE window".

   .. step {"find":"PAGE window"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-goto-new-boolean">
  <title>Open pages in a new tab and a new window</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-goto-new-boolean","detectSteps":false}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=tab" scope="external" format="html">the tab page</xref> in a new tab.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=tab","newTab":true}}'/></info></step>
      <step><cmd>Check that the page reads "PAGE tab".</cmd>
        <info><data name="doc-detective" value='step {"find":"PAGE tab"}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=window" scope="external" format="html">the window page</xref> in a new window.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=window","newWindow":true}}'/></info></step>
      <step><cmd>Check that the page reads "PAGE window".</cmd>
        <info><data name="doc-detective" value='step {"find":"PAGE window"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-goto-new-boolean",
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "goTo": {
            "url": "http://localhost:8092/multi-tab-child.html?page=tab",
            "newTab": true
          }
        },
        {
          "find": "PAGE tab"
        },
        {
          "goTo": {
            "url": "http://localhost:8092/multi-tab-child.html?page=window",
            "newWindow": true
          }
        },
        {
          "find": "PAGE window"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-goto-new-boolean
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - goTo:
          url: http://localhost:8092/multi-tab-child.html?page=tab
          newTab: true
      - find: PAGE tab
      - goTo:
          url: http://localhost:8092/multi-tab-child.html?page=window
          newWindow: true
      - find: PAGE window
```

### `"newTab": "notes"`, `"newWindow": "about"`

**Varies:** `goTo.newTab and goTo.newWindow` · **Value:** `"notes", "about"` · **Effect:** a string names the new tab or window, so later steps can select it by that name.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Open named tabs and windows

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Load [the notes page](http://localhost:8092/multi-tab-child.html?page=notes) in a new tab named `notes`.
3. Check that the `notes` tab reads "PAGE notes".
4. Load [the about page](http://localhost:8092/multi-tab-child.html?page=about) in a new window named `about`.
5. Check that the new window reads "PAGE about".
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Open named tabs and windows

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Load [the notes page](http://localhost:8092/multi-tab-child.html?page=notes) in a new tab named `notes`.
3. Check that the `notes` tab reads "PAGE notes".
4. Load [the about page](http://localhost:8092/multi-tab-child.html?page=about) in a new window named `about`.
5. Check that the new window reads "PAGE about".
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Open named tabs and windows

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Load http://localhost:8092/multi-tab-child.html?page=notes[the notes page] in a new tab named `notes`.
. Check that the `notes` tab reads "PAGE notes".
. Load http://localhost:8092/multi-tab-child.html?page=about[the about page] in a new window named `about`.
. Check that the new window reads "PAGE about".
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Open named tabs and windows</title></head>
<body>
<h1>Open named tabs and windows</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=notes">the notes page</a> in a new tab named <code>notes</code>.</li>
  <li>Check that the <code>notes</code> tab reads "PAGE notes".</li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=about">the about page</a> in a new window named <code>about</code>.</li>
  <li>Check that the new window reads "PAGE about".</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Open named tabs and windows
===========================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Load `the notes page <http://localhost:8092/multi-tab-child.html?page=notes>`__ in a new tab named ``notes``.

#. Check that the ``notes`` tab reads "PAGE notes".

#. Load `the about page <http://localhost:8092/multi-tab-child.html?page=about>`__ in a new window named ``about``.

#. Check that the new window reads "PAGE about".
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-goto-new-string">
  <title>Open named tabs and windows</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=notes" scope="external" format="html">the notes page</xref> in a new tab named <codeph>notes</codeph>.</cmd></step>
      <step><cmd>Check that the <codeph>notes</codeph> tab reads "PAGE notes".</cmd></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=about" scope="external" format="html">the about page</xref> in a new window named <codeph>about</codeph>.</cmd></step>
      <step><cmd>Check that the new window reads "PAGE about".</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-goto-new-string","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Open named tabs and windows

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Load [the notes page](http://localhost:8092/multi-tab-child.html?page=notes) in a new tab named `notes`.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=notes","newTab":"notes"}} -->
3. Check that the `notes` tab reads "PAGE notes".
   <!-- step {"find":{"elementText":"PAGE notes","surface":{"browser":"firefox","tab":"notes"}}} -->
4. Load [the about page](http://localhost:8092/multi-tab-child.html?page=about) in a new window named `about`.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=about","newWindow":"about"}} -->
5. Check that the new window reads "PAGE about".
   <!-- step {"find":"PAGE about"} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-goto-new-string","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Open named tabs and windows

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Load [the notes page](http://localhost:8092/multi-tab-child.html?page=notes) in a new tab named `notes`.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=notes","newTab":"notes"}} */}
3. Check that the `notes` tab reads "PAGE notes".
   {/* step {"find":{"elementText":"PAGE notes","surface":{"browser":"firefox","tab":"notes"}}} */}
4. Load [the about page](http://localhost:8092/multi-tab-child.html?page=about) in a new window named `about`.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=about","newWindow":"about"}} */}
5. Check that the new window reads "PAGE about".
   {/* step {"find":"PAGE about"} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Open named tabs and windows

// (test {"testId":"sessions-goto-new-string","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Load http://localhost:8092/multi-tab-child.html?page=notes[the notes page] in a new tab named `notes`.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=notes","newTab":"notes"}})
. Check that the `notes` tab reads "PAGE notes".
+
// (step {"find":{"elementText":"PAGE notes","surface":{"browser":"firefox","tab":"notes"}}})
. Load http://localhost:8092/multi-tab-child.html?page=about[the about page] in a new window named `about`.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=about","newWindow":"about"}})
. Check that the new window reads "PAGE about".
+
// (step {"find":"PAGE about"})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Open named tabs and windows</title></head>
<body>
<!-- test {"testId":"sessions-goto-new-string","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Open named tabs and windows</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=notes">the notes page</a> in a new tab named <code>notes</code>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=notes","newTab":"notes"}} --></li>
  <li>Check that the <code>notes</code> tab reads "PAGE notes".
    <!-- step {"find":{"elementText":"PAGE notes","surface":{"browser":"firefox","tab":"notes"}}} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=about">the about page</a> in a new window named <code>about</code>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=about","newWindow":"about"}} --></li>
  <li>Check that the new window reads "PAGE about".
    <!-- step {"find":"PAGE about"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Open named tabs and windows
===========================

.. test {"testId":"sessions-goto-new-string","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Load `the notes page <http://localhost:8092/multi-tab-child.html?page=notes>`__ in a new tab named ``notes``.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=notes","newTab":"notes"}}

#. Check that the ``notes`` tab reads "PAGE notes".

   .. step {"find":{"elementText":"PAGE notes","surface":{"browser":"firefox","tab":"notes"}}}

#. Load `the about page <http://localhost:8092/multi-tab-child.html?page=about>`__ in a new window named ``about``.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=about","newWindow":"about"}}

#. Check that the new window reads "PAGE about".

   .. step {"find":"PAGE about"}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-goto-new-string">
  <title>Open named tabs and windows</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-goto-new-string","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=notes" scope="external" format="html">the notes page</xref> in a new tab named <codeph>notes</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=notes","newTab":"notes"}}'/></info></step>
      <step><cmd>Check that the <codeph>notes</codeph> tab reads "PAGE notes".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE notes","surface":{"browser":"firefox","tab":"notes"}}}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=about" scope="external" format="html">the about page</xref> in a new window named <codeph>about</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=about","newWindow":"about"}}'/></info></step>
      <step><cmd>Check that the new window reads "PAGE about".</cmd>
        <info><data name="doc-detective" value='step {"find":"PAGE about"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-goto-new-string","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Open named tabs and windows

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Load [the notes page](http://localhost:8092/multi-tab-child.html?page=notes) in a new tab named `notes`.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=notes","newTab":"notes"}} -->
3. Check that the `notes` tab reads "PAGE notes".
   <!-- step {"find":{"elementText":"PAGE notes","surface":{"browser":"firefox","tab":"notes"}}} -->
4. Load [the about page](http://localhost:8092/multi-tab-child.html?page=about) in a new window named `about`.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=about","newWindow":"about"}} -->
5. Check that the new window reads "PAGE about".
   <!-- step {"find":"PAGE about"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-goto-new-string","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Open named tabs and windows

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Load [the notes page](http://localhost:8092/multi-tab-child.html?page=notes) in a new tab named `notes`.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=notes","newTab":"notes"}} */}
3. Check that the `notes` tab reads "PAGE notes".
   {/* step {"find":{"elementText":"PAGE notes","surface":{"browser":"firefox","tab":"notes"}}} */}
4. Load [the about page](http://localhost:8092/multi-tab-child.html?page=about) in a new window named `about`.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=about","newWindow":"about"}} */}
5. Check that the new window reads "PAGE about".
   {/* step {"find":"PAGE about"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Open named tabs and windows

// (test {"testId":"sessions-goto-new-string","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Load http://localhost:8092/multi-tab-child.html?page=notes[the notes page] in a new tab named `notes`.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=notes","newTab":"notes"}})
. Check that the `notes` tab reads "PAGE notes".
+
// (step {"find":{"elementText":"PAGE notes","surface":{"browser":"firefox","tab":"notes"}}})
. Load http://localhost:8092/multi-tab-child.html?page=about[the about page] in a new window named `about`.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=about","newWindow":"about"}})
. Check that the new window reads "PAGE about".
+
// (step {"find":"PAGE about"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Open named tabs and windows</title></head>
<body>
<!-- test {"testId":"sessions-goto-new-string","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Open named tabs and windows</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=notes">the notes page</a> in a new tab named <code>notes</code>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=notes","newTab":"notes"}} --></li>
  <li>Check that the <code>notes</code> tab reads "PAGE notes".
    <!-- step {"find":{"elementText":"PAGE notes","surface":{"browser":"firefox","tab":"notes"}}} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=about">the about page</a> in a new window named <code>about</code>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=about","newWindow":"about"}} --></li>
  <li>Check that the new window reads "PAGE about".
    <!-- step {"find":"PAGE about"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Open named tabs and windows
===========================

.. test {"testId":"sessions-goto-new-string","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Load `the notes page <http://localhost:8092/multi-tab-child.html?page=notes>`__ in a new tab named ``notes``.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=notes","newTab":"notes"}}

#. Check that the ``notes`` tab reads "PAGE notes".

   .. step {"find":{"elementText":"PAGE notes","surface":{"browser":"firefox","tab":"notes"}}}

#. Load `the about page <http://localhost:8092/multi-tab-child.html?page=about>`__ in a new window named ``about``.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=about","newWindow":"about"}}

#. Check that the new window reads "PAGE about".

   .. step {"find":"PAGE about"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-goto-new-string">
  <title>Open named tabs and windows</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-goto-new-string","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=notes" scope="external" format="html">the notes page</xref> in a new tab named <codeph>notes</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=notes","newTab":"notes"}}'/></info></step>
      <step><cmd>Check that the <codeph>notes</codeph> tab reads "PAGE notes".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE notes","surface":{"browser":"firefox","tab":"notes"}}}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=about" scope="external" format="html">the about page</xref> in a new window named <codeph>about</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=about","newWindow":"about"}}'/></info></step>
      <step><cmd>Check that the new window reads "PAGE about".</cmd>
        <info><data name="doc-detective" value='step {"find":"PAGE about"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-goto-new-string",
      "runOn": [
        {
          "browsers": {
            "name": "firefox",
            "headless": true
          },
          "browserFallback": "off"
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "goTo": {
            "url": "http://localhost:8092/multi-tab-child.html?page=notes",
            "newTab": "notes"
          }
        },
        {
          "find": {
            "elementText": "PAGE notes",
            "surface": {
              "browser": "firefox",
              "tab": "notes"
            }
          }
        },
        {
          "goTo": {
            "url": "http://localhost:8092/multi-tab-child.html?page=about",
            "newWindow": "about"
          }
        },
        {
          "find": "PAGE about"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-goto-new-string
    runOn:
      - browsers:
          name: firefox
          headless: true
        browserFallback: off
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - goTo:
          url: http://localhost:8092/multi-tab-child.html?page=notes
          newTab: notes
      - find:
          elementText: PAGE notes
          surface:
            browser: firefox
            tab: notes
      - goTo:
          url: http://localhost:8092/multi-tab-child.html?page=about
          newWindow: about
      - find: PAGE about
```

### `"newTab": { "name" }`, `"newWindow": { "name", "tab" }`

**Varies:** `goTo.newTab and goTo.newWindow` · **Value:** `{ "name": "report" }, { "name": "settings", "tab": "general" }` · **Effect:** the object form names the tab, or names the window and its first tab.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Open a named window with a named tab

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Load [the report page](http://localhost:8092/multi-tab-child.html?page=report) in a new tab named `report`.
3. Load [the settings page](http://localhost:8092/multi-tab-child.html?page=settings) in a new window named `settings`, with its first tab named `general`.
4. Check that the `general` tab of the `settings` window reads "PAGE settings".
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Open a named window with a named tab

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Load [the report page](http://localhost:8092/multi-tab-child.html?page=report) in a new tab named `report`.
3. Load [the settings page](http://localhost:8092/multi-tab-child.html?page=settings) in a new window named `settings`, with its first tab named `general`.
4. Check that the `general` tab of the `settings` window reads "PAGE settings".
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Open a named window with a named tab

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Load http://localhost:8092/multi-tab-child.html?page=report[the report page] in a new tab named `report`.
. Load http://localhost:8092/multi-tab-child.html?page=settings[the settings page] in a new window named `settings`, with its first tab named `general`.
. Check that the `general` tab of the `settings` window reads "PAGE settings".
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Open a named window with a named tab</title></head>
<body>
<h1>Open a named window with a named tab</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=report">the report page</a> in a new tab named <code>report</code>.</li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=settings">the settings page</a> in a new window named <code>settings</code>, with its first tab named <code>general</code>.</li>
  <li>Check that the <code>general</code> tab of the <code>settings</code> window reads "PAGE settings".</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Open a named window with a named tab
====================================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Load `the report page <http://localhost:8092/multi-tab-child.html?page=report>`__ in a new tab named ``report``.

#. Load `the settings page <http://localhost:8092/multi-tab-child.html?page=settings>`__ in a new window named ``settings``, with its first tab named ``general``.

#. Check that the ``general`` tab of the ``settings`` window reads "PAGE settings".
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-goto-new-object">
  <title>Open a named window with a named tab</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=report" scope="external" format="html">the report page</xref> in a new tab named <codeph>report</codeph>.</cmd></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=settings" scope="external" format="html">the settings page</xref> in a new window named <codeph>settings</codeph>, with its first tab named <codeph>general</codeph>.</cmd></step>
      <step><cmd>Check that the <codeph>general</codeph> tab of the <codeph>settings</codeph> window reads "PAGE settings".</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-goto-new-object","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Open a named window with a named tab

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Load [the report page](http://localhost:8092/multi-tab-child.html?page=report) in a new tab named `report`.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=report","newTab":{"name":"report"}}} -->
3. Load [the settings page](http://localhost:8092/multi-tab-child.html?page=settings) in a new window named `settings`, with its first tab named `general`.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=settings","newWindow":{"name":"settings","tab":"general"}}} -->
4. Check that the `general` tab of the `settings` window reads "PAGE settings".
   <!-- step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":{"name":"settings"},"tab":{"name":"general"}}}} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-goto-new-object","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Open a named window with a named tab

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Load [the report page](http://localhost:8092/multi-tab-child.html?page=report) in a new tab named `report`.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=report","newTab":{"name":"report"}}} */}
3. Load [the settings page](http://localhost:8092/multi-tab-child.html?page=settings) in a new window named `settings`, with its first tab named `general`.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=settings","newWindow":{"name":"settings","tab":"general"}}} */}
4. Check that the `general` tab of the `settings` window reads "PAGE settings".
   {/* step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":{"name":"settings"},"tab":{"name":"general"}}}} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Open a named window with a named tab

// (test {"testId":"sessions-goto-new-object","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Load http://localhost:8092/multi-tab-child.html?page=report[the report page] in a new tab named `report`.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=report","newTab":{"name":"report"}}})
. Load http://localhost:8092/multi-tab-child.html?page=settings[the settings page] in a new window named `settings`, with its first tab named `general`.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=settings","newWindow":{"name":"settings","tab":"general"}}})
. Check that the `general` tab of the `settings` window reads "PAGE settings".
+
// (step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":{"name":"settings"},"tab":{"name":"general"}}}})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Open a named window with a named tab</title></head>
<body>
<!-- test {"testId":"sessions-goto-new-object","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Open a named window with a named tab</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=report">the report page</a> in a new tab named <code>report</code>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=report","newTab":{"name":"report"}}} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=settings">the settings page</a> in a new window named <code>settings</code>, with its first tab named <code>general</code>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=settings","newWindow":{"name":"settings","tab":"general"}}} --></li>
  <li>Check that the <code>general</code> tab of the <code>settings</code> window reads "PAGE settings".
    <!-- step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":{"name":"settings"},"tab":{"name":"general"}}}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Open a named window with a named tab
====================================

.. test {"testId":"sessions-goto-new-object","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Load `the report page <http://localhost:8092/multi-tab-child.html?page=report>`__ in a new tab named ``report``.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=report","newTab":{"name":"report"}}}

#. Load `the settings page <http://localhost:8092/multi-tab-child.html?page=settings>`__ in a new window named ``settings``, with its first tab named ``general``.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=settings","newWindow":{"name":"settings","tab":"general"}}}

#. Check that the ``general`` tab of the ``settings`` window reads "PAGE settings".

   .. step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":{"name":"settings"},"tab":{"name":"general"}}}}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-goto-new-object">
  <title>Open a named window with a named tab</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-goto-new-object","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=report" scope="external" format="html">the report page</xref> in a new tab named <codeph>report</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=report","newTab":{"name":"report"}}}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=settings" scope="external" format="html">the settings page</xref> in a new window named <codeph>settings</codeph>, with its first tab named <codeph>general</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=settings","newWindow":{"name":"settings","tab":"general"}}}'/></info></step>
      <step><cmd>Check that the <codeph>general</codeph> tab of the <codeph>settings</codeph> window reads "PAGE settings".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":{"name":"settings"},"tab":{"name":"general"}}}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-goto-new-object","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Open a named window with a named tab

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Load [the report page](http://localhost:8092/multi-tab-child.html?page=report) in a new tab named `report`.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=report","newTab":{"name":"report"}}} -->
3. Load [the settings page](http://localhost:8092/multi-tab-child.html?page=settings) in a new window named `settings`, with its first tab named `general`.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=settings","newWindow":{"name":"settings","tab":"general"}}} -->
4. Check that the `general` tab of the `settings` window reads "PAGE settings".
   <!-- step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":{"name":"settings"},"tab":{"name":"general"}}}} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-goto-new-object","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Open a named window with a named tab

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Load [the report page](http://localhost:8092/multi-tab-child.html?page=report) in a new tab named `report`.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=report","newTab":{"name":"report"}}} */}
3. Load [the settings page](http://localhost:8092/multi-tab-child.html?page=settings) in a new window named `settings`, with its first tab named `general`.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=settings","newWindow":{"name":"settings","tab":"general"}}} */}
4. Check that the `general` tab of the `settings` window reads "PAGE settings".
   {/* step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":{"name":"settings"},"tab":{"name":"general"}}}} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Open a named window with a named tab

// (test {"testId":"sessions-goto-new-object","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Load http://localhost:8092/multi-tab-child.html?page=report[the report page] in a new tab named `report`.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=report","newTab":{"name":"report"}}})
. Load http://localhost:8092/multi-tab-child.html?page=settings[the settings page] in a new window named `settings`, with its first tab named `general`.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=settings","newWindow":{"name":"settings","tab":"general"}}})
. Check that the `general` tab of the `settings` window reads "PAGE settings".
+
// (step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":{"name":"settings"},"tab":{"name":"general"}}}})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Open a named window with a named tab</title></head>
<body>
<!-- test {"testId":"sessions-goto-new-object","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Open a named window with a named tab</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=report">the report page</a> in a new tab named <code>report</code>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=report","newTab":{"name":"report"}}} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=settings">the settings page</a> in a new window named <code>settings</code>, with its first tab named <code>general</code>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=settings","newWindow":{"name":"settings","tab":"general"}}} --></li>
  <li>Check that the <code>general</code> tab of the <code>settings</code> window reads "PAGE settings".
    <!-- step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":{"name":"settings"},"tab":{"name":"general"}}}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Open a named window with a named tab
====================================

.. test {"testId":"sessions-goto-new-object","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Load `the report page <http://localhost:8092/multi-tab-child.html?page=report>`__ in a new tab named ``report``.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=report","newTab":{"name":"report"}}}

#. Load `the settings page <http://localhost:8092/multi-tab-child.html?page=settings>`__ in a new window named ``settings``, with its first tab named ``general``.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=settings","newWindow":{"name":"settings","tab":"general"}}}

#. Check that the ``general`` tab of the ``settings`` window reads "PAGE settings".

   .. step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":{"name":"settings"},"tab":{"name":"general"}}}}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-goto-new-object">
  <title>Open a named window with a named tab</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-goto-new-object","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=report" scope="external" format="html">the report page</xref> in a new tab named <codeph>report</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=report","newTab":{"name":"report"}}}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=settings" scope="external" format="html">the settings page</xref> in a new window named <codeph>settings</codeph>, with its first tab named <codeph>general</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=settings","newWindow":{"name":"settings","tab":"general"}}}'/></info></step>
      <step><cmd>Check that the <codeph>general</codeph> tab of the <codeph>settings</codeph> window reads "PAGE settings".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE settings","surface":{"browser":"firefox","window":{"name":"settings"},"tab":{"name":"general"}}}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-goto-new-object",
      "runOn": [
        {
          "browsers": {
            "name": "firefox",
            "headless": true
          },
          "browserFallback": "off"
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "goTo": {
            "url": "http://localhost:8092/multi-tab-child.html?page=report",
            "newTab": {
              "name": "report"
            }
          }
        },
        {
          "goTo": {
            "url": "http://localhost:8092/multi-tab-child.html?page=settings",
            "newWindow": {
              "name": "settings",
              "tab": "general"
            }
          }
        },
        {
          "find": {
            "elementText": "PAGE settings",
            "surface": {
              "browser": "firefox",
              "window": {
                "name": "settings"
              },
              "tab": {
                "name": "general"
              }
            }
          }
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-goto-new-object
    runOn:
      - browsers:
          name: firefox
          headless: true
        browserFallback: off
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - goTo:
          url: http://localhost:8092/multi-tab-child.html?page=report
          newTab:
            name: report
      - goTo:
          url: http://localhost:8092/multi-tab-child.html?page=settings
          newWindow:
            name: settings
            tab: general
      - find:
          elementText: PAGE settings
          surface:
            browser: firefox
            window:
              name: settings
            tab:
              name: general
```

## Surface selector permutations

### `"tab": 0`

**Varies:** `surface.tab` · **Value:** `0` · **Effect:** a number selects the tab at that position in creation order, and `-1` selects the newest.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
3. Check that the selected page reads "MULTI-TAB HOME".
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
3. Check that the selected page reads "MULTI-TAB HOME".
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check a page in another tab or window

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Load http://localhost:8092/multi-tab-child.html?page=second[the second page] in a new tab named `second`.
. Check that the selected page reads "MULTI-TAB HOME".
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=second">the second page</a> in a new tab named <code>second</code>.</li>
  <li>Check that the selected page reads "MULTI-TAB HOME".</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check a page in another tab or window
=====================================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Load `the second page <http://localhost:8092/multi-tab-child.html?page=second>`__ in a new tab named ``second``.

#. Check that the selected page reads "MULTI-TAB HOME".
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-tab-number">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=second" scope="external" format="html">the second page</xref> in a new tab named <codeph>second</codeph>.</cmd></step>
      <step><cmd>Check that the selected page reads "MULTI-TAB HOME".</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-select-tab-number","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} -->
3. Check that the selected page reads "MULTI-TAB HOME".
   <!-- step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","tab":0}}} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-select-tab-number","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} */}
3. Check that the selected page reads "MULTI-TAB HOME".
   {/* step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","tab":0}}} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check a page in another tab or window

// (test {"testId":"sessions-select-tab-number","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Load http://localhost:8092/multi-tab-child.html?page=second[the second page] in a new tab named `second`.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}})
. Check that the selected page reads "MULTI-TAB HOME".
+
// (step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","tab":0}}})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<!-- test {"testId":"sessions-select-tab-number","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=second">the second page</a> in a new tab named <code>second</code>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} --></li>
  <li>Check that the selected page reads "MULTI-TAB HOME".
    <!-- step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","tab":0}}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check a page in another tab or window
=====================================

.. test {"testId":"sessions-select-tab-number","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Load `the second page <http://localhost:8092/multi-tab-child.html?page=second>`__ in a new tab named ``second``.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}}

#. Check that the selected page reads "MULTI-TAB HOME".

   .. step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","tab":0}}}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-tab-number">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-select-tab-number","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=second" scope="external" format="html">the second page</xref> in a new tab named <codeph>second</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}}'/></info></step>
      <step><cmd>Check that the selected page reads "MULTI-TAB HOME".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","tab":0}}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-select-tab-number","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} -->
3. Check that the selected page reads "MULTI-TAB HOME".
   <!-- step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","tab":0}}} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-select-tab-number","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} */}
3. Check that the selected page reads "MULTI-TAB HOME".
   {/* step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","tab":0}}} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check a page in another tab or window

// (test {"testId":"sessions-select-tab-number","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Load http://localhost:8092/multi-tab-child.html?page=second[the second page] in a new tab named `second`.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}})
. Check that the selected page reads "MULTI-TAB HOME".
+
// (step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","tab":0}}})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<!-- test {"testId":"sessions-select-tab-number","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=second">the second page</a> in a new tab named <code>second</code>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} --></li>
  <li>Check that the selected page reads "MULTI-TAB HOME".
    <!-- step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","tab":0}}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check a page in another tab or window
=====================================

.. test {"testId":"sessions-select-tab-number","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Load `the second page <http://localhost:8092/multi-tab-child.html?page=second>`__ in a new tab named ``second``.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}}

#. Check that the selected page reads "MULTI-TAB HOME".

   .. step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","tab":0}}}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-tab-number">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-select-tab-number","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=second" scope="external" format="html">the second page</xref> in a new tab named <codeph>second</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}}'/></info></step>
      <step><cmd>Check that the selected page reads "MULTI-TAB HOME".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","tab":0}}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-select-tab-number",
      "runOn": [
        {
          "browsers": {
            "name": "firefox",
            "headless": true
          },
          "browserFallback": "off"
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "goTo": {
            "url": "http://localhost:8092/multi-tab-child.html?page=second",
            "newTab": "second"
          }
        },
        {
          "find": {
            "elementText": "MULTI-TAB HOME",
            "surface": {
              "browser": "firefox",
              "tab": 0
            }
          }
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-select-tab-number
    runOn:
      - browsers:
          name: firefox
          headless: true
        browserFallback: off
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - goTo:
          url: http://localhost:8092/multi-tab-child.html?page=second
          newTab: second
      - find:
          elementText: MULTI-TAB HOME
          surface:
            browser: firefox
            tab: 0
```

### `"tab": "second"`

**Varies:** `surface.tab` · **Value:** `"second"` · **Effect:** a string selects the tab with that name.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
3. Check that the selected page reads "PAGE second".
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
3. Check that the selected page reads "PAGE second".
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check a page in another tab or window

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Load http://localhost:8092/multi-tab-child.html?page=second[the second page] in a new tab named `second`.
. Check that the selected page reads "PAGE second".
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=second">the second page</a> in a new tab named <code>second</code>.</li>
  <li>Check that the selected page reads "PAGE second".</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check a page in another tab or window
=====================================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Load `the second page <http://localhost:8092/multi-tab-child.html?page=second>`__ in a new tab named ``second``.

#. Check that the selected page reads "PAGE second".
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-tab-string">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=second" scope="external" format="html">the second page</xref> in a new tab named <codeph>second</codeph>.</cmd></step>
      <step><cmd>Check that the selected page reads "PAGE second".</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-select-tab-string","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} -->
3. Check that the selected page reads "PAGE second".
   <!-- step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":"second"}}} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-select-tab-string","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} */}
3. Check that the selected page reads "PAGE second".
   {/* step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":"second"}}} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check a page in another tab or window

// (test {"testId":"sessions-select-tab-string","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Load http://localhost:8092/multi-tab-child.html?page=second[the second page] in a new tab named `second`.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}})
. Check that the selected page reads "PAGE second".
+
// (step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":"second"}}})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<!-- test {"testId":"sessions-select-tab-string","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=second">the second page</a> in a new tab named <code>second</code>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} --></li>
  <li>Check that the selected page reads "PAGE second".
    <!-- step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":"second"}}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check a page in another tab or window
=====================================

.. test {"testId":"sessions-select-tab-string","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Load `the second page <http://localhost:8092/multi-tab-child.html?page=second>`__ in a new tab named ``second``.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}}

#. Check that the selected page reads "PAGE second".

   .. step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":"second"}}}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-tab-string">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-select-tab-string","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=second" scope="external" format="html">the second page</xref> in a new tab named <codeph>second</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}}'/></info></step>
      <step><cmd>Check that the selected page reads "PAGE second".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":"second"}}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-select-tab-string","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} -->
3. Check that the selected page reads "PAGE second".
   <!-- step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":"second"}}} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-select-tab-string","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} */}
3. Check that the selected page reads "PAGE second".
   {/* step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":"second"}}} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check a page in another tab or window

// (test {"testId":"sessions-select-tab-string","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Load http://localhost:8092/multi-tab-child.html?page=second[the second page] in a new tab named `second`.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}})
. Check that the selected page reads "PAGE second".
+
// (step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":"second"}}})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<!-- test {"testId":"sessions-select-tab-string","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=second">the second page</a> in a new tab named <code>second</code>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} --></li>
  <li>Check that the selected page reads "PAGE second".
    <!-- step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":"second"}}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check a page in another tab or window
=====================================

.. test {"testId":"sessions-select-tab-string","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Load `the second page <http://localhost:8092/multi-tab-child.html?page=second>`__ in a new tab named ``second``.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}}

#. Check that the selected page reads "PAGE second".

   .. step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":"second"}}}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-tab-string">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-select-tab-string","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=second" scope="external" format="html">the second page</xref> in a new tab named <codeph>second</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}}'/></info></step>
      <step><cmd>Check that the selected page reads "PAGE second".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":"second"}}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-select-tab-string",
      "runOn": [
        {
          "browsers": {
            "name": "firefox",
            "headless": true
          },
          "browserFallback": "off"
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "goTo": {
            "url": "http://localhost:8092/multi-tab-child.html?page=second",
            "newTab": "second"
          }
        },
        {
          "find": {
            "elementText": "PAGE second",
            "surface": {
              "browser": "firefox",
              "tab": "second"
            }
          }
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-select-tab-string
    runOn:
      - browsers:
          name: firefox
          headless: true
        browserFallback: off
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - goTo:
          url: http://localhost:8092/multi-tab-child.html?page=second
          newTab: second
      - find:
          elementText: PAGE second
          surface:
            browser: firefox
            tab: second
```

### `"tab": { "index": -1 }`

**Varies:** `surface.tab.index` · **Value:** `-1` · **Effect:** the `index` key works like a number, so `-1` selects the newest tab.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
3. Check that the selected page reads "PAGE second".
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
3. Check that the selected page reads "PAGE second".
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check a page in another tab or window

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Load http://localhost:8092/multi-tab-child.html?page=second[the second page] in a new tab named `second`.
. Check that the selected page reads "PAGE second".
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=second">the second page</a> in a new tab named <code>second</code>.</li>
  <li>Check that the selected page reads "PAGE second".</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check a page in another tab or window
=====================================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Load `the second page <http://localhost:8092/multi-tab-child.html?page=second>`__ in a new tab named ``second``.

#. Check that the selected page reads "PAGE second".
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-tab-index">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=second" scope="external" format="html">the second page</xref> in a new tab named <codeph>second</codeph>.</cmd></step>
      <step><cmd>Check that the selected page reads "PAGE second".</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-select-tab-index","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} -->
3. Check that the selected page reads "PAGE second".
   <!-- step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":{"index":-1}}}} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-select-tab-index","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} */}
3. Check that the selected page reads "PAGE second".
   {/* step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":{"index":-1}}}} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check a page in another tab or window

// (test {"testId":"sessions-select-tab-index","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Load http://localhost:8092/multi-tab-child.html?page=second[the second page] in a new tab named `second`.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}})
. Check that the selected page reads "PAGE second".
+
// (step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":{"index":-1}}}})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<!-- test {"testId":"sessions-select-tab-index","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=second">the second page</a> in a new tab named <code>second</code>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} --></li>
  <li>Check that the selected page reads "PAGE second".
    <!-- step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":{"index":-1}}}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check a page in another tab or window
=====================================

.. test {"testId":"sessions-select-tab-index","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Load `the second page <http://localhost:8092/multi-tab-child.html?page=second>`__ in a new tab named ``second``.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}}

#. Check that the selected page reads "PAGE second".

   .. step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":{"index":-1}}}}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-tab-index">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-select-tab-index","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=second" scope="external" format="html">the second page</xref> in a new tab named <codeph>second</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}}'/></info></step>
      <step><cmd>Check that the selected page reads "PAGE second".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":{"index":-1}}}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-select-tab-index","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} -->
3. Check that the selected page reads "PAGE second".
   <!-- step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":{"index":-1}}}} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-select-tab-index","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} */}
3. Check that the selected page reads "PAGE second".
   {/* step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":{"index":-1}}}} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check a page in another tab or window

// (test {"testId":"sessions-select-tab-index","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Load http://localhost:8092/multi-tab-child.html?page=second[the second page] in a new tab named `second`.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}})
. Check that the selected page reads "PAGE second".
+
// (step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":{"index":-1}}}})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<!-- test {"testId":"sessions-select-tab-index","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=second">the second page</a> in a new tab named <code>second</code>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} --></li>
  <li>Check that the selected page reads "PAGE second".
    <!-- step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":{"index":-1}}}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check a page in another tab or window
=====================================

.. test {"testId":"sessions-select-tab-index","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Load `the second page <http://localhost:8092/multi-tab-child.html?page=second>`__ in a new tab named ``second``.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}}

#. Check that the selected page reads "PAGE second".

   .. step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":{"index":-1}}}}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-tab-index">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-select-tab-index","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=second" scope="external" format="html">the second page</xref> in a new tab named <codeph>second</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}}'/></info></step>
      <step><cmd>Check that the selected page reads "PAGE second".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":{"index":-1}}}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-select-tab-index",
      "runOn": [
        {
          "browsers": {
            "name": "firefox",
            "headless": true
          },
          "browserFallback": "off"
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "goTo": {
            "url": "http://localhost:8092/multi-tab-child.html?page=second",
            "newTab": "second"
          }
        },
        {
          "find": {
            "elementText": "PAGE second",
            "surface": {
              "browser": "firefox",
              "tab": {
                "index": -1
              }
            }
          }
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-select-tab-index
    runOn:
      - browsers:
          name: firefox
          headless: true
        browserFallback: off
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - goTo:
          url: http://localhost:8092/multi-tab-child.html?page=second
          newTab: second
      - find:
          elementText: PAGE second
          surface:
            browser: firefox
            tab:
              index: -1
```

### `"tab": { "title": "Multi-tab home" }`

**Varies:** `surface.tab.title` · **Value:** `"Multi-tab home"` · **Effect:** the `title` key selects the tab whose title matches.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
3. Check that the selected page reads "MULTI-TAB HOME".
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
3. Check that the selected page reads "MULTI-TAB HOME".
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check a page in another tab or window

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Load http://localhost:8092/multi-tab-child.html?page=second[the second page] in a new tab named `second`.
. Check that the selected page reads "MULTI-TAB HOME".
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=second">the second page</a> in a new tab named <code>second</code>.</li>
  <li>Check that the selected page reads "MULTI-TAB HOME".</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check a page in another tab or window
=====================================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Load `the second page <http://localhost:8092/multi-tab-child.html?page=second>`__ in a new tab named ``second``.

#. Check that the selected page reads "MULTI-TAB HOME".
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-tab-title">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=second" scope="external" format="html">the second page</xref> in a new tab named <codeph>second</codeph>.</cmd></step>
      <step><cmd>Check that the selected page reads "MULTI-TAB HOME".</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-select-tab-title","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} -->
3. Check that the selected page reads "MULTI-TAB HOME".
   <!-- step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","tab":{"title":"Multi-tab home"}}}} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-select-tab-title","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} */}
3. Check that the selected page reads "MULTI-TAB HOME".
   {/* step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","tab":{"title":"Multi-tab home"}}}} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check a page in another tab or window

// (test {"testId":"sessions-select-tab-title","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Load http://localhost:8092/multi-tab-child.html?page=second[the second page] in a new tab named `second`.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}})
. Check that the selected page reads "MULTI-TAB HOME".
+
// (step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","tab":{"title":"Multi-tab home"}}}})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<!-- test {"testId":"sessions-select-tab-title","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=second">the second page</a> in a new tab named <code>second</code>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} --></li>
  <li>Check that the selected page reads "MULTI-TAB HOME".
    <!-- step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","tab":{"title":"Multi-tab home"}}}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check a page in another tab or window
=====================================

.. test {"testId":"sessions-select-tab-title","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Load `the second page <http://localhost:8092/multi-tab-child.html?page=second>`__ in a new tab named ``second``.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}}

#. Check that the selected page reads "MULTI-TAB HOME".

   .. step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","tab":{"title":"Multi-tab home"}}}}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-tab-title">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-select-tab-title","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=second" scope="external" format="html">the second page</xref> in a new tab named <codeph>second</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}}'/></info></step>
      <step><cmd>Check that the selected page reads "MULTI-TAB HOME".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","tab":{"title":"Multi-tab home"}}}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-select-tab-title","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} -->
3. Check that the selected page reads "MULTI-TAB HOME".
   <!-- step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","tab":{"title":"Multi-tab home"}}}} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-select-tab-title","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} */}
3. Check that the selected page reads "MULTI-TAB HOME".
   {/* step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","tab":{"title":"Multi-tab home"}}}} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check a page in another tab or window

// (test {"testId":"sessions-select-tab-title","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Load http://localhost:8092/multi-tab-child.html?page=second[the second page] in a new tab named `second`.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}})
. Check that the selected page reads "MULTI-TAB HOME".
+
// (step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","tab":{"title":"Multi-tab home"}}}})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<!-- test {"testId":"sessions-select-tab-title","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=second">the second page</a> in a new tab named <code>second</code>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} --></li>
  <li>Check that the selected page reads "MULTI-TAB HOME".
    <!-- step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","tab":{"title":"Multi-tab home"}}}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check a page in another tab or window
=====================================

.. test {"testId":"sessions-select-tab-title","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Load `the second page <http://localhost:8092/multi-tab-child.html?page=second>`__ in a new tab named ``second``.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}}

#. Check that the selected page reads "MULTI-TAB HOME".

   .. step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","tab":{"title":"Multi-tab home"}}}}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-tab-title">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-select-tab-title","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=second" scope="external" format="html">the second page</xref> in a new tab named <codeph>second</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}}'/></info></step>
      <step><cmd>Check that the selected page reads "MULTI-TAB HOME".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"MULTI-TAB HOME","surface":{"browser":"firefox","tab":{"title":"Multi-tab home"}}}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-select-tab-title",
      "runOn": [
        {
          "browsers": {
            "name": "firefox",
            "headless": true
          },
          "browserFallback": "off"
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "goTo": {
            "url": "http://localhost:8092/multi-tab-child.html?page=second",
            "newTab": "second"
          }
        },
        {
          "find": {
            "elementText": "MULTI-TAB HOME",
            "surface": {
              "browser": "firefox",
              "tab": {
                "title": "Multi-tab home"
              }
            }
          }
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-select-tab-title
    runOn:
      - browsers:
          name: firefox
          headless: true
        browserFallback: off
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - goTo:
          url: http://localhost:8092/multi-tab-child.html?page=second
          newTab: second
      - find:
          elementText: MULTI-TAB HOME
          surface:
            browser: firefox
            tab:
              title: Multi-tab home
```

### `"tab": { "url": "…" }`

**Varies:** `surface.tab.url` · **Value:** `"http://localhost:8092/multi-tab-child.html?page=second"` · **Effect:** the `url` key selects the tab whose URL matches.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
3. Check that the selected page reads "PAGE second".
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
3. Check that the selected page reads "PAGE second".
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check a page in another tab or window

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Load http://localhost:8092/multi-tab-child.html?page=second[the second page] in a new tab named `second`.
. Check that the selected page reads "PAGE second".
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=second">the second page</a> in a new tab named <code>second</code>.</li>
  <li>Check that the selected page reads "PAGE second".</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check a page in another tab or window
=====================================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Load `the second page <http://localhost:8092/multi-tab-child.html?page=second>`__ in a new tab named ``second``.

#. Check that the selected page reads "PAGE second".
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-tab-url">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=second" scope="external" format="html">the second page</xref> in a new tab named <codeph>second</codeph>.</cmd></step>
      <step><cmd>Check that the selected page reads "PAGE second".</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-select-tab-url","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} -->
3. Check that the selected page reads "PAGE second".
   <!-- step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=second"}}}} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-select-tab-url","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} */}
3. Check that the selected page reads "PAGE second".
   {/* step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=second"}}}} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check a page in another tab or window

// (test {"testId":"sessions-select-tab-url","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Load http://localhost:8092/multi-tab-child.html?page=second[the second page] in a new tab named `second`.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}})
. Check that the selected page reads "PAGE second".
+
// (step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=second"}}}})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<!-- test {"testId":"sessions-select-tab-url","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=second">the second page</a> in a new tab named <code>second</code>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} --></li>
  <li>Check that the selected page reads "PAGE second".
    <!-- step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=second"}}}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check a page in another tab or window
=====================================

.. test {"testId":"sessions-select-tab-url","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Load `the second page <http://localhost:8092/multi-tab-child.html?page=second>`__ in a new tab named ``second``.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}}

#. Check that the selected page reads "PAGE second".

   .. step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=second"}}}}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-tab-url">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-select-tab-url","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=second" scope="external" format="html">the second page</xref> in a new tab named <codeph>second</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}}'/></info></step>
      <step><cmd>Check that the selected page reads "PAGE second".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=second"}}}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-select-tab-url","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} -->
3. Check that the selected page reads "PAGE second".
   <!-- step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=second"}}}} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-select-tab-url","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new tab named `second`.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} */}
3. Check that the selected page reads "PAGE second".
   {/* step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=second"}}}} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check a page in another tab or window

// (test {"testId":"sessions-select-tab-url","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Load http://localhost:8092/multi-tab-child.html?page=second[the second page] in a new tab named `second`.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}})
. Check that the selected page reads "PAGE second".
+
// (step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=second"}}}})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<!-- test {"testId":"sessions-select-tab-url","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=second">the second page</a> in a new tab named <code>second</code>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}} --></li>
  <li>Check that the selected page reads "PAGE second".
    <!-- step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=second"}}}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check a page in another tab or window
=====================================

.. test {"testId":"sessions-select-tab-url","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Load `the second page <http://localhost:8092/multi-tab-child.html?page=second>`__ in a new tab named ``second``.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}}

#. Check that the selected page reads "PAGE second".

   .. step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=second"}}}}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-tab-url">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-select-tab-url","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=second" scope="external" format="html">the second page</xref> in a new tab named <codeph>second</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newTab":"second"}}'/></info></step>
      <step><cmd>Check that the selected page reads "PAGE second".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","tab":{"url":"http://localhost:8092/multi-tab-child.html?page=second"}}}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-select-tab-url",
      "runOn": [
        {
          "browsers": {
            "name": "firefox",
            "headless": true
          },
          "browserFallback": "off"
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "goTo": {
            "url": "http://localhost:8092/multi-tab-child.html?page=second",
            "newTab": "second"
          }
        },
        {
          "find": {
            "elementText": "PAGE second",
            "surface": {
              "browser": "firefox",
              "tab": {
                "url": "http://localhost:8092/multi-tab-child.html?page=second"
              }
            }
          }
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-select-tab-url
    runOn:
      - browsers:
          name: firefox
          headless: true
        browserFallback: off
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - goTo:
          url: http://localhost:8092/multi-tab-child.html?page=second
          newTab: second
      - find:
          elementText: PAGE second
          surface:
            browser: firefox
            tab:
              url: http://localhost:8092/multi-tab-child.html?page=second
```

### `"window": -1`

**Varies:** `surface.window` · **Value:** `-1` · **Effect:** a number selects the window at that position in creation order, and `-1` selects the newest.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new window named `second`.
3. Check that the selected page reads "PAGE second".
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new window named `second`.
3. Check that the selected page reads "PAGE second".
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check a page in another tab or window

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Load http://localhost:8092/multi-tab-child.html?page=second[the second page] in a new window named `second`.
. Check that the selected page reads "PAGE second".
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=second">the second page</a> in a new window named <code>second</code>.</li>
  <li>Check that the selected page reads "PAGE second".</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check a page in another tab or window
=====================================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Load `the second page <http://localhost:8092/multi-tab-child.html?page=second>`__ in a new window named ``second``.

#. Check that the selected page reads "PAGE second".
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-window-number">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=second" scope="external" format="html">the second page</xref> in a new window named <codeph>second</codeph>.</cmd></step>
      <step><cmd>Check that the selected page reads "PAGE second".</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-select-window-number","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new window named `second`.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}} -->
3. Check that the selected page reads "PAGE second".
   <!-- step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":-1}}} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-select-window-number","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new window named `second`.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}} */}
3. Check that the selected page reads "PAGE second".
   {/* step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":-1}}} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check a page in another tab or window

// (test {"testId":"sessions-select-window-number","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Load http://localhost:8092/multi-tab-child.html?page=second[the second page] in a new window named `second`.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}})
. Check that the selected page reads "PAGE second".
+
// (step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":-1}}})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<!-- test {"testId":"sessions-select-window-number","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=second">the second page</a> in a new window named <code>second</code>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}} --></li>
  <li>Check that the selected page reads "PAGE second".
    <!-- step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":-1}}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check a page in another tab or window
=====================================

.. test {"testId":"sessions-select-window-number","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Load `the second page <http://localhost:8092/multi-tab-child.html?page=second>`__ in a new window named ``second``.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}}

#. Check that the selected page reads "PAGE second".

   .. step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":-1}}}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-window-number">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-select-window-number","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=second" scope="external" format="html">the second page</xref> in a new window named <codeph>second</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}}'/></info></step>
      <step><cmd>Check that the selected page reads "PAGE second".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":-1}}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-select-window-number","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new window named `second`.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}} -->
3. Check that the selected page reads "PAGE second".
   <!-- step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":-1}}} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-select-window-number","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new window named `second`.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}} */}
3. Check that the selected page reads "PAGE second".
   {/* step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":-1}}} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check a page in another tab or window

// (test {"testId":"sessions-select-window-number","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Load http://localhost:8092/multi-tab-child.html?page=second[the second page] in a new window named `second`.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}})
. Check that the selected page reads "PAGE second".
+
// (step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":-1}}})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<!-- test {"testId":"sessions-select-window-number","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=second">the second page</a> in a new window named <code>second</code>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}} --></li>
  <li>Check that the selected page reads "PAGE second".
    <!-- step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":-1}}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check a page in another tab or window
=====================================

.. test {"testId":"sessions-select-window-number","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Load `the second page <http://localhost:8092/multi-tab-child.html?page=second>`__ in a new window named ``second``.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}}

#. Check that the selected page reads "PAGE second".

   .. step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":-1}}}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-window-number">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-select-window-number","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=second" scope="external" format="html">the second page</xref> in a new window named <codeph>second</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}}'/></info></step>
      <step><cmd>Check that the selected page reads "PAGE second".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":-1}}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-select-window-number",
      "runOn": [
        {
          "browsers": {
            "name": "firefox",
            "headless": true
          },
          "browserFallback": "off"
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "goTo": {
            "url": "http://localhost:8092/multi-tab-child.html?page=second",
            "newWindow": "second"
          }
        },
        {
          "find": {
            "elementText": "PAGE second",
            "surface": {
              "browser": "firefox",
              "window": -1
            }
          }
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-select-window-number
    runOn:
      - browsers:
          name: firefox
          headless: true
        browserFallback: off
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - goTo:
          url: http://localhost:8092/multi-tab-child.html?page=second
          newWindow: second
      - find:
          elementText: PAGE second
          surface:
            browser: firefox
            window: -1
```

### `"window": { "name": "second" }`

**Varies:** `surface.window.name` · **Value:** `"second"` · **Effect:** the `name` key, like a bare string, selects the window with that name.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new window named `second`.
3. Check that the selected page reads "PAGE second".
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new window named `second`.
3. Check that the selected page reads "PAGE second".
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check a page in another tab or window

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Load http://localhost:8092/multi-tab-child.html?page=second[the second page] in a new window named `second`.
. Check that the selected page reads "PAGE second".
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=second">the second page</a> in a new window named <code>second</code>.</li>
  <li>Check that the selected page reads "PAGE second".</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check a page in another tab or window
=====================================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Load `the second page <http://localhost:8092/multi-tab-child.html?page=second>`__ in a new window named ``second``.

#. Check that the selected page reads "PAGE second".
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-window-name">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=second" scope="external" format="html">the second page</xref> in a new window named <codeph>second</codeph>.</cmd></step>
      <step><cmd>Check that the selected page reads "PAGE second".</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-select-window-name","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new window named `second`.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}} -->
3. Check that the selected page reads "PAGE second".
   <!-- step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":{"name":"second"}}}} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-select-window-name","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new window named `second`.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}} */}
3. Check that the selected page reads "PAGE second".
   {/* step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":{"name":"second"}}}} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check a page in another tab or window

// (test {"testId":"sessions-select-window-name","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Load http://localhost:8092/multi-tab-child.html?page=second[the second page] in a new window named `second`.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}})
. Check that the selected page reads "PAGE second".
+
// (step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":{"name":"second"}}}})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<!-- test {"testId":"sessions-select-window-name","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=second">the second page</a> in a new window named <code>second</code>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}} --></li>
  <li>Check that the selected page reads "PAGE second".
    <!-- step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":{"name":"second"}}}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check a page in another tab or window
=====================================

.. test {"testId":"sessions-select-window-name","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Load `the second page <http://localhost:8092/multi-tab-child.html?page=second>`__ in a new window named ``second``.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}}

#. Check that the selected page reads "PAGE second".

   .. step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":{"name":"second"}}}}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-window-name">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-select-window-name","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=second" scope="external" format="html">the second page</xref> in a new window named <codeph>second</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}}'/></info></step>
      <step><cmd>Check that the selected page reads "PAGE second".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":{"name":"second"}}}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-select-window-name","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new window named `second`.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}} -->
3. Check that the selected page reads "PAGE second".
   <!-- step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":{"name":"second"}}}} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-select-window-name","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new window named `second`.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}} */}
3. Check that the selected page reads "PAGE second".
   {/* step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":{"name":"second"}}}} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check a page in another tab or window

// (test {"testId":"sessions-select-window-name","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Load http://localhost:8092/multi-tab-child.html?page=second[the second page] in a new window named `second`.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}})
. Check that the selected page reads "PAGE second".
+
// (step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":{"name":"second"}}}})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<!-- test {"testId":"sessions-select-window-name","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=second">the second page</a> in a new window named <code>second</code>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}} --></li>
  <li>Check that the selected page reads "PAGE second".
    <!-- step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":{"name":"second"}}}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check a page in another tab or window
=====================================

.. test {"testId":"sessions-select-window-name","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Load `the second page <http://localhost:8092/multi-tab-child.html?page=second>`__ in a new window named ``second``.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}}

#. Check that the selected page reads "PAGE second".

   .. step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":{"name":"second"}}}}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-window-name">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-select-window-name","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=second" scope="external" format="html">the second page</xref> in a new window named <codeph>second</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}}'/></info></step>
      <step><cmd>Check that the selected page reads "PAGE second".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":{"name":"second"}}}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-select-window-name",
      "runOn": [
        {
          "browsers": {
            "name": "firefox",
            "headless": true
          },
          "browserFallback": "off"
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "goTo": {
            "url": "http://localhost:8092/multi-tab-child.html?page=second",
            "newWindow": "second"
          }
        },
        {
          "find": {
            "elementText": "PAGE second",
            "surface": {
              "browser": "firefox",
              "window": {
                "name": "second"
              }
            }
          }
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-select-window-name
    runOn:
      - browsers:
          name: firefox
          headless: true
        browserFallback: off
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - goTo:
          url: http://localhost:8092/multi-tab-child.html?page=second
          newWindow: second
      - find:
          elementText: PAGE second
          surface:
            browser: firefox
            window:
              name: second
```

### `"window": { "title": "Child second" }`

**Varies:** `surface.window.title` · **Value:** `"Child second"` · **Effect:** the `title` key selects the window whose active tab has that title.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new window named `second`.
3. Check that the selected page reads "PAGE second".
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new window named `second`.
3. Check that the selected page reads "PAGE second".
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check a page in another tab or window

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Load http://localhost:8092/multi-tab-child.html?page=second[the second page] in a new window named `second`.
. Check that the selected page reads "PAGE second".
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=second">the second page</a> in a new window named <code>second</code>.</li>
  <li>Check that the selected page reads "PAGE second".</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check a page in another tab or window
=====================================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Load `the second page <http://localhost:8092/multi-tab-child.html?page=second>`__ in a new window named ``second``.

#. Check that the selected page reads "PAGE second".
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-window-title">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=second" scope="external" format="html">the second page</xref> in a new window named <codeph>second</codeph>.</cmd></step>
      <step><cmd>Check that the selected page reads "PAGE second".</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-select-window-title","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new window named `second`.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}} -->
3. Check that the selected page reads "PAGE second".
   <!-- step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":{"title":"Child second"}}}} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-select-window-title","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new window named `second`.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}} */}
3. Check that the selected page reads "PAGE second".
   {/* step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":{"title":"Child second"}}}} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check a page in another tab or window

// (test {"testId":"sessions-select-window-title","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Load http://localhost:8092/multi-tab-child.html?page=second[the second page] in a new window named `second`.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}})
. Check that the selected page reads "PAGE second".
+
// (step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":{"title":"Child second"}}}})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<!-- test {"testId":"sessions-select-window-title","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=second">the second page</a> in a new window named <code>second</code>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}} --></li>
  <li>Check that the selected page reads "PAGE second".
    <!-- step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":{"title":"Child second"}}}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check a page in another tab or window
=====================================

.. test {"testId":"sessions-select-window-title","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Load `the second page <http://localhost:8092/multi-tab-child.html?page=second>`__ in a new window named ``second``.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}}

#. Check that the selected page reads "PAGE second".

   .. step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":{"title":"Child second"}}}}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-window-title">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-select-window-title","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=second" scope="external" format="html">the second page</xref> in a new window named <codeph>second</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}}'/></info></step>
      <step><cmd>Check that the selected page reads "PAGE second".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":{"title":"Child second"}}}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-select-window-title","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new window named `second`.
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}} -->
3. Check that the selected page reads "PAGE second".
   <!-- step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":{"title":"Child second"}}}} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-select-window-title","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Load [the second page](http://localhost:8092/multi-tab-child.html?page=second) in a new window named `second`.
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}} */}
3. Check that the selected page reads "PAGE second".
   {/* step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":{"title":"Child second"}}}} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check a page in another tab or window

// (test {"testId":"sessions-select-window-title","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Load http://localhost:8092/multi-tab-child.html?page=second[the second page] in a new window named `second`.
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}})
. Check that the selected page reads "PAGE second".
+
// (step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":{"title":"Child second"}}}})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<!-- test {"testId":"sessions-select-window-title","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Load <a href="http://localhost:8092/multi-tab-child.html?page=second">the second page</a> in a new window named <code>second</code>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}} --></li>
  <li>Check that the selected page reads "PAGE second".
    <!-- step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":{"title":"Child second"}}}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check a page in another tab or window
=====================================

.. test {"testId":"sessions-select-window-title","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Load `the second page <http://localhost:8092/multi-tab-child.html?page=second>`__ in a new window named ``second``.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}}

#. Check that the selected page reads "PAGE second".

   .. step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":{"title":"Child second"}}}}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-window-title">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-select-window-title","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Load <xref href="http://localhost:8092/multi-tab-child.html?page=second" scope="external" format="html">the second page</xref> in a new window named <codeph>second</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=second","newWindow":"second"}}'/></info></step>
      <step><cmd>Check that the selected page reads "PAGE second".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE second","surface":{"browser":"firefox","window":{"title":"Child second"}}}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-select-window-title",
      "runOn": [
        {
          "browsers": {
            "name": "firefox",
            "headless": true
          },
          "browserFallback": "off"
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "goTo": {
            "url": "http://localhost:8092/multi-tab-child.html?page=second",
            "newWindow": "second"
          }
        },
        {
          "find": {
            "elementText": "PAGE second",
            "surface": {
              "browser": "firefox",
              "window": {
                "title": "Child second"
              }
            }
          }
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-select-window-title
    runOn:
      - browsers:
          name: firefox
          headless: true
        browserFallback: off
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - goTo:
          url: http://localhost:8092/multi-tab-child.html?page=second
          newWindow: second
      - find:
          elementText: PAGE second
          surface:
            browser: firefox
            window:
              title: Child second
```

### `"window": 0, "tab": 1` on a tab the page opened

**Varies:** `surface.window and surface.tab` · **Value:** `{ "window": 0, "tab": 1 }` · **Effect:** a tab that a link opens belongs to the window of the tab that opened it, so `window` and `tab` selectors together reach it.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Click the Open child in new tab link. The child page opens in a new tab.
3. In the first window, check that the second tab reads "PAGE linked".
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
2. Click the Open child in new tab link. The child page opens in a new tab.
3. In the first window, check that the second tab reads "PAGE linked".
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Check a page in another tab or window

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
. Click the Open child in new tab link. The child page opens in a new tab.
. In the first window, check that the second tab reads "PAGE linked".
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.</li>
  <li>Click the Open child in new tab link. The child page opens in a new tab.</li>
  <li>In the first window, check that the second tab reads "PAGE linked".</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Check a page in another tab or window
=====================================

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

#. Click the Open child in new tab link. The child page opens in a new tab.

#. In the first window, check that the second tab reads "PAGE linked".
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-window-tab">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd></step>
      <step><cmd>Click the Open child in new tab link. The child page opens in a new tab.</cmd></step>
      <step><cmd>In the first window, check that the second tab reads "PAGE linked".</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-select-window-tab","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Click the Open child in new tab link. The child page opens in a new tab.
   <!-- step {"click":"Open child in new tab"} -->
3. In the first window, check that the second tab reads "PAGE linked".
   <!-- step {"find":{"elementText":"PAGE linked","surface":{"browser":"firefox","window":0,"tab":1}}} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-select-window-tab","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Click the Open child in new tab link. The child page opens in a new tab.
   {/* step {"click":"Open child in new tab"} */}
3. In the first window, check that the second tab reads "PAGE linked".
   {/* step {"find":{"elementText":"PAGE linked","surface":{"browser":"firefox","window":0,"tab":1}}} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Check a page in another tab or window

// (test {"testId":"sessions-select-window-tab","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Click the Open child in new tab link. The child page opens in a new tab.
+
// (step {"click":"Open child in new tab"})
. In the first window, check that the second tab reads "PAGE linked".
+
// (step {"find":{"elementText":"PAGE linked","surface":{"browser":"firefox","window":0,"tab":1}}})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<!-- test {"testId":"sessions-select-window-tab","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Click the Open child in new tab link. The child page opens in a new tab.
    <!-- step {"click":"Open child in new tab"} --></li>
  <li>In the first window, check that the second tab reads "PAGE linked".
    <!-- step {"find":{"elementText":"PAGE linked","surface":{"browser":"firefox","window":0,"tab":1}}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Check a page in another tab or window
=====================================

.. test {"testId":"sessions-select-window-tab","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Click the Open child in new tab link. The child page opens in a new tab.

   .. step {"click":"Open child in new tab"}

#. In the first window, check that the second tab reads "PAGE linked".

   .. step {"find":{"elementText":"PAGE linked","surface":{"browser":"firefox","window":0,"tab":1}}}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-window-tab">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-select-window-tab","detectSteps":true,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Click the Open child in new tab link. The child page opens in a new tab.</cmd>
        <info><data name="doc-detective" value='step {"click":"Open child in new tab"}'/></info></step>
      <step><cmd>In the first window, check that the second tab reads "PAGE linked".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE linked","surface":{"browser":"firefox","window":0,"tab":1}}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-select-window-tab","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} -->
2. Click the Open child in new tab link. The child page opens in a new tab.
   <!-- step {"click":"Open child in new tab"} -->
3. In the first window, check that the second tab reads "PAGE linked".
   <!-- step {"find":{"elementText":"PAGE linked","surface":{"browser":"firefox","window":0,"tab":1}}} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-select-window-tab","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} */}

# Check a page in another tab or window

1. Start at [the multi-tab page](http://localhost:8092/multi-tab.html).
   {/* step {"goTo":"http://localhost:8092/multi-tab.html"} */}
2. Click the Open child in new tab link. The child page opens in a new tab.
   {/* step {"click":"Open child in new tab"} */}
3. In the first window, check that the second tab reads "PAGE linked".
   {/* step {"find":{"elementText":"PAGE linked","surface":{"browser":"firefox","window":0,"tab":1}}} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Check a page in another tab or window

// (test {"testId":"sessions-select-window-tab","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]})

. Start at http://localhost:8092/multi-tab.html[the multi-tab page].
+
// (step {"goTo":"http://localhost:8092/multi-tab.html"})
. Click the Open child in new tab link. The child page opens in a new tab.
+
// (step {"click":"Open child in new tab"})
. In the first window, check that the second tab reads "PAGE linked".
+
// (step {"find":{"elementText":"PAGE linked","surface":{"browser":"firefox","window":0,"tab":1}}})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Check a page in another tab or window</title></head>
<body>
<!-- test {"testId":"sessions-select-window-tab","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]} -->
<h1>Check a page in another tab or window</h1>
<ol>
  <li>Start at <a href="http://localhost:8092/multi-tab.html">the multi-tab page</a>.
    <!-- step {"goTo":"http://localhost:8092/multi-tab.html"} --></li>
  <li>Click the Open child in new tab link. The child page opens in a new tab.
    <!-- step {"click":"Open child in new tab"} --></li>
  <li>In the first window, check that the second tab reads "PAGE linked".
    <!-- step {"find":{"elementText":"PAGE linked","surface":{"browser":"firefox","window":0,"tab":1}}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Check a page in another tab or window
=====================================

.. test {"testId":"sessions-select-window-tab","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}

#. Start at `the multi-tab page <http://localhost:8092/multi-tab.html>`__.

   .. step {"goTo":"http://localhost:8092/multi-tab.html"}

#. Click the Open child in new tab link. The child page opens in a new tab.

   .. step {"click":"Open child in new tab"}

#. In the first window, check that the second tab reads "PAGE linked".

   .. step {"find":{"elementText":"PAGE linked","surface":{"browser":"firefox","window":0,"tab":1}}}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-select-window-tab">
  <title>Check a page in another tab or window</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-select-window-tab","detectSteps":false,"runOn":[{"browsers":{"name":"firefox","headless":true},"browserFallback":"off"}]}'/>
    <steps>
      <step><cmd>Start at <xref href="http://localhost:8092/multi-tab.html" scope="external" format="html">the multi-tab page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/multi-tab.html"}'/></info></step>
      <step><cmd>Click the Open child in new tab link. The child page opens in a new tab.</cmd>
        <info><data name="doc-detective" value='step {"click":"Open child in new tab"}'/></info></step>
      <step><cmd>In the first window, check that the second tab reads "PAGE linked".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE linked","surface":{"browser":"firefox","window":0,"tab":1}}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-select-window-tab",
      "runOn": [
        {
          "browsers": {
            "name": "firefox",
            "headless": true
          },
          "browserFallback": "off"
        }
      ],
      "steps": [
        {
          "goTo": "http://localhost:8092/multi-tab.html"
        },
        {
          "click": "Open child in new tab"
        },
        {
          "find": {
            "elementText": "PAGE linked",
            "surface": {
              "browser": "firefox",
              "window": 0,
              "tab": 1
            }
          }
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-select-window-tab
    runOn:
      - browsers:
          name: firefox
          headless: true
        browserFallback: off
    steps:
      - goTo: http://localhost:8092/multi-tab.html
      - click: Open child in new tab
      - find:
          elementText: PAGE linked
          surface:
            browser: firefox
            window: 0
            tab: 1
```

## `startSurface` and `closeSurface` permutations

### Browser descriptor, closed by object

**Varies:** `startSurface (browser descriptor) and closeSurface (object)` · **Value:** `{ "browser": "firefox", "name": "reviewer" }` · **Effect:** `startSurface` opens a second, named browser session, and `closeSurface` ends it by naming the engine and session.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Review a page in a second browser session

1. Start a headless Firefox session named `reviewer`.
2. In that session, load [the review page](http://localhost:8092/multi-tab-child.html?page=review).
3. Check that the page reads "PAGE review".
4. Close the `reviewer` session.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Review a page in a second browser session

1. Start a headless Firefox session named `reviewer`.
2. In that session, load [the review page](http://localhost:8092/multi-tab-child.html?page=review).
3. Check that the page reads "PAGE review".
4. Close the `reviewer` session.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Review a page in a second browser session

. Start a headless Firefox session named `reviewer`.
. In that session, load http://localhost:8092/multi-tab-child.html?page=review[the review page].
. Check that the page reads "PAGE review".
. Close the `reviewer` session.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Review a page in a second browser session</title></head>
<body>
<h1>Review a page in a second browser session</h1>
<ol>
  <li>Start a headless Firefox session named <code>reviewer</code>.</li>
  <li>In that session, load <a href="http://localhost:8092/multi-tab-child.html?page=review">the review page</a>.</li>
  <li>Check that the page reads "PAGE review".</li>
  <li>Close the <code>reviewer</code> session.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Review a page in a second browser session
=========================================

#. Start a headless Firefox session named ``reviewer``.

#. In that session, load `the review page <http://localhost:8092/multi-tab-child.html?page=review>`__.

#. Check that the page reads "PAGE review".

#. Close the ``reviewer`` session.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-surface-browser">
  <title>Review a page in a second browser session</title>
  <taskbody>
    <steps>
      <step><cmd>Start a headless Firefox session named <codeph>reviewer</codeph>.</cmd></step>
      <step><cmd>In that session, load <xref href="http://localhost:8092/multi-tab-child.html?page=review" scope="external" format="html">the review page</xref>.</cmd></step>
      <step><cmd>Check that the page reads "PAGE review".</cmd></step>
      <step><cmd>Close the <codeph>reviewer</codeph> session.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-surface-browser","detectSteps":true} -->

# Review a page in a second browser session

1. Start a headless Firefox session named `reviewer`.
   <!-- step {"startSurface":{"browser":"firefox","name":"reviewer","headless":true}} -->
2. In that session, load [the review page](http://localhost:8092/multi-tab-child.html?page=review).
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=review","surface":{"browser":"firefox","name":"reviewer"}}} -->
3. Check that the page reads "PAGE review".
   <!-- step {"find":{"elementText":"PAGE review","surface":{"browser":"firefox","name":"reviewer"}}} -->
4. Close the `reviewer` session.
   <!-- step {"closeSurface":{"browser":"firefox","name":"reviewer"}} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-surface-browser","detectSteps":true} */}

# Review a page in a second browser session

1. Start a headless Firefox session named `reviewer`.
   {/* step {"startSurface":{"browser":"firefox","name":"reviewer","headless":true}} */}
2. In that session, load [the review page](http://localhost:8092/multi-tab-child.html?page=review).
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=review","surface":{"browser":"firefox","name":"reviewer"}}} */}
3. Check that the page reads "PAGE review".
   {/* step {"find":{"elementText":"PAGE review","surface":{"browser":"firefox","name":"reviewer"}}} */}
4. Close the `reviewer` session.
   {/* step {"closeSurface":{"browser":"firefox","name":"reviewer"}} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Review a page in a second browser session

// (test {"testId":"sessions-surface-browser","detectSteps":true})

. Start a headless Firefox session named `reviewer`.
+
// (step {"startSurface":{"browser":"firefox","name":"reviewer","headless":true}})
. In that session, load http://localhost:8092/multi-tab-child.html?page=review[the review page].
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=review","surface":{"browser":"firefox","name":"reviewer"}}})
. Check that the page reads "PAGE review".
+
// (step {"find":{"elementText":"PAGE review","surface":{"browser":"firefox","name":"reviewer"}}})
. Close the `reviewer` session.
+
// (step {"closeSurface":{"browser":"firefox","name":"reviewer"}})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Review a page in a second browser session</title></head>
<body>
<!-- test {"testId":"sessions-surface-browser","detectSteps":true} -->
<h1>Review a page in a second browser session</h1>
<ol>
  <li>Start a headless Firefox session named <code>reviewer</code>.
    <!-- step {"startSurface":{"browser":"firefox","name":"reviewer","headless":true}} --></li>
  <li>In that session, load <a href="http://localhost:8092/multi-tab-child.html?page=review">the review page</a>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=review","surface":{"browser":"firefox","name":"reviewer"}}} --></li>
  <li>Check that the page reads "PAGE review".
    <!-- step {"find":{"elementText":"PAGE review","surface":{"browser":"firefox","name":"reviewer"}}} --></li>
  <li>Close the <code>reviewer</code> session.
    <!-- step {"closeSurface":{"browser":"firefox","name":"reviewer"}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Review a page in a second browser session
=========================================

.. test {"testId":"sessions-surface-browser","detectSteps":true}

#. Start a headless Firefox session named ``reviewer``.

   .. step {"startSurface":{"browser":"firefox","name":"reviewer","headless":true}}

#. In that session, load `the review page <http://localhost:8092/multi-tab-child.html?page=review>`__.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=review","surface":{"browser":"firefox","name":"reviewer"}}}

#. Check that the page reads "PAGE review".

   .. step {"find":{"elementText":"PAGE review","surface":{"browser":"firefox","name":"reviewer"}}}

#. Close the ``reviewer`` session.

   .. step {"closeSurface":{"browser":"firefox","name":"reviewer"}}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-surface-browser">
  <title>Review a page in a second browser session</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-surface-browser","detectSteps":true}'/>
    <steps>
      <step><cmd>Start a headless Firefox session named <codeph>reviewer</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"startSurface":{"browser":"firefox","name":"reviewer","headless":true}}'/></info></step>
      <step><cmd>In that session, load <xref href="http://localhost:8092/multi-tab-child.html?page=review" scope="external" format="html">the review page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=review","surface":{"browser":"firefox","name":"reviewer"}}}'/></info></step>
      <step><cmd>Check that the page reads "PAGE review".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE review","surface":{"browser":"firefox","name":"reviewer"}}}'/></info></step>
      <step><cmd>Close the <codeph>reviewer</codeph> session.</cmd>
        <info><data name="doc-detective" value='step {"closeSurface":{"browser":"firefox","name":"reviewer"}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-surface-browser","detectSteps":false} -->

# Review a page in a second browser session

1. Start a headless Firefox session named `reviewer`.
   <!-- step {"startSurface":{"browser":"firefox","name":"reviewer","headless":true}} -->
2. In that session, load [the review page](http://localhost:8092/multi-tab-child.html?page=review).
   <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=review","surface":{"browser":"firefox","name":"reviewer"}}} -->
3. Check that the page reads "PAGE review".
   <!-- step {"find":{"elementText":"PAGE review","surface":{"browser":"firefox","name":"reviewer"}}} -->
4. Close the `reviewer` session.
   <!-- step {"closeSurface":{"browser":"firefox","name":"reviewer"}} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-surface-browser","detectSteps":false} */}

# Review a page in a second browser session

1. Start a headless Firefox session named `reviewer`.
   {/* step {"startSurface":{"browser":"firefox","name":"reviewer","headless":true}} */}
2. In that session, load [the review page](http://localhost:8092/multi-tab-child.html?page=review).
   {/* step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=review","surface":{"browser":"firefox","name":"reviewer"}}} */}
3. Check that the page reads "PAGE review".
   {/* step {"find":{"elementText":"PAGE review","surface":{"browser":"firefox","name":"reviewer"}}} */}
4. Close the `reviewer` session.
   {/* step {"closeSurface":{"browser":"firefox","name":"reviewer"}} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Review a page in a second browser session

// (test {"testId":"sessions-surface-browser","detectSteps":false})

. Start a headless Firefox session named `reviewer`.
+
// (step {"startSurface":{"browser":"firefox","name":"reviewer","headless":true}})
. In that session, load http://localhost:8092/multi-tab-child.html?page=review[the review page].
+
// (step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=review","surface":{"browser":"firefox","name":"reviewer"}}})
. Check that the page reads "PAGE review".
+
// (step {"find":{"elementText":"PAGE review","surface":{"browser":"firefox","name":"reviewer"}}})
. Close the `reviewer` session.
+
// (step {"closeSurface":{"browser":"firefox","name":"reviewer"}})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Review a page in a second browser session</title></head>
<body>
<!-- test {"testId":"sessions-surface-browser","detectSteps":false} -->
<h1>Review a page in a second browser session</h1>
<ol>
  <li>Start a headless Firefox session named <code>reviewer</code>.
    <!-- step {"startSurface":{"browser":"firefox","name":"reviewer","headless":true}} --></li>
  <li>In that session, load <a href="http://localhost:8092/multi-tab-child.html?page=review">the review page</a>.
    <!-- step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=review","surface":{"browser":"firefox","name":"reviewer"}}} --></li>
  <li>Check that the page reads "PAGE review".
    <!-- step {"find":{"elementText":"PAGE review","surface":{"browser":"firefox","name":"reviewer"}}} --></li>
  <li>Close the <code>reviewer</code> session.
    <!-- step {"closeSurface":{"browser":"firefox","name":"reviewer"}} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Review a page in a second browser session
=========================================

.. test {"testId":"sessions-surface-browser","detectSteps":false}

#. Start a headless Firefox session named ``reviewer``.

   .. step {"startSurface":{"browser":"firefox","name":"reviewer","headless":true}}

#. In that session, load `the review page <http://localhost:8092/multi-tab-child.html?page=review>`__.

   .. step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=review","surface":{"browser":"firefox","name":"reviewer"}}}

#. Check that the page reads "PAGE review".

   .. step {"find":{"elementText":"PAGE review","surface":{"browser":"firefox","name":"reviewer"}}}

#. Close the ``reviewer`` session.

   .. step {"closeSurface":{"browser":"firefox","name":"reviewer"}}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-surface-browser">
  <title>Review a page in a second browser session</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-surface-browser","detectSteps":false}'/>
    <steps>
      <step><cmd>Start a headless Firefox session named <codeph>reviewer</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"startSurface":{"browser":"firefox","name":"reviewer","headless":true}}'/></info></step>
      <step><cmd>In that session, load <xref href="http://localhost:8092/multi-tab-child.html?page=review" scope="external" format="html">the review page</xref>.</cmd>
        <info><data name="doc-detective" value='step {"goTo":{"url":"http://localhost:8092/multi-tab-child.html?page=review","surface":{"browser":"firefox","name":"reviewer"}}}'/></info></step>
      <step><cmd>Check that the page reads "PAGE review".</cmd>
        <info><data name="doc-detective" value='step {"find":{"elementText":"PAGE review","surface":{"browser":"firefox","name":"reviewer"}}}'/></info></step>
      <step><cmd>Close the <codeph>reviewer</codeph> session.</cmd>
        <info><data name="doc-detective" value='step {"closeSurface":{"browser":"firefox","name":"reviewer"}}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-surface-browser",
      "steps": [
        {
          "startSurface": {
            "browser": "firefox",
            "name": "reviewer",
            "headless": true
          }
        },
        {
          "goTo": {
            "url": "http://localhost:8092/multi-tab-child.html?page=review",
            "surface": {
              "browser": "firefox",
              "name": "reviewer"
            }
          }
        },
        {
          "find": {
            "elementText": "PAGE review",
            "surface": {
              "browser": "firefox",
              "name": "reviewer"
            }
          }
        },
        {
          "closeSurface": {
            "browser": "firefox",
            "name": "reviewer"
          }
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-surface-browser
    steps:
      - startSurface:
          browser: firefox
          name: reviewer
          headless: true
      - goTo:
          url: http://localhost:8092/multi-tab-child.html?page=review
          surface:
            browser: firefox
            name: reviewer
      - find:
          elementText: PAGE review
          surface:
            browser: firefox
            name: reviewer
      - closeSurface:
          browser: firefox
          name: reviewer
```

### Process descriptor, closed by name

**Varies:** `startSurface (process descriptor) and closeSurface (string)` · **Value:** `{ "process": "node", "args": ["-i"], "name": "sessions-prepl" }` · **Effect:** `startSurface` starts a process you can type into, and a bare name closes it.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Evaluate an expression in the Node.js REPL

1. Start `node -i` as a process named `sessions-prepl`, and wait for the `>` prompt.
2. In `sessions-prepl`, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
3. Close `sessions-prepl`.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Evaluate an expression in the Node.js REPL

1. Start `node -i` as a process named `sessions-prepl`, and wait for the `>` prompt.
2. In `sessions-prepl`, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
3. Close `sessions-prepl`.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Evaluate an expression in the Node.js REPL

. Start `node -i` as a process named `sessions-prepl`, and wait for the `>` prompt.
. In `sessions-prepl`, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
. Close `sessions-prepl`.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Evaluate an expression in the Node.js REPL</title></head>
<body>
<h1>Evaluate an expression in the Node.js REPL</h1>
<ol>
  <li>Start <code>node -i</code> as a process named <code>sessions-prepl</code>, and wait for the <code>&gt;</code> prompt.</li>
  <li>In <code>sessions-prepl</code>, enter <code>40 + 2</code> and press Enter. Wait for the REPL to print <code>42</code>.</li>
  <li>Close <code>sessions-prepl</code>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Evaluate an expression in the Node.js REPL
==========================================

#. Start ``node -i`` as a process named ``sessions-prepl``, and wait for the ``>`` prompt.

#. In ``sessions-prepl``, enter ``40 + 2`` and press Enter. Wait for the REPL to print ``42``.

#. Close ``sessions-prepl``.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-surface-process">
  <title>Evaluate an expression in the Node.js REPL</title>
  <taskbody>
    <steps>
      <step><cmd>Start <codeph>node -i</codeph> as a process named <codeph>sessions-prepl</codeph>, and wait for the <codeph>&gt;</codeph> prompt.</cmd></step>
      <step><cmd>In <codeph>sessions-prepl</codeph>, enter <codeph>40 + 2</codeph> and press Enter. Wait for the REPL to print <codeph>42</codeph>.</cmd></step>
      <step><cmd>Close <codeph>sessions-prepl</codeph>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-surface-process","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]} -->

# Evaluate an expression in the Node.js REPL

1. Start `node -i` as a process named `sessions-prepl`, and wait for the `>` prompt.
   <!-- step {"startSurface":{"process":"node","args":["-i"],"name":"sessions-prepl","waitUntil":{"stdio":"/>/"},"timeout":30000}} -->
2. In `sessions-prepl`, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
   <!-- step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-prepl","waitUntil":{"stdio":"/42/"},"timeout":10000}} -->
3. Close `sessions-prepl`.
   <!-- step {"closeSurface":"sessions-prepl"} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-surface-process","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]} */}

# Evaluate an expression in the Node.js REPL

1. Start `node -i` as a process named `sessions-prepl`, and wait for the `>` prompt.
   {/* step {"startSurface":{"process":"node","args":["-i"],"name":"sessions-prepl","waitUntil":{"stdio":"/>/"},"timeout":30000}} */}
2. In `sessions-prepl`, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
   {/* step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-prepl","waitUntil":{"stdio":"/42/"},"timeout":10000}} */}
3. Close `sessions-prepl`.
   {/* step {"closeSurface":"sessions-prepl"} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Evaluate an expression in the Node.js REPL

// (test {"testId":"sessions-surface-process","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]})

. Start `node -i` as a process named `sessions-prepl`, and wait for the `>` prompt.
+
// (step {"startSurface":{"process":"node","args":["-i"],"name":"sessions-prepl","waitUntil":{"stdio":"/>/"},"timeout":30000}})
. In `sessions-prepl`, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
+
// (step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-prepl","waitUntil":{"stdio":"/42/"},"timeout":10000}})
. Close `sessions-prepl`.
+
// (step {"closeSurface":"sessions-prepl"})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Evaluate an expression in the Node.js REPL</title></head>
<body>
<!-- test {"testId":"sessions-surface-process","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]} -->
<h1>Evaluate an expression in the Node.js REPL</h1>
<ol>
  <li>Start <code>node -i</code> as a process named <code>sessions-prepl</code>, and wait for the <code>&gt;</code> prompt.
    <!-- step {"startSurface":{"process":"node","args":["-i"],"name":"sessions-prepl","waitUntil":{"stdio":"/>/"},"timeout":30000}} --></li>
  <li>In <code>sessions-prepl</code>, enter <code>40 + 2</code> and press Enter. Wait for the REPL to print <code>42</code>.
    <!-- step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-prepl","waitUntil":{"stdio":"/42/"},"timeout":10000}} --></li>
  <li>Close <code>sessions-prepl</code>.
    <!-- step {"closeSurface":"sessions-prepl"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Evaluate an expression in the Node.js REPL
==========================================

.. test {"testId":"sessions-surface-process","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]}

#. Start ``node -i`` as a process named ``sessions-prepl``, and wait for the ``>`` prompt.

   .. step {"startSurface":{"process":"node","args":["-i"],"name":"sessions-prepl","waitUntil":{"stdio":"/>/"},"timeout":30000}}

#. In ``sessions-prepl``, enter ``40 + 2`` and press Enter. Wait for the REPL to print ``42``.

   .. step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-prepl","waitUntil":{"stdio":"/42/"},"timeout":10000}}

#. Close ``sessions-prepl``.

   .. step {"closeSurface":"sessions-prepl"}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-surface-process">
  <title>Evaluate an expression in the Node.js REPL</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-surface-process","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]}'/>
    <steps>
      <step><cmd>Start <codeph>node -i</codeph> as a process named <codeph>sessions-prepl</codeph>, and wait for the <codeph>&gt;</codeph> prompt.</cmd>
        <info><data name="doc-detective" value='step {"startSurface":{"process":"node","args":["-i"],"name":"sessions-prepl","waitUntil":{"stdio":"/>/"},"timeout":30000}}'/></info></step>
      <step><cmd>In <codeph>sessions-prepl</codeph>, enter <codeph>40 + 2</codeph> and press Enter. Wait for the REPL to print <codeph>42</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-prepl","waitUntil":{"stdio":"/42/"},"timeout":10000}}'/></info></step>
      <step><cmd>Close <codeph>sessions-prepl</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"closeSurface":"sessions-prepl"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-surface-process","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]} -->

# Evaluate an expression in the Node.js REPL

1. Start `node -i` as a process named `sessions-prepl`, and wait for the `>` prompt.
   <!-- step {"startSurface":{"process":"node","args":["-i"],"name":"sessions-prepl","waitUntil":{"stdio":"/>/"},"timeout":30000}} -->
2. In `sessions-prepl`, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
   <!-- step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-prepl","waitUntil":{"stdio":"/42/"},"timeout":10000}} -->
3. Close `sessions-prepl`.
   <!-- step {"closeSurface":"sessions-prepl"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-surface-process","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]} */}

# Evaluate an expression in the Node.js REPL

1. Start `node -i` as a process named `sessions-prepl`, and wait for the `>` prompt.
   {/* step {"startSurface":{"process":"node","args":["-i"],"name":"sessions-prepl","waitUntil":{"stdio":"/>/"},"timeout":30000}} */}
2. In `sessions-prepl`, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
   {/* step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-prepl","waitUntil":{"stdio":"/42/"},"timeout":10000}} */}
3. Close `sessions-prepl`.
   {/* step {"closeSurface":"sessions-prepl"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Evaluate an expression in the Node.js REPL

// (test {"testId":"sessions-surface-process","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]})

. Start `node -i` as a process named `sessions-prepl`, and wait for the `>` prompt.
+
// (step {"startSurface":{"process":"node","args":["-i"],"name":"sessions-prepl","waitUntil":{"stdio":"/>/"},"timeout":30000}})
. In `sessions-prepl`, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
+
// (step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-prepl","waitUntil":{"stdio":"/42/"},"timeout":10000}})
. Close `sessions-prepl`.
+
// (step {"closeSurface":"sessions-prepl"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Evaluate an expression in the Node.js REPL</title></head>
<body>
<!-- test {"testId":"sessions-surface-process","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]} -->
<h1>Evaluate an expression in the Node.js REPL</h1>
<ol>
  <li>Start <code>node -i</code> as a process named <code>sessions-prepl</code>, and wait for the <code>&gt;</code> prompt.
    <!-- step {"startSurface":{"process":"node","args":["-i"],"name":"sessions-prepl","waitUntil":{"stdio":"/>/"},"timeout":30000}} --></li>
  <li>In <code>sessions-prepl</code>, enter <code>40 + 2</code> and press Enter. Wait for the REPL to print <code>42</code>.
    <!-- step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-prepl","waitUntil":{"stdio":"/42/"},"timeout":10000}} --></li>
  <li>Close <code>sessions-prepl</code>.
    <!-- step {"closeSurface":"sessions-prepl"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Evaluate an expression in the Node.js REPL
==========================================

.. test {"testId":"sessions-surface-process","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]}

#. Start ``node -i`` as a process named ``sessions-prepl``, and wait for the ``>`` prompt.

   .. step {"startSurface":{"process":"node","args":["-i"],"name":"sessions-prepl","waitUntil":{"stdio":"/>/"},"timeout":30000}}

#. In ``sessions-prepl``, enter ``40 + 2`` and press Enter. Wait for the REPL to print ``42``.

   .. step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-prepl","waitUntil":{"stdio":"/42/"},"timeout":10000}}

#. Close ``sessions-prepl``.

   .. step {"closeSurface":"sessions-prepl"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-surface-process">
  <title>Evaluate an expression in the Node.js REPL</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-surface-process","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]}'/>
    <steps>
      <step><cmd>Start <codeph>node -i</codeph> as a process named <codeph>sessions-prepl</codeph>, and wait for the <codeph>&gt;</codeph> prompt.</cmd>
        <info><data name="doc-detective" value='step {"startSurface":{"process":"node","args":["-i"],"name":"sessions-prepl","waitUntil":{"stdio":"/>/"},"timeout":30000}}'/></info></step>
      <step><cmd>In <codeph>sessions-prepl</codeph>, enter <codeph>40 + 2</codeph> and press Enter. Wait for the REPL to print <codeph>42</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-prepl","waitUntil":{"stdio":"/42/"},"timeout":10000}}'/></info></step>
      <step><cmd>Close <codeph>sessions-prepl</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"closeSurface":"sessions-prepl"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-surface-process",
      "runOn": [
        {
          "platforms": [
            "linux",
            "mac",
            "windows"
          ],
          "requires": "node"
        }
      ],
      "steps": [
        {
          "startSurface": {
            "process": "node",
            "args": [
              "-i"
            ],
            "name": "sessions-prepl",
            "waitUntil": {
              "stdio": "/>/"
            },
            "timeout": 30000
          }
        },
        {
          "type": {
            "keys": [
              "40 + 2",
              "$ENTER$"
            ],
            "surface": "sessions-prepl",
            "waitUntil": {
              "stdio": "/42/"
            },
            "timeout": 10000
          }
        },
        {
          "closeSurface": "sessions-prepl"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-surface-process
    runOn:
      - platforms:
          - linux
          - mac
          - windows
        requires: node
    steps:
      - startSurface:
          process: node
          args:
            - -i
          name: sessions-prepl
          waitUntil:
            stdio: />/
          timeout: 30000
      - type:
          keys:
            - 40 + 2
            - $ENTER$
          surface: sessions-prepl
          waitUntil:
            stdio: /42/
          timeout: 10000
      - closeSurface: sessions-prepl
```

### Array of descriptors, closed by array

**Varies:** `startSurface (array) and closeSurface (array)` · **Value:** `[{ "process": … }, { "process": … }]` · **Effect:** an array starts every surface in one step, and an array closes several at once, by name or by object.

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Compare two Node.js REPLs

1. Start two `node -i` processes, `sessions-pleft` and `sessions-pright`, and wait for both prompts.
2. In `sessions-pleft`, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
3. In `sessions-pright`, enter `6 * 7` and press Enter. Wait for the REPL to print `42`.
4. Close both REPLs.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Compare two Node.js REPLs

1. Start two `node -i` processes, `sessions-pleft` and `sessions-pright`, and wait for both prompts.
2. In `sessions-pleft`, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
3. In `sessions-pright`, enter `6 * 7` and press Enter. Wait for the REPL to print `42`.
4. Close both REPLs.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Compare two Node.js REPLs

. Start two `node -i` processes, `sessions-pleft` and `sessions-pright`, and wait for both prompts.
. In `sessions-pleft`, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
. In `sessions-pright`, enter `6 * 7` and press Enter. Wait for the REPL to print `42`.
. Close both REPLs.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Compare two Node.js REPLs</title></head>
<body>
<h1>Compare two Node.js REPLs</h1>
<ol>
  <li>Start two <code>node -i</code> processes, <code>sessions-pleft</code> and <code>sessions-pright</code>, and wait for both prompts.</li>
  <li>In <code>sessions-pleft</code>, enter <code>40 + 2</code> and press Enter. Wait for the REPL to print <code>42</code>.</li>
  <li>In <code>sessions-pright</code>, enter <code>6 * 7</code> and press Enter. Wait for the REPL to print <code>42</code>.</li>
  <li>Close both REPLs.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Compare two Node.js REPLs
=========================

#. Start two ``node -i`` processes, ``sessions-pleft`` and ``sessions-pright``, and wait for both prompts.

#. In ``sessions-pleft``, enter ``40 + 2`` and press Enter. Wait for the REPL to print ``42``.

#. In ``sessions-pright``, enter ``6 * 7`` and press Enter. Wait for the REPL to print ``42``.

#. Close both REPLs.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-surface-array">
  <title>Compare two Node.js REPLs</title>
  <taskbody>
    <steps>
      <step><cmd>Start two <codeph>node -i</codeph> processes, <codeph>sessions-pleft</codeph> and <codeph>sessions-pright</codeph>, and wait for both prompts.</cmd></step>
      <step><cmd>In <codeph>sessions-pleft</codeph>, enter <codeph>40 + 2</codeph> and press Enter. Wait for the REPL to print <codeph>42</codeph>.</cmd></step>
      <step><cmd>In <codeph>sessions-pright</codeph>, enter <codeph>6 * 7</codeph> and press Enter. Wait for the REPL to print <codeph>42</codeph>.</cmd></step>
      <step><cmd>Close both REPLs.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-surface-array","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]} -->

# Compare two Node.js REPLs

1. Start two `node -i` processes, `sessions-pleft` and `sessions-pright`, and wait for both prompts.
   <!-- step {"startSurface":[{"process":"node","args":["-i"],"name":"sessions-pleft","waitUntil":{"stdio":"/>/"},"timeout":30000},{"process":"node","args":["-i"],"name":"sessions-pright","waitUntil":{"stdio":"/>/"},"timeout":30000}]} -->
2. In `sessions-pleft`, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
   <!-- step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-pleft","waitUntil":{"stdio":"/42/"},"timeout":10000}} -->
3. In `sessions-pright`, enter `6 * 7` and press Enter. Wait for the REPL to print `42`.
   <!-- step {"type":{"keys":["6 * 7","$ENTER$"],"surface":"sessions-pright","waitUntil":{"stdio":"/42/"},"timeout":10000}} -->
4. Close both REPLs.
   <!-- step {"closeSurface":["sessions-pleft",{"process":"sessions-pright"}]} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-surface-array","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]} */}

# Compare two Node.js REPLs

1. Start two `node -i` processes, `sessions-pleft` and `sessions-pright`, and wait for both prompts.
   {/* step {"startSurface":[{"process":"node","args":["-i"],"name":"sessions-pleft","waitUntil":{"stdio":"/>/"},"timeout":30000},{"process":"node","args":["-i"],"name":"sessions-pright","waitUntil":{"stdio":"/>/"},"timeout":30000}]} */}
2. In `sessions-pleft`, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
   {/* step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-pleft","waitUntil":{"stdio":"/42/"},"timeout":10000}} */}
3. In `sessions-pright`, enter `6 * 7` and press Enter. Wait for the REPL to print `42`.
   {/* step {"type":{"keys":["6 * 7","$ENTER$"],"surface":"sessions-pright","waitUntil":{"stdio":"/42/"},"timeout":10000}} */}
4. Close both REPLs.
   {/* step {"closeSurface":["sessions-pleft",{"process":"sessions-pright"}]} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Compare two Node.js REPLs

// (test {"testId":"sessions-surface-array","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]})

. Start two `node -i` processes, `sessions-pleft` and `sessions-pright`, and wait for both prompts.
+
// (step {"startSurface":[{"process":"node","args":["-i"],"name":"sessions-pleft","waitUntil":{"stdio":"/>/"},"timeout":30000},{"process":"node","args":["-i"],"name":"sessions-pright","waitUntil":{"stdio":"/>/"},"timeout":30000}]})
. In `sessions-pleft`, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
+
// (step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-pleft","waitUntil":{"stdio":"/42/"},"timeout":10000}})
. In `sessions-pright`, enter `6 * 7` and press Enter. Wait for the REPL to print `42`.
+
// (step {"type":{"keys":["6 * 7","$ENTER$"],"surface":"sessions-pright","waitUntil":{"stdio":"/42/"},"timeout":10000}})
. Close both REPLs.
+
// (step {"closeSurface":["sessions-pleft",{"process":"sessions-pright"}]})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Compare two Node.js REPLs</title></head>
<body>
<!-- test {"testId":"sessions-surface-array","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]} -->
<h1>Compare two Node.js REPLs</h1>
<ol>
  <li>Start two <code>node -i</code> processes, <code>sessions-pleft</code> and <code>sessions-pright</code>, and wait for both prompts.
    <!-- step {"startSurface":[{"process":"node","args":["-i"],"name":"sessions-pleft","waitUntil":{"stdio":"/>/"},"timeout":30000},{"process":"node","args":["-i"],"name":"sessions-pright","waitUntil":{"stdio":"/>/"},"timeout":30000}]} --></li>
  <li>In <code>sessions-pleft</code>, enter <code>40 + 2</code> and press Enter. Wait for the REPL to print <code>42</code>.
    <!-- step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-pleft","waitUntil":{"stdio":"/42/"},"timeout":10000}} --></li>
  <li>In <code>sessions-pright</code>, enter <code>6 * 7</code> and press Enter. Wait for the REPL to print <code>42</code>.
    <!-- step {"type":{"keys":["6 * 7","$ENTER$"],"surface":"sessions-pright","waitUntil":{"stdio":"/42/"},"timeout":10000}} --></li>
  <li>Close both REPLs.
    <!-- step {"closeSurface":["sessions-pleft",{"process":"sessions-pright"}]} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Compare two Node.js REPLs
=========================

.. test {"testId":"sessions-surface-array","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]}

#. Start two ``node -i`` processes, ``sessions-pleft`` and ``sessions-pright``, and wait for both prompts.

   .. step {"startSurface":[{"process":"node","args":["-i"],"name":"sessions-pleft","waitUntil":{"stdio":"/>/"},"timeout":30000},{"process":"node","args":["-i"],"name":"sessions-pright","waitUntil":{"stdio":"/>/"},"timeout":30000}]}

#. In ``sessions-pleft``, enter ``40 + 2`` and press Enter. Wait for the REPL to print ``42``.

   .. step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-pleft","waitUntil":{"stdio":"/42/"},"timeout":10000}}

#. In ``sessions-pright``, enter ``6 * 7`` and press Enter. Wait for the REPL to print ``42``.

   .. step {"type":{"keys":["6 * 7","$ENTER$"],"surface":"sessions-pright","waitUntil":{"stdio":"/42/"},"timeout":10000}}

#. Close both REPLs.

   .. step {"closeSurface":["sessions-pleft",{"process":"sessions-pright"}]}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-surface-array">
  <title>Compare two Node.js REPLs</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-surface-array","detectSteps":true,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]}'/>
    <steps>
      <step><cmd>Start two <codeph>node -i</codeph> processes, <codeph>sessions-pleft</codeph> and <codeph>sessions-pright</codeph>, and wait for both prompts.</cmd>
        <info><data name="doc-detective" value='step {"startSurface":[{"process":"node","args":["-i"],"name":"sessions-pleft","waitUntil":{"stdio":"/>/"},"timeout":30000},{"process":"node","args":["-i"],"name":"sessions-pright","waitUntil":{"stdio":"/>/"},"timeout":30000}]}'/></info></step>
      <step><cmd>In <codeph>sessions-pleft</codeph>, enter <codeph>40 + 2</codeph> and press Enter. Wait for the REPL to print <codeph>42</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-pleft","waitUntil":{"stdio":"/42/"},"timeout":10000}}'/></info></step>
      <step><cmd>In <codeph>sessions-pright</codeph>, enter <codeph>6 * 7</codeph> and press Enter. Wait for the REPL to print <codeph>42</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"type":{"keys":["6 * 7","$ENTER$"],"surface":"sessions-pright","waitUntil":{"stdio":"/42/"},"timeout":10000}}'/></info></step>
      <step><cmd>Close both REPLs.</cmd>
        <info><data name="doc-detective" value='step {"closeSurface":["sessions-pleft",{"process":"sessions-pright"}]}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-surface-array","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]} -->

# Compare two Node.js REPLs

1. Start two `node -i` processes, `sessions-pleft` and `sessions-pright`, and wait for both prompts.
   <!-- step {"startSurface":[{"process":"node","args":["-i"],"name":"sessions-pleft","waitUntil":{"stdio":"/>/"},"timeout":30000},{"process":"node","args":["-i"],"name":"sessions-pright","waitUntil":{"stdio":"/>/"},"timeout":30000}]} -->
2. In `sessions-pleft`, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
   <!-- step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-pleft","waitUntil":{"stdio":"/42/"},"timeout":10000}} -->
3. In `sessions-pright`, enter `6 * 7` and press Enter. Wait for the REPL to print `42`.
   <!-- step {"type":{"keys":["6 * 7","$ENTER$"],"surface":"sessions-pright","waitUntil":{"stdio":"/42/"},"timeout":10000}} -->
4. Close both REPLs.
   <!-- step {"closeSurface":["sessions-pleft",{"process":"sessions-pright"}]} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-surface-array","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]} */}

# Compare two Node.js REPLs

1. Start two `node -i` processes, `sessions-pleft` and `sessions-pright`, and wait for both prompts.
   {/* step {"startSurface":[{"process":"node","args":["-i"],"name":"sessions-pleft","waitUntil":{"stdio":"/>/"},"timeout":30000},{"process":"node","args":["-i"],"name":"sessions-pright","waitUntil":{"stdio":"/>/"},"timeout":30000}]} */}
2. In `sessions-pleft`, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
   {/* step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-pleft","waitUntil":{"stdio":"/42/"},"timeout":10000}} */}
3. In `sessions-pright`, enter `6 * 7` and press Enter. Wait for the REPL to print `42`.
   {/* step {"type":{"keys":["6 * 7","$ENTER$"],"surface":"sessions-pright","waitUntil":{"stdio":"/42/"},"timeout":10000}} */}
4. Close both REPLs.
   {/* step {"closeSurface":["sessions-pleft",{"process":"sessions-pright"}]} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Compare two Node.js REPLs

// (test {"testId":"sessions-surface-array","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]})

. Start two `node -i` processes, `sessions-pleft` and `sessions-pright`, and wait for both prompts.
+
// (step {"startSurface":[{"process":"node","args":["-i"],"name":"sessions-pleft","waitUntil":{"stdio":"/>/"},"timeout":30000},{"process":"node","args":["-i"],"name":"sessions-pright","waitUntil":{"stdio":"/>/"},"timeout":30000}]})
. In `sessions-pleft`, enter `40 + 2` and press Enter. Wait for the REPL to print `42`.
+
// (step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-pleft","waitUntil":{"stdio":"/42/"},"timeout":10000}})
. In `sessions-pright`, enter `6 * 7` and press Enter. Wait for the REPL to print `42`.
+
// (step {"type":{"keys":["6 * 7","$ENTER$"],"surface":"sessions-pright","waitUntil":{"stdio":"/42/"},"timeout":10000}})
. Close both REPLs.
+
// (step {"closeSurface":["sessions-pleft",{"process":"sessions-pright"}]})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Compare two Node.js REPLs</title></head>
<body>
<!-- test {"testId":"sessions-surface-array","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]} -->
<h1>Compare two Node.js REPLs</h1>
<ol>
  <li>Start two <code>node -i</code> processes, <code>sessions-pleft</code> and <code>sessions-pright</code>, and wait for both prompts.
    <!-- step {"startSurface":[{"process":"node","args":["-i"],"name":"sessions-pleft","waitUntil":{"stdio":"/>/"},"timeout":30000},{"process":"node","args":["-i"],"name":"sessions-pright","waitUntil":{"stdio":"/>/"},"timeout":30000}]} --></li>
  <li>In <code>sessions-pleft</code>, enter <code>40 + 2</code> and press Enter. Wait for the REPL to print <code>42</code>.
    <!-- step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-pleft","waitUntil":{"stdio":"/42/"},"timeout":10000}} --></li>
  <li>In <code>sessions-pright</code>, enter <code>6 * 7</code> and press Enter. Wait for the REPL to print <code>42</code>.
    <!-- step {"type":{"keys":["6 * 7","$ENTER$"],"surface":"sessions-pright","waitUntil":{"stdio":"/42/"},"timeout":10000}} --></li>
  <li>Close both REPLs.
    <!-- step {"closeSurface":["sessions-pleft",{"process":"sessions-pright"}]} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Compare two Node.js REPLs
=========================

.. test {"testId":"sessions-surface-array","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]}

#. Start two ``node -i`` processes, ``sessions-pleft`` and ``sessions-pright``, and wait for both prompts.

   .. step {"startSurface":[{"process":"node","args":["-i"],"name":"sessions-pleft","waitUntil":{"stdio":"/>/"},"timeout":30000},{"process":"node","args":["-i"],"name":"sessions-pright","waitUntil":{"stdio":"/>/"},"timeout":30000}]}

#. In ``sessions-pleft``, enter ``40 + 2`` and press Enter. Wait for the REPL to print ``42``.

   .. step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-pleft","waitUntil":{"stdio":"/42/"},"timeout":10000}}

#. In ``sessions-pright``, enter ``6 * 7`` and press Enter. Wait for the REPL to print ``42``.

   .. step {"type":{"keys":["6 * 7","$ENTER$"],"surface":"sessions-pright","waitUntil":{"stdio":"/42/"},"timeout":10000}}

#. Close both REPLs.

   .. step {"closeSurface":["sessions-pleft",{"process":"sessions-pright"}]}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-surface-array">
  <title>Compare two Node.js REPLs</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-surface-array","detectSteps":false,"runOn":[{"platforms":["linux","mac","windows"],"requires":"node"}]}'/>
    <steps>
      <step><cmd>Start two <codeph>node -i</codeph> processes, <codeph>sessions-pleft</codeph> and <codeph>sessions-pright</codeph>, and wait for both prompts.</cmd>
        <info><data name="doc-detective" value='step {"startSurface":[{"process":"node","args":["-i"],"name":"sessions-pleft","waitUntil":{"stdio":"/>/"},"timeout":30000},{"process":"node","args":["-i"],"name":"sessions-pright","waitUntil":{"stdio":"/>/"},"timeout":30000}]}'/></info></step>
      <step><cmd>In <codeph>sessions-pleft</codeph>, enter <codeph>40 + 2</codeph> and press Enter. Wait for the REPL to print <codeph>42</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"type":{"keys":["40 + 2","$ENTER$"],"surface":"sessions-pleft","waitUntil":{"stdio":"/42/"},"timeout":10000}}'/></info></step>
      <step><cmd>In <codeph>sessions-pright</codeph>, enter <codeph>6 * 7</codeph> and press Enter. Wait for the REPL to print <codeph>42</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"type":{"keys":["6 * 7","$ENTER$"],"surface":"sessions-pright","waitUntil":{"stdio":"/42/"},"timeout":10000}}'/></info></step>
      <step><cmd>Close both REPLs.</cmd>
        <info><data name="doc-detective" value='step {"closeSurface":["sessions-pleft",{"process":"sessions-pright"}]}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-surface-array",
      "runOn": [
        {
          "platforms": [
            "linux",
            "mac",
            "windows"
          ],
          "requires": "node"
        }
      ],
      "steps": [
        {
          "startSurface": [
            {
              "process": "node",
              "args": [
                "-i"
              ],
              "name": "sessions-pleft",
              "waitUntil": {
                "stdio": "/>/"
              },
              "timeout": 30000
            },
            {
              "process": "node",
              "args": [
                "-i"
              ],
              "name": "sessions-pright",
              "waitUntil": {
                "stdio": "/>/"
              },
              "timeout": 30000
            }
          ]
        },
        {
          "type": {
            "keys": [
              "40 + 2",
              "$ENTER$"
            ],
            "surface": "sessions-pleft",
            "waitUntil": {
              "stdio": "/42/"
            },
            "timeout": 10000
          }
        },
        {
          "type": {
            "keys": [
              "6 * 7",
              "$ENTER$"
            ],
            "surface": "sessions-pright",
            "waitUntil": {
              "stdio": "/42/"
            },
            "timeout": 10000
          }
        },
        {
          "closeSurface": [
            "sessions-pleft",
            {
              "process": "sessions-pright"
            }
          ]
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-surface-array
    runOn:
      - platforms:
          - linux
          - mac
          - windows
        requires: node
    steps:
      - startSurface:
          - process: node
            args:
              - -i
            name: sessions-pleft
            waitUntil:
              stdio: />/
            timeout: 30000
          - process: node
            args:
              - -i
            name: sessions-pright
            waitUntil:
              stdio: />/
            timeout: 30000
      - type:
          keys:
            - 40 + 2
            - $ENTER$
          surface: sessions-pleft
          waitUntil:
            stdio: /42/
          timeout: 10000
      - type:
          keys:
            - 6 * 7
            - $ENTER$
          surface: sessions-pright
          waitUntil:
            stdio: /42/
          timeout: 10000
      - closeSurface:
          - sessions-pleft
          - process: sessions-pright
```

## Config `origin` and `originParams` permutations

### `"origin": "http://localhost:8092"`

**Varies:** `config.origin` · **Value:** `"http://localhost:8092"` · **Effect:** steps can give a path, and the config supplies the scheme and host.

The example's own `doc-detective.json` sets:

**`doc-detective.json`**

```json title="doc-detective.json"
{
  "origin": "http://localhost:8092"
}
```

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Open a page by its path

1. Go to `/multi-tab.html` on the site.
2. Check that the page reads "MULTI-TAB HOME".
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Open a page by its path

1. Go to `/multi-tab.html` on the site.
2. Check that the page reads "MULTI-TAB HOME".
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Open a page by its path

. Go to `/multi-tab.html` on the site.
. Check that the page reads "MULTI-TAB HOME".
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Open a page by its path</title></head>
<body>
<h1>Open a page by its path</h1>
<ol>
  <li>Go to <code>/multi-tab.html</code> on the site.</li>
  <li>Check that the page reads "MULTI-TAB HOME".</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Open a page by its path
=======================

#. Go to ``/multi-tab.html`` on the site.

#. Check that the page reads "MULTI-TAB HOME".
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-config-origin">
  <title>Open a page by its path</title>
  <taskbody>
    <steps>
      <step><cmd>Go to <codeph>/multi-tab.html</codeph> on the site.</cmd></step>
      <step><cmd>Check that the page reads "MULTI-TAB HOME".</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-config-origin","detectSteps":true} -->

# Open a page by its path

1. Go to `/multi-tab.html` on the site.
   <!-- step {"goTo":"/multi-tab.html"} -->
2. Check that the page reads "MULTI-TAB HOME".
   <!-- step {"find":"MULTI-TAB HOME"} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-config-origin","detectSteps":true} */}

# Open a page by its path

1. Go to `/multi-tab.html` on the site.
   {/* step {"goTo":"/multi-tab.html"} */}
2. Check that the page reads "MULTI-TAB HOME".
   {/* step {"find":"MULTI-TAB HOME"} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Open a page by its path

// (test {"testId":"sessions-config-origin","detectSteps":true})

. Go to `/multi-tab.html` on the site.
+
// (step {"goTo":"/multi-tab.html"})
. Check that the page reads "MULTI-TAB HOME".
+
// (step {"find":"MULTI-TAB HOME"})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Open a page by its path</title></head>
<body>
<!-- test {"testId":"sessions-config-origin","detectSteps":true} -->
<h1>Open a page by its path</h1>
<ol>
  <li>Go to <code>/multi-tab.html</code> on the site.
    <!-- step {"goTo":"/multi-tab.html"} --></li>
  <li>Check that the page reads "MULTI-TAB HOME".
    <!-- step {"find":"MULTI-TAB HOME"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Open a page by its path
=======================

.. test {"testId":"sessions-config-origin","detectSteps":true}

#. Go to ``/multi-tab.html`` on the site.

   .. step {"goTo":"/multi-tab.html"}

#. Check that the page reads "MULTI-TAB HOME".

   .. step {"find":"MULTI-TAB HOME"}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-config-origin">
  <title>Open a page by its path</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-config-origin","detectSteps":true}'/>
    <steps>
      <step><cmd>Go to <codeph>/multi-tab.html</codeph> on the site.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page reads "MULTI-TAB HOME".</cmd>
        <info><data name="doc-detective" value='step {"find":"MULTI-TAB HOME"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-config-origin","detectSteps":false} -->

# Open a page by its path

1. Go to `/multi-tab.html` on the site.
   <!-- step {"goTo":"/multi-tab.html"} -->
2. Check that the page reads "MULTI-TAB HOME".
   <!-- step {"find":"MULTI-TAB HOME"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-config-origin","detectSteps":false} */}

# Open a page by its path

1. Go to `/multi-tab.html` on the site.
   {/* step {"goTo":"/multi-tab.html"} */}
2. Check that the page reads "MULTI-TAB HOME".
   {/* step {"find":"MULTI-TAB HOME"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Open a page by its path

// (test {"testId":"sessions-config-origin","detectSteps":false})

. Go to `/multi-tab.html` on the site.
+
// (step {"goTo":"/multi-tab.html"})
. Check that the page reads "MULTI-TAB HOME".
+
// (step {"find":"MULTI-TAB HOME"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Open a page by its path</title></head>
<body>
<!-- test {"testId":"sessions-config-origin","detectSteps":false} -->
<h1>Open a page by its path</h1>
<ol>
  <li>Go to <code>/multi-tab.html</code> on the site.
    <!-- step {"goTo":"/multi-tab.html"} --></li>
  <li>Check that the page reads "MULTI-TAB HOME".
    <!-- step {"find":"MULTI-TAB HOME"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Open a page by its path
=======================

.. test {"testId":"sessions-config-origin","detectSteps":false}

#. Go to ``/multi-tab.html`` on the site.

   .. step {"goTo":"/multi-tab.html"}

#. Check that the page reads "MULTI-TAB HOME".

   .. step {"find":"MULTI-TAB HOME"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-config-origin">
  <title>Open a page by its path</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-config-origin","detectSteps":false}'/>
    <steps>
      <step><cmd>Go to <codeph>/multi-tab.html</codeph> on the site.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"/multi-tab.html"}'/></info></step>
      <step><cmd>Check that the page reads "MULTI-TAB HOME".</cmd>
        <info><data name="doc-detective" value='step {"find":"MULTI-TAB HOME"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-config-origin",
      "steps": [
        {
          "goTo": "/multi-tab.html"
        },
        {
          "find": "MULTI-TAB HOME"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-config-origin
    steps:
      - goTo: /multi-tab.html
      - find: MULTI-TAB HOME
```

### `"originParams": { "from": "docs" }`

**Varies:** `config.originParams` · **Value:** `{ "from": "docs" }` · **Effect:** every URL built from `origin` gets the query parameters, so the echo endpoint returns `from=docs`.

The example's own `doc-detective.json` sets:

**`doc-detective.json`**

```json title="doc-detective.json"
{
  "origin": "http://localhost:8092",
  "originParams": {
    "from": "docs"
  }
}
```

#### Prose

#### Markdown

**`prose.md`**

```markdown title="prose.md"
# Tag every request with a query parameter

1. Go to `/api/echo` on the site.
2. Check that the response echoes `"from":"docs"`.
```

#### MDX

**`prose.mdx`**

```mdx title="prose.mdx"
# Tag every request with a query parameter

1. Go to `/api/echo` on the site.
2. Check that the response echoes `"from":"docs"`.
```

#### AsciiDoc

**`prose.adoc`**

```asciidoc title="prose.adoc"
= Tag every request with a query parameter

. Go to `/api/echo` on the site.
. Check that the response echoes `"from":"docs"`.
```

#### HTML

**`prose.html`**

```html title="prose.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Tag every request with a query parameter</title></head>
<body>
<h1>Tag every request with a query parameter</h1>
<ol>
  <li>Go to <code>/api/echo</code> on the site.</li>
  <li>Check that the response echoes <code>"from":"docs"</code>.</li>
</ol>
</body>
</html>
```

#### reStructuredText

**`prose.rst`**

```rst title="prose.rst"
Tag every request with a query parameter
========================================

#. Go to ``/api/echo`` on the site.

#. Check that the response echoes ``"from":"docs"``.
```

#### DITA

**`prose.dita`**

```xml title="prose.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-config-originparams">
  <title>Tag every request with a query parameter</title>
  <taskbody>
    <steps>
      <step><cmd>Go to <codeph>/api/echo</codeph> on the site.</cmd></step>
      <step><cmd>Check that the response echoes <codeph>"from":"docs"</codeph>.</cmd></step>
    </steps>
  </taskbody>
</task>
```

#### Detected

#### Markdown

**`detected.md`**

```markdown title="detected.md"
<!-- test {"testId":"sessions-config-originparams","detectSteps":true,"runOn":[{"browsers":"chrome"}]} -->

# Tag every request with a query parameter

1. Go to `/api/echo` on the site.
   <!-- step {"goTo":"/api/echo"} -->
2. Check that the response echoes `"from":"docs"`.
   <!-- step {"find":"/\"from\":\"docs\"/"} -->

<!-- test end -->
```

#### MDX

**`detected.mdx`**

```mdx title="detected.mdx"
{/* test {"testId":"sessions-config-originparams","detectSteps":true,"runOn":[{"browsers":"chrome"}]} */}

# Tag every request with a query parameter

1. Go to `/api/echo` on the site.
   {/* step {"goTo":"/api/echo"} */}
2. Check that the response echoes `"from":"docs"`.
   {/* step {"find":"/\"from\":\"docs\"/"} */}

{/* test end */}
```

#### AsciiDoc

**`detected.adoc`**

```asciidoc title="detected.adoc"
= Tag every request with a query parameter

// (test {"testId":"sessions-config-originparams","detectSteps":true,"runOn":[{"browsers":"chrome"}]})

. Go to `/api/echo` on the site.
+
// (step {"goTo":"/api/echo"})
. Check that the response echoes `"from":"docs"`.
+
// (step {"find":"/\"from\":\"docs\"/"})

// (test end)
```

#### HTML

**`detected.html`**

```html title="detected.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Tag every request with a query parameter</title></head>
<body>
<!-- test {"testId":"sessions-config-originparams","detectSteps":true,"runOn":[{"browsers":"chrome"}]} -->
<h1>Tag every request with a query parameter</h1>
<ol>
  <li>Go to <code>/api/echo</code> on the site.
    <!-- step {"goTo":"/api/echo"} --></li>
  <li>Check that the response echoes <code>"from":"docs"</code>.
    <!-- step {"find":"/\"from\":\"docs\"/"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`detected.rst`**

```rst title="detected.rst"
Tag every request with a query parameter
========================================

.. test {"testId":"sessions-config-originparams","detectSteps":true,"runOn":[{"browsers":"chrome"}]}

#. Go to ``/api/echo`` on the site.

   .. step {"goTo":"/api/echo"}

#. Check that the response echoes ``"from":"docs"``.

   .. step {"find":"/\"from\":\"docs\"/"}

.. test end
```

#### DITA

**`detected.dita`**

```xml title="detected.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-config-originparams">
  <title>Tag every request with a query parameter</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-config-originparams","detectSteps":true,"runOn":[{"browsers":"chrome"}]}'/>
    <steps>
      <step><cmd>Go to <codeph>/api/echo</codeph> on the site.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"/api/echo"}'/></info></step>
      <step><cmd>Check that the response echoes <codeph>"from":"docs"</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"find":"/\"from\":\"docs\"/"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Inline

#### Markdown

**`inline.md`**

```markdown title="inline.md"
<!-- test {"testId":"sessions-config-originparams","detectSteps":false,"runOn":[{"browsers":"chrome"}]} -->

# Tag every request with a query parameter

1. Go to `/api/echo` on the site.
   <!-- step {"goTo":"/api/echo"} -->
2. Check that the response echoes `"from":"docs"`.
   <!-- step {"find":"/\"from\":\"docs\"/"} -->

<!-- test end -->
```

#### MDX

**`inline.mdx`**

```mdx title="inline.mdx"
{/* test {"testId":"sessions-config-originparams","detectSteps":false,"runOn":[{"browsers":"chrome"}]} */}

# Tag every request with a query parameter

1. Go to `/api/echo` on the site.
   {/* step {"goTo":"/api/echo"} */}
2. Check that the response echoes `"from":"docs"`.
   {/* step {"find":"/\"from\":\"docs\"/"} */}

{/* test end */}
```

#### AsciiDoc

**`inline.adoc`**

```asciidoc title="inline.adoc"
= Tag every request with a query parameter

// (test {"testId":"sessions-config-originparams","detectSteps":false,"runOn":[{"browsers":"chrome"}]})

. Go to `/api/echo` on the site.
+
// (step {"goTo":"/api/echo"})
. Check that the response echoes `"from":"docs"`.
+
// (step {"find":"/\"from\":\"docs\"/"})

// (test end)
```

#### HTML

**`inline.html`**

```html title="inline.html"
<!DOCTYPE html>
<html lang="en">
<head><title>Tag every request with a query parameter</title></head>
<body>
<!-- test {"testId":"sessions-config-originparams","detectSteps":false,"runOn":[{"browsers":"chrome"}]} -->
<h1>Tag every request with a query parameter</h1>
<ol>
  <li>Go to <code>/api/echo</code> on the site.
    <!-- step {"goTo":"/api/echo"} --></li>
  <li>Check that the response echoes <code>"from":"docs"</code>.
    <!-- step {"find":"/\"from\":\"docs\"/"} --></li>
</ol>
<!-- test end -->
</body>
</html>
```

#### reStructuredText

**`inline.rst`**

```rst title="inline.rst"
Tag every request with a query parameter
========================================

.. test {"testId":"sessions-config-originparams","detectSteps":false,"runOn":[{"browsers":"chrome"}]}

#. Go to ``/api/echo`` on the site.

   .. step {"goTo":"/api/echo"}

#. Check that the response echoes ``"from":"docs"``.

   .. step {"find":"/\"from\":\"docs\"/"}

.. test end
```

#### DITA

**`inline.dita`**

```xml title="inline.dita"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="sessions-config-originparams">
  <title>Tag every request with a query parameter</title>
  <taskbody>
    <data name="doc-detective" value='test {"testId":"sessions-config-originparams","detectSteps":false,"runOn":[{"browsers":"chrome"}]}'/>
    <steps>
      <step><cmd>Go to <codeph>/api/echo</codeph> on the site.</cmd>
        <info><data name="doc-detective" value='step {"goTo":"/api/echo"}'/></info></step>
      <step><cmd>Check that the response echoes <codeph>"from":"docs"</codeph>.</cmd>
        <info><data name="doc-detective" value='step {"find":"/\"from\":\"docs\"/"}'/></info></step>
    </steps>
    <data name="doc-detective" value="test end"/>
  </taskbody>
</task>
```

#### Standalone

#### JSON

**`standalone.spec.json`**

```json title="standalone.spec.json"
{
  "$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json",
  "tests": [
    {
      "testId": "sessions-config-originparams",
      "runOn": [
        {
          "browsers": "chrome"
        }
      ],
      "steps": [
        {
          "goTo": "/api/echo"
        },
        {
          "find": "/\"from\":\"docs\"/"
        }
      ]
    }
  ]
}
```

#### YAML

**`standalone.spec.yaml`**

```yaml title="standalone.spec.yaml"
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json
tests:
  - testId: sessions-config-originparams
    runOn:
      - browsers: chrome
    steps:
      - goTo: /api/echo
      - find: /"from":"docs"/
```