REFACTOR: Use the new format for acceptance tests. (#126)
This commit is contained in:
parent
1663b3ab18
commit
b824e19e91
|
@ -1,17 +1,14 @@
|
|||
import selectKit from "helpers/select-kit-helper";
|
||||
import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import { acceptance, updateCurrentUser } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { clearTopicFooterButtons } from "discourse/lib/register-topic-footer-button";
|
||||
|
||||
acceptance("Assign disabled mobile", {
|
||||
loggedIn: true,
|
||||
mobileView: true,
|
||||
settings: { assign_enabled: false },
|
||||
beforeEach() {
|
||||
clearTopicFooterButtons();
|
||||
},
|
||||
});
|
||||
acceptance("Assign disabled mobile", function (needs) {
|
||||
needs.user();
|
||||
needs.mobileView();
|
||||
needs.settings({ assign_enabled: false });
|
||||
needs.hooks.beforeEach(() => clearTopicFooterButtons());
|
||||
|
||||
QUnit.test("Footer dropdown does not contain button", async (assert) => {
|
||||
test("Footer dropdown does not contain button", async (assert) => {
|
||||
updateCurrentUser({ can_assign: true });
|
||||
const menu = selectKit(".topic-footer-mobile-dropdown");
|
||||
|
||||
|
@ -20,3 +17,4 @@ QUnit.test("Footer dropdown does not contain button", async (assert) => {
|
|||
|
||||
assert.notOk(menu.rowByValue("assign").exists());
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
import selectKit from "helpers/select-kit-helper";
|
||||
import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import { acceptance, updateCurrentUser } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { clearTopicFooterButtons } from "discourse/lib/register-topic-footer-button";
|
||||
|
||||
acceptance("Assign mobile", {
|
||||
loggedIn: true,
|
||||
mobileView: true,
|
||||
settings: { assign_enabled: true },
|
||||
beforeEach() {
|
||||
clearTopicFooterButtons();
|
||||
},
|
||||
});
|
||||
acceptance("Assign mobile", function (needs) {
|
||||
needs.user();
|
||||
needs.mobileView();
|
||||
needs.settings({ assign_enabled: true });
|
||||
needs.hooks.beforeEach(() => clearTopicFooterButtons());
|
||||
|
||||
QUnit.test("Footer dropdown contains button", async (assert) => {
|
||||
test("Footer dropdown contains button", async (assert) => {
|
||||
updateCurrentUser({ can_assign: true });
|
||||
const menu = selectKit(".topic-footer-mobile-dropdown");
|
||||
|
||||
|
@ -20,3 +17,4 @@ QUnit.test("Footer dropdown contains button", async (assert) => {
|
|||
|
||||
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 GroupMembers } from "../fixtures/group-members-fixtures";
|
||||
|
||||
acceptance("GroupAssignments", {
|
||||
loggedIn: true,
|
||||
settings: { assign_enabled: true, assigns_user_url_path: "/" },
|
||||
pretend(server, helper) {
|
||||
acceptance("GroupAssignments", function (needs) {
|
||||
needs.user();
|
||||
needs.settings({ assign_enabled: true, assigns_user_url_path: "/" });
|
||||
needs.pretender((server, helper) => {
|
||||
const groupPath = "/topics/group-topics-assigned/discourse.json";
|
||||
const memberPath = "/topics/messages-assigned/ahmedgagan6.json";
|
||||
const getMembersPath = "/assign/members/discourse";
|
||||
|
@ -15,17 +15,17 @@ acceptance("GroupAssignments", {
|
|||
server.get(groupPath, () => helper.response(groupAssigns));
|
||||
server.get(memberPath, () => helper.response(memberAssigns));
|
||||
server.get(getMembersPath, () => helper.response(getMembers));
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("Group Assignments Everyone", async (assert) => {
|
||||
test("Group Assignments Everyone", async (assert) => {
|
||||
await visit("/g/discourse/assigned");
|
||||
assert.equal(currentPath(), "group.assigned.show");
|
||||
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");
|
||||
assert.equal(currentPath(), "group.assigned.show");
|
||||
assert.ok(find(".topic-list-item").length === 1);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,23 +1,20 @@
|
|||
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";
|
||||
|
||||
const USER_MENU = "#current-user.header-dropdown-toggle";
|
||||
const QUICK_ACCESS_ASSIGNMENTS_TAB = ".widget-link.assigned";
|
||||
|
||||
acceptance("Quick access assignments panel", {
|
||||
loggedIn: true,
|
||||
settings: {
|
||||
assign_enabled: true,
|
||||
assigns_user_url_path: "/",
|
||||
},
|
||||
pretend(server, helper) {
|
||||
acceptance("Quick access assignments panel", function (needs) {
|
||||
needs.user();
|
||||
needs.settings({ assign_enabled: true, assigns_user_url_path: "/"});
|
||||
|
||||
needs.pretender((server, helper) => {
|
||||
const messagesPath = "/topics/messages-assigned/eviltrout.json";
|
||||
const assigns = AssignedTopics[messagesPath];
|
||||
server.get(messagesPath, () => helper.response(assigns));
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("Quick access assignments panel", async (assert) => {
|
||||
test("Quick access assignments panel", async (assert) => {
|
||||
updateCurrentUser({ can_assign: true });
|
||||
|
||||
await visit("/");
|
||||
|
@ -36,3 +33,4 @@ QUnit.test("Quick access assignments panel", async (assert) => {
|
|||
"a second click should redirect to the full assignments page"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import selectKit from "helpers/select-kit-helper";
|
||||
import { acceptance, waitFor, updateCurrentUser } from "helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import { acceptance, waitFor, updateCurrentUser } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Search - Full Page", {
|
||||
settings: { assign_enabled: true },
|
||||
loggedIn: true,
|
||||
});
|
||||
QUnit.test(
|
||||
acceptance("Search - Full Page", function (needs) {
|
||||
needs.settings({ assign_enabled: true });
|
||||
needs.user();
|
||||
|
||||
test(
|
||||
"update in:assigned filter through advanced search ui",
|
||||
async (assert) => {
|
||||
updateCurrentUser({ can_assign: true });
|
||||
|
@ -29,7 +29,7 @@ QUnit.test(
|
|||
}
|
||||
);
|
||||
|
||||
QUnit.test(
|
||||
test(
|
||||
"update in:unassigned filter through advanced search ui",
|
||||
async (assert) => {
|
||||
updateCurrentUser({ can_assign: true });
|
||||
|
@ -53,7 +53,7 @@ QUnit.test(
|
|||
}
|
||||
);
|
||||
|
||||
QUnit.skip("update assigned to through advanced search ui", async (assert) => {
|
||||
skip("update assigned to through advanced search ui", async (assert) => {
|
||||
updateCurrentUser({ can_assign: true });
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "none");
|
||||
|
@ -89,3 +89,4 @@ QUnit.skip("update assigned to through advanced search ui", async (assert) => {
|
|||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,21 +1,17 @@
|
|||
import selectKit from "helpers/select-kit-helper";
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { default as AssignedTopics } from "../fixtures/assigned-topics-fixtures";
|
||||
|
||||
acceptance("UnAssign/Re-assign from the topics list", {
|
||||
loggedIn: true,
|
||||
settings: {
|
||||
assign_enabled: true,
|
||||
assigns_user_url_path: "/",
|
||||
},
|
||||
pretend(server, helper) {
|
||||
acceptance("UnAssign/Re-assign from the topics list", function (needs) {
|
||||
needs.user();
|
||||
needs.settings({ assign_enabled: true, assigns_user_url_path: "/"});
|
||||
needs.pretender((server, helper) => {
|
||||
const messagesPath = "/topics/messages-assigned/eviltrout.json";
|
||||
const assigns = AssignedTopics[messagesPath];
|
||||
server.get(messagesPath, () => helper.response(assigns));
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("Unassing/Re-assign options are visible", async (assert) => {
|
||||
test("Unassing/Re-assign options are visible", async (assert) => {
|
||||
const options = selectKit(".assign-actions-dropdown");
|
||||
|
||||
await visit("/u/eviltrout/activity/assigned");
|
||||
|
@ -24,3 +20,4 @@ QUnit.test("Unassing/Re-assign options are visible", async (assert) => {
|
|||
assert.equal(find("li[data-value='unassign']").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 });
|
||||
|
||||
|
|
Loading…
Reference in New Issue