Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 10:29
    gravityvi assigned #3451
  • 10:29
    gravityvi assigned #3451
  • Nov 30 22:19
    swrdfish edited #3496
  • Nov 30 22:19
    swrdfish edited #3496
  • Nov 30 22:18
    swrdfish edited #3508
  • Nov 30 22:18
    swrdfish edited #3508
  • Nov 30 22:16
    swrdfish review_requested #3508
  • Nov 30 22:16
    swrdfish review_requested #3508
  • Nov 30 22:16
    swrdfish opened #3508
  • Nov 30 22:16
    swrdfish opened #3508
  • Nov 30 21:44
    chriscuba23 commented #3451
  • Nov 30 21:44
    chriscuba23 commented #3451
  • Nov 30 21:41
    chriscuba23 commented #3451
  • Nov 30 21:41
    chriscuba23 commented #3451
  • Nov 30 21:19
    swrdfish edited #3496
  • Nov 30 21:19
    swrdfish edited #3496
  • Nov 30 20:56
    swrdfish converted_to_draft #3496
  • Nov 30 20:56
    swrdfish converted_to_draft #3496
  • Nov 30 20:55
    swrdfish edited #3496
  • Nov 30 20:55
    swrdfish edited #3496
DustinBest
@DustinBest
Screen Shot 2021-05-17 at 11.03.40.png
this is the first i am using nightwatch so theres not much set up yet
Ravi Sawlani
@gravityvi
try using assert.value('#login_user','username') after setValue
getValue requires a callback method too so it's better to use assert.value directly
DustinBest
@DustinBest
when i use that i get the error "element could not be located". I checked the recordings and the element is there and its getting updated with the username
a more detailed response shows this "errorStatus":405,"error":"Method has not yet been implemented","httpStatusCode":501}
i am using browerstack which is using nightwatch to write the scripts which might be part of it
Ravi Sawlani
@gravityvi
Strange, I will try using browserstack and check, it should work.
DustinBest
@DustinBest
yeah, maybe i configured something wrong. This is new for us
Ravi Sawlani
@gravityvi
can you share the code base in the chat so that I work on the same thing and resolve it?
DustinBest
@DustinBest
a lot of the stuff i have so far is revolving around logging into my companies product site which is private. beyond that snippet above, not sure what you need to see, but we may be able to modify the code to show you
Ravi Sawlani
@gravityvi
yeah, it's hard to reproduce the issue if we are testing on different website
maybe setting up a test repo would resolve it
DustinBest
@DustinBest
yeah, i am actually building off of the nightwatch-browserstack demo repo that i just modified the config with my username and key and then set up the above script to run on an ipad 12
DustinBest
@DustinBest
i set the url to google.com and just typed into the search bar and when i do the assertion i still get the same result
20 replies
zwbetz-gh
@zwbetz-gh
RE: securely using the test password. Instead of hardcoding it, read it from an env var.
miltonofficial
@miltonofficial
Has anyone one implemented nightwatch.js auto tests execution(Drupal 8) on Pantheon server?
RachaelKlein92
@RachaelKlein92

Good morning,

Could you please advise whether Nightwatch testing framework supports the following?

Desktop:
IE11 - yes/no?
Edge - yes/no?
Chromium - yes/no?
Firefox - yes/no?
Safari - yes/no?

Mobile: Responsive web:
Chrome - yes/no?
Safari - yes/no?

Ravi Sawlani
@gravityvi
Hey @RachaelKlein92 it's possible to run test on all of the above using nightwatch
RachaelKlein92
@RachaelKlein92
This message was deleted
1 reply
Amit Pandey
@mastergogo
Hi All, new here and also new to automated testing, im trying to test a hybrid mobile application using Nightwatch, I'm able to launch my localhost url and also able to open the dev tools, but not able to emulate device, how can i do that? is there any reference i can look? or do i need to share how my nightwatch.conf.js look like? thanks in advance
3 replies
Michael Harding
@redoxeon
I'm trying to get both unit and e2e testing set up for my team, but for the unit tests I'm not sure about the right way to import vue components that I want to test. Can unit tests also use the BDD Describe stuff?
dharls36
@dharls36

Hi. I'm trying to run my nightwatch tests on headless firefox, but can't get it to work. My config includes

firefox: {
desiredCapabilities: {
browserName: 'firefox',
javascriptEnabled : true,
acceptSslCerts: true,
acceptInsecureCerts: true,
firefoxOptions: {
w3c: false,
headless: true,
args: [
'--enable-features=NetworkService,NetworkServiceInProcess',
'--ignore-certificate-errors',
'--disable-web-security',
'--window-size=1920,1080',
'--disable-extensions',
'--start-maximized',
'--disable-dev-shm-usage',
'disable-infobars',
'disable-notifications',
'--log-level=3',
'--headless'],
prefs: {

any ideas what I'm doing wrong? Thanks.

Alexander Kjeldaas
@alexander.kjeldaas:matrix.org
[m]
Is there a way to modify a web page before it's parsed? I would like to replace a <script src=...> element in a test.
Ravi Sawlani
@gravityvi
Hey @dharls36, the following is the desired capabilities to use firefox in headless mode.
Hope this helps.
desiredCapabilities: {
        'moz:firefoxOptions': {
          args: [
            '--headless'],
        }
      }
Ravi Sawlani
@gravityvi
Hey @redoxeon, it is totally possibe to run unit test cases using nightwatch with describe thing. you can set unit_tests_mode:true in your nightwatch config and you are ready go. Below is the simple example of it. For more information on unit test cases you can refer this. Hope it helps ๐Ÿ˜ƒ
const add = require('./add');
const assert = require('assert');
describe('Adding two numbers',function (){
    it('adding two numbers',function(){
        const sum = add(2,3);
        assert.strictEqual(sum,5);
    })
})
Andrei Rusu
@beatfactor
Hey everyone! Nightwatch v1.7.3 is released in NPM. You can check out the changelog here:
https://github.com/nightwatchjs/nightwatch/releases/tag/v1.7.3
Andrei Rusu
@beatfactor
We released a survey where you can let us know about what features you'd like to see in Nightwatch v2. Here's the link: https://forms.gle/zBhbjdsDE77hTHSB7
neu5
@neu5
hey, If I expose some global methods eg. window.e2e
how can I access them in the test?
I want to write API for testing
Ravi Sawlani
@gravityvi
Hey @neu5, I didn't get your use case quite clearly. would it be possible to elaborate it or maybe share a code snippet?
neu5
@neu5

hey @gravityvi, my application renders in <canvas> so I cannot interact with it via DOM elements. So my idea was to create global object on window, eg. e2e holding methods eg.
e2e: { doSmth() }
that method under the hoods can call the backend endpoint or whatever. I'm trying to have tests looking like

client
      .url("http://localhost:5000/")
      .makePlayerDie('playerName')
      .pause(2000) // wait for backend to perform
      .checkIfPlayerIsDead('playerName')
      .respawnPlayer('playerName')
      .checkIfPlayerIsAlive('playerName')
      .end()

this makePlayerDie, checkIfPlayerIsDead, respawnPlayer, checkIfPlayerIsAlive are methods available in
window.e2e global
but I don't know how to access this global from the nightwatch

neu5
@neu5
okey, it looks like I am on the right path. I need to use execute :)
Ravi Sawlani
@gravityvi
๐Ÿ˜ƒ
Tim Yao
@tim-yao
Hi, I have problem to use basic authentication in Safari. Url like "https://user:pass@hostname.com" works for Chrome and Firefox, but won't work for Safari. Do we have a solution except proxy?
Ravi Sawlani
@gravityvi
Hi @tim-yao, can you share your nightwatch config?
Tim Yao
@tim-yao
@gravityvi I mean just browser.url("https://user:pass@hostname.com"); won't work for Safari.
Safari in MacOS does not support basic authentication by passing the username and password in URL. Unfortunately, currently we do not have any workaround to solve this problem.
Looks like no solution for it based on this doc about selenium:
https://www.browserstack.com/docs/automate/selenium/basic-http-authentication#pass-username-and-password-in-the-url
dharls36
@dharls36

Hi.

I've just installed the latest Nightwatch (npm node package) version 1.7.7 and the way I run my tests is no longer working.

If I run my tests on a group basis:

npx nightwatch -c config/local.conf.js -e chrome --g carInsurance

it works ok.

However, if I run them on a tag basis:

npx nightwatch -c config/local.conf.js -e chrome --t carInsuranceTest

it runs all of my tests, not just the tests with the carInsuranceTest tag.

Has the way you run tests using tags changed in the latest Nightwatch version (my tests worked Ok in my previous nightwatch version, which was 0.9.21)?

Any help would be greatly appreciated. Thanks.

Ravi Sawlani
@gravityvi
Hey @dharls36, I am not able to reproduce the issue. Can you share your project structure and nightwatch config?
dharls36
@dharls36

Hi.
Ok, so this appeared to be an issue with my nightwatch 1.7.7 setup, as it works locally with 1.7.6.
However, something strange is happening with 1.7.6 when I run my tests through Browserstack. If I run a single test, it works Ok. However, if I run the same test but using its tag, it falls.

darrenharley@wks63613 Functional % ./node_modules/.bin/nightwatch -c config/browserstack.conf.js -e chrome /Users/darrenharley/Documents/Git/uk-content-parkers/Tests/Functional/tests/carInsurance/PAR-4540.js
Using insecure HTTP connection on port 80. Consider using SSL by setting port to 443 in your Nightwatch configuration.
โ„น Connected to hub-cloud.browserstack.com on port 80 (5875ms).
  Using: chrome (85.0.4183.83) on WINDOWS platform.

โœ” [Car Insurance/ PAR 4540] navigate to an example model insurance groups page (4.614s)
โœ” [Car Insurance/ PAR 4540] choose another car dropdowns removed (146ms)
โœ” [Car Insurance/ PAR 4540] insurance group link correctly added (915ms)
โœ” [Car Insurance/ PAR 4540] closing the browser (1.644s)

  See more info, video, & screenshots on Browserstack:
  https://automate.browserstack.com/builds/8f4a93d294271b7c0e7b8db31370f34dd7ba1e76/sessions/ebdae3948c7f16175783f9f814b7aadc21e91c02

OK. 4  total assertions passed (13.513s)

darrenharley@wks63613 Functional % ./node_modules/.bin/nightwatch -c config/browserstack.conf.js -e chrome --tag carInsurance                                                           Using insecure HTTP connection on port 80. Consider using SSL by setting port to 443 in your Nightwatch configuration.
โ ธ Connecting to hub-cloud.browserstack.com on port 80...
_________________________________________________

TEST FAILURE: 1 error during execution; 0 tests failed, 0 passed (788ms)

  Error: Handshake failed: no matching key exchange algorithm
       at addChunk (internal/streams/readable.js:309:12)
       at readableAddChunk (internal/streams/readable.js:284:9)
       at Socket.Readable.push (internal/streams/readable.js:223:10)
       at TCP.onStreamRead (internal/stream_base_commons.js:188:23)

Has anyone seen this before? Thanks.

--group works ok too. So it appears to be just tags.
Ravi Sawlani
@gravityvi
@dharls36 can you share your browserstack.conf.js? I am not able to reproduce this in version 1.7.6
dharls36
@dharls36

Hi @gravityvi yeah, sure. Here it is...

browserstackConf = {
    src_folders: [
        'tests/'
    ],
    output_folder: false,
    globals_path: 'globals.js',
    page_objects_path: 'config/page_objects',
    test_workers: true,
    detailed_output: false,
    output: true,
    disable_error_log: true,
    disable_colors: false,
    custom_commands_path: 'config/commands/',
    selenium: {
        start_process: false,
        host: 'hub-cloud.browserstack.com',
        port: 80
    },
    test_settings: {
        default: {
            launch_url: 'https://www.parkers.co.uk/',
            desiredCapabilities: {
                project: 'Parkers',
                build: 'latestBuild',
                'browserstack.selenium_version': '3.141.59',
                'browserstack.user': 'xxxxxx',
                'browserstack.key': 'xxxxxx',
                'browserstack.local': false,
                'browserstack.debug': true,
                'excludeSwitches': ['disable-popup-blocking'],
            },
        },
    chrome: {
        desiredCapabilities: {
            os: 'Windows',
            os_version: '10',
            browserName: 'Chrome',
            browser_version: '85.0',
            javascriptEnabled : true,
            acceptSslCerts: true,
            acceptInscureCerts: true,
            chromeOptions : {
                'excludeSwitches': ['disable-popup-blocking'],
                args: [
                    '--ignore-certificate-errors',
                    '--disable-web-security',
                    '--window-size=1920,1080',
                    '--disable-extensions',
                    '--start-maximized',
                    '--disable-dev-shm-usage',
                    'disable-infobars',
                    'disable-popup-blocking',
                    'disable-notifications',
                    '--log-level=3'],
                prefs: {
                    'profile.managed_default_content_settings.popups' : 1,
                    'profile.managed_default_content_settings.notifications' : 1
                },
            },
        },
    },
    safari: {
        desiredCapabilities: {
            os: 'OS X',
            os_version: 'Catalina',
            browserName: 'Safari',
            browser_version: '13.1'
        },
    },
    edge: {
        desiredCapabilities: {
            os: 'Windows',
            os_version: '10',
            browserName: 'Edge',
            browser_version: '18.0'
        },
    },
    firefox: {
        desiredCapabilities: {
            os: 'OS X',
            os_version: 'Catalina',
            browserName: 'Firefox',
            browser_version: '76'
        },
    },
    android: {
        desiredCapabilities: {
            device: 'Google Pixel 2',
            os_version: '8.0',
            realMobile: 'true'
        },
    },
  },
};

for (const settingsLoop in browserstackConf.test_settings) {
    const config = browserstackConf.test_settings[settingsLoop];
    config["selenium_host"] = browserstackConf.selenium.host;
    config["selenium_port"] = browserstackConf.selenium.port;
    config["desiredCapabilities"] = config["desiredCapabilities"] || {}
    for (const capabilitiesLoop in browserstackConf.common_capabilities) {
    config["desiredCapabilities"][capabilitiesLoop] = config["desiredCapabilities"][capabilitiesLoop] || browserstackConf.common_capabilities[capabilitiesLoop]
    }
}

module.exports = browserstackConf

many thanks :)

Ravi Sawlani
@gravityvi
@dharls36 I used this config with Nightwatch version 1.7.6, I am afraid I am not able to reproduce it. Could you a setup a small test recreating this issue so I can pick up from there?
personwyr
@personwyr
Why is browser.mouseButtonClick ('right ') a left click instead of a right click
I'm Chinese. I'm sorry for my poor English
Ravi Sawlani
@gravityvi
Hey @personwyr, I tried re-creating this issue in a sample test. The right click worked fine. Can you share some code snippet where I can re-create this? By the way your English looks alright to me :smile:
personwyr
@personwyr
// @gravityvi
// A tab navigation DOM that can pop up a drop-down box with the right click
const tab = '/html/body/div[1]'  

module.exports = {
  '้กต้ขๅˆทๆ–ฐ': (brower) => {
    brower
      .useXpath()
      .moveToElement(tab)
      .mouseButtonClick('right')
      .pause(5000)
  }
}
personwyr
@personwyr
moveToElement(tab, 5, 5)
I just sent a wrong code