0
當我運行SpecRunning時,網頁顯示什麼都沒有,但沒有任何錯誤。 這是我SpecRunning.htmlangularjs e2e測試,沒有結果
<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);
});
});
});
如果我從SpecRunning.html中刪除
<script type="text/javascript" src="app/lib/angular/angular-scenario.js"></script>
,它會提示「瀏覽器未定義」。 我該怎麼辦?在此先感謝