我想优化我的 WebdriverIO 测试。当我使用 WebdriverIO 运行测试套件时,我试图避免重新输入用户名和密码。(铬驱动程序)
以下两个文件是一个模块的一部分,总共有4个模块。
第一个功能文件:
var name = 'Andrea' + Math.floor((Math.random() * 1000000) + 1);
var ssn = 'V-' + Math.floor((Math.random() * 1000000) + 1);
var url = 'http://someurl.com';
var new_contact = 'https://someurl.com/client/add';
describe('Some contact is create', function() {
it('Should login to the system', function() {
browser.url(url)
browser.setValue('#email','xxxxxxxx@xxxx.com')
browser.setValue('#password','xxxxxx')
browser.click('#submit');
});
it('Should be fill the form', function() {
browser.url(new_contact)
browser.waitForVisible('#addClient')
browser.setValue('#clientNameTextField-inputEl',name)
browser.setValue('#clientIdentidicationTextField-inputEl',ssn)
browser.setValue('#clientAddressTextField-inputEl','El busque')
browser.setValue('#clientCicyyTextField-inputEl','Valencia')
browser.setValue('#clientEmailField-inputEl','salvador.salvatierra@alegra.com')
browser.setValue('#clientPhoneTextField-inputEl','04141234567')
browser.setValue('[name="phone2"]','04147654321')
});
it('the contact is store',function() {
browser.click('=save)
browser.waitForExist('#viewClientInfoBalances')
browser.end;
});
});
});
第二个特征文件:
var url = 'http://someurl.com';
describe('We get the basic info from index contact', function(){
it('Shouldlogin to the system', function(){
browser.url(url)
browser.setValue('#email','xxxxxxxx@xxx.com')
browser.setValue('#password','xxxxx')
browser.click('#submit');
});
it('We should see the basic info', function(){
browser.click('[href="/client"]')
browser.click('#gridview-1043-record-ext-record-66 .action-icons a:nth-child(1)')
browser.waitForExist('#viewClientInfoBalances')
browser.end();
});
});