intern

How to do conditional browser interactions with intern

落爺英雄遲暮 提交于 2019-12-02 09:22:21
问题 With the promised web driver I would like to check if an element exists on the page, then login if it does, otherwise continue with the promise chain. Is this not possible at the moment due to https://github.com/theintern/intern/issues/14? 回答1: In Intern 2, simply use the normal find command: var remote = this.remote; remote.get(url) .findById('foo') .then(function (element) { // exists }, function () { // does not exist }); In Intern 1, if you need to conditionally branch, you’ll need to

How to do conditional browser interactions with intern

99封情书 提交于 2019-12-02 04:49:05
With the promised web driver I would like to check if an element exists on the page, then login if it does, otherwise continue with the promise chain. Is this not possible at the moment due to https://github.com/theintern/intern/issues/14 ? In Intern 2, simply use the normal find command: var remote = this.remote; remote.get(url) .findById('foo') .then(function (element) { // exists }, function () { // does not exist }); In Intern 1, if you need to conditionally branch, you’ll need to stop and add new instructions based on the result of your check. var remote = this.remote; remote.get(url)

How to run intern to test a dojo application running with node.js ?

和自甴很熟 提交于 2019-12-02 00:20:02
问题 I'm trying to use intern to test a dojo application running under node.js My intern.js configuration file is something like: define({ loader: { packages: [ { name: 'elenajs', location: 'lib' }, { name: 'tests', location: 'tests' } ], map: { 'elenajs': { dojo: 'node_modules/dojo' }, 'tests': { dojo: 'node_modules/dojo' } } }, suites: [ 'tests/all' ]}); When I try to run a test with node node_modules/intern/client.js config=tests/intern , I get this error: Error: node plugin failed to load

How to run intern to test a dojo application running with node.js ?

﹥>﹥吖頭↗ 提交于 2019-12-01 23:41:51
I'm trying to use intern to test a dojo application running under node.js My intern.js configuration file is something like: define({ loader: { packages: [ { name: 'elenajs', location: 'lib' }, { name: 'tests', location: 'tests' } ], map: { 'elenajs': { dojo: 'node_modules/dojo' }, 'tests': { dojo: 'node_modules/dojo' } } }, suites: [ 'tests/all' ]}); When I try to run a test with node node_modules/intern/client.js config=tests/intern , I get this error: Error: node plugin failed to load because environment is not Node.js . Normally I would have configured dojo with something like dojoConfig =

How to mock dependencies in Intern tests [closed]

两盒软妹~` 提交于 2019-11-29 16:34:53
Is intern use requireJs to load the test? I'm using this approach to mock out dependencies for the module I wanna test, so I wonder if this will work with Intern as well. Intern uses the Dojo Toolkit’s AMD loader. To mock out dependencies, you should be able to just use the standard AMD map feature. In your Intern configuration file, something like this should do what you need: define({ …, loader: { map: { myPackage: { 'myPackage/foo': 'myPackage/mocks/foo', 'herp': 'myPackage/mocks/herp', 'derp': 'myPackage/mocks/derp' } } } }); See https://github.com/amdjs/amdjs-api/wiki/Common-Config#map-

Why is my intern test failing with “document is not defined”

夙愿已清 提交于 2019-11-29 12:27:00
I am new to Intern and struggling with trying to get a simple test to run in my environment. I was able to get the tutorial test to run but I've tried to set up a test where the test file is located inside my app directory hierarchy. The module being tested is located here: sandbox/web/libs/ev/grids/FilterGrid.js The test file is located here: sandbox/web/libs/ev/tests/FilterGrid.js My intern config file is located here: sandbox/tests/intern.js My loader and suites objects looks like this: loader: { packages: [ { name: 'dojo', location: 'web/libs/dojo' }, { name: 'dijit', location: 'web/libs

How do I load the node.js http module from within an intern.js test?

折月煮酒 提交于 2019-11-28 14:15:12
I am attempting to use the Intern test framework to automate testing of a simple REST API implemented with node.js and StrongLoop. StrongLoop provides an explorer web page that I have used to validate that the REST API is implemented and I can manually test the API from Postman. The first API test I am attempting with intern.js retrieves the count of media objects in a collection. The HTTP method is GET, the URL is http://localhost:3000/api/media/count and the response is {"count": 2}. When I run my intern.js test I receive an error "Error: Attempt to require unloaded module http". I have a

Why is my intern test failing with “document is not defined”

落花浮王杯 提交于 2019-11-28 06:27:52
问题 I am new to Intern and struggling with trying to get a simple test to run in my environment. I was able to get the tutorial test to run but I've tried to set up a test where the test file is located inside my app directory hierarchy. The module being tested is located here: sandbox/web/libs/ev/grids/FilterGrid.js The test file is located here: sandbox/web/libs/ev/tests/FilterGrid.js My intern config file is located here: sandbox/tests/intern.js My loader and suites objects looks like this:

How do I load the node.js http module from within an intern.js test?

我的梦境 提交于 2019-11-27 08:16:26
问题 I am attempting to use the Intern test framework to automate testing of a simple REST API implemented with node.js and StrongLoop. StrongLoop provides an explorer web page that I have used to validate that the REST API is implemented and I can manually test the API from Postman. The first API test I am attempting with intern.js retrieves the count of media objects in a collection. The HTTP method is GET, the URL is http://localhost:3000/api/media/count and the response is {"count": 2}. When I