2020-07-15 01:29:15 +02:00
|
|
|
var common = require("../casper_lib/common.js");
|
2015-11-04 18:21:17 +01:00
|
|
|
|
|
|
|
common.start_and_log_in();
|
|
|
|
|
2020-04-10 12:44:12 +02:00
|
|
|
common.manage_organization();
|
2017-08-18 01:23:55 +02:00
|
|
|
|
2020-01-13 12:32:38 +01:00
|
|
|
function submit_notifications_stream_settings() {
|
2020-01-15 23:11:29 +01:00
|
|
|
casper.then(function () {
|
|
|
|
casper.waitUntilVisible('#org-submit-notifications[data-status="unsaved"]', function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.assertSelectorHasText("#org-submit-notifications", "Save");
|
2020-01-15 23:11:29 +01:00
|
|
|
});
|
2020-01-13 12:32:38 +01:00
|
|
|
});
|
|
|
|
casper.then(function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.click("#org-submit-notifications");
|
2020-01-13 12:32:38 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-06-10 07:03:53 +02:00
|
|
|
// Test changing notifications stream
|
|
|
|
casper.then(function () {
|
|
|
|
casper.test.info('Changing notifications stream to Verona by filtering with "verona"');
|
2020-04-10 09:38:55 +02:00
|
|
|
casper.click("#realm_notifications_stream_id_widget button.dropdown-toggle");
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitUntilVisible("#realm_notifications_stream_id_widget ul.dropdown-menu", function () {
|
|
|
|
casper.sendKeys("#realm_notifications_stream_id_widget .dropdown-search > input[type=text]", "verona");
|
2020-04-10 09:38:55 +02:00
|
|
|
casper.click("#realm_notifications_stream_id_widget .dropdown-list-body > li:nth-of-type(1)");
|
2017-06-10 07:03:53 +02:00
|
|
|
});
|
2020-01-15 23:11:29 +01:00
|
|
|
});
|
2017-06-10 07:03:53 +02:00
|
|
|
|
2020-01-15 23:11:29 +01:00
|
|
|
submit_notifications_stream_settings();
|
2020-01-13 12:32:38 +01:00
|
|
|
|
2020-01-15 23:11:29 +01:00
|
|
|
casper.then(function () {
|
2019-08-05 21:11:30 +02:00
|
|
|
casper.waitUntilVisible('#org-submit-notifications[data-status="saved"]', function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.assertSelectorHasText("#org-submit-notifications", "Saved");
|
2017-06-10 07:03:53 +02:00
|
|
|
});
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitWhileVisible("#org-submit-notifications");
|
2017-06-10 07:03:53 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
casper.then(function () {
|
2020-04-10 09:38:55 +02:00
|
|
|
casper.click("#realm_notifications_stream_id_widget .dropdown_list_reset_button");
|
2020-01-15 23:11:29 +01:00
|
|
|
});
|
2020-01-13 12:32:38 +01:00
|
|
|
|
2020-01-15 23:11:29 +01:00
|
|
|
submit_notifications_stream_settings();
|
2020-01-13 12:32:38 +01:00
|
|
|
|
2020-01-15 23:11:29 +01:00
|
|
|
casper.then(function () {
|
2019-08-05 21:11:30 +02:00
|
|
|
casper.waitUntilVisible('#org-submit-notifications[data-status="saved"]', function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.assertSelectorHasText("#org-submit-notifications", "Saved");
|
2017-06-10 07:03:53 +02:00
|
|
|
});
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitWhileVisible("#org-submit-notifications");
|
2017-06-10 07:03:53 +02:00
|
|
|
});
|
|
|
|
|
2017-10-20 16:55:04 +02:00
|
|
|
// Test changing signup notifications stream
|
|
|
|
casper.then(function () {
|
|
|
|
casper.test.info('Changing signup notifications stream to Verona by filtering with "verona"');
|
2020-04-10 09:38:55 +02:00
|
|
|
casper.click("#id_realm_signup_notifications_stream_id > button.dropdown-toggle");
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitUntilVisible("#realm_signup_notifications_stream_id_widget ul.dropdown-menu", function () {
|
|
|
|
casper.sendKeys("#realm_signup_notifications_stream_id_widget .dropdown-search > input[type=text]", "verona");
|
2020-04-10 09:38:55 +02:00
|
|
|
casper.click("#realm_signup_notifications_stream_id_widget .dropdown-list-body li.list_item");
|
2017-10-20 16:55:04 +02:00
|
|
|
});
|
2020-01-15 23:11:29 +01:00
|
|
|
});
|
2017-10-20 16:55:04 +02:00
|
|
|
|
2020-01-15 23:11:29 +01:00
|
|
|
submit_notifications_stream_settings();
|
2020-01-13 12:32:38 +01:00
|
|
|
|
2020-01-15 23:11:29 +01:00
|
|
|
casper.then(function () {
|
2019-08-05 21:11:30 +02:00
|
|
|
casper.waitUntilVisible('#org-submit-notifications[data-status="saved"]', function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.assertSelectorHasText("#org-submit-notifications", "Saved");
|
2017-10-20 16:55:04 +02:00
|
|
|
});
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitWhileVisible("#org-submit-notifications");
|
2017-10-20 16:55:04 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
casper.then(function () {
|
2020-04-10 09:38:55 +02:00
|
|
|
casper.click("#realm_signup_notifications_stream_id_widget .dropdown_list_reset_button");
|
2020-01-15 23:11:29 +01:00
|
|
|
});
|
2020-01-13 12:32:38 +01:00
|
|
|
|
2020-01-15 23:11:29 +01:00
|
|
|
submit_notifications_stream_settings();
|
2020-01-13 12:32:38 +01:00
|
|
|
|
2020-01-15 23:11:29 +01:00
|
|
|
casper.then(function () {
|
2019-08-05 21:11:30 +02:00
|
|
|
casper.waitUntilVisible('#org-submit-notifications[data-status="saved"]', function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.assertSelectorHasText("#org-submit-notifications", "Saved");
|
2017-10-20 16:55:04 +02:00
|
|
|
});
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitWhileVisible("#org-submit-notifications");
|
2017-10-20 16:55:04 +02:00
|
|
|
});
|
|
|
|
|
2017-05-18 14:06:57 +02:00
|
|
|
// Test permissions setting
|
|
|
|
casper.then(function () {
|
|
|
|
casper.click("li[data-section='organization-permissions']");
|
|
|
|
});
|
|
|
|
|
2017-05-25 00:50:07 +02:00
|
|
|
function submit_permissions_change() {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.assertSelectorHasText("#org-submit-other-permissions", "Save");
|
|
|
|
casper.click("#org-submit-other-permissions");
|
2017-05-25 00:50:07 +02:00
|
|
|
}
|
|
|
|
|
2019-05-07 19:06:05 +02:00
|
|
|
// Test setting create streams policy to 'admins only'.
|
2017-04-21 01:10:59 +02:00
|
|
|
casper.then(function () {
|
2019-05-07 19:06:05 +02:00
|
|
|
casper.test.info("Test setting create streams policy to 'admins only'.");
|
2019-05-06 18:41:36 +02:00
|
|
|
casper.waitUntilVisible("#id_realm_create_stream_policy", function () {
|
2020-02-21 20:58:17 +01:00
|
|
|
// by_admins_only
|
2018-01-05 15:34:10 +01:00
|
|
|
casper.evaluate(function () {
|
2020-02-21 20:58:17 +01:00
|
|
|
$("#id_realm_create_stream_policy").val(2).change();
|
2018-01-05 15:34:10 +01:00
|
|
|
});
|
|
|
|
submit_permissions_change();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.then(function () {
|
2019-05-07 19:06:05 +02:00
|
|
|
// Test that save worked.
|
2018-03-22 14:07:52 +01:00
|
|
|
casper.waitUntilVisible('#org-submit-other-permissions[data-status="saved"]', function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.assertSelectorHasText("#org-submit-other-permissions", "Saved");
|
2018-01-05 15:34:10 +01:00
|
|
|
});
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitWhileVisible("#org-submit-notifications");
|
2018-01-05 15:34:10 +01:00
|
|
|
});
|
|
|
|
|
2019-05-07 19:06:05 +02:00
|
|
|
// Test setting create streams policy to 'members and admins'.
|
2018-01-05 15:34:10 +01:00
|
|
|
casper.then(function () {
|
2019-05-07 19:06:05 +02:00
|
|
|
casper.test.info("Test setting create streams policy to 'members and admins'.");
|
2019-05-06 18:41:36 +02:00
|
|
|
casper.waitUntilVisible("#id_realm_create_stream_policy", function () {
|
2020-02-21 20:58:17 +01:00
|
|
|
// by_members
|
2018-01-05 15:34:10 +01:00
|
|
|
casper.evaluate(function () {
|
2020-02-21 20:58:17 +01:00
|
|
|
$("#id_realm_create_stream_policy").val(1).change();
|
2018-01-05 15:34:10 +01:00
|
|
|
});
|
|
|
|
submit_permissions_change();
|
|
|
|
});
|
2016-07-27 12:34:08 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
casper.then(function () {
|
2019-05-07 19:06:05 +02:00
|
|
|
// Test that save worked.
|
2018-03-22 14:07:52 +01:00
|
|
|
casper.waitUntilVisible('#org-submit-other-permissions[data-status="saved"]', function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.assertSelectorHasText("#org-submit-other-permissions", "Saved");
|
2016-05-12 10:28:00 +02:00
|
|
|
});
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitWhileVisible("#org-submit-notifications");
|
2016-05-12 10:28:00 +02:00
|
|
|
});
|
|
|
|
|
2019-05-07 19:06:05 +02:00
|
|
|
// Test setting create streams policy to 'full members'.
|
|
|
|
casper.then(function () {
|
|
|
|
casper.test.info("Test setting create streams policy to 'waiting period.");
|
|
|
|
casper.waitUntilVisible("#id_realm_create_stream_policy", function () {
|
2020-02-21 20:58:17 +01:00
|
|
|
// by_full_members
|
2019-05-07 19:06:05 +02:00
|
|
|
casper.evaluate(function () {
|
2020-02-21 20:58:17 +01:00
|
|
|
$("#id_realm_create_stream_policy").val(3).change();
|
2019-05-07 19:06:05 +02:00
|
|
|
});
|
|
|
|
submit_permissions_change();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.then(function () {
|
|
|
|
// Test that save worked.
|
|
|
|
casper.waitUntilVisible('#org-submit-other-permissions[data-status="saved"]', function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.assertSelectorHasText("#org-submit-other-permissions", "Saved");
|
2019-05-07 19:06:05 +02:00
|
|
|
});
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitWhileVisible("#org-submit-notifications");
|
2019-05-07 19:06:05 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
// Test setting invite to streams policy to 'admins only'.
|
|
|
|
casper.then(function () {
|
|
|
|
casper.test.info("Test setting invite to streams policy to 'admins only'.");
|
|
|
|
casper.waitUntilVisible("#id_realm_invite_to_stream_policy", function () {
|
2020-02-21 20:58:17 +01:00
|
|
|
// by_admins_only
|
2019-05-07 19:06:05 +02:00
|
|
|
casper.evaluate(function () {
|
2020-02-21 20:58:17 +01:00
|
|
|
$("#id_realm_invite_to_stream_policy").val(2).change();
|
2019-05-07 19:06:05 +02:00
|
|
|
});
|
|
|
|
submit_permissions_change();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.then(function () {
|
|
|
|
// Test that save worked.
|
|
|
|
casper.waitUntilVisible('#org-submit-other-permissions[data-status="saved"]', function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.assertSelectorHasText("#org-submit-other-permissions", "Saved");
|
2019-05-07 19:06:05 +02:00
|
|
|
});
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitWhileVisible("#org-submit-notifications");
|
2019-05-07 19:06:05 +02:00
|
|
|
});
|
2018-01-05 15:34:10 +01:00
|
|
|
|
2019-05-07 19:06:05 +02:00
|
|
|
// Test setting invite to streams policy to 'members and admins'.
|
|
|
|
casper.then(function () {
|
|
|
|
casper.test.info("Test setting invite to streams policy to 'members and admins'.");
|
|
|
|
casper.waitUntilVisible("#id_realm_invite_to_stream_policy", function () {
|
2020-02-21 20:58:17 +01:00
|
|
|
// by_members
|
2019-05-07 19:06:05 +02:00
|
|
|
casper.evaluate(function () {
|
2020-02-21 20:58:17 +01:00
|
|
|
$("#id_realm_invite_to_stream_policy").val(1).change();
|
2019-05-07 19:06:05 +02:00
|
|
|
});
|
|
|
|
submit_permissions_change();
|
|
|
|
});
|
|
|
|
});
|
2016-05-12 10:28:00 +02:00
|
|
|
|
2019-05-07 19:06:05 +02:00
|
|
|
casper.then(function () {
|
|
|
|
// Test that save worked.
|
|
|
|
casper.waitUntilVisible('#org-submit-other-permissions[data-status="saved"]', function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.assertSelectorHasText("#org-submit-other-permissions", "Saved");
|
2019-05-07 19:06:05 +02:00
|
|
|
});
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitWhileVisible("#org-submit-notifications");
|
2019-05-07 19:06:05 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
// Test setting invite to streams policy to 'full members'.
|
|
|
|
casper.then(function () {
|
|
|
|
casper.test.info("Test setting invite to streams policy to 'waiting period'.");
|
|
|
|
casper.waitUntilVisible("#id_realm_invite_to_stream_policy", function () {
|
2020-02-21 20:58:17 +01:00
|
|
|
// by_full_members
|
2019-05-07 19:06:05 +02:00
|
|
|
casper.evaluate(function () {
|
2020-02-21 20:58:17 +01:00
|
|
|
$("#id_realm_invite_to_stream_policy").val(3).change();
|
2019-05-07 19:06:05 +02:00
|
|
|
});
|
|
|
|
submit_permissions_change();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.then(function () {
|
|
|
|
// Test that save worked.
|
|
|
|
casper.waitUntilVisible('#org-submit-other-permissions[data-status="saved"]', function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.assertSelectorHasText("#org-submit-other-permissions", "Saved");
|
2019-05-07 19:06:05 +02:00
|
|
|
});
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitWhileVisible("#org-submit-notifications");
|
2019-05-07 19:06:05 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
// Test setting new user threshold to three days.
|
|
|
|
casper.then(function () {
|
|
|
|
casper.test.info("Test setting new user threshold to three days.");
|
|
|
|
casper.waitUntilVisible("#id_realm_waiting_period_setting", function () {
|
|
|
|
casper.evaluate(function () {
|
|
|
|
$("#id_realm_waiting_period_setting").val("three_days").change();
|
|
|
|
});
|
|
|
|
submit_permissions_change();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.then(function () {
|
|
|
|
// Test that save worked.
|
|
|
|
casper.waitUntilVisible('#org-submit-other-permissions[data-status="saved"]', function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.assertSelectorHasText("#org-submit-other-permissions", "Saved");
|
|
|
|
casper.test.assertNotVisible("#id_realm_waiting_period_threshold");
|
2019-05-07 19:06:05 +02:00
|
|
|
});
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitWhileVisible("#org-submit-notifications");
|
2019-05-07 19:06:05 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
// Test setting new user threshold to N days.
|
|
|
|
casper.then(function () {
|
|
|
|
casper.test.info("Test setting new user threshold to N days.");
|
|
|
|
casper.waitUntilVisible("#id_realm_waiting_period_setting", function () {
|
|
|
|
casper.evaluate(function () {
|
|
|
|
$("#id_realm_waiting_period_setting").val("custom_days").change();
|
|
|
|
});
|
|
|
|
submit_permissions_change();
|
2018-01-05 15:34:10 +01:00
|
|
|
});
|
2016-07-27 12:34:08 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
casper.then(function () {
|
2019-05-07 19:06:05 +02:00
|
|
|
// Test that save worked.
|
2018-03-22 14:07:52 +01:00
|
|
|
casper.waitUntilVisible('#org-submit-other-permissions[data-status="saved"]', function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.assertSelectorHasText("#org-submit-other-permissions", "Saved");
|
|
|
|
casper.test.assertVisible("#id_realm_waiting_period_threshold");
|
2016-05-12 10:28:00 +02:00
|
|
|
});
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitWhileVisible("#org-submit-notifications");
|
2016-05-12 10:28:00 +02:00
|
|
|
});
|
|
|
|
|
2016-07-27 12:34:08 +02:00
|
|
|
casper.then(function () {
|
|
|
|
// Test custom realm emoji
|
2016-12-03 01:12:52 +01:00
|
|
|
casper.click("li[data-section='emoji-settings']");
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitUntilVisible(".admin-emoji-form", function () {
|
|
|
|
casper.fill("form.admin-emoji-form", {
|
|
|
|
name: "new mouse face",
|
|
|
|
emoji_file_input: "static/images/logo/zulip-icon-128x128.png",
|
2016-12-03 01:12:52 +01:00
|
|
|
}, true);
|
2016-02-12 21:08:56 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-07-27 12:34:08 +02:00
|
|
|
casper.then(function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitUntilVisible("div#admin-emoji-status", function () {
|
|
|
|
casper.test.assertSelectorHasText("div#admin-emoji-status", "Custom emoji added!");
|
2016-07-27 12:34:08 +02:00
|
|
|
});
|
2016-02-12 21:08:56 +01:00
|
|
|
});
|
|
|
|
|
2016-07-27 12:34:08 +02:00
|
|
|
casper.then(function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitUntilVisible("tr#emoji_new_mouse_face", function () {
|
|
|
|
casper.test.assertSelectorHasText("tr#emoji_new_mouse_face .emoji_name", "new mouse face");
|
|
|
|
casper.test.assertExists("tr#emoji_new_mouse_face img");
|
|
|
|
casper.click("tr#emoji_new_mouse_face button.delete");
|
2016-07-27 12:34:08 +02:00
|
|
|
});
|
2016-02-12 21:08:56 +01:00
|
|
|
});
|
|
|
|
|
2016-07-27 12:34:08 +02:00
|
|
|
casper.then(function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitWhileVisible("tr#emoji_new_mouse_face", function () {
|
|
|
|
casper.test.assertDoesntExist("tr#emoji_new_mouse_face");
|
2016-07-27 12:34:08 +02:00
|
|
|
});
|
2016-02-12 21:08:56 +01:00
|
|
|
});
|
|
|
|
|
2017-02-09 09:13:30 +01:00
|
|
|
var stream_name = "Scotland";
|
2016-05-20 22:08:42 +02:00
|
|
|
function get_suggestions(str) {
|
|
|
|
casper.then(function () {
|
|
|
|
casper.evaluate(function (str) {
|
2020-07-15 01:29:15 +02:00
|
|
|
$(".create_default_stream")
|
2018-05-07 01:42:17 +02:00
|
|
|
.focus()
|
|
|
|
.val(str)
|
2020-07-16 22:40:18 +02:00
|
|
|
.trigger($.Event("keyup", {which: 0}));
|
2016-05-20 22:08:42 +02:00
|
|
|
}, str);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function select_from_suggestions(item) {
|
|
|
|
casper.then(function () {
|
|
|
|
casper.evaluate(function (item) {
|
2020-07-15 01:29:15 +02:00
|
|
|
var tah = $(".create_default_stream").data().typeahead;
|
2016-05-20 22:08:42 +02:00
|
|
|
tah.mouseenter({
|
2018-06-04 21:13:07 +02:00
|
|
|
currentTarget: $('.typeahead:visible li:contains("' + item + '")')[0],
|
2016-05-20 22:08:42 +02:00
|
|
|
});
|
|
|
|
tah.select();
|
|
|
|
}, {item: item});
|
2020-03-22 20:46:12 +01:00
|
|
|
casper.click(".default-stream-form #do_submit_stream");
|
2016-05-20 22:08:42 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test default stream creation and addition
|
|
|
|
casper.then(function () {
|
2016-12-03 01:12:52 +01:00
|
|
|
casper.click("li[data-section='default-streams-list']");
|
2017-02-09 09:13:30 +01:00
|
|
|
casper.waitUntilVisible(".create_default_stream", function () {
|
|
|
|
// It matches with all the stream names which has 'O' as a substring (Rome, Scotland, Verona
|
|
|
|
// etc). 'O' is used to make sure that it works even if there are multiple suggestions.
|
|
|
|
// Uppercase 'O' is used instead of the lowercase version to make sure that the suggestions
|
|
|
|
// are case insensitive.
|
|
|
|
get_suggestions("O");
|
|
|
|
select_from_suggestions(stream_name);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.then(function () {
|
2020-03-22 20:29:49 +01:00
|
|
|
var stream_id = common.get_stream_id(stream_name);
|
|
|
|
var row = ".default_stream_row[data-stream-id='" + stream_id + "']";
|
|
|
|
casper.waitUntilVisible(row, function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.assertSelectorHasText(row + " .default_stream_name", stream_name);
|
|
|
|
casper.click(row + " button.remove-default-stream");
|
2020-03-22 20:29:49 +01:00
|
|
|
casper.waitWhileVisible(row, function () {
|
|
|
|
casper.test.assertDoesntExist(row);
|
|
|
|
});
|
2016-05-20 22:08:42 +02:00
|
|
|
});
|
|
|
|
});
|
2016-07-27 12:34:08 +02:00
|
|
|
|
2015-11-04 18:21:17 +01:00
|
|
|
// TODO: Test stream deletion
|
|
|
|
|
2017-02-27 03:43:13 +01:00
|
|
|
// Test uploading realm icon image
|
|
|
|
casper.then(function () {
|
2017-08-18 01:23:55 +02:00
|
|
|
casper.click("li[data-section='organization-profile']");
|
2020-06-17 05:58:39 +02:00
|
|
|
var selector = '#realm-icon-upload-widget .image-block[src^="https://secure.gravatar.com/avatar/"]';
|
2017-03-05 20:36:21 +01:00
|
|
|
casper.waitUntilVisible(selector, function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.assertEqual(casper.visible("#realm-icon-upload-widget .settings-page-delete-button"), false);
|
2018-03-26 12:06:42 +02:00
|
|
|
// Hack: Rather than submitting the form, we just fill the
|
|
|
|
// form and then trigger a click event by clicking the button.
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.fill("form.admin-realm-form", {
|
|
|
|
file_input: "static/images/logo/zulip-icon-128x128.png",
|
2018-03-26 12:06:42 +02:00
|
|
|
}, false);
|
2020-06-17 05:58:39 +02:00
|
|
|
casper.click("#realm-icon-upload-widget .image_upload_button");
|
|
|
|
casper.waitWhileVisible("#realm-icon-upload-widget .upload-spinner-background", function () {
|
|
|
|
casper.test.assertExists('#realm-icon-upload-widget .image-block[src^="/user_avatars/2/realm/icon.png?version=2"]');
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.assertEqual(casper.visible("#realm-icon-upload-widget .settings-page-delete-button"), true);
|
2017-03-05 20:36:21 +01:00
|
|
|
});
|
2017-02-27 03:43:13 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// Test deleting realm icon image
|
|
|
|
casper.then(function () {
|
2017-08-18 01:23:55 +02:00
|
|
|
casper.click("li[data-section='organization-profile']");
|
2020-06-17 05:58:39 +02:00
|
|
|
casper.click("#realm-icon-upload-widget .settings-page-delete-button");
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.assertEqual(casper.visible("#realm-icon-upload-widget .settings-page-delete-button"), true);
|
|
|
|
casper.waitWhileVisible("#realm-icon-upload-widget .settings-page-delete-button", function () {
|
2020-06-17 05:58:39 +02:00
|
|
|
casper.test.assertExists('#realm-icon-upload-widget .image-block[src^="https://secure.gravatar.com/avatar/"]');
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.assertEqual(casper.visible("#realm-icon-upload-widget .settings-page-delete-button"), false);
|
2017-02-27 03:43:13 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-05-25 00:50:07 +02:00
|
|
|
|
2016-08-04 17:32:41 +02:00
|
|
|
casper.then(function () {
|
2016-12-03 01:12:52 +01:00
|
|
|
casper.click("li[data-section='organization-settings']");
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitUntilVisible("#id_realm_default_language", function () {
|
2017-02-10 06:58:09 +01:00
|
|
|
casper.test.info("Changing realm default language");
|
|
|
|
casper.evaluate(function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
$("#id_realm_default_language").val("de").change();
|
2017-02-10 06:58:09 +01:00
|
|
|
});
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.assertSelectorHasText("#org-submit-user-defaults", "Save");
|
|
|
|
casper.click("#org-submit-user-defaults");
|
2016-08-04 17:32:41 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-02-10 06:58:09 +01:00
|
|
|
casper.then(function () {
|
2018-03-31 07:39:22 +02:00
|
|
|
casper.waitUntilVisible('#org-submit-user-defaults[data-status="saved"]', function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.assertSelectorHasText("#org-submit-user-defaults",
|
|
|
|
"Saved");
|
2017-02-10 06:58:09 +01:00
|
|
|
});
|
2016-08-04 17:32:41 +02:00
|
|
|
});
|
|
|
|
|
2016-11-02 21:51:56 +01:00
|
|
|
// Test authentication methods setting
|
2017-02-10 06:58:09 +01:00
|
|
|
casper.then(function () {
|
2016-12-03 01:12:52 +01:00
|
|
|
casper.click("li[data-section='auth-methods']");
|
2018-05-22 19:00:25 +02:00
|
|
|
casper.waitUntilVisible(".method_row[data-method='Google'] input[type='checkbox'] + span", function () {
|
|
|
|
casper.click(".method_row[data-method='Google'] input[type='checkbox'] + span");
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.assertSelectorHasText("#org-submit-auth_settings", "Save");
|
|
|
|
casper.click("#org-submit-auth_settings");
|
2016-11-02 21:51:56 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.then(function () {
|
|
|
|
// Leave the page and return
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.click("#settings-dropdown");
|
2017-03-09 00:20:22 +01:00
|
|
|
casper.click('a[href^="#streams"]');
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.click("#settings-dropdown");
|
2017-04-07 21:39:58 +02:00
|
|
|
casper.click('a[href^="#organization"]');
|
2018-05-22 19:00:25 +02:00
|
|
|
casper.click("li[data-section='auth-methods']");
|
2016-11-02 21:51:56 +01:00
|
|
|
|
2018-05-22 19:00:25 +02:00
|
|
|
casper.waitUntilVisible(".method_row[data-method='Google'] input[type='checkbox'] + span", function () {
|
2016-11-02 21:51:56 +01:00
|
|
|
// Test Setting was saved
|
|
|
|
casper.test.assertEval(function () {
|
2018-06-06 18:19:09 +02:00
|
|
|
return !document.querySelector(".method_row[data-method='Google'] input[type='checkbox']").checked;
|
2016-11-02 21:51:56 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2015-11-04 18:21:17 +01:00
|
|
|
common.then_log_out();
|
|
|
|
|
|
|
|
casper.run(function () {
|
|
|
|
casper.test.done();
|
|
|
|
});
|