to record integration tests for different frameworks.
npm install test-recorderThis project records the ways you interact with your application and then generates the code to playback these actions inside an acceptance test runner.
The idea is to save you time writing these tests by hand.
You should only add the TestRecorder.js script to your app when your app behaves as
expected (happy flow) as then you will have the tests generated for this. You can then take these tests and modify them to your specific needs.
alt="IMAGE ALT TEXT HERE" width="240" height="180" border="10" />
As this is a pure dev tool, I only support recording your Applications on Chrome due to it having the features I need. I will support other browsers if I get enough support.
npm i --save-dev test-recorderTo help you understand how it works I made a video playlist!
First video of the series
alt="IMAGE ALT TEXT HERE" width="240" height="180" border="10" />
* Button clicks
* Text input
* Changes in DOM additions/removals (only if they have an id)
If an element doesn't have an id then an exlusive dom path selector will be generated to click on this button in a test, ie
``js`
click("body>div>div:eq(0)>button");
andThen(function () {
equal(find("#foo").length, 0, "foo removed AFTER user [INSERT REASON]");
});
If you don't want to record an element, and any of its children add this class to it doNotRecord
I have an example app inside /tests that can be used to create tests for the various test frameworks.
* First you need to build the test project by running npm i and webpack inside /tests. tests/build/
* then you can open in the browser to see the app running with the test recorder UI. tests/nightwatch/tests/index.test.js
* You can select what framework you are using and you can copy the code that is generated.
* Once you have the tests generated you can paste the code into the actual test file inside the relevant test framework, e.g
Note all the tests frameworks have a test example file for you to get started.
Import the script and init the TestRecorder. Thats it!
`
`
Import the script and init the TestRecorder. That's it!
`js
import { TestRecorder } from 'test-recorder'
let testRecorder = new TestRecorder()
`
Import the script and init the TestRecorder. Thats it!
* copy the test-recorder script to vendor. You can add an npm script for this "copy": "cp node_modules/test-recorder/build/test-recorder.js vendor" app.import('vendor/test-recorder.js');
* import the test recorder to ember-cli-build.js:let testRecorder = new TestRecorder.TestRecorder()
* In your app run:
* Run node tests/server.jstest/nightwatch
* run nightwatch inside of
This uses tests/nightwatch/nightwatch.json as settings to to run test files in the tests/nightwatch/tests` folder.
Just paste in the output into the relevant place in your tests and run as normal.
I maintain a fork here of using the test-recorder with the travis-web app.
Avoid making multiple button clicks (or other interactions that cause asynchronous) updates until DOM has
finished updating. This will allow code generated by the mutations observer to be placed in the in the
generated code.