DEV: Add helper values for admin manager acceptance tests
Dieser Commit ist enthalten in:
Ursprung
7c70e8ca75
Commit
fbf7319c36
1 geänderte Dateien mit 9 neuen und 272 gelöschten Zeilen
|
@ -1,6 +1,11 @@
|
||||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
import { click, find, findAll, settled, visit } from "@ember/test-helpers";
|
import { click, find, findAll, visit } from "@ember/test-helpers";
|
||||||
|
import {
|
||||||
|
getUnsubscribedAdminWizards,
|
||||||
|
getWizard,
|
||||||
|
getWizardTestingLog,
|
||||||
|
} from "../helpers/admin-wizard";
|
||||||
|
|
||||||
acceptance("Admin | Manager", function (needs) {
|
acceptance("Admin | Manager", function (needs) {
|
||||||
needs.user();
|
needs.user();
|
||||||
|
@ -10,281 +15,17 @@ acceptance("Admin | Manager", function (needs) {
|
||||||
});
|
});
|
||||||
needs.pretender((server, helper) => {
|
needs.pretender((server, helper) => {
|
||||||
server.get("/admin/wizards/manager/this_is_testing_wizard", () => {
|
server.get("/admin/wizards/manager/this_is_testing_wizard", () => {
|
||||||
return helper.response({
|
return helper.response(getWizardTestingLog);
|
||||||
wizard: {
|
|
||||||
id: "this_is_testing_wizard",
|
|
||||||
name: "This is testing wizard",
|
|
||||||
},
|
|
||||||
logs: [
|
|
||||||
{
|
|
||||||
date: "2022-12-13T05:32:38.906-04:00",
|
|
||||||
action: "create_topic",
|
|
||||||
username: "christin",
|
|
||||||
message: "success: created topic - id: 119",
|
|
||||||
user: {
|
|
||||||
id: 55,
|
|
||||||
username: "christin",
|
|
||||||
name: "Sybil Ratke",
|
|
||||||
avatar_template: "",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
date: "2022-12-12T09:41:57.888-04:00",
|
|
||||||
action: "create_topic",
|
|
||||||
username: "someuser",
|
|
||||||
message:
|
|
||||||
"error: invalid topic params - title: ; post: creating a text for this text area that is being displayed here.",
|
|
||||||
user: {
|
|
||||||
id: 1,
|
|
||||||
username: "someuser",
|
|
||||||
name: null,
|
|
||||||
avatar_template: "",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
total: 2,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
server.get("/admin/wizards", () => {
|
server.get("/admin/wizards", () => {
|
||||||
return helper.response({
|
return helper.response(getUnsubscribedAdminWizards);
|
||||||
subscribed: false,
|
|
||||||
subscription_type: "none",
|
|
||||||
subscription_attributes: {
|
|
||||||
wizard: {
|
|
||||||
required: {
|
|
||||||
none: [],
|
|
||||||
standard: ["*"],
|
|
||||||
business: ["*"],
|
|
||||||
community: ["*"],
|
|
||||||
},
|
|
||||||
permitted: {
|
|
||||||
none: [],
|
|
||||||
standard: ["*"],
|
|
||||||
business: ["*"],
|
|
||||||
community: ["*"],
|
|
||||||
},
|
|
||||||
restart_on_revisit: {
|
|
||||||
none: [],
|
|
||||||
standard: ["*"],
|
|
||||||
business: ["*"],
|
|
||||||
community: ["*"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
step: {
|
|
||||||
condition: {
|
|
||||||
none: [],
|
|
||||||
standard: ["*"],
|
|
||||||
business: ["*"],
|
|
||||||
community: ["*"],
|
|
||||||
},
|
|
||||||
required_data: {
|
|
||||||
none: [],
|
|
||||||
standard: ["*"],
|
|
||||||
business: ["*"],
|
|
||||||
community: ["*"],
|
|
||||||
},
|
|
||||||
permitted_params: {
|
|
||||||
none: [],
|
|
||||||
standard: ["*"],
|
|
||||||
business: ["*"],
|
|
||||||
community: ["*"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
field: {
|
|
||||||
condition: {
|
|
||||||
none: [],
|
|
||||||
standard: ["*"],
|
|
||||||
business: ["*"],
|
|
||||||
community: ["*"],
|
|
||||||
},
|
|
||||||
type: {
|
|
||||||
none: [
|
|
||||||
"text",
|
|
||||||
"textarea",
|
|
||||||
"text_only",
|
|
||||||
"date",
|
|
||||||
"time",
|
|
||||||
"date_time",
|
|
||||||
"number",
|
|
||||||
"checkbox",
|
|
||||||
"dropdown",
|
|
||||||
"upload",
|
|
||||||
],
|
|
||||||
standard: ["*"],
|
|
||||||
business: ["*"],
|
|
||||||
community: ["*"],
|
|
||||||
},
|
|
||||||
realtime_validations: {
|
|
||||||
none: [],
|
|
||||||
standard: ["*"],
|
|
||||||
business: ["*"],
|
|
||||||
community: ["*"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
action: {
|
|
||||||
type: {
|
|
||||||
none: [
|
|
||||||
"create_topic",
|
|
||||||
"update_profile",
|
|
||||||
"open_composer",
|
|
||||||
"route_to",
|
|
||||||
],
|
|
||||||
standard: [
|
|
||||||
"create_topic",
|
|
||||||
"update_profile",
|
|
||||||
"open_composer",
|
|
||||||
"route_to",
|
|
||||||
"send_message",
|
|
||||||
"watch_categories",
|
|
||||||
"add_to_group",
|
|
||||||
],
|
|
||||||
business: ["*"],
|
|
||||||
community: ["*"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
custom_field: {
|
|
||||||
klass: {
|
|
||||||
none: ["topic", "post"],
|
|
||||||
standard: ["topic", "post"],
|
|
||||||
business: ["*"],
|
|
||||||
community: ["*"],
|
|
||||||
},
|
|
||||||
type: {
|
|
||||||
none: ["string", "boolean", "integer"],
|
|
||||||
standard: ["string", "boolean", "integer"],
|
|
||||||
business: ["*"],
|
|
||||||
community: ["*"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
api: {
|
|
||||||
all: { none: [], standard: [], business: ["*"], community: ["*"] },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
subscription_client_installed: false,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
server.get("/admin/wizards/wizard", () => {
|
server.get("/admin/wizards/wizard", () => {
|
||||||
return helper.response({
|
return helper.response(getWizard);
|
||||||
wizard_list: [
|
|
||||||
{ id: "this_is_testing_wizard", name: "This is testing wizard" },
|
|
||||||
],
|
|
||||||
field_types: {
|
|
||||||
text: {
|
|
||||||
min_length: null,
|
|
||||||
max_length: null,
|
|
||||||
prefill: null,
|
|
||||||
char_counter: null,
|
|
||||||
validations: null,
|
|
||||||
placeholder: null,
|
|
||||||
},
|
|
||||||
textarea: {
|
|
||||||
min_length: null,
|
|
||||||
max_length: null,
|
|
||||||
prefill: null,
|
|
||||||
char_counter: null,
|
|
||||||
placeholder: null,
|
|
||||||
},
|
|
||||||
composer: {
|
|
||||||
min_length: null,
|
|
||||||
max_length: null,
|
|
||||||
char_counter: null,
|
|
||||||
placeholder: null,
|
|
||||||
},
|
|
||||||
text_only: {},
|
|
||||||
composer_preview: { preview_template: null },
|
|
||||||
date: { format: "YYYY-MM-DD" },
|
|
||||||
time: { format: "HH:mm" },
|
|
||||||
date_time: { format: "" },
|
|
||||||
number: {},
|
|
||||||
checkbox: {},
|
|
||||||
url: { min_length: null },
|
|
||||||
upload: { file_types: ".jpg,.jpeg,.png" },
|
|
||||||
dropdown: { prefill: null, content: null },
|
|
||||||
tag: { limit: null, prefill: null, content: null, tag_groups: null },
|
|
||||||
category: { limit: 1, property: "id", prefill: null, content: null },
|
|
||||||
group: { prefill: null, content: null },
|
|
||||||
user_selector: {},
|
|
||||||
},
|
|
||||||
realtime_validations: {
|
|
||||||
similar_topics: {
|
|
||||||
types: ["text"],
|
|
||||||
component: "similar-topics-validator",
|
|
||||||
backend: true,
|
|
||||||
required_params: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
custom_fields: [
|
|
||||||
{
|
|
||||||
id: "external",
|
|
||||||
klass: "category",
|
|
||||||
name: "require_topic_approval",
|
|
||||||
type: "boolean",
|
|
||||||
serializers: null,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "external",
|
|
||||||
klass: "category",
|
|
||||||
name: "require_reply_approval",
|
|
||||||
type: "boolean",
|
|
||||||
serializers: null,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "external",
|
|
||||||
klass: "category",
|
|
||||||
name: "num_auto_bump_daily",
|
|
||||||
type: "integer",
|
|
||||||
serializers: null,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "external",
|
|
||||||
klass: "category",
|
|
||||||
name: "has_chat_enabled",
|
|
||||||
type: "boolean",
|
|
||||||
serializers: null,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "external",
|
|
||||||
klass: "post",
|
|
||||||
name: "missing uploads",
|
|
||||||
type: "json",
|
|
||||||
serializers: null,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "external",
|
|
||||||
klass: "post",
|
|
||||||
name: "missing uploads ignored",
|
|
||||||
type: "boolean",
|
|
||||||
serializers: null,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "external",
|
|
||||||
klass: "post",
|
|
||||||
name: "notice",
|
|
||||||
type: "json",
|
|
||||||
serializers: null,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "external",
|
|
||||||
klass: "post",
|
|
||||||
name: "local_dates",
|
|
||||||
type: "json",
|
|
||||||
serializers: null,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "external",
|
|
||||||
klass: "post",
|
|
||||||
name: "has_polls",
|
|
||||||
type: "boolean",
|
|
||||||
serializers: null,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
// TODO Review failing test
|
|
||||||
test("viewing manager fields content", async (assert) => {
|
test("viewing manager fields content", async (assert) => {
|
||||||
await visit("/admin/wizards/manager");
|
await visit("/admin/wizards/manager");
|
||||||
await settled();
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
query(".message-content").innerText.includes(
|
query(".message-content").innerText.includes(
|
||||||
"Export, import or destroy wizards"
|
"Export, import or destroy wizards"
|
||||||
|
@ -308,13 +49,11 @@ acceptance("Admin | Manager", function (needs) {
|
||||||
"the export button is disabled when export checkbox is unchecked"
|
"the export button is disabled when export checkbox is unchecked"
|
||||||
);
|
);
|
||||||
await click(exportCheck);
|
await click(exportCheck);
|
||||||
await settled();
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
!exportButton.hasAttribute("disabled"),
|
!exportButton.hasAttribute("disabled"),
|
||||||
"the export button is enabled when export checkbox is clicked"
|
"the export button is enabled when export checkbox is clicked"
|
||||||
);
|
);
|
||||||
await click(exportCheck);
|
await click(exportCheck);
|
||||||
await settled();
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
exportButton.hasAttribute("disabled"),
|
exportButton.hasAttribute("disabled"),
|
||||||
"the export button is disabled when export checkbox is unchecked"
|
"the export button is disabled when export checkbox is unchecked"
|
||||||
|
@ -325,13 +64,11 @@ acceptance("Admin | Manager", function (needs) {
|
||||||
"the destroy button is disabled when destroy checkbox is unchecked"
|
"the destroy button is disabled when destroy checkbox is unchecked"
|
||||||
);
|
);
|
||||||
await click(destroyCheck);
|
await click(destroyCheck);
|
||||||
await settled();
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
!destroyButton.hasAttribute("disabled"),
|
!destroyButton.hasAttribute("disabled"),
|
||||||
"the destroy button is enabled when destroy checkbox is clicked"
|
"the destroy button is enabled when destroy checkbox is clicked"
|
||||||
);
|
);
|
||||||
await click(destroyCheck);
|
await click(destroyCheck);
|
||||||
await settled();
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
destroyButton.hasAttribute("disabled"),
|
destroyButton.hasAttribute("disabled"),
|
||||||
"the destroy button is disabled when destroy checkbox is unchecked"
|
"the destroy button is disabled when destroy checkbox is unchecked"
|
||||||
|
|
Laden …
In neuem Issue referenzieren