nightwatch.js

What is the difference between NightwatchJS and WebdriverIO?

泪湿孤枕 提交于 2019-12-03 01:50:40
问题 As the title states, what is the difference between Nightwatch.js and Webdriver.io? It seems like they have kind of the same syntax and do almost the same thing. How are they different? I need to choose between them. 回答1: I've written a test suite using each of these tools a few times. Webdriver.io allows you to write your test cases "from scratch" and have great control over reporting, by say, integrating with slack using slack npm, and other packages. You would need to know or quickly learn

How to run a single test in nightwatch

拜拜、爱过 提交于 2019-12-02 17:54:26
How do I run only Test 3 from the following tests? module.exports = { 'Test 1':function(){}, 'Test 2':function(){} 'Test 3':function(){} } A new parameter --testcase has been added to run a specified testcase. nightwatch.js --test tests\demo.js --testcase "Test 1" It's a new feature since the v0.6.0 https://github.com/beatfactor/nightwatch/releases/tag/v0.6.0 You must use specific tags before function and separate all functions in diferent files under tests directory, and then call command with --tag argument. See wiki nightwatch tags page and watch this example: // --- file1.js --- module

What is the difference between NightwatchJS and WebdriverIO?

被刻印的时光 ゝ 提交于 2019-12-02 14:03:18
As the title states, what is the difference between Nightwatch.js and Webdriver.io? It seems like they have kind of the same syntax and do almost the same thing. How are they different? I need to choose between them. I've written a test suite using each of these tools a few times. Webdriver.io allows you to write your test cases "from scratch" and have great control over reporting, by say, integrating with slack using slack npm, and other packages. You would need to know or quickly learn node.js. In addition to working very well with desktop browsers, it integrates well with Appium, Android

Cannot locate element using recursion after it found it as visible

家住魔仙堡 提交于 2019-12-02 10:55:58
问题 My Problem: I am trying to click options in a dropdown with Nightwatch, using sections in page objects. I'm not sure if it's a problem with the section declaration or i'm missing something scope-related. Problem is that it finds the element as visible, but when it tries to click it will throw error that it cannot locate it using recursion. What could i try to do to fix this issue using sections? In the test: var myPage = browser.page.searchPageObject(); var mySection = searchPage.section

Nightwatch.js - Can't figure out how to pass a local variable into a URL parameter

跟風遠走 提交于 2019-12-02 07:11:34
I have tried both options, but nothing seems to work: var webNum = browser.getText('selector'); var urlGo = 'https://gotourl.com/' + webNum; browser.url(urlGo); or var webNum = browser.getText('selector'); browser.url('https://gotourl.com/' + webNum); Any ideas? .getText() is returning a WebElement JSON Object rather than string (the documentation on nightwatch api is misleading...) The text you want is the value of the WebElement JSON Object , and you can access it by using .value if you would like to get the text you have to do the following : var webNum = 'nothing'; browser.getText(

Cannot locate element using recursion after it found it as visible

ⅰ亾dé卋堺 提交于 2019-12-02 04:20:10
My Problem: I am trying to click options in a dropdown with Nightwatch, using sections in page objects. I'm not sure if it's a problem with the section declaration or i'm missing something scope-related. Problem is that it finds the element as visible, but when it tries to click it will throw error that it cannot locate it using recursion. What could i try to do to fix this issue using sections? In the test: var myPage = browser.page.searchPageObject(); var mySection = searchPage.section.setResults; // [finding and clicking the dropdown so it opens and displays the options] browser.pause (3000

Is it possible to set the value of Style property of an element by nightwatch.js ? if yes then how?

一世执手 提交于 2019-12-02 01:59:38
问题 I am working with nightwatch.js and i am quite new into this automation testing, i want to set the value into the style property of an element by nightwatch.js, so i am asking, is it possible ? if it is possible then how can we implement it. I can access the style property values and can check by following nightwatch api command but i couldn't find any way to set the style's value to an element using nightwatch.js browser.expect.element('#main').to.have.css('display').which.equals('block');

Nightwatch.js: window is undefined

谁都会走 提交于 2019-12-01 19:33:59
I'm trying to use Nightwatch to test a React application. I'm using React-Router with it. When running my test with Nightwatch window is undefined. React uses the following snippet to test if the DOM is available: var canUseDOM = !!( typeof window !== 'undefined' && window.document && window.document.createElement ); From React.js source: ExecutionEnvironment.js#L16 React-Router expects canUseDOM to be true, otherwise it throws an error. So my test fails because window is undefined when running Nightwatch. Shouldn't window be present with selenium webdriver? How can I make window available?

Browserstack reports successful even when test fails in Nightwatchjs

自闭症网瘾萝莉.ら 提交于 2019-12-01 18:16:17
I just started using nightwatch with browserstack and I'm noticing that when we get a failed test, nightwatch registers the failure, but browserstack does not. sample test I am using . Also I am using free trial version of BrowserStack. My question is: Are there any ideas how to tell browserstack when a test run failed ? From BrowserStack doc : REST API It is possible to mark tests as either a pass or a fail, using the following snippet: var request = require("request"); request({ uri: "https://user:key@www.browserstack.com/automate/sessions/<session-id>.json", method: "PUT", form: { "status":

Loop is not working properly - nightwatch

余生长醉 提交于 2019-12-01 14:22:45
I have this code, I want to go thru all the links available at the bottom of the page. After clicking them I want to make sure the URL opened is the correct one. I think the the recursive calls are done too early. Another issue is how can I do to tell that link belongs to certain URL. function links(browser, total_links) { if (total_links <= 0) { browser.end(); return; } console.log("Number of links: " + total_links); console.log('Flag1'); browser .waitForElementVisible('.bottom .socal>span:nth-child(' + total_links + ')', 1000, function () { console.log('Flag2'); browser.execute(