在尝试用量角器运行我的茉莉花规格时,我收到了非常奇怪的测试规范行为。
我有两个空的规格都应该通过,但是我的第一个规格通过然后所有进行的规格都失败了。我相信这可能与版本级别有关,因为当我进行更新时,它导致我的jasmine测试用例中断。
测试规格
it('test spec 1', function () {
});
it('test spec 2', function () {
});
错误:超时 - 在jasmine.DEFAULT_TIMEOUT_INTERVAL指定的超时时间内未调用异步回调。
'use strict';
exports.config = {
seleniumAddress: 'http://127.0.0.1:4723/wd/hub',
baseUrl: 'http://10.0.2.2:' + (process.env.HTTP_PORT || '8000'),
specs: [
'./e2e-test.js'
],
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
isVerbose: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
capabilities: {
deviceName:"Samsung S7",
platformName: 'Android',
'appium-version': '1.4.16',
platformVersion:'23',
app: 'C:/Users/egreen/Desktop/Android/foo/platforms/android/build/outputs/apk/android-debug.apk',
browserName:'',
udid:'988627534e4c383848',
autoWebview: true
},
// A callback function called when tests are started
onPrepare: function () {
var wd = require('wd'),
protractor = require('protractor'),
wdBridge = require('wd-bridge')(protractor, wd);
wdBridge.initFromProtractor(exports.config);
require('jasmine-reporters');
var fs = require('fs'),
d = new Date(),
date = [
d.getFullYear(),
('0' + (d.getMonth() + 1)).slice(-2),
('0' + d.getDate()).slice(-2)
].join('-'),
time = [
('0'+d.getHours()).slice(-2),
(('0'+d.getMinutes()).slice(-2)),
('0'+d.getSeconds()).slice(-2)
].join('');
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
jasmine.getEnv().addReporter(
new Jasmine2HtmlReporter({
savePath: 'target/reports/mobile-app/'+date+'/'+time+'/',
screenshotsFolder: 'images'
})
);
var SpecReporter = require('jasmine-spec-reporter');
jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: 'all'}));
},
};
答案 0 :(得分:2)
更新:
尝试消除Jasmine2HtmlReporter。
尝试添加:
describe("long asynchronous specs", function() {
beforeEach(function(done) {
done();
}, 10000);
// Your code here
afterEach(function(done) {
done();
}, 10000);
}
您还可以查看:Jasmine Asynchronous Support
或尝试在此处添加时间:
it('test spec 1', function () {
},1000);
it('test spec 2', function () {
},1000);