casper_tests: Log in as Desdemona, not Iago.

As of commit 87e72ac8e2 (#15267), we
need to be an owner for some of the tested functionality, not just an
administrator.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-07-22 19:32:20 -07:00 committed by Tim Abbott
parent ded8c34cee
commit ca42fc2e21
4 changed files with 40 additions and 46 deletions

View File

@ -338,7 +338,7 @@ casper.then(function () {
casper.waitWhileSelector("#streams_list .input-append.notdisplayed", function () { casper.waitWhileSelector("#streams_list .input-append.notdisplayed", function () {
casper.test.assertExists(get_stream_li("Denmark"), "Original stream list contains Denmark"); casper.test.assertExists(get_stream_li("Denmark"), "Original stream list contains Denmark");
casper.test.assertExists(get_stream_li("Scotland"), "Original stream list contains Scotland"); casper.test.assertExists(get_stream_li("Venice"), "Original stream list contains Venice");
casper.test.assertExists(get_stream_li("Verona"), "Original stream list contains Verona"); casper.test.assertExists(get_stream_li("Verona"), "Original stream list contains Verona");
}); });
@ -356,8 +356,8 @@ casper.waitForSelector("#stream_filters .highlighted_stream", function () {
"Stream Denmark is highlighted" "Stream Denmark is highlighted"
); );
casper.test.assertDoesntExist( casper.test.assertDoesntExist(
get_stream_li("Scotland") + ".highlighted_stream", get_stream_li("Venice") + ".highlighted_stream",
"Stream Scotland is not highlighted" "Stream Venice is not highlighted"
); );
casper.test.assertDoesntExist( casper.test.assertDoesntExist(
get_stream_li("Verona") + ".highlighted_stream", get_stream_li("Verona") + ".highlighted_stream",
@ -370,22 +370,22 @@ casper.then(function () {
function arrow(key) { function arrow(key) {
casper.sendKeys(".stream-list-filter", casper.page.event.key[key], {keepFocus: true}); casper.sendKeys(".stream-list-filter", casper.page.event.key[key], {keepFocus: true});
} }
arrow("Down"); // Denmark -> Scotland arrow("Down"); // Denmark -> Venice
arrow("Up"); // Scotland -> Denmark arrow("Up"); // Venice -> Denmark
arrow("Up"); // Denmark -> Denmark arrow("Up"); // Denmark -> Denmark
arrow("Down"); // Denmark -> Scotland arrow("Down"); // Denmark -> Venice
}); });
casper.then(function () { casper.then(function () {
casper.waitForSelector(get_stream_li("Scotland") + ".highlighted_stream", function () { casper.waitForSelector(get_stream_li("Venice") + ".highlighted_stream", function () {
casper.test.info("Suggestion highlighting - after arrow key navigation"); casper.test.info("Suggestion highlighting - after arrow key navigation");
casper.test.assertDoesntExist( casper.test.assertDoesntExist(
get_stream_li("Denmark") + ".highlighted_stream", get_stream_li("Denmark") + ".highlighted_stream",
"Stream Denmark is not highlighted" "Stream Denmark is not highlighted"
); );
casper.test.assertExist( casper.test.assertExist(
get_stream_li("Scotland") + ".highlighted_stream", get_stream_li("Venice") + ".highlighted_stream",
"Stream Scotland is highlighted" "Stream Venice is highlighted"
); );
casper.test.assertDoesntExist( casper.test.assertDoesntExist(
get_stream_li("Verona") + ".highlighted_stream", get_stream_li("Verona") + ".highlighted_stream",
@ -394,13 +394,13 @@ casper.then(function () {
}); });
}); });
// We search for the beginning of "Scotland", not case sensitive // We search for the beginning of "Venice", not case sensitive
casper.then(function () { casper.then(function () {
casper.evaluate(function () { casper.evaluate(function () {
$(".stream-list-filter") $(".stream-list-filter")
.expectOne() .expectOne()
.trigger("focus") .trigger("focus")
.val("sCoT") .val("vEnI")
.trigger($.Event("input")) .trigger($.Event("input"))
.trigger($.Event("click")); .trigger($.Event("click"));
}); });
@ -423,13 +423,10 @@ casper.waitWhileVisible(get_stream_li("Verona"), function () {
}); });
casper.then(function () { casper.then(function () {
casper.test.assertExists(get_stream_li("Venice"), "Filtered stream list does contain Venice");
casper.test.assertExists( casper.test.assertExists(
get_stream_li("Scotland"), get_stream_li("Venice") + ".highlighted_stream",
"Filtered stream list does contain Scotland" "Stream Venice is highlighted"
);
casper.test.assertExists(
get_stream_li("Scotland") + ".highlighted_stream",
"Stream Scotland is highlighted"
); );
}); });
@ -444,11 +441,8 @@ casper.then(function () {
casper.waitUntilVisible(get_stream_li("Denmark"), function () { casper.waitUntilVisible(get_stream_li("Denmark"), function () {
casper.test.assertExists(get_stream_li("Denmark"), "Restored stream list contains Denmark"); casper.test.assertExists(get_stream_li("Denmark"), "Restored stream list contains Denmark");
}); });
casper.waitUntilVisible(get_stream_li("Scotland"), function () { casper.waitUntilVisible(get_stream_li("Venice"), function () {
casper.test.assertExists( casper.test.assertExists(get_stream_li("Denmark"), "Restored stream list contains Venice");
get_stream_li("Denmark"),
"Restored stream list contains Scotland"
);
}); });
casper.waitUntilVisible(get_stream_li("Verona"), function () { casper.waitUntilVisible(get_stream_li("Verona"), function () {
casper.test.assertExists(get_stream_li("Denmark"), "Restored stream list contains Verona"); casper.test.assertExists(get_stream_li("Denmark"), "Restored stream list contains Verona");
@ -509,7 +503,7 @@ function assert_not_selected(name) {
// User search at the right sidebar // User search at the right sidebar
casper.then(function () { casper.then(function () {
casper.test.info("Search users using right sidebar"); casper.test.info("Search users using right sidebar");
assert_in_list("Iago"); assert_in_list("Desdemona");
assert_in_list("Cordelia Lear"); assert_in_list("Cordelia Lear");
assert_in_list("King Hamlet"); assert_in_list("King Hamlet");
assert_in_list("aaron"); assert_in_list("aaron");
@ -525,7 +519,7 @@ casper.then(function () {
casper.waitForSelector("#user_presences .highlighted_user", function () { casper.waitForSelector("#user_presences .highlighted_user", function () {
casper.test.info("Suggestion highlighting - initial situation"); casper.test.info("Suggestion highlighting - initial situation");
assert_selected("Iago"); assert_selected("Desdemona");
assert_not_selected("Cordelia Lear"); assert_not_selected("Cordelia Lear");
assert_not_selected("King Hamlet"); assert_not_selected("King Hamlet");
assert_not_selected("aaron"); assert_not_selected("aaron");

View File

@ -48,10 +48,10 @@ casper.then(function () {
casper.test.assertVisible("#old_password"); casper.test.assertVisible("#old_password");
casper.test.assertVisible("#new_password"); casper.test.assertVisible("#new_password");
casper.test.assertEqual(casper.getFormValues(form_sel).full_name, "Iago"); casper.test.assertEqual(casper.getFormValues(form_sel).full_name, "Desdemona");
casper.fill(form_sel, { casper.fill(form_sel, {
full_name: "IagoNew", full_name: "DesdemonaNew",
old_password: test_credentials.default_user.password, old_password: test_credentials.default_user.password,
new_password: "qwertyuiop", new_password: "qwertyuiop",
}); });
@ -87,7 +87,7 @@ casper.then(function () {
/* /*
// Change it all back so the next test can still log in // Change it all back so the next test can still log in
casper.fill(form_sel, { casper.fill(form_sel, {
full_name: "Iago", full_name: "Desdemona",
old_password: "qwertyuiop", old_password: "qwertyuiop",
new_password: test_credentials.default_user.password, new_password: test_credentials.default_user.password,
}); });

View File

@ -111,7 +111,7 @@ casper.then(function () {
// test copying two first messages from topic // test copying two first messages from topic
casper.then(function () { casper.then(function () {
var actual_copied_lines = copy_messages("copy paste test C", "copy paste test D"); var actual_copied_lines = copy_messages("copy paste test C", "copy paste test D");
var expected_copied_lines = ["Iago: copy paste test C", "Iago: copy paste test D"]; var expected_copied_lines = ["Desdemona: copy paste test C", "Desdemona: copy paste test D"];
casper.test.assertEquals( casper.test.assertEquals(
actual_copied_lines, actual_copied_lines,
expected_copied_lines, expected_copied_lines,
@ -123,9 +123,9 @@ casper.then(function () {
casper.then(function () { casper.then(function () {
var actual_copied_lines = copy_messages("copy paste test C", "copy paste test E"); var actual_copied_lines = copy_messages("copy paste test C", "copy paste test E");
var expected_copied_lines = [ var expected_copied_lines = [
"Iago: copy paste test C", "Desdemona: copy paste test C",
"Iago: copy paste test D", "Desdemona: copy paste test D",
"Iago: copy paste test E", "Desdemona: copy paste test E",
]; ];
casper.test.assertEquals( casper.test.assertEquals(
actual_copied_lines, actual_copied_lines,
@ -139,9 +139,9 @@ casper.then(function () {
var actual_copied_lines = copy_messages("copy paste test B", "copy paste test C"); var actual_copied_lines = copy_messages("copy paste test B", "copy paste test C");
var expected_copied_lines = [ var expected_copied_lines = [
"Verona > copy-paste-subject #1 Today", "Verona > copy-paste-subject #1 Today",
"Iago: copy paste test B", "Desdemona: copy paste test B",
"Verona > copy-paste-subject #2 Today", "Verona > copy-paste-subject #2 Today",
"Iago: copy paste test C", "Desdemona: copy paste test C",
]; ];
casper.test.assertEquals( casper.test.assertEquals(
actual_copied_lines, actual_copied_lines,
@ -155,11 +155,11 @@ casper.then(function () {
var actual_copied_lines = copy_messages("copy paste test B", "copy paste test E"); var actual_copied_lines = copy_messages("copy paste test B", "copy paste test E");
var expected_copied_lines = [ var expected_copied_lines = [
"Verona > copy-paste-subject #1 Today", "Verona > copy-paste-subject #1 Today",
"Iago: copy paste test B", "Desdemona: copy paste test B",
"Verona > copy-paste-subject #2 Today", "Verona > copy-paste-subject #2 Today",
"Iago: copy paste test C", "Desdemona: copy paste test C",
"Iago: copy paste test D", "Desdemona: copy paste test D",
"Iago: copy paste test E", "Desdemona: copy paste test E",
]; ];
casper.test.assertEquals( casper.test.assertEquals(
actual_copied_lines, actual_copied_lines,
@ -173,10 +173,10 @@ casper.then(function () {
var actual_copied_lines = copy_messages("copy paste test A", "copy paste test C"); var actual_copied_lines = copy_messages("copy paste test A", "copy paste test C");
var expected_copied_lines = [ var expected_copied_lines = [
"Verona > copy-paste-subject #1 Today", "Verona > copy-paste-subject #1 Today",
"Iago: copy paste test A", "Desdemona: copy paste test A",
"Iago: copy paste test B", "Desdemona: copy paste test B",
"Verona > copy-paste-subject #2 Today", "Verona > copy-paste-subject #2 Today",
"Iago: copy paste test C", "Desdemona: copy paste test C",
]; ];
casper.test.assertEquals( casper.test.assertEquals(
actual_copied_lines, actual_copied_lines,
@ -190,13 +190,13 @@ casper.then(function () {
var actual_copied_lines = copy_messages("copy paste test B", "copy paste test F"); var actual_copied_lines = copy_messages("copy paste test B", "copy paste test F");
var expected_copied_lines = [ var expected_copied_lines = [
"Verona > copy-paste-subject #1 Today", "Verona > copy-paste-subject #1 Today",
"Iago: copy paste test B", "Desdemona: copy paste test B",
"Verona > copy-paste-subject #2 Today", "Verona > copy-paste-subject #2 Today",
"Iago: copy paste test C", "Desdemona: copy paste test C",
"Iago: copy paste test D", "Desdemona: copy paste test D",
"Iago: copy paste test E", "Desdemona: copy paste test E",
"Verona > copy-paste-subject #3 Today", "Verona > copy-paste-subject #3 Today",
"Iago: copy paste test F", "Desdemona: copy paste test F",
]; ];
casper.test.assertEquals( casper.test.assertEquals(
actual_copied_lines, actual_copied_lines,

View File

@ -3,7 +3,7 @@ set -e
cd "$(dirname "$0")"/../.. cd "$(dirname "$0")"/../..
email=iago@zulip.com email=desdemona@zulip.com
mkdir -p var/casper mkdir -p var/casper