Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test does not start because there is an error while trying to load the file "node_modules\nightwatch\dist\api\client-commands\saveSnapshot.js" #3884

Closed
chriscuba23 opened this issue Aug 17, 2023 · 8 comments

Comments

@chriscuba23
Copy link

chriscuba23 commented Aug 17, 2023

Description of the bug/issue

When I run a simple js file in examples I expect for it to run but instead I get a ERR_DLOPEN_FAILED file load error

Steps to reproduce

  1. Upgrade Nightwatch to version 3.1.2
  2. In Visual Studio Code run the following

.\node_modules\.bin\nightwatch.cmd -e chrome .\nightwatch\examples\basic\duckDuckGo.js --verbose

Sample test

describe('duckduckgo example', function() {
  it('Search Nightwatch.js and check results', function(browser) {
    browser
      .navigateTo('https://duckduckgo.com')
      .waitForElementVisible('input[name=q]')
      .sendKeys('input[name=q]', ['Nightwatch.js'])
      .click('*[type="submit"]')
      .assert.visible('.results--main')
      .assert.textContains('.results--main', 'Nightwatch.js');
  }); 
});

Command to run

.\node_modules\.bin\nightwatch.cmd -e chrome .\nightwatch\examples\basic\duckDuckGo.js --verbose

Verbose Output

┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                                                                                                                   │
│   There was an error while trying to load the file 
C:\Users\MT User\e2e_tests\node_modules\nightwatch\dist\api\client-commands\saveSnapshot.js:   │
                                                                                    │
│   \\?\C:\Users\MT User\e2e_tests\node_modules\canvas\build\Release\canvas.node;                                                                   │
│                                                                                                                                                   │
│    Current working directory is: C:\Users\MT User\e2e_tests                                                                                       │
│                                                                                                                                                   │
│                                                                                                                                                   │
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

  Error
    [ERR_DLOPEN_FAILED] The specified module could not be found.
\\?\C:\Users\MT User\e2e_tests\node_modules\canvas\build\Release\canvas.node;

Nightwatch Configuration

// Refer to the online docs for more details:
// https://nightwatchjs.org/gettingstarted/configuration/
//

//  _   _  _         _      _                     _          _
// | \ | |(_)       | |    | |                   | |        | |
// |  \| | _   __ _ | |__  | |_ __      __  __ _ | |_   ___ | |__
// | . ` || | / _` || '_ \ | __|\ \ /\ / / / _` || __| / __|| '_ \
// | |\  || || (_| || | | || |_  \ V  V / | (_| || |_ | (__ | | | |
// \_| \_/|_| \__, ||_| |_| \__|  \_/\_/   \__,_| \__| \___||_| |_|
//             __/ |
//            |___/

// Autogenerated by Nightwatch
// Refer to the online docs for more details: https://nightwatchjs.org/gettingstarted/configuration/
const Services = {}; loadServices();

require('dotenv').config();
const FAILURES_ERRORS_PATH = "./failures"; // Location of the screenshots taken on failures/errors
const REPORTS = "./reports"; // The location where the JUnit XML report files will be saved.

module.exports = {
  // An array of folders (excluding subfolders) where your tests are located;
  // if this is not specified, the test source must be passed as the second argument to the test runner.
  src_folders: ['Scenarios', 'nightwatch/examples'],

  // See https://nightwatchjs.org/guide/concepts/page-object-model.html
  page_objects_path: ['pages'],

  // See https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-commands.html
  custom_commands_path: ['./custom_commands', "./node_modules/nightwatch-xhr/es5/commands", "./node_modules/nightwatch-mixpanel/es5/commands", "./node_modules/@bbc/nightwatch-vrt/commands"],

  // See https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-assertions.html
  custom_assertions_path: ['./custom_assertions', "./node_modules/nightwatch-xhr/es5/assertions", "./node_modules/nightwatch-mixpanel/es5/assertions", "node_modules/@bbc/nightwatch-vrt/assertions"],

  // See https://nightwatchjs.org/guide/extending-nightwatch/adding-plugins.html
  plugins: [],

  // See https://nightwatchjs.org/guide/concepts/test-globals.html
  globals_path: './globals.js',

  data_path: "data",
  output_folder: REPORTS, // The location where the JUnit XML report files will be saved.
  live_output: false, // Whether or not to buffer the output in case of parallel running
  silent: true, // Whether to show the extended HTTP traffic command logs (verbose) from the WebDriver or Selenium server.
  output: true, //Used to disable CLI output completely.
  detailed_output: true, // By default detailed assertion output is displayed while the test is running. Set this to `false` if you'd like to only see the test case name displayed and pass/fail status. Detailed output is disabled by default when running tests in parallel.
  disable_error_log: false, // Set this to true if you'd like to not display errors during the execution of the test (they are shown at the end always).

  webdriver: {
    "keep_alive": true // Enable HTTP Keep-Alive. If set to true the keepAlive option is enabled with default settings (keepAliveMsecs = 3000). If set to an object, can specify specify the keepAliveMsecs value.
  },

  test_workers: {
    enabled: true
  },

  test_settings: {
    default: {
      disable_error_log: false,
      launch_url: 'http://localhost',
      use_xpath: false, // 	Use xpath as the default locator strategy
      test_workers: { "enabled": true, "workers": 2 }, // Whether or not to run individual test files in parallel. If set to `true`, runs the tests in parallel and determines the number of workers automatically. If set to an object, can specify specify the number of workers as `"auto"` or a `number`. 
      globals: require('./globals'), // An object which will be made available within the test and can be overwritten per environment
      screenshots: {
        enabled: false,
        path: FAILURES_ERRORS_PATH,
        on_failure: true
      },

      desiredCapabilities: {
        browserName: 'chrome',
        javascriptEnabled: true,
        acceptSslCerts: true,
        acceptInsecureCerts: true,
        browserTag: "mttestcr"
      },
      end_session_on_fail: true, // End the session automatically when the test is being terminated, usually after a failed assertion.
      skip_testcases_on_fail: true, // Skip the remaining testcases (or test steps) from the same test suite (i.e. test file), when one testcase fails.
      detailed_output: true, // By default detailed assertion output is displayed while the test is running. Set this to `false` if you'd like to only see the test case name displayed and pass/fail status. This is especially useful when running tests in parallel.

      webdriver: {
        start_process: true, // When this is enabled, the Webdriver server is run in background in a child process and started/stopped automatically. Nightwatch includes support for managing Chromedriver, Geckodriver (Firefox), Safaridriver, and Selenium Server. Please refer to the Install Webdriver section for details.
        server_path: (Services.chromedriver ? Services.chromedriver.path : '') // Only useful if start_process is enabled.
      },

    },
    firefox: {
      capabilities: {
        browserName: 'firefox',
        browserTag: "mttestff",
        acceptSslCerts: true,
        acceptInsecureCerts: true,
        'moz:firefoxOptions': {
          args: [
            // '-headless',
            // '-verbose'
            '--window-size=1920,925',
            '--no-sandbox',
          ],
          prefs: {
            // 'media.navigator.permission.disable': true,
            // 'media.navigator.streams.fake': true
          }
        },
      },
      webdriver: {
        start_process: true,
        server_path: '',
        host: '127.0.0.1',
        port: 4444,
        cli_args: [
          // very verbose geckodriver logs
          // '-vv'
        ]
      },

    },

    h_firefox: {
      capabilities: {
        browserName: 'firefox',
        browserTag: "mttestff",
        acceptSslCerts: true,
        acceptInsecureCerts: true,
        'moz:firefoxOptions': {
          args: [
            '-headless',
            // '-verbose'
            '--window-size=1920,925',
            '--no-sandbox',
          ],
          prefs: {
            // 'media.navigator.permission.disable': true,
            // 'media.navigator.streams.fake': true
          }
        },
      },
      webdriver: {
        start_process: true,
        server_path: '',
        host: '127.0.0.1',
        port: 4444,
        cli_args: [
          // very verbose geckodriver logs
          // '-vv'
        ]
      },

    },
    chrome: {
      desiredCapabilities: {
        browserName: 'chrome',
        loggingPrefs: {
          browser: "ALL"
        },
        javascriptEnabled: true,
        acceptSslCerts: true,
        acceptInsecureCerts: true,
        'goog:chromeOptions': {
          // More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/
          //
          // w3c:false tells Chromedriver to run using the legacy JSONWire protocol (not required in Chrome 78)
          w3c: true,
          args: [
            '--no-sandbox',
            //'--ignore-certificate-errors',
            //'--allow-insecure-localhost',
            '--disable-software-rasterizer',
            '--disable-gpu',
            '--window-size=1920,925',
            '--log-level=3',
            '--disable-logging'
          ],
          prefs: {
            "profile.default_content_setting_values.cookies": 1, // Allow sites to save and read cookie data (recommended): 2=Blocked, 1=Allow
          },
        },

      },

      webdriver: {
        start_process: true,
        port: 9515,
        server_path: (Services.chromedriver ? Services.chromedriver.path : ''),
        cli_args: [
          // --verbose
        ]
      },
    },

    h_chrome: {
      desiredCapabilities: {
        browserName: 'chrome',
        loggingPrefs: {
          browser: "ALL"
        },
        javascriptEnabled: true,
        acceptSslCerts: true,
        acceptInsecureCerts: true,
        'goog:chromeOptions': {
          // More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/
          //
          // This tells Chromedriver to run using the legacy JSONWire protocol (not required in Chrome 78)
          w3c: true,
          args: [
            '--no-sandbox',
            '--ignore-certificate-errors',
            '--allow-insecure-localhost',
            '--headless',
            '--disable-gpu',
            '--disable-software-rasterizer',
            //'--verbose',
            '--window-size=1920,925',
            '--log-level=3',
            '--disable-logging'

          ],
          prefs: {
            "profile.default_content_setting_values.cookies": 1, // Allow sites to save and read cookie data (recommended): 2=Blocked, 1=Allow
          },
        },

      },

      webdriver: {
        start_process: true,
        port: 9515,
        server_path: (Services.chromedriver ? Services.chromedriver.path : ''),
        cli_args: [
          // --verbose
        ]
      },

    },

    edge: {
      desiredCapabilities: {
        browserName: 'MicrosoftEdge',
        browserTag: "mtteste",
        acceptSslCerts: true,
        acceptInsecureCerts: true,
        'ms:edgeOptions': {
          w3c: true,
          // More info on EdgeDriver: https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/capabilities-edge-options
          args: [
          ]
        },

      },

      webdriver: {
        start_process: true,
        // Download msedgedriver from https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/
        //  and set the location below:
        server_path: "C:\\Windows\\System32\\msedgedriver.exe",
        cli_args: [
          // --verbose

        ]
      },

    },

    h_edge: {
      desiredCapabilities: {
        browserName: 'MicrosoftEdge',
        browserTag: "mtteste",
        acceptSslCerts: true,
        acceptInsecureCerts: true,
        'ms:edgeOptions': {
          w3c: true,
          // More info on EdgeDriver: https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/capabilities-edge-options
          args: [
            '--no-sandbox',
            //'--ignore-certificate-errors',
            //'--allow-insecure-localhost',
            '--headless',
            '--window-size=1920,925',
            '--log-level=3',
            '--disable-gpu',
            '--disable-software-rasterizer',
          ]
        },
      },

      webdriver: {
        start_process: true,
        // Download msedgedriver from https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/
        //  and set the location below:
        server_path: "C:\\Windows\\System32\\msedgedriver.exe",
        cli_args: [
          // --verbose
        ]
      },

    },

    safari: {
      desiredCapabilities: {
        acceptInsecureCerts: false,
        browserName: 'safari',
        browserTag: "mttests",
      },
      webdriver: {
        port: 4445,
        start_process: true,
        server_path: '/usr/bin/safaridriver'
      }
    },


    ////////////////////////////////////////////////////////////////////////////////////////
    // Configuration for using remote Selenium service or a cloud-based testing provider.  |
    //                                                                                     |
    // Please set the hostname and port of your remote selenium-server or cloud-provider   |
    // (by setting the following properties in the configuration below):                   |
    // - `selenium.host`                                                                   |
    // - `selenium.port`                                                                   |
    //                                                                                     |
    // If you are using a cloud provider such as CrossBrowserTesting, LambdaTests, etc.,   |
    // please set the username and access_key by setting the below environment variables:  |
    // - REMOTE_USERNAME                                                                   |
    // - REMOTE_ACCESS_KEY                                                                 |
    // (.env files are supported)                                                          |
    ////////////////////////////////////////////////////////////////////////////////////////
    remote: {
      // Info on all the available options with "selenium":
      // https://nightwatchjs.org/guide/configuration/settings.html#selenium-server-settings
      selenium: {
        start_process: false,
        launch_url: 'http://localhost',
        server_path: (Services.seleniumServer ? Services.seleniumServer.path : ''),
        screenshots: {
          enabled: true,
          path: FAILURES_ERRORS_PATH,
          on_failure: true
        },
        cli_args: {
          'webdriver.gecko.driver': (Services.geckodriver ? Services.geckodriver.path : ''),
          'webdriver.chrome.driver': (Services.chromedriver ? Services.chromedriver.path : '')
        }
      },
      username: '${REMOTE_USERNAME}',
      access_key: '${REMOTE_ACCESS_KEY}',

      webdriver: {
        keep_alive: true,
        start_process: false
      }
    },

    'remote.chrome': {
      extends: 'remote',
      desiredCapabilities: {
        browserName: 'chrome',
        javascriptEnabled: true,
        acceptSslCerts: true,
        acceptInsecureCerts: true,
        chromeOptions: {
          w3c: true,
          args: [
            '--no-sandbox',
            '--ignore-certificate-errors',
            '--allow-insecure-localhost',
            '--headless',
            '--disable-gpu',
            '--disable-software-rasterizer',
            //'--verbose',
            '--window-size=1920,925',
            '--log-level=3',
            '--disable-logging'

          ]
        }
      },
      webdriver: {
        start_process: false,
      }
    },
    'remote.firefox': {
      extends: 'selenium_server',
      desiredCapabilities: {
        browserName: 'firefox',
        'moz:firefoxOptions': {
          args: [
            '-headless',
            // '-verbose'
          ]
        }
      }
    }

  },

  usage_analytics: {
    enabled: true,
    log_path: './logs/analytics'
  }

};

function loadServices() {
  try {
    Services.seleniumServer = require('selenium-server');
  } catch (err) { }

  try {
    Services.chromedriver = require('chromedriver');
  } catch (err) { }

  try {
    Services.geckodriver = require('geckodriver');
  } catch (err) { }
}

Nightwatch.js Version

3.1.2

Node Version

18.16.0

Browser

Chrome Version 115.0.5790.173 (Official Build) (64-bit)

Operating System

Windows 11 Pro

Additional Information

@dtslvr
Copy link

dtslvr commented Aug 23, 2023

I get the same error after upgrading from version 2.4.1 to 3.1.3. Is any version of Nightwatch.js 3 working for you @chriscuba23?

@gravityvi
Copy link
Member

gravityvi commented Aug 28, 2023

Hey @chriscuba23, Thanks for raising this issue. Could you try a fresh install of dependencies and see if it works?

@chriscuba23
Copy link
Author

I get the same error after upgrading from version 2.4.1 to 3.1.3. Is any version of Nightwatch.js 3 working for you @chriscuba23?

will try other versions and will let you know!

@chriscuba23
Copy link
Author

Hey @chriscuba23, Thanks for raising this issue. Could you try a fresh install of dependencies and see if it works?

will try now, thanx

@chriscuba23
Copy link
Author

chriscuba23 commented Sep 11, 2023

I've tried version 3.0.1 and version 3.1.3 but sadly the failure was the same

@chriscuba23
Copy link
Author

@dtslvr I've tried doing a fresh install of the dependencies using npm ci. It worked. fyi @gravityvi

@AutomatedTester
Copy link
Member

Glad you got sorted!

@dtslvr
Copy link

dtslvr commented Oct 4, 2023

I've tried doing a fresh install of the dependencies using npm ci. It worked.

That worked for me too. Thank you very much @chriscuba23.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants