I am trying to connect to directline using the following setup:
botium_directline.json:
{
"botium": {
"Capabilities": {
"PROJECTNAME": "botium-sample1",
"CONTAINERMODE": "directline3",
"DIRECTLINE3_SECRET": "<BOTIUM_SECRET>",
"DIRECTLINE3_WEBSOCKET": true
},
"Sources": {},
"Envs": {
"NODE_TLS_REJECT_UNAUTHORIZED": 0
}
}
}
Folder structure:
If I run:
botium-cli emulator browser --convos ./spec/convos --config ./botium_directline.json
I am able to "communicate with the bot" within the new conversation.
If I wanna run the tests I prepared I get the following timeouts:
botium-cli run --convos ./spec/convos/ --config ./botium_directline.json
user # /Users/username/workspace/testing/botium
~~ npm test
> botium#1.0.0 test /Users/username/workspace/testing/botium
> botium-cli run --convos ./spec/convos/ --config ./botium_directline.json
Botium Test-Suite
1) Test One
2) Test Two
0 passing (4s)
2 failing
1) Botium Test-Suite
Test One:
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
2) Botium Test-Suite
Test Two:
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
The error is similar to a standard mocha timeout error, but I do not know where to put a .js file to increase the timeout in a beforeEach.
I attempted to add both BOTIUM_TIMEOUT or a TIMEOUT properties into the botium_directline.json but this did not do anything.
Any ideas how to increase the timeout?
Botium automated tests have default timeout of 60000 milliseconds, but you can customize it by passing the --timeout flag at the end of your CLI command.
To do that, just add the flag --timeout followed by the time in milliseconds you'd like to set it up for. For instance, for 100000 milliseconds, your command should be like this: botium-cli emulator browser --convos ./spec/convos --config ./botium_directline.json --timeout 100000
The "BOTIUM_TIMEOUT" environment variable is the correct choice, or you can use the "--timeout" command line switch for botium-cli. This is only available since some days, there was a bug involved which has been fixed. Please get the build 0.0.34 of the botium-cli:
npm install botium-cli#0.0.34
Related
Working on a React project.
I start up my environment using npm start. I then start my testing infrastructure using npm test in a different terminal. While my tests are running, errors are generated and printed in the terminal that my environment is running in.
npm start
Compiled successfully!
You can now view v2 in the browser.
Local: http://localhost:3000
Note that the development build is not optimized.
To create a production build, use yarn build.
Open another terminal and run npm test
Test Suites: 1 passed, 1 total
Tests: 3 passed, 3 total
Snapshots: 0 total
Time: 2.415s
Ran all test suites.
Yet, some UI errors that the tests generate appear in the terminal for my local environment
Compiled successfully!
You can now view v2 in the browser.
Local: http://localhost:3000
Note that the development build is not optimized.
To create a production build, use yarn build.
[HPM] Error occurred while trying to proxy request /directory from localhost:3000 to <TARGET> (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /directory from localhost:3000 to <TARGET> (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /directory from localhost:3000 to <TARGET> (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /directory from localhost:3000 to <TARGET> (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /directory from localhost:3000 to <TARGET> (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
How do I prevent errors - and anything else for that matter - from being printed out to the terminal where I started my dev environment?
looking at the output of your npm test, it seems like you are using jest, which has a support for configuring setup files
A list of paths to modules that run some code to configure or set up the testing framework before each test file in the suite is executed.
you can utilize it by pointing to a file, where you can mock the implmentation for console.
add to jest.config.js the following
module.exports = {
setupFilesAfterEnv: ['./jest.setup.js'],
};
then in jest.setup.js file
global.beforeAll(() => {
// disable console.error for clarity
console.error = jest.fn().mockImplementation(() => {});
});
note that it will achieve what you desire only if the module that prints to the console during the testing is using console.error(). otherwise, you might need to mock other functions, such as console.info(), console.log(), console.debug()
I'm getting inconsistent results when every I run npm test
Sometimes all test pass and most of the time one or the other test fails due to this error:
Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.
at node_modules/jest-jasmine2/build/queue_runner.js:68:21
at Timeout.callback [as _onTimeout] (node_modules/jsdom/lib/jsdom/browser/Window.js:678:19)
I have noticed when ever test files name is printed twice or thrice some test fails.
I'm using WSL to run the tests and I have configured jestjs like this:
"scripts": {
"test": "jest --watchAll --verbose --coverage"
},
"jest": {
"testURL": "http://localhost/"
},
how should I configure jest so the tests run properly or fix this inconsistent behavior?
I am performing vue unit through below command
vue-cli-service test:unit
Now the problem is some unit test case need the response from the server, and usually they take much time to execute.
So i want to know how to manually set the timeout for vue-cli unit tests
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure
"done()" is called; if returning a Promise, ensure it resolves.
Try as below
vue-cli-service test:unit --timeout, -t timeout threshold in milliseconds
Im building my React Native app with TravisCI and using Detox to run E2E on the version.
The Detox test results are printed to the travis console but i need to know fail or pass in an env var so i could act on it.
The test command is:
detox test --configuration ios.sim.debug
So i've tried:
export SANITY_RES=$(detox test --configuration ios.sim.debug)
but echo $SANITY_RES only contains:
configuration="ios.sim.debug" artifactsLocation="artifacts/ios.sim.debug.2018-12-25 14-42-58Z" node_modules/.bin/jest e2e --config=e2e/config.json --maxWorkers=1 '--testNamePattern=^((?!:android:).)$' detox[80481] INFO: [DetoxServer.js] server listening on localhost:51067...*
and not the final result.
Any other way i could get them ?
Detox allows you the ability to write logs of your builds. See for more details https://github.com/wix/Detox/blob/master/docs/APIRef.Artifacts.md
If you add —record-logs all as a flag to your detox test it will save all the logs of the build, change it to —record-logs failing if you only want logs of failing tests.
You can even specify where the logs will be stored.
I've installed gulp-npm-test following their documentation, that is, in my gulp directory I've got a file test.js that looks like this:
var gulp = require('gulp')
require('gulp-npm-test')(gulp)
var gulp = require('gulp-npm-test')(gulp, {
withoutNpmRun: false
})
But when I run gulp test I get the output like the following:
[17:12:41] Using gulpfile ~/my-project/gulpfile.js
[17:12:41] Starting 'test'...
> my-project#0.0.1 test /Users/wogsland/my-project
> jest
PASS frontend/tests/components/atoms/InputText.test.js
.
.
(many more Jest test passes, no fails)
.
.
FAIL gulp/tasks/test.js
● Test suite failed to run
Your test suite must contain at least one test.
at onResult (node_modules/jest/node_modules/jest-cli/build/TestRunner.js:192:18)
Test Suites: 1 failed, 135 passed, 136 total
Tests: 135 passed, 135 total
Snapshots: 209 passed, 209 total
Time: 92.237s
Ran all test suites.
npm ERR! Test failed. See above for more details.
What am I missing here? I've go a bunch of tests
Looks like the matcher that figures out which files are tests, matches everything that includes in the filename test.js. The default is [ '**/__tests__/**/*.js?(x)', '**/?(*.)(spec|test).js?(x)' ]. So either adapt this one, its testMatch in your jest settings. Or use testPathIgnorePatterns to exclude the /gulp folder.