Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 12 12:09
    harshit-bs assigned #191
  • Aug 12 12:09
    harshit-bs review_requested #191
  • Aug 12 12:09
    harshit-bs edited #191
  • Aug 12 12:08
    harshit-bs opened #191
  • Aug 12 12:06

    harshit-bs on third-party

    json and allure reporter doc ad… (compare)

  • Aug 12 08:28
    vishalshah133 commented #185
  • Aug 12 07:00
    vaibhavsingh97 synchronize #3316
  • Aug 12 07:00
    vaibhavsingh97 synchronize #3316
  • Aug 12 06:16
    bes edited #3336
  • Aug 12 06:16
    bes edited #3336
  • Aug 11 20:27
    bes opened #3336
  • Aug 11 20:27
    bes opened #3336
  • Aug 11 13:21
    gravityvi unassigned #3037
  • Aug 11 13:21
    gravityvi unassigned #3037
  • Aug 11 13:21
    gravityvi locked #3037
  • Aug 11 13:21
    gravityvi locked #3037
  • Aug 11 13:21
    gravityvi closed #3037
  • Aug 11 13:21
    gravityvi closed #3037
  • Aug 11 13:21
    gravityvi commented #3037
  • Aug 11 13:21
    gravityvi commented #3037
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
Ravi Sawlani
@gravityvi
which page has been used to for this sample test?
personwyr
@personwyr

@gravityvi

module.exports = {
    'contextmenu test': function (browser) {
      browser
        .url('https://panjiachen.github.io/vue-element-admin/#/login')
        .waitForElementVisible('body', 1000)
        .click('#app > div > form > button')
        .pause(1000)
        .click('#app > div > div.sidebar-container > div > div.scrollbar-wrapper.el-scrollbar__wrap > div > ul > div:nth-child(2) > a')
        .pause(2000)
        .moveToElement('#tags-view-container > div > div.el-scrollbar__wrap > div > span:nth-child(1)', 5, 5)
        .mouseButtonClick('right')
        .pause(6000)
    }
}

is this ok?
I executed this code and didn't get the expected effect 👀

Ravi Sawlani
@gravityvi
Yes this works. I get a dropdown at the end of the test with 3 options refresh close others and close all. @personwyr is this what you were expecting from the test?
personwyr
@personwyr
Yes, I expect the first tab to get a dropdown with 3 options.
But on my computer, the first tab was selected without dropdown.
I use Nightwatch 1.7.6
Ravi Sawlani
@gravityvi
which browser are you using to run the test can you also share your nightwatch config so I verify it?
personwyr
@personwyr

nightwatch.conf.js

module.exports = {
  src_folders: ['tests'],
  output_folder: 'output',
  custom_assertions_path: [],
  page_objects_path: '',
  globals_path: '',
  selenium: {
      start_process: true,
      server_path: require('selenium-server').path,
      host: '127.0.0.1',
      port: 5555,
      cli_args: {
          'webdriver.chrome.driver': require('chromedriver').path
      }
  },
  test_settings: {
      default: {
          selenium_port: 5555,
          selenium_host: 'localhost',
          silent: true,
          globals: {
              devServerURL: 'http://localhost:' + (process.env.PORT || 1111)
          }
      },
      chrome: {
          desiredCapabilities: {
              browserName: 'chrome',
              javascriptEnabled: true,
              acceptSslCerts: true
          }
      },
      firefox: {
          desiredCapabilities: {
              browserName: 'firefox',
              javascriptEnabled: true,
              acceptSslCerts: true
          }
      }
  }
}

I'm using chrome

My dependencies version:
"chromedriver": "^91.0.1",
"nightwatch": "^1.7.7",
"selenium-server": "^3.141.59"
Ravi Sawlani
@gravityvi
is it possible to use default nightwatch config?
personwyr
@personwyr
ok, i'll try. I see an example "https://github.com/nightwatchjs/nightwatch-website-test".
I'll re-create the project tomorrow. At present, it may be caused by nightwatch config. Thank you
personwyr
@personwyr
I used the default nightwatch config, The problem is solved 👏😊
Ravi Sawlani
@gravityvi
🎉
Henry Pitman
@profplum700
image.png
Hi, we're trying to upgrade from Nightwatch 1.2.4 to 1.7.7. We get several errors still though! Does anyone have any tips for troubleshooting/resolving?
This is our package.json
image.png
Amit Pandey
@mastergogo
is there any way to run tests in mobile emulation (toggle device toolbar) in chrome for any web page?
Amit Pandey
@mastergogo
found it, updated my config with below:
desiredCapabilities: {
browserName: 'chrome',
javascriptEnabled : true,
acceptSslCerts : true,
chromeOptions: {mobileEmulation: {
deviceMetrics: {width: 360, height: 640, pixelRatio: 3},
userAgent:
'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/60.0.3112.101 Mobile Safari/537.36 profi-autotest',
}
}
Tim Yao
@tim-yao
Hi, in VSCode we can use F12 to find the definition of a function. However, it seems not work for nightwatch commands. Either my custom commands or core commands. Does anyone here has solution for it?
I think this https://www.npmjs.com/package/@types/nightwatch will help but couldn't make it work. Based on https://code.visualstudio.com/docs/nodejs/working-with-javascript#_typings-and-automatic-type-acquisition
Thanks.
Amit Pandey
@mastergogo
Hi, working on testing the mobile app using the ionic framework, it has custom HTML elements (ion-button) and UI components, when I'm trying to click a button, it says the button is not visible and not interactable, I tried using XPath and CSS selectors both also delaying the click by few seconds, but unable to click on the button, can anyone help or point me in the right direction? thanks in advance
strellisrx
@strellisrx
Hey everyone I'm new on gitter. I'll appreciate some insight on this issue. I looked all over the internet and still haven't found a definitive solution to this issue.
When running npm run cuke I get:
'Driver info: driver.version: unknown'
],
message: 'Unable to create session from {'
},
status: 33
It does log the version prior to executing
And I can create a session if I do it from the hub manually
I'm using chromeversion90 macOS big sur
this is my nightwatch conf

// @ts-ignore

const chromedriver = require('chromedriver');
const seleniumServer = require('selenium-server');

const config = {
// we use a nightwatch.conf.js file so we can include comments and helper functions
src_folders: [
'src/tests/functionaltest', // we use '/test' as the name of our test directory by default. So 'test/e2e' for 'e2e'.
],
page_objects_path: 'src/tests/page-objects',
output_folder: './node_modules/nightwatch/reports', // reports (test outcome) output by Nightwatch
custom_commands_path: 'src/tests/commands',
selenium: {
start_process: true,
server_path: seleniumServer.path,
log_path: '',
host: '127.0.0.1',
port: 4444,
cli_args: {
'webdriver.chrome.driver': chromedriver.path,
},
},
test_workers: { enabled: true, workers: 'auto' }, // perform tests in parallel where possible
test_settings: {
default: {
webdriver: {
start_process: true,
server_path: chromedriver.path,
port: 4444,
cli_args: ['--port=4444'],
},
launch_url: 'http://localhost:3000',
selenium_port: 4444,
selenium_host: '127.0.0.1',
silent: true,
capabilities: {
configuration: {
_comment: 'Configuration for Node',
cleanUpCycle: 2000,
timeout: 30000,
port: 5555,
host: '127.0.0.1',
register: true,
hubPort: 4444,
maxSession: 5,
},
},
desiredCapabilities: {
browserName: 'chrome',
seleniumProtocol: 'WebDriver',
chromeOptions: {
w3c: false,
args: [
'--enable-features=NetworkService,NetworkServiceInProcess',
'--headless',
'--disable-gpu',
'--no-sandbox',
'--disable-dev-shm-usage',
'--window-size=1920,1080',
],
},
},
screenshots: {
enabled: true,
path: './reports/nightwatchTests/screenshots',
on_failure: true,
on_error: true,
},
use_xpath: false,
},
local: {
launch_url: 'http://localhost:3000',
selenium_port: 4444,
selenium_host: '127.0.0.1',
silent: true,
globals: {
waitForConditionTimeout: 15000, // Default timeout, 15 seconds
},
desiredCapabilities: {
browserName: 'chrome',
platform: 'ANY',
seleniumProtocol: 'WebDriver',
chromeOptions: {
w3c: false,
args: [
'--enable-features=NetworkService,NetworkServiceInProcess',
'--headless',
'--disable-gpu',
'--no-sandbox',
'--disable-dev-shm-usage',
'--window-size=1920,1080',
],
},
javascriptEnabled: true,
acceptSslCerts: true,
},
},

Ravi Sawlani
@gravityvi
Hey @strellisrx, can you use compose mode for sharing code as it would more readable also can you share your cuke npm script you are trying to run?
Xander Dumaine
@xdumaine

Hi, I'm trying to convert a bash script that invokes nightwatch to using programmatic API, and when I'm running it, the webdriver isn't starting and I can't figure out why.

config:

{
  output_folder: 'nightwatch_output',
  webdriver: {
    start_process: true,
    port: 9515,
    server_path: '/usr/local/bin/chromedriver',
    cli_args: [
      '--port=9515',
      '--log-path=nightwatch_output/chromedriver-2021-07-23T00:55:10.479Z.log'
    ]
  },
  test_settings: {
    default: {
      desiredCapabilities: [Object],
      globals: [Object],
      launch_url: 'redacted',
      screenshots: [Object]
    }
  },
  globals: {
    asyncHookTimeout: 90000,
    retryAssertionTimeout: 30000,
    waitForConditionTimeout: 30000
  },
  src_folders: [ 'test' ]
}

Code:

(async () => {
  const runner = Nightwatch.CliRunner();
  await runner.setup(config).startWebDriver();

  try {
    runner.runTests();
  } catch (err) {
    await runner.stopWebDriver();
  }
})();

output:


==========================
⠋ Connecting to localhost on port 9515...
    POST  /session - ECONNREFUSED
⚠ Error connecting to localhost on port 9515.
_________________________________________________

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

   Error: An error occurred while retrieving a new session: "Connection refused to 127.0.0.1:9515". If the Webdriver/Selenium service is managed by Nightwatch, check if "start_process" is set to "true".
it doesn't even seem like it's attempting to start the webdriver.
Xander Dumaine
@xdumaine
to clarify, tests run fine with the exact same config using yarn nightwatch and passing that config.
Xander Dumaine
@xdumaine
It's a dead simple setup so something must be bad about the example here - https://nightwatchjs.org/guide/running-tests/programmatic-api.html
Xander Dumaine
@xdumaine

I made some progress by passing Nightwatch.CliRunner({ config: 'nightwatch.conf.js', env: 'default'})

but now getting unknown error: Chrome failed to start: exited abnormally.

Xander Dumaine
@xdumaine
oh hey, I solved that, I just missed the headless. boy that took some reverse engineering to figure out the right params. that docs page really needs updated.
Ravi Sawlani
@gravityvi
Hey @xdumaine, we would surely work on documentation but thanks for sharing :smile:
You could also use Nightwatch default config which would save you from all the configuration
Tim Yao
@tim-yao
Hi @gravityvi As you here, any idea on this question?
in VSCode we can use F12 to find the definition of a function. However, it seems not work for nightwatch commands. Either my custom commands or core commands. Does anyone here has solution for it?
I think this https://www.npmjs.com/package/@types/nightwatch will help but couldn't make it work. Based on https://code.visualstudio.com/docs/nodejs/working-with-javascript#_typings-and-automatic-type-acquisition
Thanks.
Ravi Sawlani
@gravityvi
Hi @tim-yao, I don't have an idea regarding but have a look at this tweet this might help your usecase I think : tweet
Tim Yao
@tim-yao
Thanks @gravityvi , I really think this is important for dev experience. When I use cypress, VSCode Intellisense works by default.
Ravi Sawlani
@gravityvi
Yes, I agree, we will look into it :smiley: .
Tim Yao
@tim-yao
Thanks!
Xander Dumaine
@xdumaine

You could also use Nightwatch default config which would save you from all the configuration

That seems like a silly suggestion.

  1. it disregards the specific requirements that I have
  2. it doesn't work. Using the example provided on the docs that I linked, the cli runner still doesn't create any webdriver instances

Additional feedback:

when starting the runner, I don't think it should resolve if there are no instances to start. Rejecting due to no instances would be best, but at least have a warning logged that there are no instances created (and why) would save a lot of time in debugging.

Ravi Sawlani
@gravityvi
Hey @xdumaine, you can raise a issue regarding this in the project moreover we will also appreciate your contribution if you can raise a PR with suggested changes.
vdokkupalle-ebsco
@vdokkupalle-ebsco

Hi.. I am using nightwatch API as a node service. I found that over the time, the memory is keep increasing. When I profiled the node app, I see the results are not being cleared from memory and all the loaded scenarios as modules are in memory in the form of strings. Is there a way to unload the scenario when a test is completed?

Also is there a way to store the results as JSON file.. I am using the reporter callback in globals to get the results and saving it as JSON. But when there are many tests, the results object is huge and it is crashing the server when saving it to file system (Probably during stringify. I am using BFJ library to stringify the object asynchronously). Any ideas to reduce the report size?

Thanks

Ravi Sawlani
@gravityvi
hey @vdokkupalle-ebsco, by Nightwatch API are you referring to the nightwatch-api node package?
vdokkupalle-ebsco
@vdokkupalle-ebsco
Hi @gravityvi , It's Nightwatch Cli Runner