[英]angularjs e2e test, no result
當我運行SpecRunning時,網頁沒有顯示任何內容,但是沒有任何錯誤。 這是我的SpecRunning.html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Jasmine Spec Runner v<%= jasmineVersion %></title>
<link rel="shortcut icon" type="image/png" href="test/images/jasmine_favicon.png">
<link rel="stylesheet" type="text/css" href="test/lib/jasmine-core/jasmine.css">
<script type="text/javascript" src="test/lib/jasmine-core/jasmine.js"></script>
<script type="text/javascript" src="test/lib/jasmine-core/jasmine-html.js"></script>
<script type="text/javascript" src="test/lib/jasmine-core/boot.js"></script>
<script type="text/javascript" src="app/lib/angular/angular-scenario.js"></script>
<!-- include source files here... -->
<script src="app/js/phoneControllers.js"></script>
<!-- include spec files here... -->
<script src="test/js/phoneControllersSpec.js"></script>
</head>
<body></body>
</html>
這是
phoneControllers.js
function PhoneListCtrl($scope){
$scope.phones=[
{
"name":"SamSung",
"snippet":"Good phone"
},
{
"name":"M",
"snippet":"Small phone"
},
{
"name":"Apple",
"snippet":"American phone"
},
{
"name":"BBK",
"snippet":"Made in China"
}
];
$scope.Hello="Hello,world";
}
describe("PhoneCat controllers", function(){
describe("PhoneListCtrl", function(){
var scope={}, ctrl=new PhoneListCtrl(scope);
it("should create 'phones' model with 4 phones", function(){
expect(scope.phones.length).toBe(4);
});
it("should create 'Hello,world' sentence", function(){
expect(scope.Hello).toEqual("Hello,world");
});
});
});
這是我的phoneControllersSpec.js
describe('PhoneCat App', function(){
describe('Phone list view', function(){
beforeEach(function(){
browser().navigateTo('../../app/Index.html');
});
it('should filter ', function(){
expect(repeater('.phones li').count()).toBe(4);
input('query').enter('SamSung');
expect(repeater('.phones li').count()).toBe(1);
input('query').enter('China');
expect(repeater('.phones li').count()).toBe(1);
});
});
});
如果我刪除
<script type="text/javascript" src="app/lib/angular/angular-scenario.js"></script>
在SpecRunning.html中,它提示“瀏覽器未定義”。 我該怎么辦? 提前致謝
之后,我自己解決了這個問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.