(node:19502) UnresolvedPromiseRejectionNotification: Promise rejection not handled (rejection id: 1): TypeError: Unable to access property 'indexOf' of undefined

I successfully integrated cucumber with nightwatch.js.

Here is a snippet of my package.json file:

{
  "name": "learning-nightwatch",
  "version": "1.0.0",
  "description": "learning nightwatch",
  "license": "UNLICENSED",
  "scripts": {
    "nightwatch": "nightwatch",
    "start": "bin/start",
    "stop": "bin/stop",
    "test": "bin/test"
  },
  "dependencies": {
    "lodash": "^4.17.4",
    "minimist": "^1.2.0",
    "nightwatch": "^0.9.16",
    "cucumber": "^3.1.0",
    "nightwatch-cucumber": "^8.2.9"
  }
}

nightwatch config:

{
    "src_folders": [null],
    "output_folder": "reports",
    "custom_commands_path": "",
    "custom_assertions_path": "",
    "page_objects_path": "./pageObjects",
    "globals_path": "",
    "test_settings": {
        "default": {
            "launch_url": "http://localhost:8083",
            "selenium_port": 4444,
            "selenium_host": "localhost",
            "screenshots": {
                "enabled": true,
                "on_failure": true,
                "on_error": true,
                "path": "./screenshots"
            },
            "desiredCapabilities": {
                "marionette": true,
                "javascriptEnabled": true,
                "acceptSslCerts": true,
                "browserName": "chrome",
                "chromeOptions": {
                    "args": ["start-fullscreen"]
                }
            },
            "silent": true
        },
        "firefox": {
            "desiredCapabilities": {
                "browserName": "firefox",
                "args": ["-headless"]
            }
        }
    },
    "selenium": {
        "start_process": true,
        "server_path": "./bin/lib/selenium-server-standalone-3.7.1.jar",
        "log_path": "",
        "port": 4444,
        "cli_args": {
            "webdriver.chrome.driver": "./bin/lib/chromedriver",
            "webdriver.gecko.driver": "./bin/lib/geckodriver"
        }
    }
}

After running the test cases using yarn nightwatch, all scenarios and steps pass successfully. However, I encounter an issue where the application does not terminate with exit code 0 and displays the following message:

4 scenarios (4 passed)
8 steps (8 passed)
0m05.510s
(node:19502) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'indexOf' of undefined
(node:19502) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Does anyone have insights into why this error is occurring?

Answer №1

Here are my top 3 recommendations:

  • Consider removing the src_folders attribute.
  • Take a look at this guide for getting started.
  • Explore the resources available at this GitHub repository.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Invoke data-id when the ajax call is successful

Initially, there was a smoothly working "like button" with the following appearance: <a href="javascript:void();" class="like" id="<?php echo $row['id']; ?>">Like <span><?php echo likes($row['id']); ?></span ...

Issue encountered when compiling Vue 3 with TypeScript and Webpack Encore: Vue Router's $route is missing

I've been grappling with setting up vue-router's $route in my shims.vue.d.ts file to avoid getting an error on the this scope. Whenever I try to access this.$route.params.paymentId, I keep receiving a type error: TS2339: Property '$route&apo ...

The error is occurring because the default element wait time for the Cucumber Page object "PageObject" has

I tried adjusting the default element time out to 10 seconds by adding PageObject.default_element_wait = 10 in the env.rb file, but I encountered an error upon saving. Here is the content of the env.rb file: require 'rspec' require 'page-o ...

JavaScript is reliant on the presence of the alert() function to properly function

I have a JavaScript function that performs well, except for when I remove or comment out the alert() line. This function is designed to calculate the sum of values in up to 30 fields if they are present and contain a value. Here is an example of the HTML ...

Ways to customize the default countdown timer

I came across this amazing project at https://codepen.io/mattlitzinger/pen/ysowF. While the project is wonderful, I am looking to make some modifications to the code, specifically targeting a specific date. Here is the JavaScript code snippet: var tar ...

"Error 404: Invalid request encountered while using React and

I am encountering an issue with a 404 not found error when I attempt to send a post request in React. My code involves using Django Rest Framework on the backend and React Axios on the frontend, but I am facing errors while making the post request. Below i ...

Separate scales for small multiple line charts

Explore the notebook here. I am currently developing a small multiple line chart using d3.v5 on Observable, with the dataset organized as follows: When visualizing, the y scale utilizes the num values from the values array for the domain. With unique key ...

Accessing the react-bootstrap tab using the history feature in React

Currently, I am in the process of developing a multi-form page that includes login, registration, and lost password functionalities displayed using tabs with react-bootstrap. The technologies I am using for this project are react 17.0.2, react-bootstrap 2 ...

Dynamic water filling effect with SVG

I'm trying to create a wipe animation that looks like water filling up inside of a drop shape. Currently, it is a square with a wave animation on top of the drop logo. The wave animation works correctly, but I am struggling to contain it within the dr ...

The organizational chart function was functioning properly on the local environment, however, it failed to work after deployment, resulting in the error message "jQuery(

Currently, I am in the process of creating an organizational chart using the Angular library called orgchart. The code I have developed works fine on my local machine, but when we deploy it onto our nginx server, we encounter an error related to jQuery. T ...

Angular: Disabling a button based on an empty datepicker selection

Can anyone help me figure out how to disable a button when the datepicker value is empty? I've tried using ngIf to check if the datepicker is empty and then disable the button, but it's not working. My goal is to make the button unclickable if th ...

Why is MutationRecord[] organized as an array in MutationObserver?

I've been diving into the world of MutationObserve, and I've grasped most of it. However, one thing that's puzzling me is why the parameter requires an array. According to the documentation: An array of MutationRecord objects, detailing e ...

Error: The function $(...).draggable is not recognized" and "Error: The object $.browser is not defined

I encountered an error stating, TypeError: $(...).draggable is not a function. To resolve this issue, I added jQuery as follows: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> < ...

Display a comprehensive inventory of all bot commands within a designated category

When a user executes a command, I have various commands categorized and would like to present them accordingly. For instance, consider the following command: const Discord = require('discord.js') const { MessageEmbed } = require('discord.js& ...

Tips for scrolling an element within its parent container as a fixed element moves past it

I'm a bit stuck on this jQuery/javascript challenge and haven't made much progress yet. I need some guidance to help me navigate in the right direction! The issue I'm facing involves a fixed element on my webpage that moves into different w ...

What could be causing my webpage to automatically refresh following a POST request in NodeJS?

Utilizing the express framework alongside NodeJS, I have encountered an issue where my client webpage refreshes after making a POST request that triggers a python script and returns a JSON object to the client. My dilemma lies in preventing this automatic ...

The console log is not being displayed in my Redux reducer and it is returning an undefined

I'm facing an issue with my Redux application after integrating JWT into my Nest API. Below is the code snippet from my reducer: export default function reducer(state = {}, action) { switch (action.type) { case 'USER_LOGIN_SUCCESS&apo ...

Generating a list of values separated by commas from a Microsoft Excel column after applying regular expressions

I have an Excel column that I need to convert into CSV format. A JavaScript regex has been provided to apply on the column values: var regex = new RegExp("[^a-z0-9',.]+","gi"); return input.replace(regex, "_").replace(/_+/g, "_").replace(/^_|_$|^&bso ...

Combining the Powers of JMeter and Selenium

After successfully writing Selenium Automation Test Scripts using Page Object Model without any issues, I have decided to venture into performance testing of the application. My plan is to utilize Jmeter for this purpose. I am curious if there is a method ...

Is there a more efficient method for invoking `emit` in Vue's Composition API from an external file?

Is there a more efficient way to access the emit function in a separate logic file? This is my current approach that is functioning well: foo.js export default (emit) => { const foo = () => { emit('bar') }; return { foo }; } When ...