diff --git a/docs/guide/browser-drivers/geckodriver.md b/docs/guide/browser-drivers/geckodriver.md
index a79cefbd..6522f1e5 100644
--- a/docs/guide/browser-drivers/geckodriver.md
+++ b/docs/guide/browser-drivers/geckodriver.md
@@ -64,7 +64,7 @@ GeckoDriver can also be used as a standalone application. Usage steps are docume
### Command line usage
-
$ ./bin/geckodriver-0.23 -help
+$ ./bin/geckodriver-0.23 -help
geckodriver 0.23.0
USAGE:
diff --git a/docs/guide/ci-integrations/run-nightwatch-on-azure-pipelines.md b/docs/guide/ci-integrations/run-nightwatch-on-azure-pipelines.md
index 072dc3ce..e3dd29ee 100644
--- a/docs/guide/ci-integrations/run-nightwatch-on-azure-pipelines.md
+++ b/docs/guide/ci-integrations/run-nightwatch-on-azure-pipelines.md
@@ -47,7 +47,7 @@ You need to click on Node.js in order to configure its plugin. This will provide
#### Step 4 : Configure azure-pipelines.yml file
Now you have to review and write the steps inside the azure-pipelines.yml file to run your tests.
-# Node.js
+# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
diff --git a/docs/guide/ci-integrations/run-nightwatch-on-circleci.md b/docs/guide/ci-integrations/run-nightwatch-on-circleci.md
index 6e015b1f..9d41a74b 100644
--- a/docs/guide/ci-integrations/run-nightwatch-on-circleci.md
+++ b/docs/guide/ci-integrations/run-nightwatch-on-circleci.md
@@ -36,7 +36,7 @@ In the next screen, select `Node` from the list
#### Step 2 : Update the config.yml file, commit and run the pipeline
Now you will view the config.yml file that you can edit. Copy the below file contents into the file
-# This config is equivalent to both the '.circleci/extended/orb-free.yml' and the base '.circleci/config.yml'
+# This config is equivalent to both the '.circleci/extended/orb-free.yml' and the base '.circleci/config.yml'
version: 2.1
# Orbs are reusable packages of CircleCI configuration that you may share across projects, enabling you to create encapsulated, parameterized commands, jobs, and executors that can be used across multiple projects.
diff --git a/docs/guide/ci-integrations/run-nightwatch-on-jenkins.md b/docs/guide/ci-integrations/run-nightwatch-on-jenkins.md
index 28d6f7da..fbb8406f 100644
--- a/docs/guide/ci-integrations/run-nightwatch-on-jenkins.md
+++ b/docs/guide/ci-integrations/run-nightwatch-on-jenkins.md
@@ -56,12 +56,10 @@ In order to run your tests on BrowserStack from Jenkins, setup the environment v
Setup the following 2 environment variables
-```
-
-BROWSERSTACK_USERNAME
+
+BROWSERSTACK_USERNAME
BROWSERSTACK_ACCESS_KEY
-
-```
+
![Jenkins BrowserStack](https://user-images.githubusercontent.com/1677755/177569029-da96b37d-6377-404f-9562-315d0694997d.png)
diff --git a/docs/guide/component-testing/testing-angular-components.md b/docs/guide/component-testing/testing-angular-components.md
index e0a6e44f..ae2fea7b 100644
--- a/docs/guide/component-testing/testing-angular-components.md
+++ b/docs/guide/component-testing/testing-angular-components.md
@@ -5,7 +5,7 @@ description: Learn how to do write and execute Angular component tests in Nightw
Angular component testing in Nightwatch
### Overview
-Angular component testing in Nightwatch is available using our official **[`@nightwatch/angular`][1]** plugin, It uses the Webpack DevServer under the hood. Requires Nightwatch 2.4+
+Angular component testing in Nightwatch is available using our official **[`@nightwatch/angular`][https://github.com/nightwatchjs/nightwatch-plugin-angular]** plugin, It uses the Webpack DevServer under the hood. Requires Nightwatch 2.4+
@@ -91,15 +91,7 @@ The angular plugin uses webpack dev server to compile and render angular compone
test/sampleTest.jsit('Test Form Component', async function (browser) {
const component = await browser.mountComponent('/src/components/Form.component');
-
expect(component).text.to.equal('form-component works!');
});
-
-
-
-
-
-
-
-
-[1]: https://github.com/nightwatchjs/nightwatch-plugin-angular
+
+
diff --git a/docs/guide/concepts/test-globals.md b/docs/guide/concepts/test-globals.md
index 5d4d1bc0..b3f74437 100644
--- a/docs/guide/concepts/test-globals.md
+++ b/docs/guide/concepts/test-globals.md
@@ -202,9 +202,7 @@ Pass the `--env integration` option to the runner:
Then our globals object will look like:
-```
-myGlobalVar is: "integrated global"
-```
+myGlobalVar is: "integrated global"
### Recommended content
- [Use external globals in tests](/guide/writing-tests/using-test-globals.html)
diff --git a/docs/guide/configuration/define-test-environments.md b/docs/guide/configuration/define-test-environments.md
index 47eb0b69..8d838a05 100644
--- a/docs/guide/configuration/define-test-environments.md
+++ b/docs/guide/configuration/define-test-environments.md
@@ -49,7 +49,7 @@ Test environments are referenced using the `--env` cli argument. Since we only h
npx nightwatch --env chrome-local
-```
+
~/workspace/test-project % npx nightwatch --env chrome-local
┌──────────────────────────────────────────────────────────────────┐
@@ -61,7 +61,7 @@ Test environments are referenced using the `--env` cli argument. Since we only h
│ │
│ │
└──────────────────────────────────────────────────────────────────┘
-```
+
### Define a new "chrome-local" environment
@@ -108,7 +108,7 @@ Run the sample and pass the `--env chrome-local` argument:
The output will look a bit like this:
-```
+
[sample nightwatch test] Test Suite
──────────────────────────────────────────────────────────────────────
ℹ Connected to ChromeDriver on port 9515 (844ms).
@@ -116,12 +116,12 @@ The output will look a bit like this:
Running opens the browser and checks for input:
-────────────────────────────────────────────────────────────────────────────────────────────────────────────────
+───────────────────────────────────────────────────────────────────────
ℹ Loaded url https://home.cern in 5531ms
✔ Testing if the page title equals 'Home | CERN' (6ms)
OK. 1 assertions passed. (5.604s)
-```
+
### Recommended content
- [Concepts > Test environments](/guide/concepts/test-environments.html)
@@ -148,4 +148,4 @@ OK. 1 assertions passed. (5.604s)
→
-
\ No newline at end of file
+
diff --git a/docs/guide/migrating-to-nightwatch/from-protractor.md b/docs/guide/migrating-to-nightwatch/from-protractor.md
index 1dbdb98c..6ad077e8 100644
--- a/docs/guide/migrating-to-nightwatch/from-protractor.md
+++ b/docs/guide/migrating-to-nightwatch/from-protractor.md
@@ -13,23 +13,26 @@ Protractor was a popular end-to-end test framework for Angular and AngularJS app
Install the [Nightwatch Angular schematic](https://github.com/nightwatchjs/nightwatch-schematics) to add Nightwatch to your Angular project.
-```bash
-ng add @nightwatch/schematics
-```
+
+ng add @nightwatch/schematics
+
+
This will install Nightwatch, add different scripts to run Nightwatch, scaffold Nightwatch config, and test files. It also prompts you to remove Protractor from your project and reconfigure your default `ng e2e` command to use Nightwatch.
You can now run Nightwatch with the following command:
-```bash
-ng e2e
-```
+
+ng e2e
+
+
You can also use the following command to run Nightwatch alternatively.
-```bash
-ng run {your-project-name}:nightwatch-run
-```
+
+ng run {your-project-name}:nightwatch-run
+
+
### Next Steps
@@ -55,17 +58,21 @@ In e2e tests, one of the most common things to do in a webpage is to get one or
Before: Protractor
-```javascript
-// Find an element using a css selector.
+
+// Find an element using a css selector.
element(by.css('.myclass'))
-```
+
+
+
After: Nightwatch v2
-```javascript
-// Find an element using a css selector.
+
+// Find an element using a css selector.
element(by.css('.myclass'))
-```
+
+
+
##### Getting multiple elements
@@ -73,27 +80,30 @@ If you need to access more than one element on the page, you must chain the .all
Before: Protractor
-```javascript
-// Find elements using a css selector.
+
+// Find elements using a css selector.
element.all(by.css('.myclass'))
-```
+
+
+
After: Nightwatch v2
-```javascript
-// Find mulltiple elements using a css selector.
+
+// Find mulltiple elements using a css selector.
browser.findElements(by.css('.myclass'))
// or simply:
browser.findElements('.myclass')
-```
+
+
##### Interaction with DOM Elements
Before: Protractor
-```javascript
-// Click on the element
+
+// Click on the element
element(by.css('button')).click()
// Clear the text in an element (usually an input).
@@ -107,12 +117,13 @@ browser
.actions()
.mouseMove(element(by.id('my-id')))
.perform()
-```
+
+
After: Nightwatch v2
-```javascript
-// Click on the element
+
+// Click on the element
browser.click(element(by.css('button')))
// or with default css selector as locate strategy:
@@ -133,7 +144,8 @@ browser
.perform(function() {
return this.actions().mouseMove(element(by.id('my-id')))
})
-```
+
+
> You can learn more about working with DOM elements in our [official documentation](/guide/writing-tests/finding-interacting-with-dom-elements.html)
@@ -143,96 +155,123 @@ browser
Before: Protractor
-```javascript
-const list = element.all(by.css('.custom-class'))
+
+const list = element.all(by.css('.custom-class'))
expect(list.count()).toBe(3)
-```
+
+
+
After: Nightwatch v2
-```javascript
-expect.elements('.custom-class').count.to.equal(3);
-```
+
+
+expect.elements('.custom-class').count.to.equal(3);
+
+
+
#### Value
Before: Protractor
-```javascript
-expect(element(by.css('input[name="first_name"]'))).getAttribute('value').toBe('foo')
-```
+
+expect(element(by.css('input[name="first_name"]'))).getAttribute('value').toBe('foo')
+
+
+
After: Nightwatch v2
-```javascript
-expect(element('input[name="first_name"]')).attribute('value').toEqual('foo');
-```
+
+
+expect(element('input[name="first_name"]')).attribute('value').toEqual('foo');
+
+
+
#### Text Content
Before: Protractor
-```javascript
-// assert the element\'s text content is exactly the given text
+
+// assert the element\'s text content is exactly the given text
expect(element(by.id('user-name')).getText()).toBe('John Doe')
-```
+
+
+
After: Nightwatch v2
-```javascript
-expect.element(by.id('user-name')).text.toEqual('John Doe');
-```
+
+expect.element(by.id('user-name')).text.toEqual('John Doe');
+
+
+
#### Visibility
Before: Protractor
-```javascript
-// assert button is visible
+
+
+// assert button is visible
expect(element(by.css('#main ul li a.first')).isDisplayed()).toBe(true)
-```
+
+
+
After: Nightwatch v2
-```javascript
-expect('#main ul li a.first').to.be.visible;
+
+expect('#main ul li a.first').to.be.visible;
// The following will end the test:
browser.assert.visible('#main ul li a.first');
// However this will just log the failure and continue:
browser.verify.visible('#main ul li a.first');
-```
+
+
+
#### Existence
Before: Protractor
-```javascript
-// assert the spinner no longer exists
+
+// assert the spinner no longer exists
expect(element(by.id('loading')).isPresent()).toBe(false)
-```
+
+
+
After: Nightwatch v2
-```javascript
-browser.assert.not.elementPresent(by.id('loading'))
-```
+
+browser.assert.not.elementPresent(by.id('loading'))
+
+
+
#### CSS
Before: Protractor
-```javascript
-// assert #main ul li a.first has css style "block" for "display" property
+
+// assert #main ul li a.first has css style "block" for "display" property
expect(element(by.css('#main ul li a.first')).getCssValue('display')).toBe('block')
-```
+
+
+
After: Nightwatch v2
-```javascript
-browser.assert.cssProperty(by.css('#main ul li a.first'), 'display', 'block');
-```
+
+browser.assert.cssProperty(by.css('#main ul li a.first'), 'display', 'block');
+
+
+
#### Navigating websites
@@ -240,24 +279,28 @@ When you need to visit a page in your test, you can use following code:
Before: Protractor
-```javascript
-it('visits a page', () => {
+
+it('visits a page', () => {
browser.get('/about')
browser.navigate().forward()
browser.navigate().back()
})
-```
+
+
+
After: Nightwatch v2
-```javascript
-it('visits a page', () => {
+
+it('visits a page', () => {
browser
.navigateTo('/about')
.forward()
.back()
})
-```
+
+
+
### Questions or having issues?
diff --git a/docs/guide/mobile-web-testing/with-appium.md b/docs/guide/mobile-web-testing/with-appium.md
index 21f83832..254fec44 100644
--- a/docs/guide/mobile-web-testing/with-appium.md
+++ b/docs/guide/mobile-web-testing/with-appium.md
@@ -22,7 +22,7 @@ First step is to [download and setup Appium](https://appium.io/docs/en/about-app
### Configuration
We can add configuration in Nightwatch to run our tests on mobile devices running locally against the Appium server:
-nightwatch.conf.js
\ No newline at end of file
+
diff --git a/docs/guide/running-tests/using-with-test-groups.md b/docs/guide/running-tests/using-with-test-groups.md
index 0fa16f5f..eb2d053e 100644
--- a/docs/guide/running-tests/using-with-test-groups.md
+++ b/docs/guide/running-tests/using-with-test-groups.md
@@ -9,7 +9,7 @@ description: Learn how to group tests together for better organization of the te
Nightwatch makes it possible to organize your test scripts into groups and run them as needed. To group tests together just place them in the same sub-folder. The folder name is the name of the group.
### Example
-
+
lib/
├── selenium-server-standalone.jar
custom-commands/
diff --git a/docs/guide/writing-tests/using-cucumberjs.md b/docs/guide/writing-tests/using-cucumberjs.md
index 978d15b9..6f23c232 100644
--- a/docs/guide/writing-tests/using-cucumberjs.md
+++ b/docs/guide/writing-tests/using-cucumberjs.md
@@ -137,7 +137,8 @@ Here's how the output looks like when running the example tests in Firefox. You
-
diff --git a/src/includes/rightSidebarContent.ejs b/src/includes/rightSidebarContent.ejs
index 09bdb1b8..3d51e3e1 100644
--- a/src/includes/rightSidebarContent.ejs
+++ b/src/includes/rightSidebarContent.ejs
@@ -11,7 +11,7 @@ const content = [...pageContent.matchAll(/]*id="([^"]+)".*?>(?:]*>([^
On this page
Contribute
@@ -20,4 +20,4 @@ const content = [...pageContent.matchAll(/]*id="([^"]+)".*?>(?:]*>([^
Join us on Discord
Read our blog
Nightwatch Docs on Github
-
\ No newline at end of file
+
diff --git a/src/js/app-esm.js b/src/js/app-esm.js
index 0d5f2cdb..625b5909 100644
--- a/src/js/app-esm.js
+++ b/src/js/app-esm.js
@@ -308,7 +308,7 @@ const renderCodeTabs = () => {
const updatePreStyle = () => {
document.querySelectorAll('pre').forEach((preTag) => {
- if (!preTag.classList.contains('line-numbers')) {
+ if (!preTag.classList.contains('line-numbers') && !preTag.classList.contains('nocode-space')) {
preTag.classList.add('code-space');
}
});
diff --git a/src/pages/guide/comparison-with-leading-frameworks.ejs b/src/pages/guide/comparison-with-leading-frameworks.ejs
index 8633dfe5..4d180139 100644
--- a/src/pages/guide/comparison-with-leading-frameworks.ejs
+++ b/src/pages/guide/comparison-with-leading-frameworks.ejs
@@ -33,7 +33,7 @@ const data = {
Nightwatch
-
+
Playwright