如何进行基本的跨页测试?登录示例
How to do a basic cross page test ? Login example
所以我正在用这段代码测试我的登录页面
describe('Testing the login page', function (t) {
t.it('Should be possible to login', function (t) {
t.chain(
{
waitForCQ : '>> textfield[itemId=login]'
},
{
action : 'type',
target : '>> textfield[itemId=login]',
text : 'accountname'
},
{
action : 'type',
target : '>> textfield[itemId=password]',
text : 'passwd[ENTER]'
}
)
})
});
与此 harness.start() conf :
harness.start(
'010_sanity.t.js',
{
group : 'Login/Logout',
items : [
{
enablePageRedirect : true,
pageUrl : "https://mywebsite.com/Login",
url : "020_login.t.js"
},
{
enablePageRedirect : true,
pageUrl : "https://mywebsite.com/",
url : "021_logout.t.js"
}
]
},
...
);
我遇到了一个问题。即使将 enablePageRedirect 选项设置为 true,测试似乎也不会从第一页持续到下一页。
相反,在午睡测试界面(中间一个)的日志区域中,我看到当页面更改时测试从头开始重新启动。
永无止境的旋转器。
如何用siesta做这么简单的跨页测试?
该文档并没有真正帮助我:http://www.bryntum.com/docs/siesta/#!/guide/cross_page_testing
提前致谢
每个测试都应该从一个新页面开始并且是独立的,因此您的每个测试都需要通过重新登录应用程序来开始。启用页面重定向只是意味着一旦发生登录,应用程序可以在到达下一个页面后继续测试。这是我们如何在测试中编写它的示例:
test.chain(
// Enter username
{
action: 'type',
target: '#user_id',
text: 'ACCOUNTNAMEHERE'
},
// Enter password
{
action: 'type',
target: '#password',
text: 'PASSWORDHERE'
},
// Set up detection of the page changing.
// The trigger specifies what action will cause the
// page to change. The timeout is the maximum length
// to wait for the navigation to occur.
{
waitFor: 'PageLoad',
timeout: 20000,
trigger: {
click: 'input[type=submit]'
}
}
);
所以我正在用这段代码测试我的登录页面
describe('Testing the login page', function (t) {
t.it('Should be possible to login', function (t) {
t.chain(
{
waitForCQ : '>> textfield[itemId=login]'
},
{
action : 'type',
target : '>> textfield[itemId=login]',
text : 'accountname'
},
{
action : 'type',
target : '>> textfield[itemId=password]',
text : 'passwd[ENTER]'
}
)
})
});
与此 harness.start() conf :
harness.start(
'010_sanity.t.js',
{
group : 'Login/Logout',
items : [
{
enablePageRedirect : true,
pageUrl : "https://mywebsite.com/Login",
url : "020_login.t.js"
},
{
enablePageRedirect : true,
pageUrl : "https://mywebsite.com/",
url : "021_logout.t.js"
}
]
},
...
);
我遇到了一个问题。即使将 enablePageRedirect 选项设置为 true,测试似乎也不会从第一页持续到下一页。 相反,在午睡测试界面(中间一个)的日志区域中,我看到当页面更改时测试从头开始重新启动。 永无止境的旋转器。
如何用siesta做这么简单的跨页测试? 该文档并没有真正帮助我:http://www.bryntum.com/docs/siesta/#!/guide/cross_page_testing
提前致谢
每个测试都应该从一个新页面开始并且是独立的,因此您的每个测试都需要通过重新登录应用程序来开始。启用页面重定向只是意味着一旦发生登录,应用程序可以在到达下一个页面后继续测试。这是我们如何在测试中编写它的示例:
test.chain(
// Enter username
{
action: 'type',
target: '#user_id',
text: 'ACCOUNTNAMEHERE'
},
// Enter password
{
action: 'type',
target: '#password',
text: 'PASSWORDHERE'
},
// Set up detection of the page changing.
// The trigger specifies what action will cause the
// page to change. The timeout is the maximum length
// to wait for the navigation to occur.
{
waitFor: 'PageLoad',
timeout: 20000,
trigger: {
click: 'input[type=submit]'
}
}
);