TT#6423 Use Mocha test framework instead of Jasmin

Karma and WebdriverIO tests are now using Mocha as testing framework.

Change-Id: Id9c90e25891f8dcf5058eea08068c86dda142f0b
changes/87/9587/2
Markus Danek 9 years ago
parent 68aa47fd9d
commit aa539ba0e7

@ -164,4 +164,4 @@ Create and run Docker Image (see instructions inside the Dockerfile).
Inside docker:
```cd /code && /opt/Sencha/Cmd/sencha app build -c && ./t/testrunner```
```cd /code && ./t/testrunner```

@ -35,7 +35,7 @@ RUN ln -s /usr/bin/xvfb-chromium /usr/bin/chromium-browser
RUN curl -sL https://deb.nodesource.com/setup_4.x | bash -
RUN apt-get install -y nodejs
RUN echo "cd /code && /opt/Sencha/Cmd/sencha app build -c && ./t/testrunner" >/root/.bash_history
RUN echo "cd /code && ./t/testrunner" >/root/.bash_history
RUN ln -s /home/selenium/chromedriver /usr/bin/chromedriver
@ -55,5 +55,5 @@ WORKDIR /home/selenium/
# % docker run --rm -i -t -v $(pwd)/..:/code:rw docker.mgm.sipwise.com/ngcp-csc-jessie:latest bash
#
# Inside docker:
# cd /code && /opt/Sencha/Cmd/sencha app build -c && ./t/testrunner
# cd /code && ./t/testrunner
################################################################################

@ -1,18 +1,18 @@
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jasmine'],
frameworks: ['mocha', 'chai'],
files: [
'../../ext/build/ext-all-debug.js', '../specs/app_test.js', '../specs/karma-*.js'
],
browsers: ['Chrome'],
plugins: [
'karma-jasmine', 'karma-chrome-launcher', 'karma-junit-reporter'
'karma-mocha', 'karma-chai-plugins', 'karma-chrome-launcher', 'karma-junit-reporter', 'karma-spec-reporter'
],
exclude: [],
preprocessors: {},
reporters: [
'progress', 'junit'
'spec', 'junit'
],
junitReporter: {
outputDir: '../',

@ -16,12 +16,12 @@ exports.config = {
waitforTimeout: 10000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
framework: 'jasmine',
framework: 'mocha',
reporters: [
'spec', 'junit'
],
reporterOptions: {
outputDir: '../'
outputDir: './'
},
jasmineNodeOpts: {
defaultTimeoutInterval: 10000,

@ -1,4 +1,4 @@
#!/bin/bash
# This script is used for running the tests with proper arguments
# from within Jenkins
cd /code && /opt/Sencha/Cmd/sencha app build -c && ./t/testrunner
cd /code && ./t/testrunner

@ -1,21 +1,24 @@
{
"name": "ngcp-csc",
"description": "Sipwise ngcp-csc tests",
"version": "1.0.1",
"version": "1.0.2",
"author": "Markus Danek <mdanek@sipwise.com>",
"private": "true",
"scripts": {
"test": "karma start config/karma.conf.js && wdio config/wdio.conf.js"
},
"dependencies": {
"jasmine": "^2.5.2",
"chai": "^3.5.0",
"karma": "^1.3.0",
"karma-chai": "^0.1.0",
"karma-chai-plugins": "^0.8.0",
"karma-chrome-launcher": "^2.0.0",
"karma-jasmine": "^1.0.2",
"karma-junit-reporter": "^1.1.0",
"selenium-standalone": "^5.7.2",
"wdio-jasmine-framework": "^0.2.6",
"karma-mocha": "^1.3.0",
"karma-spec-reporter": "0.0.26",
"mocha": "^3.1.2",
"wdio-junit-reporter": "^0.1.0",
"wdio-mocha-framework": "^0.2.6",
"wdio-spec-reporter": "0.0.3",
"webdriverio": "^4.2.16"
}

@ -1,36 +1,31 @@
var karmaLoadedFunction;
if (window.__karma__) {
// store karma function to start it later
// override it with dummy
karmaLoadedFunction = window.__karma__.loaded;
window.__karma__.loaded = function() {
};
// store karma function to start it later
// override it with dummy
karmaLoadedFunction = window.__karma__.loaded;
window.__karma__.loaded = function() {};
}
Ext.Loader.setConfig({
enabled : true,
paths : {
'NgcpCsc.view' : 'classic/src/view',
},
disableCaching : true
enabled: true,
paths: {
'NgcpCsc.view': 'classic/src/view'
},
disableCaching: true
});
console.log('Starting the test application...');
Ext.application({
name : 'NgcpCsc',
launch : function() {
var jasmineEnv = jasmine.getEnv();
jasmineEnv.updateInterval = 1000;
name: 'NgcpCsc',
launch: function() {
if (window.__karma__) {
console.log('Starting the tests in specs');
if (window.__karma__) {
console.log('Starting the tests in specs');
window.__karma__.loaded = karmaLoadedFunction;
window.__karma__.loaded();
}
}
window.__karma__.loaded = karmaLoadedFunction;
window.__karma__.loaded();
}
}
});

@ -1,6 +1,6 @@
describe('Karma setup check', function() {
it('has a dummy spec to check if included files are there', function() {
// console.log(Ext.create('NgcpCsc.model.Call'));
expect(0).toEqual(0);
expect(null).to.be.a('null');
});
});

@ -23,15 +23,17 @@ echo "Finished main setup, now running tests ..."
echo "Selenium server log file available at /home/selenium/selenium.log"
cp -Rf . /tmp/code
cd /tmp/code/
/opt/Sencha/Cmd/sencha app build -c
cd /tmp/code/t/
rm -rf node_modules node_modules
npm install
echo "Starting Karma test"
cd /tmp/code/t/
./node_modules/karma/bin/karma start config/karma.conf.js
echo "Starting WebdriverIO test"
cd /tmp/code/
/opt/Sencha/Cmd/sencha web start &
sleep 5

Loading…
Cancel
Save