2020-07-15 01:29:15 +02:00
|
|
|
var common = require("../casper_lib/common.js");
|
|
|
|
var test_credentials = require("../../var/casper/test_credentials.js").test_credentials;
|
|
|
|
var OUTGOING_WEBHOOK_BOT_TYPE = "3";
|
|
|
|
var GENERIC_BOT_TYPE = "1";
|
2013-03-20 22:38:20 +01:00
|
|
|
|
|
|
|
common.start_and_log_in();
|
|
|
|
|
2017-09-18 09:32:15 +02:00
|
|
|
// Password change form test commented out due to Django logging out the user.
|
|
|
|
|
|
|
|
// var form_sel = 'form[action^="/json/settings"]';
|
2016-12-07 18:38:59 +01:00
|
|
|
var regex_zuliprc = /^data:application\/octet-stream;charset=utf-8,\[api\]\nemail=.+\nkey=.+\nsite=.+\n$/;
|
2018-06-04 16:24:21 +02:00
|
|
|
var regex_outgoing_webhook_zuliprc = /^data:application\/octet-stream;charset=utf-8,\[api\]\nemail=.+\nkey=.+\nsite=.+\ntoken=.+\n$/;
|
2018-05-30 11:09:35 +02:00
|
|
|
var regex_botserverrc = /^data:application\/octet-stream;charset=utf-8,\[\]\nemail=.+\nkey=.+\nsite=.+\ntoken=.+\n$/;
|
2013-06-12 17:38:13 +02:00
|
|
|
|
2016-10-07 19:06:35 +02:00
|
|
|
casper.then(function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
var menu_selector = "#settings-dropdown";
|
2016-10-07 19:06:35 +02:00
|
|
|
casper.waitUntilVisible(menu_selector, function () {
|
|
|
|
casper.click(menu_selector);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-11-17 12:25:05 +01:00
|
|
|
casper.then(function () {
|
|
|
|
casper.waitUntilVisible('a[href^="#settings"]', function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.info("Settings page");
|
2016-11-17 12:25:05 +01:00
|
|
|
casper.click('a[href^="#settings"]');
|
|
|
|
});
|
2016-06-10 09:03:36 +02:00
|
|
|
});
|
|
|
|
|
2016-11-17 12:25:05 +01:00
|
|
|
casper.then(function () {
|
2016-12-03 01:12:52 +01:00
|
|
|
casper.waitUntilVisible("#settings_content .account-settings-form", function () {
|
2020-07-15 00:34:28 +02:00
|
|
|
casper.test.assertUrlMatch(
|
|
|
|
/^http:\/\/[^/]+\/#settings/,
|
|
|
|
"URL suggests we are on settings page"
|
|
|
|
);
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.assertVisible(".account-settings-form", "Settings page is active");
|
2013-06-12 17:38:13 +02:00
|
|
|
|
2016-11-17 12:25:05 +01:00
|
|
|
casper.test.assertNotVisible("#pw_change_controls");
|
2013-06-12 17:38:13 +02:00
|
|
|
|
2017-09-18 09:32:15 +02:00
|
|
|
// casper.click(".change_password_button");
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.click("#api_key_button");
|
2016-11-17 12:25:05 +01:00
|
|
|
});
|
2013-06-12 17:38:13 +02:00
|
|
|
});
|
|
|
|
|
2017-09-18 09:32:15 +02:00
|
|
|
/*
|
2016-11-17 12:25:05 +01:00
|
|
|
casper.then(function () {
|
|
|
|
casper.waitUntilVisible("#pw_change_controls", function () {
|
|
|
|
casper.waitForResource("zxcvbn.js", function () {
|
|
|
|
casper.test.assertVisible("#old_password");
|
|
|
|
casper.test.assertVisible("#new_password");
|
|
|
|
|
2020-07-23 04:32:20 +02:00
|
|
|
casper.test.assertEqual(casper.getFormValues(form_sel).full_name, "Desdemona");
|
2016-11-17 12:25:05 +01:00
|
|
|
|
|
|
|
casper.fill(form_sel, {
|
2020-07-23 04:32:20 +02:00
|
|
|
full_name: "DesdemonaNew",
|
2016-12-03 03:08:47 +01:00
|
|
|
old_password: test_credentials.default_user.password,
|
|
|
|
new_password: "qwertyuiop",
|
2016-11-17 12:25:05 +01:00
|
|
|
});
|
2017-08-23 08:17:25 +02:00
|
|
|
casper.test.assertNotVisible("#account-settings-status");
|
2017-03-18 10:44:00 +01:00
|
|
|
casper.click('button[name="change_settings"]');
|
2016-06-04 02:19:07 +02:00
|
|
|
});
|
2013-06-12 17:38:13 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-11-17 12:25:05 +01:00
|
|
|
casper.then(function () {
|
2017-03-10 19:19:25 +01:00
|
|
|
casper.waitUntilVisible('#account-settings-status', function () {
|
|
|
|
casper.test.assertSelectorHasText('#account-settings-status', 'Updated settings!');
|
2017-06-21 20:28:17 +02:00
|
|
|
casper.click('#api_key_button');
|
2016-11-17 12:25:05 +01:00
|
|
|
});
|
2013-06-12 17:38:13 +02:00
|
|
|
});
|
2017-09-18 09:32:15 +02:00
|
|
|
*/
|
2013-06-12 17:38:13 +02:00
|
|
|
|
2016-11-17 12:25:05 +01:00
|
|
|
casper.then(function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitUntilVisible("#get_api_key_button", function () {
|
|
|
|
casper.fill("#api_key_form", {password: test_credentials.default_user.password});
|
|
|
|
casper.click("#get_api_key_button");
|
2016-11-17 12:25:05 +01:00
|
|
|
});
|
2013-03-20 22:38:20 +01:00
|
|
|
});
|
|
|
|
|
2016-11-17 12:25:05 +01:00
|
|
|
casper.then(function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitUntilVisible("#show_api_key", function () {
|
2020-07-15 00:34:28 +02:00
|
|
|
casper.test.assertMatch(
|
|
|
|
casper.fetchText("#api_key_value"),
|
|
|
|
/[a-zA-Z0-9]{32}/,
|
|
|
|
"Looks like an API key"
|
|
|
|
);
|
2013-06-12 17:38:13 +02:00
|
|
|
|
2017-09-18 09:32:15 +02:00
|
|
|
/*
|
2016-11-17 12:25:05 +01:00
|
|
|
// Change it all back so the next test can still log in
|
|
|
|
casper.fill(form_sel, {
|
2020-07-23 04:32:20 +02:00
|
|
|
full_name: "Desdemona",
|
2016-12-03 03:08:47 +01:00
|
|
|
old_password: "qwertyuiop",
|
|
|
|
new_password: test_credentials.default_user.password,
|
2016-11-17 12:25:05 +01:00
|
|
|
});
|
2017-03-18 10:44:00 +01:00
|
|
|
casper.click('button[name="change_settings"]');
|
2017-09-18 09:32:15 +02:00
|
|
|
*/
|
2013-06-12 17:38:13 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-12-07 18:38:59 +01:00
|
|
|
casper.then(function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitUntilVisible("#show_api_key", function () {
|
|
|
|
casper.test.assertExists("#download_zuliprc", "~/.zuliprc button exists");
|
|
|
|
casper.click("#download_zuliprc");
|
2016-12-07 18:38:59 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.then(function () {
|
|
|
|
casper.waitUntilVisible('#download_zuliprc[href^="data:application"]', function () {
|
|
|
|
casper.test.assertMatch(
|
2020-07-15 01:29:15 +02:00
|
|
|
decodeURIComponent(casper.getElementsAttribute("#download_zuliprc", "href")),
|
2016-12-07 18:38:59 +01:00
|
|
|
regex_zuliprc,
|
2020-07-15 00:34:28 +02:00
|
|
|
"Looks like a zuliprc file"
|
|
|
|
);
|
2016-12-07 18:38:59 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-06-13 17:57:33 +02:00
|
|
|
casper.then(function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.click("#api_key_modal .close");
|
2019-08-12 16:43:20 +02:00
|
|
|
|
2017-09-18 09:32:15 +02:00
|
|
|
// casper.waitUntilVisible('#account-settings-status', function () {
|
|
|
|
casper.click('[data-section="your-bots"]');
|
|
|
|
// });
|
2017-06-13 17:57:33 +02:00
|
|
|
});
|
|
|
|
|
2014-02-19 16:07:28 +01:00
|
|
|
casper.then(function create_bot() {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.info("Filling out the create bot form for an outgoing webhook bot");
|
2014-02-19 16:07:28 +01:00
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.fill("#create_bot_form", {
|
|
|
|
bot_name: "Bot 1",
|
|
|
|
bot_short_name: "1",
|
2017-05-30 16:12:02 +02:00
|
|
|
bot_type: OUTGOING_WEBHOOK_BOT_TYPE,
|
2020-07-15 01:29:15 +02:00
|
|
|
payload_url: "http://hostname.example.com/bots/followup",
|
2014-02-19 16:07:28 +01:00
|
|
|
});
|
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.info("Submitting the create bot form");
|
|
|
|
casper.click("#create_bot_button");
|
2014-02-19 16:07:28 +01:00
|
|
|
});
|
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
var bot_email = "1-bot@zulip.testserver";
|
2018-03-01 22:57:11 +01:00
|
|
|
var button_sel = '.download_bot_zuliprc[data-email="' + bot_email + '"]';
|
2017-03-05 04:17:12 +01:00
|
|
|
|
2016-12-07 18:38:59 +01:00
|
|
|
casper.then(function () {
|
|
|
|
casper.waitUntilVisible(button_sel, function () {
|
|
|
|
casper.click(button_sel);
|
2018-03-01 22:57:11 +01:00
|
|
|
});
|
|
|
|
});
|
2016-12-07 18:38:59 +01:00
|
|
|
|
2018-03-01 22:57:11 +01:00
|
|
|
casper.then(function () {
|
|
|
|
casper.waitUntilVisible(button_sel + '[href^="data:application"]', function () {
|
|
|
|
casper.test.assertMatch(
|
2020-07-15 01:29:15 +02:00
|
|
|
decodeURIComponent(casper.getElementsAttribute(button_sel, "href")),
|
2018-06-04 16:24:21 +02:00
|
|
|
regex_outgoing_webhook_zuliprc,
|
2020-07-15 00:34:28 +02:00
|
|
|
"Looks like an outgoing webhook bot ~/.zuliprc file"
|
|
|
|
);
|
2018-06-04 16:24:21 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.then(function create_bot() {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.info("Filling out the create bot form for a normal bot");
|
2018-06-04 16:24:21 +02:00
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.fill("#create_bot_form", {
|
|
|
|
bot_name: "Bot 2",
|
|
|
|
bot_short_name: "2",
|
2018-06-04 16:24:21 +02:00
|
|
|
bot_type: GENERIC_BOT_TYPE,
|
|
|
|
});
|
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.info("Submitting the create bot form");
|
|
|
|
casper.click("#create_bot_button");
|
2018-06-04 16:24:21 +02:00
|
|
|
});
|
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
var second_bot_email = "2-bot@zulip.testserver";
|
2018-06-04 16:24:21 +02:00
|
|
|
var second_button_sel = '.download_bot_zuliprc[data-email="' + second_bot_email + '"]';
|
|
|
|
|
|
|
|
casper.then(function () {
|
|
|
|
casper.waitUntilVisible(second_button_sel, function () {
|
|
|
|
casper.click(second_button_sel);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.then(function () {
|
|
|
|
casper.waitUntilVisible(second_button_sel + '[href^="data:application"]', function () {
|
|
|
|
casper.test.assertMatch(
|
2020-07-15 01:29:15 +02:00
|
|
|
decodeURIComponent(casper.getElementsAttribute(second_button_sel, "href")),
|
2018-03-01 22:57:11 +01:00
|
|
|
regex_zuliprc,
|
2020-07-15 00:34:28 +02:00
|
|
|
"Looks like a bot ~/.zuliprc file"
|
|
|
|
);
|
2016-12-07 18:38:59 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-05-30 16:12:02 +02:00
|
|
|
casper.then(function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitUntilVisible("#download_botserverrc", function () {
|
2018-05-29 10:18:06 +02:00
|
|
|
casper.click("#download_botserverrc");
|
2017-05-30 16:12:02 +02:00
|
|
|
|
2018-05-29 10:18:06 +02:00
|
|
|
casper.waitUntilVisible('#download_botserverrc[href^="data:application"]', function () {
|
2017-05-30 16:12:02 +02:00
|
|
|
casper.test.assertMatch(
|
2020-07-15 01:29:15 +02:00
|
|
|
decodeURIComponent(casper.getElementsAttribute("#download_botserverrc", "href")),
|
2018-05-29 10:18:06 +02:00
|
|
|
regex_botserverrc,
|
2020-07-15 00:34:28 +02:00
|
|
|
"Looks like a botserverrc file"
|
|
|
|
);
|
2017-05-30 16:12:02 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-11-17 12:25:05 +01:00
|
|
|
casper.then(function () {
|
2020-07-15 00:34:28 +02:00
|
|
|
casper.waitUntilVisible(
|
|
|
|
'.open_edit_bot_form[data-email="' + bot_email + '"]',
|
|
|
|
function open_edit_bot_form() {
|
|
|
|
casper.test.info("Opening edit bot form");
|
|
|
|
casper.click('.open_edit_bot_form[data-email="' + bot_email + '"]');
|
|
|
|
}
|
|
|
|
);
|
2014-02-19 16:07:28 +01:00
|
|
|
});
|
|
|
|
|
2016-11-17 12:25:05 +01:00
|
|
|
casper.then(function () {
|
2020-07-15 00:34:28 +02:00
|
|
|
casper.waitUntilVisible(
|
|
|
|
'.edit_bot_form[data-email="' + bot_email + '"]',
|
|
|
|
function test_edit_bot_form_values() {
|
|
|
|
var form_sel = '.edit_bot_form[data-email="' + bot_email + '"]';
|
|
|
|
casper.test.info("Testing edit bot form values");
|
|
|
|
|
|
|
|
// casper.test.assertEqual(
|
|
|
|
// common.get_form_field_value(form_sel + ' [name=bot_name]'),
|
|
|
|
// 'Bot 1');
|
|
|
|
// casper.test.assertEqual(
|
|
|
|
// common.get_form_field_value(form_sel + ' [name=bot_default_sending_stream]'),
|
|
|
|
// 'Denmark');
|
|
|
|
// casper.test.assertEqual(
|
|
|
|
// common.get_form_field_value(form_sel + ' [name=bot_default_events_register_stream]'),
|
|
|
|
// 'Rome');
|
|
|
|
casper.test.assertEqual(
|
|
|
|
common.get_form_field_value(form_sel + " [name=bot_name]"),
|
|
|
|
"Bot 1"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
2014-02-19 16:07:28 +01:00
|
|
|
});
|
|
|
|
|
2017-06-08 14:53:52 +02:00
|
|
|
casper.then(function () {
|
|
|
|
casper.click('[data-section="alert-words"]');
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitUntilVisible("#create_alert_word_form", function () {
|
|
|
|
casper.test.info("Attempting to submit an empty alert word");
|
|
|
|
casper.click("#create_alert_word_button");
|
|
|
|
casper.waitUntilVisible("#alert_word_status", function () {
|
|
|
|
casper.test.info("Checking that an error is displayed");
|
2020-07-15 00:34:28 +02:00
|
|
|
casper.test.assertSelectorHasText(
|
|
|
|
".alert_word_status_text",
|
|
|
|
"Alert word can't be empty!"
|
|
|
|
);
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.info("Closing the error message");
|
|
|
|
casper.click(".close-alert-word-status");
|
|
|
|
casper.test.info("Checking the error is hidden");
|
|
|
|
casper.test.assertNotVisible("#alert_word_status");
|
2017-06-08 14:53:52 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2016-07-14 01:32:25 +02:00
|
|
|
|
2017-06-08 14:53:52 +02:00
|
|
|
casper.then(function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.info("Filling out the alert word input");
|
|
|
|
casper.sendKeys("#create_alert_word_name", "some phrase");
|
|
|
|
casper.click("#create_alert_word_button");
|
|
|
|
casper.test.info("Checking that a success message is displayed");
|
|
|
|
casper.waitUntilVisible("#alert_word_status", function () {
|
2020-07-15 00:34:28 +02:00
|
|
|
casper.test.assertSelectorHasText(
|
|
|
|
".alert_word_status_text",
|
|
|
|
'Alert word "some phrase" added successfully!'
|
|
|
|
);
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.info("Closing the status message");
|
|
|
|
casper.click(".close-alert-word-status");
|
|
|
|
casper.test.info("Checking the status message is hidden");
|
|
|
|
casper.test.assertNotVisible("#alert_word_status");
|
2017-06-08 14:53:52 +02:00
|
|
|
});
|
|
|
|
});
|
2016-06-24 01:53:49 +02:00
|
|
|
|
2017-06-08 14:53:52 +02:00
|
|
|
casper.then(function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.info("Checking that an element was created");
|
2017-06-08 14:53:52 +02:00
|
|
|
casper.waitUntilVisible(".alert-word-item[data-word='some phrase']", function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.assertExists("div.alert-word-information-box");
|
|
|
|
casper.test.assertSelectorHasText("span.value", "some phrase");
|
2017-06-08 14:53:52 +02:00
|
|
|
});
|
|
|
|
});
|
2016-06-24 01:53:49 +02:00
|
|
|
|
2017-06-11 21:30:06 +02:00
|
|
|
casper.then(function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.info("Trying to create a duplicate alert word");
|
|
|
|
casper.sendKeys("#create_alert_word_name", "some phrase");
|
|
|
|
casper.click("#create_alert_word_button");
|
|
|
|
casper.test.info("Checking that an error message is displayed");
|
|
|
|
casper.waitUntilVisible("#alert_word_status", function () {
|
|
|
|
casper.test.assertSelectorHasText(".alert_word_status_text", "Alert word already exists!");
|
|
|
|
casper.test.info("Closing the status message");
|
|
|
|
casper.click(".close-alert-word-status");
|
|
|
|
casper.test.info("Checking the status message is hidden");
|
|
|
|
casper.test.assertNotVisible("#alert_word_status");
|
2017-06-11 21:30:06 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-06-08 14:53:52 +02:00
|
|
|
casper.then(function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.info("Deleting alert word");
|
2020-07-23 03:22:47 +02:00
|
|
|
casper.click("button.remove-alert-word[data-word='some phrase']");
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.info("Checking that a success message is displayed");
|
|
|
|
casper.waitUntilVisible("#alert_word_status", function () {
|
2020-07-15 00:34:28 +02:00
|
|
|
casper.test.assertSelectorHasText(
|
|
|
|
".alert_word_status_text",
|
|
|
|
"Alert word removed successfully!"
|
|
|
|
);
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.info("Closing the status message");
|
|
|
|
casper.click(".close-alert-word-status");
|
|
|
|
casper.test.info("Checking the status message is hidden");
|
|
|
|
casper.test.assertNotVisible("#alert_word_status");
|
2017-06-08 14:53:52 +02:00
|
|
|
});
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.info("Checking that the element was deleted");
|
2017-06-08 14:53:52 +02:00
|
|
|
casper.waitWhileVisible(".alert-word-item[data-word='some phrase']", function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.info("Element deleted successfully");
|
2017-06-08 14:53:52 +02:00
|
|
|
});
|
2016-06-24 01:53:49 +02:00
|
|
|
});
|
|
|
|
|
2016-07-05 08:03:22 +02:00
|
|
|
casper.then(function change_default_language() {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.info("Changing the default language");
|
2016-12-03 01:12:52 +01:00
|
|
|
casper.click('[data-section="display-settings"]');
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitUntilVisible("#default_language");
|
2016-07-05 08:03:22 +02:00
|
|
|
});
|
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.thenClick("#default_language");
|
2016-08-02 15:03:42 +02:00
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitUntilVisible("#default_language_modal");
|
2016-08-02 15:03:42 +02:00
|
|
|
|
2017-10-20 08:16:18 +02:00
|
|
|
casper.thenClick('a[data-code="zh-hans"]');
|
2016-08-02 15:03:42 +02:00
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitUntilVisible("#language-settings-status a", function () {
|
2020-07-15 00:34:28 +02:00
|
|
|
casper.test.assertSelectorHasText(
|
|
|
|
"#language-settings-status",
|
|
|
|
"Saved. Please reload for the change to take effect."
|
|
|
|
);
|
2016-07-19 08:57:51 +02:00
|
|
|
casper.test.info("Reloading the page.");
|
|
|
|
casper.reload();
|
2016-07-05 08:03:22 +02:00
|
|
|
});
|
|
|
|
|
2016-11-17 12:25:05 +01:00
|
|
|
casper.then(function () {
|
2017-02-10 07:54:02 +01:00
|
|
|
casper.waitUntilVisible("#default_language", function () {
|
2016-11-17 12:25:05 +01:00
|
|
|
casper.test.info("Checking if we are on Chinese page.");
|
|
|
|
casper.test.assertEvalEquals(function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
return $("#default_language_name").text().trim();
|
|
|
|
}, "简体中文");
|
2016-11-17 12:25:05 +01:00
|
|
|
casper.test.info("Opening German page through i18n url.");
|
|
|
|
});
|
2016-07-05 08:03:22 +02:00
|
|
|
});
|
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
var settings_url = "http://zulip.zulipdev.com:9981/de/#settings";
|
2016-07-19 14:35:08 +02:00
|
|
|
|
|
|
|
casper.thenOpen(settings_url);
|
2016-07-05 08:03:22 +02:00
|
|
|
|
2017-02-10 07:54:02 +01:00
|
|
|
casper.waitUntilVisible("#settings-change-box", function check_url_preference() {
|
2016-07-19 08:57:51 +02:00
|
|
|
casper.test.info("Checking the i18n url language precedence.");
|
2016-07-05 08:03:22 +02:00
|
|
|
casper.test.assertEvalEquals(function () {
|
|
|
|
return document.documentElement.lang;
|
2020-07-15 01:29:15 +02:00
|
|
|
}, "de");
|
2017-02-03 23:32:05 +01:00
|
|
|
casper.test.info("English is now the default language");
|
2016-12-03 01:12:52 +01:00
|
|
|
casper.click('[data-section="display-settings"]');
|
2016-07-05 08:03:22 +02:00
|
|
|
});
|
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.thenClick("#default_language");
|
2016-08-02 15:03:42 +02:00
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitUntilVisible("#default_language_modal");
|
2016-08-02 15:03:42 +02:00
|
|
|
|
|
|
|
casper.thenClick('a[data-code="en"]');
|
|
|
|
|
2016-07-19 08:57:51 +02:00
|
|
|
/*
|
|
|
|
* Changing the language back to English so that subsequent tests pass.
|
|
|
|
*/
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.waitUntilVisible("#language-settings-status a", function () {
|
2020-07-15 00:34:28 +02:00
|
|
|
casper.test.assertSelectorHasText(
|
|
|
|
"#language-settings-status",
|
|
|
|
"Gespeichert. Bitte lade die Seite neu um die Änderungen zu aktivieren."
|
|
|
|
);
|
2016-07-05 08:03:22 +02:00
|
|
|
});
|
|
|
|
|
2018-01-11 21:36:11 +01:00
|
|
|
casper.then(function () {
|
|
|
|
casper.waitUntilVisible('[data-section="notifications"]', function () {
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.test.info("Testing disabled/enabled behavior for Notification sound");
|
2018-01-11 21:36:11 +01:00
|
|
|
casper.click('[data-section="notifications"]');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
casper.then(function () {
|
2019-06-11 08:47:49 +02:00
|
|
|
// At the beginning, `#enable_sounds` will be on and `#enable_stream_audible_notifications`
|
2018-01-11 21:36:11 +01:00
|
|
|
// will be off by default.
|
2020-07-15 00:34:28 +02:00
|
|
|
casper.test.assertVisible(
|
|
|
|
"#notification_sound:enabled",
|
|
|
|
"Notification sound selector is enabled"
|
|
|
|
);
|
2018-01-11 21:36:11 +01:00
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.click("#enable_stream_audible_notifications");
|
2020-07-15 00:34:28 +02:00
|
|
|
casper.test.assertVisible(
|
|
|
|
"#notification_sound:enabled",
|
|
|
|
"Notification sound selector is enabled"
|
|
|
|
);
|
2018-01-11 21:36:11 +01:00
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.click("#enable_sounds");
|
2020-07-15 00:34:28 +02:00
|
|
|
casper.test.assertVisible(
|
|
|
|
"#notification_sound:enabled",
|
|
|
|
"Notification sound selector is enabled"
|
|
|
|
);
|
2018-01-11 21:36:11 +01:00
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
casper.click("#enable_stream_audible_notifications");
|
2020-07-15 00:34:28 +02:00
|
|
|
casper.test.assertVisible(
|
|
|
|
"#notification_sound:disabled",
|
|
|
|
"Notification sound selector is disabled"
|
|
|
|
);
|
2018-01-11 21:36:11 +01:00
|
|
|
});
|
|
|
|
|
2017-08-25 05:41:04 +02:00
|
|
|
casper.thenOpen("http://zulip.zulipdev.com:9981/");
|
2016-12-15 12:43:08 +01:00
|
|
|
|
2013-08-06 21:32:15 +02:00
|
|
|
// TODO: test the "Declare Zulip Bankruptcy option"
|
2013-06-12 17:38:13 +02:00
|
|
|
|
2013-03-20 22:38:20 +01:00
|
|
|
common.then_log_out();
|
|
|
|
|
|
|
|
casper.run(function () {
|
|
|
|
casper.test.done();
|
|
|
|
});
|