jasmine test 页面测试工具
before((request, response) -> { response.header("Access-Control-Allow-Origin", "http://localhost"); response.header("Access-Control-Allow-Credentials ", "true"); response.header("Access-Control-Allow-Methods", "POST, GET, PUT, DELETE, OPTIONS"); response.header("Access-Control-Allow-Headers", "X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept"); });
1. chrome 开本地访问网络命令行 : open /Applications/Google\ Chrome.app/ --args --disable-web-security (版本在49以上,还须添加--user-data-dir)
2. 还需要添加跨域
3. 测试本地需要修改html 里面的url
4. 现在ajax返回的测试用的是 settimeout 判断返回值
5. 需要调用ajax可以放到xmapp项目里面
ex:
describe("异常参数测试", function() {
var data;
beforeEach(function() {
b2cCustomerLogin();
var currentUrl = url;
var params = {
name: test_name,
province: test_province,
city: test_city,
address : test_address,
telephone : test_telephone
}
data = ajaxReq(currentUrl, params);
});
afterEach(function() {
});
it("create promotion success", function() {
expect(data.status).toEqual(1);
});
});
浙公网安备 33010602011771号