mirror of
https://github.com/zulip/zulip.git
synced 2026-07-15 21:03:26 +08:00
casper: Attempt to fix flakes with message edit settings.
This introduces the helpers submit_checked() and submit_unchecked() to wait to submit forms till casper sees the checkbox being clicked.
This commit is contained in:
parent
5df9011ae5
commit
27f7bdf8b1
@ -1,5 +1,22 @@
|
||||
var common = require('../casper_lib/common.js').common;
|
||||
|
||||
|
||||
function submit_checked() {
|
||||
casper.then(function () {
|
||||
casper.waitUntilVisible('input:checked[type="checkbox"][id="id_realm_allow_message_editing"] + span', function () {
|
||||
casper.click('form.org-settings-form button.button');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function submit_unchecked() {
|
||||
casper.then(function () {
|
||||
casper.waitUntilVisible('input:not(:checked)[type="checkbox"][id="id_realm_allow_message_editing"] + span', function () {
|
||||
casper.click('form.org-settings-form button.button');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
common.start_and_log_in();
|
||||
|
||||
// For clarity these should be different than what 08-edit uses, until
|
||||
@ -95,10 +112,11 @@ casper.then(function () {
|
||||
// deactivate "allow message editing"
|
||||
casper.waitUntilVisible('input[type="checkbox"][id="id_realm_allow_message_editing"] + span', function () {
|
||||
casper.click('input[type="checkbox"][id="id_realm_allow_message_editing"] + span');
|
||||
casper.click('form.org-settings-form button.button');
|
||||
});
|
||||
});
|
||||
|
||||
submit_unchecked();
|
||||
|
||||
casper.then(function () {
|
||||
casper.waitUntilVisible('#admin-realm-message-editing-status', function () {
|
||||
casper.test.assertSelectorHasText('#admin-realm-message-editing-status', 'Users can no longer edit their past messages!');
|
||||
@ -175,11 +193,7 @@ casper.then(function () {
|
||||
});
|
||||
});
|
||||
|
||||
casper.then(function () {
|
||||
casper.waitUntilVisible('input:checked[type="checkbox"][id="id_realm_allow_message_editing"] + span', function () {
|
||||
casper.click('form.org-settings-form button.button');
|
||||
});
|
||||
});
|
||||
submit_checked();
|
||||
|
||||
casper.then(function () {
|
||||
casper.waitUntilVisible('#admin-realm-message-editing-status', function () {
|
||||
@ -244,10 +258,11 @@ casper.then(function () {
|
||||
$('input[type="text"][id="id_realm_message_content_edit_limit_minutes"]').val('4');
|
||||
});
|
||||
casper.click('input[type="checkbox"][id="id_realm_allow_message_editing"] + span');
|
||||
casper.click('form.org-settings-form button.button');
|
||||
});
|
||||
});
|
||||
|
||||
submit_unchecked();
|
||||
|
||||
casper.then(function () {
|
||||
casper.waitUntilVisible('#admin-realm-message-editing-status', function () {
|
||||
casper.test.assertSelectorHasText('#admin-realm-message-editing-status', 'Users can no longer edit their past messages!');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user