REFACTOR: Use the new format for acceptance tests. (#126)
This commit is contained in:
parent
1663b3ab18
commit
b824e19e91
|
@ -1,22 +1,20 @@
|
||||||
import selectKit from "helpers/select-kit-helper";
|
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||||
import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
|
import { acceptance, updateCurrentUser } from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { clearTopicFooterButtons } from "discourse/lib/register-topic-footer-button";
|
import { clearTopicFooterButtons } from "discourse/lib/register-topic-footer-button";
|
||||||
|
|
||||||
acceptance("Assign disabled mobile", {
|
acceptance("Assign disabled mobile", function (needs) {
|
||||||
loggedIn: true,
|
needs.user();
|
||||||
mobileView: true,
|
needs.mobileView();
|
||||||
settings: { assign_enabled: false },
|
needs.settings({ assign_enabled: false });
|
||||||
beforeEach() {
|
needs.hooks.beforeEach(() => clearTopicFooterButtons());
|
||||||
clearTopicFooterButtons();
|
|
||||||
},
|
test("Footer dropdown does not contain button", async (assert) => {
|
||||||
});
|
updateCurrentUser({ can_assign: true });
|
||||||
|
const menu = selectKit(".topic-footer-mobile-dropdown");
|
||||||
QUnit.test("Footer dropdown does not contain button", async (assert) => {
|
|
||||||
updateCurrentUser({ can_assign: true });
|
await visit("/t/internationalization-localization/280");
|
||||||
const menu = selectKit(".topic-footer-mobile-dropdown");
|
await menu.expand();
|
||||||
|
|
||||||
await visit("/t/internationalization-localization/280");
|
assert.notOk(menu.rowByValue("assign").exists());
|
||||||
await menu.expand();
|
});
|
||||||
|
|
||||||
assert.notOk(menu.rowByValue("assign").exists());
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,22 +1,20 @@
|
||||||
import selectKit from "helpers/select-kit-helper";
|
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||||
import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
|
import { acceptance, updateCurrentUser } from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { clearTopicFooterButtons } from "discourse/lib/register-topic-footer-button";
|
import { clearTopicFooterButtons } from "discourse/lib/register-topic-footer-button";
|
||||||
|
|
||||||
acceptance("Assign mobile", {
|
acceptance("Assign mobile", function (needs) {
|
||||||
loggedIn: true,
|
needs.user();
|
||||||
mobileView: true,
|
needs.mobileView();
|
||||||
settings: { assign_enabled: true },
|
needs.settings({ assign_enabled: true });
|
||||||
beforeEach() {
|
needs.hooks.beforeEach(() => clearTopicFooterButtons());
|
||||||
clearTopicFooterButtons();
|
|
||||||
},
|
test("Footer dropdown contains button", async (assert) => {
|
||||||
});
|
updateCurrentUser({ can_assign: true });
|
||||||
|
const menu = selectKit(".topic-footer-mobile-dropdown");
|
||||||
QUnit.test("Footer dropdown contains button", async (assert) => {
|
|
||||||
updateCurrentUser({ can_assign: true });
|
await visit("/t/internationalization-localization/280");
|
||||||
const menu = selectKit(".topic-footer-mobile-dropdown");
|
await menu.expand();
|
||||||
|
|
||||||
await visit("/t/internationalization-localization/280");
|
assert.ok(menu.rowByValue("assign").exists());
|
||||||
await menu.expand();
|
});
|
||||||
|
|
||||||
assert.ok(menu.rowByValue("assign").exists());
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { acceptance } from "helpers/qunit-helpers";
|
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { default as AssignedTopics } from "../fixtures/assigned-group-assignments-fixtures";
|
import { default as AssignedTopics } from "../fixtures/assigned-group-assignments-fixtures";
|
||||||
import { default as GroupMembers } from "../fixtures/group-members-fixtures";
|
import { default as GroupMembers } from "../fixtures/group-members-fixtures";
|
||||||
|
|
||||||
acceptance("GroupAssignments", {
|
acceptance("GroupAssignments", function (needs) {
|
||||||
loggedIn: true,
|
needs.user();
|
||||||
settings: { assign_enabled: true, assigns_user_url_path: "/" },
|
needs.settings({ assign_enabled: true, assigns_user_url_path: "/" });
|
||||||
pretend(server, helper) {
|
needs.pretender((server, helper) => {
|
||||||
const groupPath = "/topics/group-topics-assigned/discourse.json";
|
const groupPath = "/topics/group-topics-assigned/discourse.json";
|
||||||
const memberPath = "/topics/messages-assigned/ahmedgagan6.json";
|
const memberPath = "/topics/messages-assigned/ahmedgagan6.json";
|
||||||
const getMembersPath = "/assign/members/discourse";
|
const getMembersPath = "/assign/members/discourse";
|
||||||
|
@ -15,17 +15,17 @@ acceptance("GroupAssignments", {
|
||||||
server.get(groupPath, () => helper.response(groupAssigns));
|
server.get(groupPath, () => helper.response(groupAssigns));
|
||||||
server.get(memberPath, () => helper.response(memberAssigns));
|
server.get(memberPath, () => helper.response(memberAssigns));
|
||||||
server.get(getMembersPath, () => helper.response(getMembers));
|
server.get(getMembersPath, () => helper.response(getMembers));
|
||||||
},
|
});
|
||||||
});
|
|
||||||
|
|
||||||
QUnit.test("Group Assignments Everyone", async (assert) => {
|
test("Group Assignments Everyone", async (assert) => {
|
||||||
await visit("/g/discourse/assigned");
|
await visit("/g/discourse/assigned");
|
||||||
assert.equal(currentPath(), "group.assigned.show");
|
assert.equal(currentPath(), "group.assigned.show");
|
||||||
assert.ok(find(".topic-list-item").length === 1);
|
assert.ok(find(".topic-list-item").length === 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test("Group Assignments Ahmedgagan", async (assert) => {
|
test("Group Assignments Ahmedgagan", async (assert) => {
|
||||||
await visit("/g/discourse/assigned/ahmedgagan6");
|
await visit("/g/discourse/assigned/ahmedgagan6");
|
||||||
assert.equal(currentPath(), "group.assigned.show");
|
assert.equal(currentPath(), "group.assigned.show");
|
||||||
assert.ok(find(".topic-list-item").length === 1);
|
assert.ok(find(".topic-list-item").length === 1);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,38 +1,36 @@
|
||||||
import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
|
import { acceptance, updateCurrentUser } from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { default as AssignedTopics } from "../fixtures/assigned-topics-fixtures";
|
import { default as AssignedTopics } from "../fixtures/assigned-topics-fixtures";
|
||||||
|
|
||||||
const USER_MENU = "#current-user.header-dropdown-toggle";
|
const USER_MENU = "#current-user.header-dropdown-toggle";
|
||||||
const QUICK_ACCESS_ASSIGNMENTS_TAB = ".widget-link.assigned";
|
const QUICK_ACCESS_ASSIGNMENTS_TAB = ".widget-link.assigned";
|
||||||
|
|
||||||
acceptance("Quick access assignments panel", {
|
acceptance("Quick access assignments panel", function (needs) {
|
||||||
loggedIn: true,
|
needs.user();
|
||||||
settings: {
|
needs.settings({ assign_enabled: true, assigns_user_url_path: "/"});
|
||||||
assign_enabled: true,
|
|
||||||
assigns_user_url_path: "/",
|
needs.pretender((server, helper) => {
|
||||||
},
|
|
||||||
pretend(server, helper) {
|
|
||||||
const messagesPath = "/topics/messages-assigned/eviltrout.json";
|
const messagesPath = "/topics/messages-assigned/eviltrout.json";
|
||||||
const assigns = AssignedTopics[messagesPath];
|
const assigns = AssignedTopics[messagesPath];
|
||||||
server.get(messagesPath, () => helper.response(assigns));
|
server.get(messagesPath, () => helper.response(assigns));
|
||||||
},
|
});
|
||||||
});
|
|
||||||
|
test("Quick access assignments panel", async (assert) => {
|
||||||
QUnit.test("Quick access assignments panel", async (assert) => {
|
updateCurrentUser({ can_assign: true });
|
||||||
updateCurrentUser({ can_assign: true });
|
|
||||||
|
await visit("/");
|
||||||
await visit("/");
|
await click(USER_MENU);
|
||||||
await click(USER_MENU);
|
|
||||||
|
await click(QUICK_ACCESS_ASSIGNMENTS_TAB);
|
||||||
await click(QUICK_ACCESS_ASSIGNMENTS_TAB);
|
const assignment = find(".quick-access-panel li a")[0];
|
||||||
const assignment = find(".quick-access-panel li a")[0];
|
|
||||||
|
assert.ok(assignment.innerText.includes("Greetings!"));
|
||||||
assert.ok(assignment.innerText.includes("Greetings!"));
|
assert.ok(assignment.href.includes("/t/greetings/10/5"));
|
||||||
assert.ok(assignment.href.includes("/t/greetings/10/5"));
|
|
||||||
|
await click(QUICK_ACCESS_ASSIGNMENTS_TAB);
|
||||||
await click(QUICK_ACCESS_ASSIGNMENTS_TAB);
|
assert.equal(
|
||||||
assert.equal(
|
currentPath(),
|
||||||
currentPath(),
|
"user.userActivity.assigned",
|
||||||
"user.userActivity.assigned",
|
"a second click should redirect to the full assignments page"
|
||||||
"a second click should redirect to the full assignments page"
|
);
|
||||||
);
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,91 +1,92 @@
|
||||||
import selectKit from "helpers/select-kit-helper";
|
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||||
import { acceptance, waitFor, updateCurrentUser } from "helpers/qunit-helpers";
|
import { acceptance, waitFor, updateCurrentUser } from "discourse/tests/helpers/qunit-helpers";
|
||||||
|
|
||||||
acceptance("Search - Full Page", {
|
acceptance("Search - Full Page", function (needs) {
|
||||||
settings: { assign_enabled: true },
|
needs.settings({ assign_enabled: true });
|
||||||
loggedIn: true,
|
needs.user();
|
||||||
});
|
|
||||||
QUnit.test(
|
|
||||||
"update in:assigned filter through advanced search ui",
|
|
||||||
async (assert) => {
|
|
||||||
updateCurrentUser({ can_assign: true });
|
|
||||||
const inSelector = selectKit(".search-advanced-options .select-kit#in");
|
|
||||||
|
|
||||||
await visit("/search");
|
test(
|
||||||
|
"update in:assigned filter through advanced search ui",
|
||||||
|
async (assert) => {
|
||||||
|
updateCurrentUser({ can_assign: true });
|
||||||
|
const inSelector = selectKit(".search-advanced-options .select-kit#in");
|
||||||
|
|
||||||
await fillIn(".search-query", "none");
|
await visit("/search");
|
||||||
await inSelector.expand();
|
|
||||||
await inSelector.selectRowByValue("assigned");
|
|
||||||
assert.equal(
|
|
||||||
inSelector.header().label(),
|
|
||||||
"are assigned",
|
|
||||||
'has "are assigned" populated'
|
|
||||||
);
|
|
||||||
assert.equal(
|
|
||||||
find(".search-query").val(),
|
|
||||||
"none in:assigned",
|
|
||||||
'has updated search term to "none in:assinged"'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
QUnit.test(
|
await fillIn(".search-query", "none");
|
||||||
"update in:unassigned filter through advanced search ui",
|
await inSelector.expand();
|
||||||
async (assert) => {
|
await inSelector.selectRowByValue("assigned");
|
||||||
updateCurrentUser({ can_assign: true });
|
assert.equal(
|
||||||
const inSelector = selectKit(".search-advanced-options .select-kit#in");
|
inSelector.header().label(),
|
||||||
|
"are assigned",
|
||||||
await visit("/search");
|
'has "are assigned" populated'
|
||||||
|
);
|
||||||
await fillIn(".search-query", "none");
|
assert.equal(
|
||||||
await inSelector.expand();
|
find(".search-query").val(),
|
||||||
await inSelector.selectRowByValue("unassigned");
|
"none in:assigned",
|
||||||
assert.equal(
|
'has updated search term to "none in:assinged"'
|
||||||
inSelector.header().label(),
|
);
|
||||||
"are unassigned",
|
}
|
||||||
'has "are unassigned" populated'
|
|
||||||
);
|
|
||||||
assert.equal(
|
|
||||||
find(".search-query").val(),
|
|
||||||
"none in:unassigned",
|
|
||||||
'has updated search term to "none in:unassinged"'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
QUnit.skip("update assigned to through advanced search ui", async (assert) => {
|
|
||||||
updateCurrentUser({ can_assign: true });
|
|
||||||
await visit("/search");
|
|
||||||
await fillIn(".search-query", "none");
|
|
||||||
await fillIn(".search-advanced-options .user-selector-assigned", "admin");
|
|
||||||
await click(".search-advanced-options .user-selector-assigned");
|
|
||||||
await keyEvent(
|
|
||||||
".search-advanced-options .user-selector-assigned",
|
|
||||||
"keydown",
|
|
||||||
8
|
|
||||||
);
|
);
|
||||||
waitFor(assert, async () => {
|
|
||||||
assert.ok(
|
|
||||||
visible(".search-advanced-options .autocomplete"),
|
|
||||||
'"autocomplete" popup is visible'
|
|
||||||
);
|
|
||||||
assert.ok(
|
|
||||||
exists(
|
|
||||||
'.search-advanced-options .autocomplete ul li a span.username:contains("admin")'
|
|
||||||
),
|
|
||||||
'"autocomplete" popup has an entry for "admin"'
|
|
||||||
);
|
|
||||||
|
|
||||||
await click(".search-advanced-options .autocomplete ul li a:first");
|
test(
|
||||||
|
"update in:unassigned filter through advanced search ui",
|
||||||
|
async (assert) => {
|
||||||
|
updateCurrentUser({ can_assign: true });
|
||||||
|
const inSelector = selectKit(".search-advanced-options .select-kit#in");
|
||||||
|
|
||||||
assert.ok(
|
await visit("/search");
|
||||||
exists('.search-advanced-options span:contains("admin")'),
|
|
||||||
'has "admin" pre-populated'
|
await fillIn(".search-query", "none");
|
||||||
);
|
await inSelector.expand();
|
||||||
assert.equal(
|
await inSelector.selectRowByValue("unassigned");
|
||||||
find(".search-query").val(),
|
assert.equal(
|
||||||
"none assigned:admin",
|
inSelector.header().label(),
|
||||||
'has updated search term to "none assigned:admin"'
|
"are unassigned",
|
||||||
|
'has "are unassigned" populated'
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
find(".search-query").val(),
|
||||||
|
"none in:unassigned",
|
||||||
|
'has updated search term to "none in:unassinged"'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
skip("update assigned to through advanced search ui", async (assert) => {
|
||||||
|
updateCurrentUser({ can_assign: true });
|
||||||
|
await visit("/search");
|
||||||
|
await fillIn(".search-query", "none");
|
||||||
|
await fillIn(".search-advanced-options .user-selector-assigned", "admin");
|
||||||
|
await click(".search-advanced-options .user-selector-assigned");
|
||||||
|
await keyEvent(
|
||||||
|
".search-advanced-options .user-selector-assigned",
|
||||||
|
"keydown",
|
||||||
|
8
|
||||||
);
|
);
|
||||||
|
waitFor(assert, async () => {
|
||||||
|
assert.ok(
|
||||||
|
visible(".search-advanced-options .autocomplete"),
|
||||||
|
'"autocomplete" popup is visible'
|
||||||
|
);
|
||||||
|
assert.ok(
|
||||||
|
exists(
|
||||||
|
'.search-advanced-options .autocomplete ul li a span.username:contains("admin")'
|
||||||
|
),
|
||||||
|
'"autocomplete" popup has an entry for "admin"'
|
||||||
|
);
|
||||||
|
|
||||||
|
await click(".search-advanced-options .autocomplete ul li a:first");
|
||||||
|
|
||||||
|
assert.ok(
|
||||||
|
exists('.search-advanced-options span:contains("admin")'),
|
||||||
|
'has "admin" pre-populated'
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
find(".search-query").val(),
|
||||||
|
"none assigned:admin",
|
||||||
|
'has updated search term to "none assigned:admin"'
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,26 +1,23 @@
|
||||||
import selectKit from "helpers/select-kit-helper";
|
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||||
import { acceptance } from "helpers/qunit-helpers";
|
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { default as AssignedTopics } from "../fixtures/assigned-topics-fixtures";
|
import { default as AssignedTopics } from "../fixtures/assigned-topics-fixtures";
|
||||||
|
|
||||||
acceptance("UnAssign/Re-assign from the topics list", {
|
acceptance("UnAssign/Re-assign from the topics list", function (needs) {
|
||||||
loggedIn: true,
|
needs.user();
|
||||||
settings: {
|
needs.settings({ assign_enabled: true, assigns_user_url_path: "/"});
|
||||||
assign_enabled: true,
|
needs.pretender((server, helper) => {
|
||||||
assigns_user_url_path: "/",
|
|
||||||
},
|
|
||||||
pretend(server, helper) {
|
|
||||||
const messagesPath = "/topics/messages-assigned/eviltrout.json";
|
const messagesPath = "/topics/messages-assigned/eviltrout.json";
|
||||||
const assigns = AssignedTopics[messagesPath];
|
const assigns = AssignedTopics[messagesPath];
|
||||||
server.get(messagesPath, () => helper.response(assigns));
|
server.get(messagesPath, () => helper.response(assigns));
|
||||||
},
|
});
|
||||||
});
|
|
||||||
|
test("Unassing/Re-assign options are visible", async (assert) => {
|
||||||
QUnit.test("Unassing/Re-assign options are visible", async (assert) => {
|
const options = selectKit(".assign-actions-dropdown");
|
||||||
const options = selectKit(".assign-actions-dropdown");
|
|
||||||
|
await visit("/u/eviltrout/activity/assigned");
|
||||||
await visit("/u/eviltrout/activity/assigned");
|
await options.expand();
|
||||||
await options.expand();
|
|
||||||
|
assert.equal(find("li[data-value='unassign']").length, 1);
|
||||||
assert.equal(find("li[data-value='unassign']").length, 1);
|
assert.equal(find("li[data-value='reassign']").length, 1);
|
||||||
assert.equal(find("li[data-value='reassign']").length, 1);
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import componentTest from "helpers/component-test";
|
import componentTest from "discourse/tests/helpers/component-test";
|
||||||
|
|
||||||
moduleForComponent("group-assigned-filter", { integration: true });
|
moduleForComponent("group-assigned-filter", { integration: true });
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue