//没有protractor
driver.getTitle().then(function(title){
expect(title).toBe('Baidu');
});
//使用protractor
expect(browser.getTitle()).toEqual('Baidu');
describe('hello world', function() {
it('标题是hello world', function() {
browser.get('测试地址自己搞一个咯');
expect(browser.getTitle()).toEqual('hello world');
});
});
//等待ng-model="password"的出现,最多等待20秒
browser.wait(function(){
return browser.isElementPresent(by.model("password"));
},20000);
describe('angularjs homepage', function() {
it('should greet the named user', function() {
browser.get('http://www.angularjs.org');
element(by.model('yourName')).sendKeys('Julie');
var greeting = element(by.binding('yourName'));
expect(greeting.getText()).toEqual('Hello Julie!');
});
describe('todo list', function() {
var todoList;
beforeEach(function() {
browser.get('http://www.angularjs.org');
todoList = element.all(by.repeater('todo in todos'));
});
it('should list todos', function() {
expect(todoList.count()).toEqual(2);
expect(todoList.get(1).getText()).toEqual('build an angular app');
});
it('should add a todo', function() {
var addTodo = element(by.model('todoText'));
var addButton = element(by.css('[value="add"]'));
addTodo.sendKeys('write a protractor test');
addButton.click();
expect(todoList.count()).toEqual(3);
expect(todoList.get(2).getText()).toEqual('write a protractor test');
});
function ScrollBarSelector(model){
Object.defineProperty(this,"target",{
get:function(){
return typeof model == "string" ? element(by.model(model)) : model;
}
})
Object.defineProperty(this,"pre",{
get:function(){
return this.target.$(".pre");
}
})
Object.defineProperty(this,"next",{
get:function(){
return this.target.$(".next");
}
})
Object.defineProperty(this,"scrollButton",{
get:function(){
return this.target.$(".scrollButton");
}
})
Object.defineProperty(this,"value",{
get:function(){
return this.target.$("input").getAttribute("value");
} })
}
!function(){
require(".LoginAction.js");
require(".LogoutAction.js");
require(".ScrollbarAction.js");
describe("自动登录",function(){
new LoginAction().execute("GetLiShu","123456");
})
describe('testScrollbar', function () {
new ScrollbarAction().execute();
});
describe("退出登录",function(){
new LogoutAction().execute();
});
}();
!function(){
function LoginAction(){
}
var prop = LoginAction.prototype;
prop.execute = function(userName,password){
beforeEach(function () {
//先跳转到登录页面
browser.get("登录页面");
//等待输入框出来
browser.wait(function(){
return browser.isElementPresent(by.model("username"));
},20000);
})
//输入账号密码然后点击登录
it('自动登录', function () {
element(by.model("username")).sendKeys(userName);
element(by.model("password")).sendKeys(password);
element(by.css(".login-input-btn")).click();
});
}
module.exports = LoginAction;
}();
!function(){
beforeEach(function () {
browser.setLocation("/app/common/stepper");
})
it('测试滚动条', function () {
var scrollbar = new ScrollbarSelector("vm.scroll");
//等待滚动条出来,最多等待20秒,滚动条出来了,马上处理测试代码
browser.wait(function(){
return browser.isElementPresent(numberDefault.mius);
},20000);
//这里省略很多行测试代码
});
}();
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有