intern

How to generate unit tests from a JS module automatically?

≯℡__Kan透↙ 提交于 2020-07-08 20:40:40
问题 I have inherited a project with multiple JavaScript files. Each of them has a bunch of functions; the files are defined in AMD style. For instance: math.js define([], function () { return { func1: function (a, b) { return a + b; }, func2: function (c, d) { return c + d; }, }; }); I would like to generate a new file in the tests folder with the name ( math.js ) that will contain the boilerplate code for the unit tests in tdd style for the intern framework. I have used the intern-generator, a

Can you upload remote files with intern leadfoot

蓝咒 提交于 2020-01-17 03:14:04
问题 I'm testing a file upload feature and trying to upload remote files(e.g. https://s3.amazonaws.com/some_dir/some_file). Using type() throws an error stating the path is not absolute. Is this supported by intern? If yes, how should it be done? 回答1: Leadfoot handles file uploads like this: The test calls type on a file input element with the local (to Intern) path of a file. This file must exist on the system running Intern. You can get an absolute path to it by using require.toUrl (e.g.,

define is not defined when trying to run my intern dojo tests

孤街浪徒 提交于 2020-01-14 05:40:29
问题 I've been trying to get intern to run with the intern-cucumber plugin for ages now. I am super confused about how to get my intern test even running. This is my file structure: project features ar.feature addition.feature models calculator.js tests addition.js ar.js intern.json package.json I want to create unit tests that run in the browser . The main issues arise with my arizona.js file, because it depends on several dojo libraries. Currently, my intern.json configuration file looks like: {

define is not defined when trying to run my intern dojo tests

假装没事ソ 提交于 2020-01-14 05:40:14
问题 I've been trying to get intern to run with the intern-cucumber plugin for ages now. I am super confused about how to get my intern test even running. This is my file structure: project features ar.feature addition.feature models calculator.js tests addition.js ar.js intern.json package.json I want to create unit tests that run in the browser . The main issues arise with my arizona.js file, because it depends on several dojo libraries. Currently, my intern.json configuration file looks like: {

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

安稳与你 提交于 2020-01-13 07:11:28
问题 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

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

◇◆丶佛笑我妖孽 提交于 2020-01-13 07:11:12
问题 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

How do you specify test suites in Intern using a wildcard?

守給你的承諾、 提交于 2020-01-02 11:44:24
问题 I have a bunch of unit tests in this folder: src/app/tests/ . Do I have to list them individually in intern.js or is there a way to use a wildcard? I've tried suites: [ 'src/app/tests/*' ] but that just causes the test runner to try to load src/app/tests/*.js . Do I really have to list each test suite individually? 回答1: The common convention is to have an all module which collects your test modules, e.g.: define([ './module1', './module2', // ... ], function(){}); Then you simply list the all

How do you specify test suites in Intern using a wildcard?

血红的双手。 提交于 2020-01-02 11:44:08
问题 I have a bunch of unit tests in this folder: src/app/tests/ . Do I have to list them individually in intern.js or is there a way to use a wildcard? I've tried suites: [ 'src/app/tests/*' ] but that just causes the test runner to try to load src/app/tests/*.js . Do I really have to list each test suite individually? 回答1: The common convention is to have an all module which collects your test modules, e.g.: define([ './module1', './module2', // ... ], function(){}); Then you simply list the all

intern.js and Browserstack

故事扮演 提交于 2020-01-01 16:55:05
问题 Intern.js is a great testrunner but it only appears to work with SauceLabs. My company already uses BrowserStack and are very happy with it. I was wondering if anyone has been able to integrate Intern.js with BrowserStack and if so how? 回答1: You should be able to use BrowserStack with the following Intern configuration for Intern 1: define({ capabilities: { 'browserstack.user': 'your-username', 'browserstack.key': 'your-access-key' }, webdriver: { host: 'hub.browserstack.com' },

intern.js and Browserstack

时光怂恿深爱的人放手 提交于 2020-01-01 16:53:09
问题 Intern.js is a great testrunner but it only appears to work with SauceLabs. My company already uses BrowserStack and are very happy with it. I was wondering if anyone has been able to integrate Intern.js with BrowserStack and if so how? 回答1: You should be able to use BrowserStack with the following Intern configuration for Intern 1: define({ capabilities: { 'browserstack.user': 'your-username', 'browserstack.key': 'your-access-key' }, webdriver: { host: 'hub.browserstack.com' },