Skip to content

Commit

Permalink
Update nightwatch from 2.0 to 3.0 #121
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaimaaNatshah committed Dec 27, 2023
1 parent 68d2b71 commit 98eb6e0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
node-version: '18.x'

- name: Install
run: yarn install
Expand Down
2 changes: 1 addition & 1 deletion bitbucket-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: node:16 # Choose an appropriate Node.js version
image: node:18 # Choose an appropriate Node.js version

pipelines:
default:
Expand Down
21 changes: 21 additions & 0 deletions lib/custom-assertions/elementContainsText.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@

module.exports.assertion = function (negativeCase, expectedText, element) {

/**
* Returns the expected value of the assertion which is displayed in the case of a failure
*
* @return {string}
*/
this.expected = function() {
return this.negate ? `is not '${expectedText}'` : `is '${expectedText}'`;
};

/**
* When defined, this method is called by the assertion runner with the command result to determine the actual
* state of the assertion in the event of a failure
*
* @param {Boolean} passed
* @return {string}
*/
this.actual = function(passed) {
return passed ? `contains '${expectedText}'` : `does not contain '${expectedText}'`;
};


browser.element('css selector', element, function (result) {
if (result.status === 0) {
if (negativeCase) {
Expand Down

0 comments on commit 98eb6e0

Please sign in to comment.