nightwatch summary
nightwatch summary
When you install a package globally, it becomes available for use anywhere on your system, rather than
just within a specific project. This is commonly used for command-line tools and utilities that you want
to be accessible from any directory.
For example:
This command installs package-name globally. You can then use package-name from the command line
in any directory.
Some examples of globally installed packages are tools like nodemon, http-server, and create-react-app.
//** end
First Script:
//*we can use “Client. Or browser.” After opening of function
Run script:
Npm run test-e2e (e2e is test name, npm run is global command)
Multiple attribute
Multi Scripts:
Browser support:
browser. assert . urlContains ( 'expectedString' );
x`
Commands List:
Certainly! Here are the commands listed with either `browser.` or `this.`:
1. **Visibility**:
- `browser.assert.visible(selector)`
- `browser.verify.visible(selector)`
- `browser.assert.hidden(selector)`
- `browser.verify.hidden(selector)`
2. **Existence**:
- `browser.assert.elementPresent(selector)`
- `browser.verify.elementPresent(selector)`
- `browser.assert.elementNotPresent(selector)`
- `browser.verify.elementNotPresent(selector)`
3. **Text Content**:
- `browser.assert.containsText(selector, expectedText)`
- `browser.verify.containsText(selector, expectedText)`
- `browser.assert.cssClassPresent(selector, className)`
- `browser.verify.cssClassPresent(selector, className)`
4. **State**:
- `browser.assert.enabled(selector)`
- `browser.verify.enabled(selector)`
- `browser.assert.disabled(selector)`
- `browser.verify.disabled(selector)`
- `browser.assert.selected(selector)`
- `browser.verify.selected(selector)`
- `browser.assert.title(expectedTitle)`
- `browser.verify.title(expectedTitle)`
- `browser.assert.urlContains(expectedString)`
- `browser.verify.urlContains(expectedString)`
- `browser.assert.urlEquals(expectedUrl)`
- `browser.verify.urlEquals(expectedUrl)`
These are the commands used in Nightwatch.js for assertions and verifications, fully prefixed with either
`browser.` or `this.`. They are used to check various aspects of a web application during automated
testing.
//*we can use “Client. Or browser.”
Certainly! Here are the common actions (commands) used in Nightwatch.js test scripts:
1. **Navigation**:
2. **Interactions**:
4. **Alert Handling**:
5. **Wait Commands**:
These are some of the common actions (commands) used in Nightwatch.js test scripts to interact with
web pages and perform various operations during automated testing.
No, the list I provided contains common actions used in Nightwatch.js test scripts, but it's not exhaustive.
Nightwatch.js provides a rich set of commands that cover a wide range of interactions with web pages
and browsers.
- `browser.pause(milliseconds)`: Pause the test execution for the specified number of milliseconds.
- `browser.execute(script, args)`: Execute JavaScript code within the context of the current page.
Moreover, Nightwatch.js also supports custom commands, which allow you to define your own actions
tailored to your specific testing needs. These custom commands can extend the capabilities of
Nightwatch.js by encapsulating reusable test logic.
So, while the list provided covers many common actions, Nightwatch.js offers more commands and the
flexibility to create custom commands to suit your testing requirements.
To disable a script:
//could be wrng
src_folder