intern

Intern JS - how can I use Promise.all() within chained Command methods?

陌路散爱 提交于 2019-12-06 01:54:32
I am new to writing tests with Intern JS and have been following their documentation to use the Object interface and Page objects , particularly. According to the docs, the idea behind page objects is to encapsulate the DOM for a particular page, in case of the markup changing. In attempting to follow the page object pattern, my goal is to have a method on myPage which uses Promise.all() to find several DOM elements, and then return these to an actual test function. I'm roughly basing this on the Promise.all() example near the top of the documentation for leadfood/Command . I'm suspecting I'm

How to require modules for testing NodeJS with Intern JS?

左心房为你撑大大i 提交于 2019-12-06 00:21:56
I'm getting the error Attempt to require unloaded module xxxxxx with the following intern.js test (myfile.js below does a require('xxxxxx') ) for testing NodeJS. define(function(require) { var bdd = require('intern!bdd'); var myfile = require('../myfile.js'); bdd.describe('the thing being tested', function() { bdd.it('do the test', function() { ... The directory structure is intern.js myfile.js test |-- test.js How do I properly require a file? There's no examples on how to do it with the BDD test interface. There are examples of doing it with the other style like in How do I load the node.js

Intern: loop on Promise.<Array.<leadfoot/Element>>

回眸只為那壹抹淺笑 提交于 2019-12-05 22:51:33
Let's say I have the following DOM structure, for simplicity: <div class='myparent'> <div class='child'> <div class="label">A</div> <div class="ico"/> </div> <div class='child'> <div class="label">B</div> <div class="ico"/> </div> <div class='child'> <div class="label">C</div> <div class="ico"/> </div> </div> I would like to loop within all child Element returned by the function findAllByCssSelector('.child'). In particular, I would click on the ico div subelement ONLY if the label of the div is B. I would remember, that findAllByCssSelector() returns Promise.<Array.<leadfoot/Element>> .

Can't get Intern to run Node.js Module

眉间皱痕 提交于 2019-12-05 06:36:14
I am trying to test Intern to see if it would be a good fit for a testing framework. I am trying to test the following code in Intern. var HelloWorld; HelloWorld = (function () { function HelloWorld (name) { this.name = name || "N/A"; } HelloWorld.prototype.printHello = function() { console.log('Hello, ' + this.name); }; HelloWorld.prototype.changeName = function(name) { if (name === null || name === undefined) { throw new Error('Name is required'); } this.name = name; }; return HelloWorld; })(); exports = module.exports = HelloWorld; The file is located in 'js-test-projects/node/lib

test suite paths when using ArcGIS JSAPI as an alternate loader in intern

最后都变了- 提交于 2019-12-05 02:30:41
问题 I have an application built using ArcGIS Javascript API and I've been adding tests using intern. I run it under IIS in Windows 7 while developing. I had no trouble getting the intern tutorial working when getting started and after looking at How to specify alternate loader for intern I was able to set the loader in client.html to <script src="http://js.arcgis.com/3.7/"></script> and I was able get my tests running but only after I changed the path in both the query string and in intern.js to

How do I take a screenshot when a test in internjs fails?

情到浓时终转凉″ 提交于 2019-12-04 20:44:31
I am having issues figuring out how to take a screenshot ONLY when a test fails in InternJs. I have this simple test in my registerSuite; 'verify google homepage': function () { var url = 'https://www.google.com/'; return this.remote .get(url) .getCurrentUrl() .then(function (data) { assert.strictEqual(data, url, 'Incorrect URL'); }) .findByName('q') .click() } I can simply create a screenshot using the following code; .takeScreenshot .then(function (data) { fs.writeFileSync('/path/to/some/file', data, 'base64'); )} I want to only take a screenshot, if the above test fails the assertion or is

Start Chrome emulation from command line

一世执手 提交于 2019-12-04 17:46:57
问题 I use Google Chrome with Intern to run automated tests and I would like to know if there is a way to launch Chrome in emulation mode from CLI or using a specific flag to test mobile rendering. If not, do you know a good workaround ? I could directly use the Android Emulator (from Android SDK) with Selenium Webdriver apk or with mobile Chrome but tests are crashing most of the time, emulators don't respond and I have to restart it. Also, I need to test on the largest possible scope, not

Remote debugging Internjs that runs on selenium chromedriver

血红的双手。 提交于 2019-12-04 07:44:39
I try to remotely debug tests run by Internjs. Basically it is a Chrome that is run by Selenium and Chromedriver. I set up Chromedriver debuggerAddress option as debuggerAddress: '127.0.0.1:8765' Now when I run tests Selenium waits some time and than fails with message: FATAL ERROR UnknownError: [POST http://localhost:4444/wd/hub/session / {"desiredCapabilities":{"browserName":"chrome","name":"tests/intern_local","idle-timeout":60,"selenium-version":"2.44.0","chromeOptions":{"debuggerAddress":"127.0.0.1:8765"}}}] unknown error: cannot connect to chrome at 127.0.0.1:8765 from chrome not

test suite paths when using ArcGIS JSAPI as an alternate loader in intern

杀马特。学长 韩版系。学妹 提交于 2019-12-03 16:38:16
I have an application built using ArcGIS Javascript API and I've been adding tests using intern. I run it under IIS in Windows 7 while developing. I had no trouble getting the intern tutorial working when getting started and after looking at How to specify alternate loader for intern I was able to set the loader in client.html to <script src="http://js.arcgis.com/3.7/"></script> and I was able get my tests running but only after I changed the path in both the query string and in intern.js to include the parent path as defined in IIS. For example, say my app is hosted at http://localhost

“TypeError: deps.map is not a function” in resolveDepMaps() of node_modules/dojo/dojo.js

僤鯓⒐⒋嵵緔 提交于 2019-12-02 11:27:32
问题 I've been changing my org's underlying infrastructure to switch our automated tests from running in browser client using a separate web server to running in the test runner (intern-runner). In the test runner environment, things had been going swell--I'd gotten past a ton of issues, but then boom! Someone drops a new unittest, that runs just fine in the browser client, but then when I run it with test runner, I get this error: ! TypeError: deps.map is not a function at http://9.77.140.51:9000