mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
@@ -125,12 +125,20 @@ function expect_all_pm() {
|
||||
]);
|
||||
}
|
||||
|
||||
function check_narrow_title(title) {
|
||||
return function () {
|
||||
// need to get title tag from HTML
|
||||
// test if it's equal to some string passed in to function
|
||||
casper.test.assertSelectorHasText('title', title, 'Got expected narrow title');
|
||||
};
|
||||
}
|
||||
|
||||
function un_narrow() {
|
||||
casper.then(common.un_narrow);
|
||||
casper.then(expect_home);
|
||||
casper.then(check_narrow_title('home - Zulip Dev - Zulip'));
|
||||
}
|
||||
|
||||
|
||||
// Narrow by clicking links.
|
||||
|
||||
common.wait_for_receive(function () {
|
||||
@@ -141,6 +149,7 @@ common.wait_for_receive(function () {
|
||||
casper.waitUntilVisible('#zfilt', function () {
|
||||
expect_stream();
|
||||
});
|
||||
casper.then(check_narrow_title('Verona - Zulip Dev - Zulip'));
|
||||
un_narrow();
|
||||
|
||||
casper.waitUntilVisible('#zhome', function () {
|
||||
@@ -148,6 +157,7 @@ casper.waitUntilVisible('#zhome', function () {
|
||||
casper.test.info('Narrowing by clicking subject');
|
||||
casper.click('*[title="Narrow to stream \\\"Verona\\\", topic \\\"frontend test\\\""]');
|
||||
});
|
||||
casper.then(check_narrow_title('frontend test - Zulip Dev - Zulip'));
|
||||
|
||||
casper.waitUntilVisible('#zfilt', function () {
|
||||
expect_stream_subject();
|
||||
@@ -163,6 +173,7 @@ casper.waitUntilVisible('#zhome', function () {
|
||||
casper.click('*[title="Narrow to your private messages with Cordelia Lear, King Hamlet"]');
|
||||
});
|
||||
|
||||
casper.then(check_narrow_title('private - Zulip Dev - Zulip'));
|
||||
|
||||
casper.waitUntilVisible('#zfilt', function () {
|
||||
expect_huddle();
|
||||
@@ -205,32 +216,39 @@ function do_search(str, item) {
|
||||
});
|
||||
}
|
||||
|
||||
function search_and_check(str, item, check) {
|
||||
function search_and_check(str, item, check, narrow_title) {
|
||||
do_search(str, item);
|
||||
|
||||
casper.then(check);
|
||||
casper.then(check_narrow_title(narrow_title));
|
||||
un_narrow();
|
||||
}
|
||||
|
||||
casper.waitUntilVisible('#zhome', expect_home);
|
||||
|
||||
// Test stream / recipient autocomplete in the search bar
|
||||
search_and_check('Verona', 'Narrow to stream', expect_stream);
|
||||
search_and_check('Cordelia', 'Narrow to private', expect_1on1);
|
||||
search_and_check('Verona', 'Narrow to stream', expect_stream,
|
||||
'Verona - Zulip Dev - Zulip');
|
||||
search_and_check('Cordelia', 'Narrow to private', expect_1on1,
|
||||
'private - Zulip Dev - Zulip');
|
||||
|
||||
// Test operators
|
||||
search_and_check('stream:verona', 'Narrow', expect_stream);
|
||||
search_and_check('stream:verona subject:frontend+test', 'Narrow', expect_stream_subject);
|
||||
search_and_check('subject:frontend+test', 'Narrow', expect_subject);
|
||||
|
||||
search_and_check('stream:Verona', 'Narrow', expect_stream,
|
||||
'Verona - Zulip Dev - Zulip');
|
||||
search_and_check('stream:Verona subject:frontend+test', 'Narrow', expect_stream_subject,
|
||||
'frontend test - Zulip Dev - Zulip');
|
||||
search_and_check('subject:frontend+test', 'Narrow', expect_subject,
|
||||
'home - Zulip Dev - Zulip');
|
||||
|
||||
// Narrow by clicking the left sidebar.
|
||||
casper.then(function () {
|
||||
casper.test.info('Narrowing with left sidebar');
|
||||
});
|
||||
casper.thenClick('#stream_filters [data-name="Verona"] a', expect_stream);
|
||||
casper.then(check_narrow_title('Verona - Zulip Dev - Zulip'));
|
||||
casper.thenClick('#global_filters [data-name="home"] a', expect_home);
|
||||
casper.then(check_narrow_title('home - Zulip Dev - Zulip'));
|
||||
casper.thenClick('#global_filters [data-name="private"] a', expect_all_pm);
|
||||
casper.then(check_narrow_title('private - Zulip Dev - Zulip'));
|
||||
un_narrow();
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user