Exploring the concept of defining multiple global files for each environment in Nightwatchjs adds

I'm facing a challenge with NightwatchJS as I attempt to configure multiple globals files based on different environments.

While the documentation at suggests that this can be achieved, I'm having trouble implementing it correctly. It seems that only a global file specified at the top level of the configuration file is being recognized, and any attempts to embed them within the environment nodes are being overlooked.


"chromeTR" : {
      "persist_globals": true,
      "globals": {
        "Report":true 
      },
      "desiredCapabilities": {
        "browserName": "chrome",
        "test_card" : "4111111111111111",
        "test_alt_card" : "0000405060708090",
        "chromeOptions": {
          "args" : ["--no-sandbox"]
        },
        "cli_args" : {
          "webdriver.gecko.driver" : "drivers/chromedriver"
        }
      }
    },

This setup is necessary because I am creating a custom before function that varies depending on the environment.

Furthermore, since this is the before function, I am unable to utilize a globally defined variable from the environment to trigger a switch within the function itself, as the before function lacks access to the browser object.

Answer №1

It is my understanding that you can utilize

this.client.globals.Report

or

this.client.globals.test_settings.globals.Report

in the before function to retrieve your environment-specific global variables - are you experiencing difficulties with this approach?

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

Encountering a freeze with Selenium Webdriver when utilizing Java's Robot class

Currently, I am tackling an automated test that necessitates opening a document in Internet Explorer. Initially, everything operates smoothly until the point where after clicking on a link to access the document, an annoying IE popup window appears as foll ...

Tips for waiting until the browser times out in selenium automation

After conducting several tests using Selenium, I have encountered an issue: My page contains a simple Drop Down List. I am selecting different values from this Element, waiting for the next page to load, and calculating the time taken for each operation. ...

Issue with PHP $_GET function not functioning properly in conjunction with JQuery Mobile

I am currently developing an application using a combination of JQuery Mobile and PHP. The issue at hand is as follows: I am encountering difficulties when attempting to transfer values between different pages in my JQuery mobile app (for example, from #p ...

Error encountered while attempting to forward the new session with Selenium Remote Driver, session not located

Recently, I updated the VM (node) to Windows 10 while using Selenium Grid, and now it's not functioning correctly. Here are the details: To register this Win10 VM as a node to the Grid, I used the following command: java -Dwebdriver.ie.driver=C:&bso ...

On IOS, Three.js ensures that the RGB values of a texture are set to zero whenever the ALPHA value

Working on a WebGL project utilizing javascript and the three.js framework, I am in the process of crafting a custom shader with GLSL. In this shader, I must load various lookup tables to utilize individual RGBA values for calculations rather than renderin ...

Achieving window focus on Mac with python and selenium

if platform == "darwin": #if on OS X, requires this module: pip install pygetwindow import pygetwindow as gw titles = gw.getAllTitles() print(titles) win = gw.getWindowsWithTitle('Photoshop') win.activate() When run ...

Using jQuery, create a function that dynamically retrieves and updates parameters in a URL based on selected data

I am working with the following HTML structure: <div class="color-class" data-color="red"> <div class="inside-color">Red</div> </div> <div class="color-class" data-color="green"> <div class="inside-color">Green&l ...

What could be the reason I am unable to choose data properties from the dropdown options?

There are two different dropdowns for clothing types and colors. When a type of clothing is selected from the first dropdown, JSON data will fill the second dropdown with options based on the first dropdown selection. After selecting an option from the se ...

Converting a timestamp to a date format within AngularJS interpolation

Is there a way to send a timestamp, such as 1519357500, to HTML and then convert it into a date format while using interpolation? I attempted the following approach but unfortunately it did not work: {{moment($ctrl.myTimestamp).format('MMMM Do YYYY, ...

What is the process for importing a specific version of a node module?

Is there a way to import a specific version of a node module? I am familiar with using npm to install packages, but that is not what I need in this case. Currently, my approach looks like this: // File 1 const fetch = require('module-version-1'); ...

Struggling to retrieve scope variable within ng-template inside script tag

Trying to create a template for inline editing with Angular, I found this useful tutorial: Here is my code: <table class="table"> <tbody> <tr class="table-row" ng-repeat="admin in admins" ng-include="getTemplate(admin)" ...

missing input fields in HTML form causing incomplete data submission on POST

I've encountered an unusual problem with my form data being POSTed via AJAX. For some reason, certain parts of the form are not being sent - specifically, the date and time sections. Here's a snippet of my form: <script src="/js/x.js" >< ...

Adding auth0 authentication to a Next.js 13 application: A step-by-step guide

Currently, I am using a nextjs 12 application and set up auth0 as my authentication provider by following the guidelines provided here: https://auth0.com/docs/quickstart/webapp/nextjs/interactive. However, I am now looking to upgrade my application to next ...

Having trouble implementing the center edge effect in this CSS design

Looking for help with CSS to center the edges of a family tree design. Has anyone experience in working on styling family trees? *, *:before, *:after { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .tree { ...

Utilize Office Scripts to update values across numerous worksheets

Looking for ways to improve the performance of this script, as it currently takes 45 seconds to run. Any ideas? function main(workbook: ExcelScript.Workbook) { try { const sheets = workbook.getWorksheets(); for (let sheet of sheets) { const break ...

Displaying a Modal with a Click Action

I am encountering a challenge in displaying a modal when clicked using onClick(). In a component, I have a function that adds players to a list when the Add Player button is clicked. This button is generated separately in a function called renderAddButton( ...

Bootstrap Tags Input - the tagsinput does not clear values when removed

I am attempting to manually remove the input value from bootstrap-tags-input when the x button is clicked, but the values are not changing in either the array or the inputs. This is the code I have tried: $('input').tagsinput({ allowDuplica ...

What is the best way to refresh a video within an image carousel?

I'm encountering an issue with my image carousel that contains a video. The first time the video plays normally, transitioning to another slide at the end. However, on subsequent plays, the video remains paused at the end and requires manual intervent ...

Having trouble with Vue and Vuex not returning the correct value in HTML?

I've implemented a navbar that displays specific menu items based on the user's role. Below is the simplified HTML code for the navbar: <v-speed-dial class="speed-dial-container contextual-text-menu" v-if="user && user. ...