2023-05-09 07:15:21 +02:00
|
|
|
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
2022-12-21 16:30:31 +01:00
|
|
|
import { test } from "qunit";
|
2023-05-09 07:15:21 +02:00
|
|
|
import { findAll, visit } from "@ember/test-helpers";
|
2022-12-21 17:24:39 +01:00
|
|
|
import {
|
|
|
|
getCustomFields,
|
|
|
|
getUnsubscribedAdminWizards,
|
|
|
|
getWizard,
|
|
|
|
} from "../helpers/admin-wizard";
|
2022-12-13 09:27:41 +01:00
|
|
|
|
2023-05-09 07:15:21 +02:00
|
|
|
acceptance("Admin | Custom Fields Unsuscribed", function (needs) {
|
2022-12-13 09:27:41 +01:00
|
|
|
needs.user();
|
|
|
|
needs.settings({
|
|
|
|
custom_wizard_enabled: true,
|
|
|
|
available_locales: JSON.stringify([{ name: "English", value: "en" }]),
|
|
|
|
});
|
|
|
|
|
|
|
|
needs.pretender((server, helper) => {
|
2022-12-21 05:18:10 +01:00
|
|
|
server.get("/admin/wizards/wizard", () => {
|
2022-12-21 17:24:39 +01:00
|
|
|
return helper.response(getWizard);
|
2022-12-13 09:27:41 +01:00
|
|
|
});
|
|
|
|
server.get("/admin/wizards", () => {
|
2022-12-21 17:24:39 +01:00
|
|
|
return helper.response(getUnsubscribedAdminWizards);
|
2022-12-13 09:27:41 +01:00
|
|
|
});
|
2022-12-21 05:18:10 +01:00
|
|
|
server.get("/admin/wizards/custom-fields", () => {
|
2022-12-21 17:24:39 +01:00
|
|
|
return helper.response(getCustomFields);
|
2022-12-13 09:27:41 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2023-05-09 07:15:21 +02:00
|
|
|
test("Navigate to custom fields tab", async (assert) => {
|
2022-12-13 09:27:41 +01:00
|
|
|
await visit("/admin/wizards/custom-fields");
|
|
|
|
assert.ok(find("table"));
|
|
|
|
assert.ok(findAll("table tbody tr").length === 9);
|
|
|
|
assert.ok(
|
|
|
|
query(".message-content").innerText.includes(
|
|
|
|
"View, create, edit and destroy custom fields"
|
|
|
|
),
|
|
|
|
"it displays wizard message"
|
|
|
|
);
|
2023-05-06 02:37:58 +02:00
|
|
|
});
|
2022-12-13 09:27:41 +01:00
|
|
|
});
|