Skip to content

Commit 7f7b1fc

Browse files
Fix outputs of code not visible in Guide (#325)
* fix issue #4327: Outputs of code not visible in Guide * Few refactors. --------- Co-authored-by: Priyansh Garg <[email protected]>
1 parent cc5d6d7 commit 7f7b1fc

File tree

8 files changed

+40
-55
lines changed

8 files changed

+40
-55
lines changed

docs/guide/ci-integrations/run-nightwatch-on-jenkins.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,10 @@ In order to run your tests on BrowserStack from Jenkins, setup the environment v
5656

5757
Setup the following 2 environment variables
5858

59-
```
60-
61-
BROWSERSTACK_USERNAME
59+
<pre class="hide-indicator"><code class="language-bash">BROWSERSTACK_USERNAME
6260
BROWSERSTACK_ACCESS_KEY
61+
</code></pre>
6362

64-
```
6563

6664
![Jenkins BrowserStack](https://user-images.githubusercontent.com/1677755/177569029-da96b37d-6377-404f-9562-315d0694997d.png)
6765

docs/guide/concepts/test-globals.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,8 @@ Pass the `--env integration` option to the runner:
202202

203203
Then our globals object will look like:
204204

205-
```
206-
myGlobalVar is: "integrated global"
207-
```
205+
<pre class="hide-indicator"><code class="language-bash">myGlobalVar is: "integrated global"
206+
</code></pre>
208207

209208
### Recommended content
210209
- [Use external globals in tests](/guide/writing-tests/using-test-globals.html)

docs/guide/configuration/define-test-environments.md

+8-9
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ Test environments are referenced using the `--env` cli argument. Since we only h
4949

5050
<pre class="language-bash"><code class="language-bash">npx nightwatch --env chrome-local</code></pre>
5151

52-
```
53-
~/workspace/test-project % npx nightwatch --env chrome-local
54-
52+
<pre class="hide-indicator">
53+
<code class="language-bash">
5554
┌──────────────────────────────────────────────────────────────────┐
5655
│ │
5756
│ Error: Invalid testing environment specified: chrome-local. │
@@ -61,7 +60,8 @@ Test environments are referenced using the `--env` cli argument. Since we only h
6160
│ │
6261
│ │
6362
└──────────────────────────────────────────────────────────────────┘
64-
```
63+
</code>
64+
</pre>
6565

6666
### Define a new "chrome-local" environment
6767

@@ -107,21 +107,20 @@ Run the sample and pass the `--env chrome-local` argument:
107107
<pre class="language-bash"><code class="language-bash">npx nightwatch --env chrome-local</code></pre>
108108

109109
The output will look a bit like this:
110-
111-
```
112-
[sample nightwatch test] Test Suite
110+
<pre class="hide-indicator"><code class="language-bash">[sample nightwatch test] Test Suite
113111
──────────────────────────────────────────────────────────────────────
114112
ℹ Connected to ChromeDriver on port 9515 (844ms).
115113
Using: chrome (101.0.4951.64) on MAC OS X.
116114

117115

118116
Running opens the browser and checks for input:
119-
────────────────────────────────────────────────────────────────────────────────────────────────────────────────
117+
──────────────────────────────────────────────────────────────────────
120118
ℹ Loaded url https://home.cern in 5531ms
121119
✔ Testing if the page title equals 'Home | CERN' (6ms)
122120

123121
OK. 1 assertions passed. (5.604s)
124-
```
122+
</code>
123+
</pre>
125124

126125
### Recommended content
127126
- [Concepts > Test environments](/guide/concepts/test-environments.html)

docs/guide/network-requests/capture-network-calls.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ All you need to do is call the `browser.captureNetworkRequests()` command with t
7272

7373
Output from one of the network calls in the example above:
7474

75-
```
76-
Running Capture network calls:
75+
<pre class="hide-indicator"><code class="language-bash">Running Capture network calls:
7776
───────────────────────────────────────────────────────────────────────────────────────────────────
7877
Request Number: 35
7978
Request URL: https://www.google.com/favicon.ico
@@ -94,7 +93,7 @@ Request headers: {
9493
'sec-ch-ua-model': '',
9594
'sec-ch-ua-platform': '"macOS"'
9695
}
97-
```
96+
</code></pre>
9897

9998
### Recommended content
10099
- [Chrome DevTools Protocol in Selenium 4](https://www.selenium.dev/documentation/webdriver/bidirectional/chrome_devtools/)

docs/guide/reporters/use-json-reporter.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@ Refer to the [Configuration > Output settings](/guide/configuration/customising-
2323
#### Via the CLI
2424
You can also configure the output folder at runtime via the CLI, using the `--output` flag :
2525

26-
```javascript
27-
module.exports = {
28-
output_folder: 'tests_output'
26+
<pre data-language="javascript"><code class="language-javascript">module.exports = {
27+
output_folder: 'tests_output'
2928
}
30-
```
31-
29+
</code></pre>
3230

3331
<pre class="language-bash"><code class="language-bash">nightwatch --output ./tests-output</code></pre>
3432

docs/guide/reporters/use-junit-reporter.md

+15-23
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,9 @@ Refer to the [CLI reference page](/guide/nightwatch-cli/command-line-options.htm
3434

3535
The XML file name follows the pattern:
3636

37-
<div class="hide-indicator"><pre>
38-
39-
```
40-
<BROWSER>_<VERSION>__<testSuiteFileName>.xml
41-
```
42-
43-
</pre></div>
37+
<pre class="hide-indicator">
38+
<code class="language-bash">&lt;BROWSER&gt;_&lt;VERSION&gt;__&lt;testSuiteFileName&gt;.xml
39+
</code></pre>
4440

4541
### Example
4642

@@ -87,27 +83,23 @@ To generate both the built-in JUnit-XML and HTML reports, run the following comm
8783

8884
The JUnit XML report should have been generated in the local `tests_output` folder inside the current project directory. It will look something like this:
8985

90-
<div class="hide-indicator"><pre>
91-
92-
```
93-
<?xml version="1.0" encoding="UTF-8" ?>
94-
<testsuites errors="0"
86+
<pre class="language-xml hide-indicator">
87+
<code class ="language-xml">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
88+
&lt;testsuites errors="0"
9589
failures="0"
96-
tests="1">
90+
tests="1"&gt;
9791

98-
<testsuite name="duckDuckGo"
92+
&lt;testsuite name="duckDuckGo"
9993
errors="0" failures="0" hostname="" id="" package="duckDuckGo" skipped="0"
100-
tests="1" time="2.007" timestamp="">
101-
102-
<testcase name="Search Nightwatch.js and check results" classname="duckDuckGo" time="2.007" assertions="3">
103-
</testcase>
104-
</testsuite>
94+
tests="1" time="2.007" timestamp=""&gt;
95+
96+
&lt;testcase name="Search Nightwatch.js and check results" classname="duckDuckGo" time="2.007" assertions="3">
97+
&lt;/testcase&gt;
10598

106-
</testsuites>
107-
</pre>
108-
```
99+
&lt;/testsuite&gt;
109100

110-
</pre></div>
101+
&lt;/testsuites&gt;
102+
</code></pre>
111103

112104
### Jenkins integration
113105
JUnit-formatted XML output integrates by default into Jenkins via the "Publish JUnit test result report" Post-build Action.

docs/guide/running-tests/capture-console-messages.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,11 @@ All you need to do is call the `browser.captureBrowserConsoleLogs()` command wit
7474

7575
Output of the example above:
7676

77-
```
78-
Running Capture console messages:
79-
───────────────────────────────────────────────────────────────────────────────────────────────────
77+
<pre class="hide-indicator"><code class="language-bash">Running Capture console messages:
78+
─────────────────────────────────────────────────────────────────────────────────
8079
error 2022-06-10T13:38:22.082Z here
8180
No assertions ran.
82-
```
81+
</code></pre>
8382

8483
### Recommended content
8584
- [Capture Browser JS Exceptions](/guide/running-tests/catch-js-exceptions.html)

docs/guide/running-tests/catch-js-exceptions.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,8 @@ Use the `browser.captureBrowserExceptions()` command with the required parameter
6767

6868
Output of the example above:
6969

70-
```
71-
Running captureBrowserExceptions():
72-
───────────────────────────────────────────────────────────────────────────────────────────────────
70+
<pre class="hide-indicator"><code class="language-bash">Running captureBrowserExceptions():
71+
────────────────────────────────────────────────────────────────────────────────
7372
{
7473
exceptionDetails: {
7574
exceptionId: 1,
@@ -93,7 +92,9 @@ Output of the example above:
9392
timestamp: 2022-06-10T13:14:52.722Z
9493
}
9594
No assertions ran.
96-
```
95+
</code>
96+
</pre>
97+
9798

9899
### Recommended content
99100
- [Capture browser console messages](/guide/running-tests/capture-console-messages.html)

0 commit comments

Comments
 (0)