mirror of https://github.com/zulip/zulip.git
casper test: Add helpers for buddy list checks.
This commit is contained in:
parent
731f76cea1
commit
e978158519
|
@ -447,15 +447,35 @@ casper.waitWhileVisible('#stream_filters [data-stream-name="Denmark"]', function
|
|||
|
||||
un_narrow();
|
||||
|
||||
function assert_in_list(name) {
|
||||
casper.test.assertExists(
|
||||
'#user_presences li [data-name="' + name + '"]',
|
||||
'User ' + name + ' is IN buddy list'
|
||||
);
|
||||
}
|
||||
|
||||
function assert_selected(name) {
|
||||
casper.test.assertExists(
|
||||
'#user_presences li.highlighted_user [data-name="' + name + '"]',
|
||||
'User ' + name + ' is SELECTED IN buddy list'
|
||||
);
|
||||
}
|
||||
|
||||
function assert_not_selected(name) {
|
||||
assert_in_list(name);
|
||||
casper.test.assertDoesntExist(
|
||||
'#user_presences li.highlighted_user [data-name="' + name + '"]',
|
||||
'User ' + name + ' is NOT SELECTED buddy list'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// User search at the right sidebar
|
||||
casper.then(function () {
|
||||
casper.test.info('Search users using right sidebar');
|
||||
casper.test.assertExists('#user_presences li [data-name="Cordelia Lear"]',
|
||||
'User Cordelia Lear exists');
|
||||
casper.test.assertExists('#user_presences li [data-name="King Hamlet"]',
|
||||
'User King Hamlet exists');
|
||||
casper.test.assertExists('#user_presences li [data-name="aaron"]',
|
||||
'User aaron exists');
|
||||
assert_in_list('Cordelia Lear');
|
||||
assert_in_list('King Hamlet');
|
||||
assert_in_list('aaron');
|
||||
});
|
||||
|
||||
// Enter the search box and test selected suggestion navigation
|
||||
|
@ -470,12 +490,9 @@ casper.then(function () {
|
|||
|
||||
casper.waitForSelector('#user_presences .highlighted_user', function () {
|
||||
casper.test.info('Suggestion highlighting - initial situation');
|
||||
casper.test.assertExist('#user_presences li.highlighted_user [data-name="Cordelia Lear"]',
|
||||
'User Cordelia Lear is selected');
|
||||
casper.test.assertDoesntExist('#user_presences li.highlighted_user [data-name="King Hamlet"]',
|
||||
'User King Hamlet is not selected');
|
||||
casper.test.assertDoesntExist('#user_presences li.highlighted_user [data-name="aaron"]',
|
||||
'User aaron is not selected');
|
||||
assert_selected('Cordelia Lear');
|
||||
assert_not_selected('King Hamlet');
|
||||
assert_not_selected('aaron');
|
||||
});
|
||||
|
||||
// Use arrow keys to navigate through suggestions
|
||||
|
@ -493,10 +510,8 @@ casper.then(function () {
|
|||
|
||||
casper.waitForSelector('#user_presences li.highlighted_user [data-name="King Hamlet"]', function () {
|
||||
casper.test.info('Suggestion highlighting - after arrow key navigation');
|
||||
casper.test.assertDoesntExist('#user_presences li.highlighted_user [data-name="Cordelia Lear"]',
|
||||
'User Cordelia Lear not is selected');
|
||||
casper.test.assertExist('#user_presences li.highlighted_user [data-name="King Hamlet"]',
|
||||
'User King Hamlet is selected');
|
||||
assert_not_selected('Cordelia Lear');
|
||||
assert_selected('King Hamlet');
|
||||
});
|
||||
|
||||
common.then_log_out();
|
||||
|
|
Loading…
Reference in New Issue