DEV: Remove old user profile navigation menu tests (#20386)
Since 359dc1c532
, support for the old user
profile navigation menu has been dropped. This commit seeks to remove
code from the client side that still relies on the `currentUser.redesigned_user_page_nav_enabled` prop.
This commit is contained in:
parent
6efebd7f11
commit
c1486790d6
|
@ -63,7 +63,9 @@ acceptance(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
|
acceptance(
|
||||||
|
"User Private Messages - user with group messages",
|
||||||
|
function (needs) {
|
||||||
let fetchedNew;
|
let fetchedNew;
|
||||||
let fetchUserNew;
|
let fetchUserNew;
|
||||||
let fetchedGroupNew;
|
let fetchedGroupNew;
|
||||||
|
@ -72,7 +74,7 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
|
||||||
id: 5,
|
id: 5,
|
||||||
username: "charlie",
|
username: "charlie",
|
||||||
groups: [{ id: 14, name: "awesome_group", has_messages: true }],
|
groups: [{ id: 14, name: "awesome_group", has_messages: true }],
|
||||||
...(customUserProps || {}),
|
redesigned_user_page_nav_enabled: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
needs.site({
|
needs.site({
|
||||||
|
@ -329,7 +331,10 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const url of ["/u/charlie/messages", "/u/charlie/messages/archive"]) {
|
for (const url of [
|
||||||
|
"/u/charlie/messages",
|
||||||
|
"/u/charlie/messages/archive",
|
||||||
|
]) {
|
||||||
await visit(url);
|
await visit(url);
|
||||||
|
|
||||||
await publishGroupArchiveToMessageBus({ groupIds: [14], topicId: 1 });
|
await publishGroupArchiveToMessageBus({ groupIds: [14], topicId: 1 });
|
||||||
|
@ -347,7 +352,6 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
|
||||||
await publishUnreadToMessageBus({ topicId: 1 });
|
await publishUnreadToMessageBus({ topicId: 1 });
|
||||||
await publishNewToMessageBus({ topicId: 2 });
|
await publishNewToMessageBus({ topicId: 2 });
|
||||||
|
|
||||||
if (customUserProps?.redesigned_user_page_nav_enabled) {
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
query(".user-nav__messages-new").innerText.trim(),
|
query(".user-nav__messages-new").innerText.trim(),
|
||||||
I18n.t("user.messages.new_with_count", { count: 1 }),
|
I18n.t("user.messages.new_with_count", { count: 1 }),
|
||||||
|
@ -359,19 +363,6 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
|
||||||
I18n.t("user.messages.unread_with_count", { count: 1 }),
|
I18n.t("user.messages.unread_with_count", { count: 1 }),
|
||||||
"displays the right count"
|
"displays the right count"
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
assert.strictEqual(
|
|
||||||
query(".messages-nav li a.new").innerText.trim(),
|
|
||||||
I18n.t("user.messages.new_with_count", { count: 1 }),
|
|
||||||
"displays the right count"
|
|
||||||
);
|
|
||||||
|
|
||||||
assert.strictEqual(
|
|
||||||
query(".messages-nav li a.unread").innerText.trim(),
|
|
||||||
I18n.t("user.messages.unread_with_count", { count: 1 }),
|
|
||||||
"displays the right count"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("incoming new messages while viewing new", async function (assert) {
|
test("incoming new messages while viewing new", async function (assert) {
|
||||||
|
@ -379,19 +370,11 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
|
||||||
|
|
||||||
await publishNewToMessageBus({ topicId: 1 });
|
await publishNewToMessageBus({ topicId: 1 });
|
||||||
|
|
||||||
if (customUserProps?.redesigned_user_page_nav_enabled) {
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
query(".messages-nav .user-nav__messages-new").innerText.trim(),
|
query(".messages-nav .user-nav__messages-new").innerText.trim(),
|
||||||
I18n.t("user.messages.new_with_count", { count: 1 }),
|
I18n.t("user.messages.new_with_count", { count: 1 }),
|
||||||
"displays the right count"
|
"displays the right count"
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
assert.strictEqual(
|
|
||||||
query(".messages-nav li a.new").innerText.trim(),
|
|
||||||
I18n.t("user.messages.new_with_count", { count: 1 }),
|
|
||||||
"displays the right count"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.ok(exists(".show-mores"), "displays the topic incoming info");
|
assert.ok(exists(".show-mores"), "displays the topic incoming info");
|
||||||
});
|
});
|
||||||
|
@ -401,19 +384,11 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
|
||||||
|
|
||||||
await publishUnreadToMessageBus();
|
await publishUnreadToMessageBus();
|
||||||
|
|
||||||
if (customUserProps?.redesigned_user_page_nav_enabled) {
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
query(".messages-nav .user-nav__messages-unread").innerText.trim(),
|
query(".messages-nav .user-nav__messages-unread").innerText.trim(),
|
||||||
I18n.t("user.messages.unread_with_count", { count: 1 }),
|
I18n.t("user.messages.unread_with_count", { count: 1 }),
|
||||||
"displays the right count"
|
"displays the right count"
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
assert.strictEqual(
|
|
||||||
query(".messages-nav li a.unread").innerText.trim(),
|
|
||||||
I18n.t("user.messages.unread_with_count", { count: 1 }),
|
|
||||||
"displays the right count"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.ok(exists(".show-mores"), "displays the topic incoming info");
|
assert.ok(exists(".show-mores"), "displays the topic incoming info");
|
||||||
});
|
});
|
||||||
|
@ -424,7 +399,6 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
|
||||||
await publishUnreadToMessageBus({ groupIds: [14], topicId: 1 });
|
await publishUnreadToMessageBus({ groupIds: [14], topicId: 1 });
|
||||||
await publishNewToMessageBus({ groupIds: [14], topicId: 2 });
|
await publishNewToMessageBus({ groupIds: [14], topicId: 2 });
|
||||||
|
|
||||||
if (customUserProps?.redesigned_user_page_nav_enabled) {
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
query(
|
query(
|
||||||
".messages-nav .user-nav__messages-group-unread"
|
".messages-nav .user-nav__messages-group-unread"
|
||||||
|
@ -454,35 +428,6 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
|
||||||
I18n.t("user.messages.new"),
|
I18n.t("user.messages.new"),
|
||||||
"displays the right count"
|
"displays the right count"
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
assert.strictEqual(
|
|
||||||
query(".messages-nav a.unread").innerText.trim(),
|
|
||||||
I18n.t("user.messages.unread_with_count", { count: 1 }),
|
|
||||||
"displays the right count"
|
|
||||||
);
|
|
||||||
|
|
||||||
assert.strictEqual(
|
|
||||||
query(".messages-nav a.new").innerText.trim(),
|
|
||||||
I18n.t("user.messages.new_with_count", { count: 1 }),
|
|
||||||
"displays the right count"
|
|
||||||
);
|
|
||||||
|
|
||||||
assert.ok(exists(".show-mores"), "displays the topic incoming info");
|
|
||||||
|
|
||||||
await visit("/u/charlie/messages/unread");
|
|
||||||
|
|
||||||
assert.strictEqual(
|
|
||||||
query(".messages-nav a.unread").innerText.trim(),
|
|
||||||
I18n.t("user.messages.unread"),
|
|
||||||
"displays the right count"
|
|
||||||
);
|
|
||||||
|
|
||||||
assert.strictEqual(
|
|
||||||
query(".messages-nav a.new").innerText.trim(),
|
|
||||||
I18n.t("user.messages.new"),
|
|
||||||
"displays the right count"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("incoming messages is not tracked on non user messages route", async function (assert) {
|
test("incoming messages is not tracked on non user messages route", async function (assert) {
|
||||||
|
@ -515,19 +460,11 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
|
||||||
await click(".btn.dismiss-read");
|
await click(".btn.dismiss-read");
|
||||||
await click("#dismiss-read-confirm");
|
await click("#dismiss-read-confirm");
|
||||||
|
|
||||||
if (customUserProps?.redesigned_user_page_nav_enabled) {
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
query(".user-nav__messages-unread").innerText.trim(),
|
query(".user-nav__messages-unread").innerText.trim(),
|
||||||
I18n.t("user.messages.unread"),
|
I18n.t("user.messages.unread"),
|
||||||
"displays the right count"
|
"displays the right count"
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
assert.strictEqual(
|
|
||||||
query(".messages-nav li a.unread").innerText.trim(),
|
|
||||||
I18n.t("user.messages.unread"),
|
|
||||||
"displays the right count"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
count(".topic-list-item"),
|
count(".topic-list-item"),
|
||||||
|
@ -589,19 +526,11 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
|
||||||
|
|
||||||
await click(".btn.dismiss-read");
|
await click(".btn.dismiss-read");
|
||||||
|
|
||||||
if (customUserProps?.redesigned_user_page_nav_enabled) {
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
query(".messages-nav .user-nav__messages-new").innerText.trim(),
|
query(".messages-nav .user-nav__messages-new").innerText.trim(),
|
||||||
I18n.t("user.messages.new"),
|
I18n.t("user.messages.new"),
|
||||||
"displays the right count"
|
"displays the right count"
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
assert.strictEqual(
|
|
||||||
query(".messages-nav li a.new").innerText.trim(),
|
|
||||||
I18n.t("user.messages.new"),
|
|
||||||
"displays the right count"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
count(".topic-list-item"),
|
count(".topic-list-item"),
|
||||||
|
@ -768,7 +697,6 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (customUserProps?.redesigned_user_page_nav_enabled) {
|
|
||||||
test("navigating between user messages route with dropdown", async function (assert) {
|
test("navigating between user messages route with dropdown", async function (assert) {
|
||||||
await visit("/u/charlie/messages");
|
await visit("/u/charlie/messages");
|
||||||
|
|
||||||
|
@ -780,11 +708,7 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
|
||||||
"User personal inbox is selected in dropdown"
|
"User personal inbox is selected in dropdown"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (customUserProps?.redesigned_user_page_nav_enabled) {
|
|
||||||
await click(".user-nav__messages-sent");
|
await click(".user-nav__messages-sent");
|
||||||
} else {
|
|
||||||
await click(".messages-sent");
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
messagesDropdown.header().name(),
|
messagesDropdown.header().name(),
|
||||||
|
@ -807,11 +731,7 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
|
||||||
"Group inbox is selected in dropdown"
|
"Group inbox is selected in dropdown"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (customUserProps?.redesigned_user_page_nav_enabled) {
|
|
||||||
await click(".user-nav__messages-group-new");
|
await click(".user-nav__messages-group-new");
|
||||||
} else {
|
|
||||||
await click(".messages-group-new");
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
messagesDropdown.header().name(),
|
messagesDropdown.header().name(),
|
||||||
|
@ -867,22 +787,6 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
acceptance(
|
|
||||||
"User Private Messages - user with group messages",
|
|
||||||
function (needs) {
|
|
||||||
return testUserPrivateMessagesWithGroupMessages(needs);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
acceptance(
|
|
||||||
"User Private Messages - user with group messages - redesigned user page nav enabled",
|
|
||||||
function (needs) {
|
|
||||||
return testUserPrivateMessagesWithGroupMessages(needs, {
|
|
||||||
redesigned_user_page_nav_enabled: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
acceptance("User Private Messages - user with no messages", function (needs) {
|
acceptance("User Private Messages - user with no messages", function (needs) {
|
||||||
|
|
Loading…
Reference in New Issue