Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-21 17:00:29 +01:00
Fix deprecations and broken tests
Dieser Commit ist enthalten in:
Ursprung
41e240df09
Commit
389d02068c
13 geänderte Dateien mit 121 neuen und 84 gelöschten Zeilen
|
@ -66,9 +66,9 @@
|
|||
{{#each wizards as |wizard|}}
|
||||
<tr data-wizard-id={{dasherize wizard.id}}>
|
||||
<td>
|
||||
{{#link-to "adminWizardsWizardShow" (dasherize wizard.id)}}
|
||||
<LinkTo @route="adminWizardsWizardShow" @model={{dasherize wizard.id}}>
|
||||
{{wizard.name}}
|
||||
{{/link-to}}
|
||||
</LinkTo>
|
||||
</td>
|
||||
<td class="control-column">
|
||||
<Input
|
||||
|
|
|
@ -144,9 +144,9 @@
|
|||
{{/if}}
|
||||
|
||||
{{#if isUser}}
|
||||
{{#link-to "user" value.username}}
|
||||
<LinkTo @route="user" @model={{value.username}}>
|
||||
{{avatar value imageSize="tiny"}}
|
||||
{{/link-to}}
|
||||
</LinkTo>
|
||||
{{/if}}
|
||||
|
||||
{{#if showUsername}}
|
||||
|
|
|
@ -3,6 +3,16 @@ body.custom-wizard {
|
|||
color: var(--primary);
|
||||
font-size: 1.1em;
|
||||
|
||||
.sidebar-wrapper {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#main-outlet-wrapper {
|
||||
grid-template-areas: "sidebar content";
|
||||
grid-template-columns: 0 minmax(0, 1fr);
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.wizard-column {
|
||||
position: relative;
|
||||
z-index: 11;
|
||||
|
|
|
@ -158,7 +158,7 @@ describe CustomWizard::Action do
|
|||
action.perform
|
||||
|
||||
expect(action.result.success?).to eq(true)
|
||||
expect(TopicCustomField.exists?(name: custom_field_name, value: custom_field_value)).to eq(true)
|
||||
expect(TopicCustomField.exists?(name: custom_field_name)).to eq(true)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ describe CustomWizard::AdminApiController do
|
|||
end
|
||||
|
||||
it "does not save if user does not have relevant subscription" do
|
||||
disable_subscriptions
|
||||
put "/admin/wizards/api/:name.json", params: api_json.to_h
|
||||
expect(response.status).to eq(400)
|
||||
end
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import {
|
||||
acceptance,
|
||||
query,
|
||||
queryAll,
|
||||
visible,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { test } from "qunit";
|
||||
import { click, fillIn, findAll, visit, waitUntil } from "@ember/test-helpers";
|
||||
import { click, fillIn, visit, waitUntil } from "@ember/test-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import {
|
||||
getCustomFields,
|
||||
|
@ -93,9 +94,9 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) {
|
|||
|
||||
test("Navigate to custom fields tab", async (assert) => {
|
||||
await visit("/admin/wizards/custom-fields");
|
||||
assert.ok(find("table"));
|
||||
assert.ok(query("table"));
|
||||
assert.ok(
|
||||
findAll("table tbody tr").length === 4,
|
||||
queryAll("table tbody tr").length === 4,
|
||||
"Display loaded custom fields"
|
||||
);
|
||||
assert.ok(
|
||||
|
@ -124,10 +125,10 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) {
|
|||
'.admin-wizard-container details:has(summary[name="Filter by: Select a class"])'
|
||||
);
|
||||
await dropdown1.expand();
|
||||
let enabledOptions1 = findAll(
|
||||
let enabledOptions1 = queryAll(
|
||||
'.admin-wizard-container details:has(summary[name="Filter by: Select a class"]) ul li:not(.disabled)'
|
||||
);
|
||||
let disabledOptions1 = findAll(
|
||||
let disabledOptions1 = queryAll(
|
||||
'.admin-wizard-container details:has(summary[name="Filter by: Select a class"]) ul li.disabled'
|
||||
);
|
||||
assert.equal(
|
||||
|
@ -144,10 +145,10 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) {
|
|||
'.admin-wizard-container details:has(summary[name="Filter by: Select a type"])'
|
||||
);
|
||||
await dropdown2.expand();
|
||||
let enabledOptions2 = findAll(
|
||||
let enabledOptions2 = queryAll(
|
||||
'.admin-wizard-container details:has(summary[name="Filter by: Select a type"]) ul li:not(.disabled)'
|
||||
);
|
||||
let disabledOptions2 = findAll(
|
||||
let disabledOptions2 = queryAll(
|
||||
'.admin-wizard-container details:has(summary[name="Filter by: Select a type"]) ul li.disabled'
|
||||
);
|
||||
assert.equal(
|
||||
|
@ -174,7 +175,7 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) {
|
|||
".admin-wizard-container details.multi-select"
|
||||
);
|
||||
await serializerDropdown.expand();
|
||||
let enabledOptions1 = findAll(
|
||||
let enabledOptions1 = queryAll(
|
||||
".admin-wizard-container details.multi-select ul li"
|
||||
);
|
||||
assert.equal(
|
||||
|
@ -189,7 +190,7 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) {
|
|||
await dropdown2.expand();
|
||||
await click('.select-kit-collection li[data-value="post"]');
|
||||
await serializerDropdown.expand();
|
||||
let enabledOptions2 = findAll(
|
||||
let enabledOptions2 = queryAll(
|
||||
".admin-wizard-container details.multi-select ul li"
|
||||
);
|
||||
assert.equal(
|
||||
|
@ -202,7 +203,7 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) {
|
|||
test("Create Topic and Post custom fields", async (assert) => {
|
||||
await visit("/admin/wizards/custom-fields");
|
||||
assert.ok(
|
||||
findAll("table tbody tr").length === 4,
|
||||
queryAll("table tbody tr").length === 4,
|
||||
"Display loaded custom fields"
|
||||
);
|
||||
await click(".admin-wizard-controls .btn-icon-text");
|
||||
|
@ -267,7 +268,7 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) {
|
|||
"Post custom field name is displayed"
|
||||
);
|
||||
assert.ok(
|
||||
findAll("table tbody tr").length === 6,
|
||||
queryAll("table tbody tr").length === 6,
|
||||
"Display added custom fields"
|
||||
);
|
||||
});
|
||||
|
@ -330,7 +331,7 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) {
|
|||
test("Delete Topic custom field", async (assert) => {
|
||||
await visit("/admin/wizards/custom-fields");
|
||||
assert.ok(
|
||||
findAll("table tbody tr").length === 4,
|
||||
queryAll("table tbody tr").length === 4,
|
||||
"Display loaded custom fields"
|
||||
);
|
||||
await click(".admin-wizard-controls .btn-icon-text");
|
||||
|
@ -349,13 +350,13 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) {
|
|||
await click(".actions .save");
|
||||
await waitForSaveMessage();
|
||||
assert.ok(
|
||||
findAll("table tbody tr").length === 5,
|
||||
queryAll("table tbody tr").length === 5,
|
||||
"Display added custom fields"
|
||||
);
|
||||
await click(".admin-wizard-container tbody tr:first-child button");
|
||||
await click(".actions .destroy");
|
||||
assert.ok(
|
||||
findAll("table tbody tr").length === 4,
|
||||
queryAll("table tbody tr").length === 4,
|
||||
"Display custom fields without deleted fields"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import {
|
||||
acceptance,
|
||||
query,
|
||||
queryAll,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { test } from "qunit";
|
||||
import { click, findAll, visit } from "@ember/test-helpers";
|
||||
import { click, visit } from "@ember/test-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import {
|
||||
getSuppliers,
|
||||
|
@ -55,19 +59,19 @@ acceptance("Admin | Logs", function (needs) {
|
|||
),
|
||||
"it displays logs for a selected wizard"
|
||||
);
|
||||
assert.ok(find("table"));
|
||||
assert.ok(findAll("table tbody tr").length === 2, "Displays logs list");
|
||||
assert.ok(queryAll("table"));
|
||||
assert.ok(queryAll("table tbody tr").length === 2, "Displays logs list");
|
||||
|
||||
await click(".refresh.btn");
|
||||
assert.ok(find("table"));
|
||||
assert.ok(queryAll("table"));
|
||||
assert.ok(
|
||||
findAll("table tbody tr").length === 2,
|
||||
queryAll("table tbody tr").length === 2,
|
||||
"Refresh button works correctly"
|
||||
);
|
||||
|
||||
await wizards.expand();
|
||||
await click('[data-name="Select a wizard"]');
|
||||
const wizardContainerDiv = find(".admin-wizard-container");
|
||||
const wizardContainerDiv = queryAll(".admin-wizard-container");
|
||||
assert.ok(wizardContainerDiv.children().length === 0, "the div is empty");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import {
|
||||
acceptance,
|
||||
query,
|
||||
queryAll,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { test } from "qunit";
|
||||
import { click, findAll, visit } from "@ember/test-helpers";
|
||||
import { click, visit } from "@ember/test-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import {
|
||||
getAnotherWizardSubmission,
|
||||
|
@ -61,7 +65,7 @@ acceptance("Admin | Submissions", function (needs) {
|
|||
"it displays submissions for a selected wizard"
|
||||
);
|
||||
const submissions = getWizardSubmissions.submissions; // Get submissions data from your JSON file
|
||||
const rows = findAll("table tbody tr");
|
||||
const rows = queryAll("table tbody tr");
|
||||
|
||||
for (let i = 0; i < submissions.length; i++) {
|
||||
const dateCell = rows[i].querySelector("td:nth-child(1)");
|
||||
|
@ -88,14 +92,14 @@ acceptance("Admin | Submissions", function (needs) {
|
|||
);
|
||||
}
|
||||
assert.ok(
|
||||
findAll("table tbody tr").length >= 1,
|
||||
queryAll("table tbody tr").length >= 1,
|
||||
"Displays submissions list"
|
||||
);
|
||||
|
||||
await wizards.expand();
|
||||
await click('[data-name="Select a wizard"]');
|
||||
const wizardContainerDiv = find(".admin-wizard-container");
|
||||
assert.ok(wizardContainerDiv.children().length === 0, "the div is empty");
|
||||
const wizardContainerDiv = query(".admin-wizard-container");
|
||||
assert.ok(wizardContainerDiv.children.length === 0, "the div is empty");
|
||||
});
|
||||
test("View submissions tab for another wizard with more steps", async (assert) => {
|
||||
await visit("/admin/wizards/submissions");
|
||||
|
@ -112,7 +116,7 @@ acceptance("Admin | Submissions", function (needs) {
|
|||
);
|
||||
|
||||
const submissions = getAnotherWizardSubmission.submissions; // Get submissions data from your JSON file
|
||||
const rows = findAll("table tbody tr");
|
||||
const rows = queryAll("table tbody tr");
|
||||
|
||||
for (let i = 0; i < submissions.length; i++) {
|
||||
const dateCell = rows[i].querySelector("td:nth-child(1)");
|
||||
|
@ -147,7 +151,7 @@ acceptance("Admin | Submissions", function (needs) {
|
|||
}
|
||||
|
||||
assert.ok(
|
||||
findAll("table tbody tr").length >= 1,
|
||||
queryAll("table tbody tr").length >= 1,
|
||||
"Displays submissions list for another wizard"
|
||||
);
|
||||
});
|
||||
|
@ -158,9 +162,9 @@ acceptance("Admin | Submissions", function (needs) {
|
|||
await wizards.selectRowByValue("this_is_testing_wizard");
|
||||
|
||||
await click(".open-edit-columns-btn");
|
||||
assert.dom(".modal-inner-container").exists("Modal is displayed");
|
||||
assert.dom(".d-modal__body").exists("Modal is displayed");
|
||||
|
||||
const userCheckbox = find(
|
||||
const userCheckbox = queryAll(
|
||||
".edit-directory-columns-container .edit-directory-column:nth-child(2) .left-content .column-name input"
|
||||
);
|
||||
assert.ok(userCheckbox, "User checkbox is present");
|
||||
|
@ -177,7 +181,7 @@ acceptance("Admin | Submissions", function (needs) {
|
|||
.doesNotIncludeText("User", "User column is not displayed");
|
||||
|
||||
await click(".open-edit-columns-btn");
|
||||
const submittedAtCheckbox = find(
|
||||
const submittedAtCheckbox = queryAll(
|
||||
".edit-directory-columns-container .edit-directory-column:nth-child(1) .left-content .column-name input"
|
||||
);
|
||||
assert.ok(submittedAtCheckbox, "Submitted At checkbox is present");
|
||||
|
@ -215,7 +219,7 @@ acceptance("Admin | Submissions", function (needs) {
|
|||
await wizards.expand();
|
||||
await wizards.selectRowByValue("this_is_testing_wizard");
|
||||
|
||||
const downloadLinks = findAll(".download-link");
|
||||
const downloadLinks = queryAll(".download-link");
|
||||
assert.ok(downloadLinks.length > 1, "Download links are present");
|
||||
|
||||
const downloadLink = downloadLinks[1];
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import {
|
||||
acceptance,
|
||||
query,
|
||||
queryAll,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { test } from "qunit";
|
||||
import { click, currentURL, fillIn, visit } from "@ember/test-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
|
@ -53,7 +57,7 @@ acceptance("Admin | API tab", function (needs) {
|
|||
|
||||
test("Visit API tab and fill data", async function (assert) {
|
||||
await visit("/admin/wizards/api");
|
||||
const list = find(".admin-controls li");
|
||||
const list = queryAll(".admin-controls li");
|
||||
const count = list.length;
|
||||
assert.equal(count, 6, "There should be 6 admin tabs");
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ import {
|
|||
acceptance,
|
||||
exists,
|
||||
query,
|
||||
queryAll,
|
||||
visible,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { test } from "qunit";
|
||||
|
@ -58,7 +59,7 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
|
|||
|
||||
test("Displaying all tabs including API", async (assert) => {
|
||||
await visit("/admin/wizards");
|
||||
const list = find(".admin-controls li");
|
||||
const list = queryAll(".admin-controls li");
|
||||
const count = list.length;
|
||||
assert.equal(count, 6, "There should be 6 admin tabs");
|
||||
});
|
||||
|
@ -92,10 +93,11 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
|
|||
wizardTitle,
|
||||
"The title input is inserted"
|
||||
);
|
||||
const wizardLink = find("div.wizard-url a");
|
||||
const wizardLink = queryAll("div.wizard-url a");
|
||||
assert.equal(wizardLink.length, 1, "Wizard link was created");
|
||||
assert.equal(
|
||||
find(".wizard-subscription-container a:contains('Subscribed')").length,
|
||||
queryAll(".wizard-subscription-container a:contains('Subscribed')")
|
||||
.length,
|
||||
1,
|
||||
"Wizard subscription features are accesible"
|
||||
);
|
||||
|
@ -103,7 +105,7 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
|
|||
'.wizard-subscription-container .subscription-settings .setting-value input[type="checkbox"]'
|
||||
);
|
||||
assert.ok(
|
||||
find(
|
||||
queryAll(
|
||||
'.wizard-subscription-container .subscription-settings .setting-value input[type="checkbox"]'
|
||||
).is(":checked"),
|
||||
"subscription feature available"
|
||||
|
@ -112,7 +114,7 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
|
|||
// Step 2: Creating a step section
|
||||
await click(".step .link-list button");
|
||||
const stepOneText = "step_1 (step_1)";
|
||||
const stepOneBtn = find(`.step button:contains(${stepOneText})`);
|
||||
const stepOneBtn = queryAll(`.step button:contains(${stepOneText})`);
|
||||
assert.equal(stepOneBtn.length, 1, "Creating a step");
|
||||
const stepTitle = "step title";
|
||||
await fillIn(".wizard-custom-step input[name='title']", stepTitle);
|
||||
|
@ -124,7 +126,8 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
|
|||
"The step button changes according to title"
|
||||
);
|
||||
assert.equal(
|
||||
find(".wizard-subscription-container a:contains('Subscribed')").length,
|
||||
queryAll(".wizard-subscription-container a:contains('Subscribed')")
|
||||
.length,
|
||||
2,
|
||||
"Steps subscription features are accesible"
|
||||
);
|
||||
|
@ -136,7 +139,7 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
|
|||
"clear button is not rendered"
|
||||
);
|
||||
const fieldOneText = "step_1_field_1 (step_1_field_1)";
|
||||
const fieldOneBtn = find(`.field button:contains(${fieldOneText})`);
|
||||
const fieldOneBtn = queryAll(`.field button:contains(${fieldOneText})`);
|
||||
assert.equal(fieldOneBtn.length, 1, "Creating a field");
|
||||
const fieldTitle = "field title";
|
||||
await fillIn(".wizard-custom-field input[name='label']", fieldTitle);
|
||||
|
@ -171,7 +174,8 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
|
|||
"Text tipe for field correctly selected"
|
||||
);
|
||||
assert.equal(
|
||||
find(".wizard-subscription-container a:contains('Subscribed')").length,
|
||||
queryAll(".wizard-subscription-container a:contains('Subscribed')")
|
||||
.length,
|
||||
3,
|
||||
"Field subscription features are accesible"
|
||||
);
|
||||
|
@ -180,7 +184,7 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
|
|||
await click(".action .link-list button");
|
||||
|
||||
const actionOneText = "action_1 (action_1)";
|
||||
const actionOneBtn = find(`.action button:contains(${actionOneText})`);
|
||||
const actionOneBtn = queryAll(`.action button:contains(${actionOneText})`);
|
||||
assert.equal(actionOneBtn.length, 1, "Creating an action");
|
||||
assert.ok(
|
||||
query(
|
||||
|
|
|
@ -2,10 +2,11 @@ import {
|
|||
acceptance,
|
||||
exists,
|
||||
query,
|
||||
queryAll,
|
||||
visible,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { test } from "qunit";
|
||||
import { click, currentURL, fillIn, findAll, visit } from "@ember/test-helpers";
|
||||
import { click, currentURL, fillIn, visit } from "@ember/test-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import {
|
||||
getAdminTestingWizard,
|
||||
|
@ -58,7 +59,7 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
|||
|
||||
test("Displaying all tabs except API", async (assert) => {
|
||||
await visit("/admin/wizards");
|
||||
const list = find(".admin-controls li");
|
||||
const list = queryAll(".admin-controls li");
|
||||
const count = list.length;
|
||||
assert.equal(count, 5, "There should be 5 admin tabs");
|
||||
});
|
||||
|
@ -92,14 +93,15 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
|||
wizardTitle,
|
||||
"The title input is inserted"
|
||||
);
|
||||
const wizardLink = find("div.wizard-url a");
|
||||
const wizardLink = queryAll("div.wizard-url a");
|
||||
assert.equal(wizardLink.length, 1, "Wizard link was created");
|
||||
assert.equal(
|
||||
find(".wizard-subscription-container a:contains('Subscribed')").length,
|
||||
queryAll(".wizard-subscription-container a:contains('Subscribed')")
|
||||
.length,
|
||||
1,
|
||||
"Wizard subscription features are accesible"
|
||||
);
|
||||
const subsFeature = find(
|
||||
const subsFeature = queryAll(
|
||||
".wizard-subscription-container .subscription-settings .setting-value input"
|
||||
);
|
||||
await click(
|
||||
|
@ -109,7 +111,7 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
|||
// ("Step 2: Creating a step section")
|
||||
await click(".step .link-list button");
|
||||
const stepOneText = "step_1 (step_1)";
|
||||
const stepOneBtn = find(`.step button:contains(${stepOneText})`);
|
||||
const stepOneBtn = queryAll(`.step button:contains(${stepOneText})`);
|
||||
assert.equal(stepOneBtn.length, 1, "Creating a step");
|
||||
const stepTitle = "step title";
|
||||
await fillIn(".wizard-custom-step input[name='title']", stepTitle);
|
||||
|
@ -121,7 +123,8 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
|||
"The step button changes according to title"
|
||||
);
|
||||
assert.equal(
|
||||
find(".wizard-subscription-container a:contains('Subscribed')").length,
|
||||
queryAll(".wizard-subscription-container a:contains('Subscribed')")
|
||||
.length,
|
||||
2,
|
||||
"Steps subscription features are accesible"
|
||||
);
|
||||
|
@ -132,7 +135,7 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
|||
"clear button is not rendered"
|
||||
);
|
||||
const fieldOneText = "step_1_field_1 (step_1_field_1)";
|
||||
const fieldOneBtn = find(`.field button:contains(${fieldOneText})`);
|
||||
const fieldOneBtn = queryAll(`.field button:contains(${fieldOneText})`);
|
||||
assert.equal(fieldOneBtn.length, 1, "Creating a field");
|
||||
const fieldTitle = "field title";
|
||||
await fillIn(".wizard-custom-field input[name='label']", fieldTitle);
|
||||
|
@ -167,14 +170,15 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
|||
"Text tipe for field correctly selected"
|
||||
);
|
||||
assert.equal(
|
||||
find(".wizard-subscription-container a:contains('Subscribed')").length,
|
||||
queryAll(".wizard-subscription-container a:contains('Subscribed')")
|
||||
.length,
|
||||
3,
|
||||
"Field subscription features are accesible"
|
||||
);
|
||||
// ("Step 4: Creating a action section")
|
||||
await click(".action .link-list button");
|
||||
const actionOneText = "action_1 (action_1)";
|
||||
const actionOneBtn = find(`.action button:contains(${actionOneText})`);
|
||||
const actionOneBtn = queryAll(`.action button:contains(${actionOneText})`);
|
||||
assert.equal(actionOneBtn.length, 1, "Creating an action");
|
||||
assert.ok(
|
||||
query(
|
||||
|
@ -186,10 +190,10 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
|||
".wizard-custom-action .setting-value .select-kit"
|
||||
);
|
||||
await actionTypeDropdown.expand();
|
||||
const listEnabled = findAll(
|
||||
const listEnabled = queryAll(
|
||||
".wizard-custom-action .setting .setting-value ul li:not(.disabled)"
|
||||
);
|
||||
const listDisabled = findAll(
|
||||
const listDisabled = queryAll(
|
||||
".wizard-custom-action .setting .setting-value ul li.disabled"
|
||||
);
|
||||
assert.ok(
|
||||
|
@ -207,7 +211,7 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
|||
),
|
||||
"Create type action correctly selected"
|
||||
);
|
||||
let listTopicSettings = findAll(
|
||||
let listTopicSettings = queryAll(
|
||||
".admin-wizard-container .wizard-custom-action .setting"
|
||||
);
|
||||
assert.ok(
|
||||
|
@ -216,7 +220,7 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
|||
);
|
||||
await actionTypeDropdown.expand();
|
||||
await actionTypeDropdown.selectRowByValue("send_message");
|
||||
listTopicSettings = findAll(
|
||||
listTopicSettings = queryAll(
|
||||
".admin-wizard-container .wizard-custom-action .setting"
|
||||
);
|
||||
assert.ok(
|
||||
|
@ -225,7 +229,7 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
|||
);
|
||||
await actionTypeDropdown.expand();
|
||||
await actionTypeDropdown.selectRowByValue("watch_categories");
|
||||
listTopicSettings = findAll(
|
||||
listTopicSettings = queryAll(
|
||||
".admin-wizard-container .wizard-custom-action .setting"
|
||||
);
|
||||
assert.ok(
|
||||
|
@ -234,7 +238,7 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
|||
);
|
||||
await actionTypeDropdown.expand();
|
||||
await actionTypeDropdown.selectRowByValue("add_to_group");
|
||||
listTopicSettings = findAll(
|
||||
listTopicSettings = queryAll(
|
||||
".admin-wizard-container .wizard-custom-action .setting"
|
||||
);
|
||||
assert.ok(
|
||||
|
|
|
@ -2,10 +2,11 @@ import {
|
|||
acceptance,
|
||||
exists,
|
||||
query,
|
||||
queryAll,
|
||||
visible,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { test } from "qunit";
|
||||
import { click, currentURL, fillIn, findAll, visit } from "@ember/test-helpers";
|
||||
import { click, currentURL, fillIn, visit } from "@ember/test-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import {
|
||||
getAdminTestingWizard,
|
||||
|
@ -71,7 +72,7 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
|||
|
||||
test("Displaying all tabs except API", async (assert) => {
|
||||
await visit("/admin/wizards");
|
||||
const list = find(".admin-controls li");
|
||||
const list = queryAll(".admin-controls li");
|
||||
const count = list.length;
|
||||
assert.equal(count, 5, "There should be 5 admin tabs");
|
||||
});
|
||||
|
@ -104,7 +105,7 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
|||
wizardTitle,
|
||||
"The title input is inserted"
|
||||
);
|
||||
const wizardLink = find("div.wizard-url a");
|
||||
const wizardLink = queryAll("div.wizard-url a");
|
||||
assert.equal(wizardLink.length, 1, "Wizard link was created");
|
||||
await click(".btn-after-time");
|
||||
assert.ok(
|
||||
|
@ -122,13 +123,13 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
|||
"Show messsage and link of user not subscribed"
|
||||
);
|
||||
assert.equal(
|
||||
find(".wizard-subscription-container").length,
|
||||
queryAll(".wizard-subscription-container").length,
|
||||
1,
|
||||
"Wizard subscription features are not accesible"
|
||||
);
|
||||
await click(".step .link-list button");
|
||||
const stepOneText = "step_1 (step_1)";
|
||||
const stepOneBtn = find(`.step button:contains(${stepOneText})`);
|
||||
const stepOneBtn = queryAll(`.step button:contains(${stepOneText})`);
|
||||
assert.equal(stepOneBtn.length, 1, "Creating a step");
|
||||
const stepTitle = "step title";
|
||||
await fillIn(".wizard-custom-step input[name='title']", stepTitle);
|
||||
|
@ -140,7 +141,7 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
|||
"The step button changes according to title"
|
||||
);
|
||||
assert.equal(
|
||||
find(".wizard-subscription-container").length,
|
||||
queryAll(".wizard-subscription-container").length,
|
||||
2,
|
||||
"Steps subscription features are not accesible"
|
||||
);
|
||||
|
@ -209,7 +210,7 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
|||
".wizard-custom-step .wizard-text-editor textarea",
|
||||
`\n\n* List item\n* List item`
|
||||
);
|
||||
let listItems = findAll(
|
||||
let listItems = queryAll(
|
||||
".wizard-custom-step .wizard-text-editor .d-editor-preview-wrapper ul li"
|
||||
);
|
||||
assert.strictEqual(
|
||||
|
@ -231,7 +232,7 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
|||
".wizard-custom-step .wizard-text-editor textarea",
|
||||
`\n\n1. List item\n1. List item`
|
||||
);
|
||||
let orderedListItems = findAll(
|
||||
let orderedListItems = queryAll(
|
||||
".wizard-custom-step .wizard-text-editor .d-editor-preview-wrapper ol li"
|
||||
);
|
||||
assert.strictEqual(
|
||||
|
@ -308,7 +309,7 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
|||
"clear button is not rendered"
|
||||
);
|
||||
const fieldOneText = "step_1_field_1 (step_1_field_1)";
|
||||
const fieldOneBtn = find(`.field button:contains(${fieldOneText})`);
|
||||
const fieldOneBtn = queryAll(`.field button:contains(${fieldOneText})`);
|
||||
assert.equal(fieldOneBtn.length, 1, "Creating a field");
|
||||
const fieldTitle = "field title";
|
||||
await fillIn(".wizard-custom-field input[name='label']", fieldTitle);
|
||||
|
@ -352,13 +353,13 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
|||
"Text tipe for field correctly selected"
|
||||
);
|
||||
assert.equal(
|
||||
find(".wizard-subscription-container").length,
|
||||
queryAll(".wizard-subscription-container").length,
|
||||
3,
|
||||
"Field subscription features are not accesible"
|
||||
);
|
||||
await click(".action .link-list button");
|
||||
const actionOneText = "action_1 (action_1)";
|
||||
const actionOneBtn = find(`.action button:contains(${actionOneText})`);
|
||||
const actionOneBtn = queryAll(`.action button:contains(${actionOneText})`);
|
||||
assert.equal(actionOneBtn.length, 1, "Creating an action");
|
||||
assert.ok(
|
||||
query(
|
||||
|
@ -370,10 +371,10 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
|||
".wizard-custom-action .setting-value .select-kit"
|
||||
);
|
||||
await actionTypeDropdown.expand();
|
||||
const listEnabled = findAll(
|
||||
const listEnabled = queryAll(
|
||||
".wizard-custom-action .setting .setting-value ul li:not(.disabled)"
|
||||
);
|
||||
const listDisabled = findAll(
|
||||
const listDisabled = queryAll(
|
||||
".wizard-custom-action .setting .setting-value ul li.disabled"
|
||||
);
|
||||
assert.ok(
|
||||
|
@ -391,7 +392,7 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
|||
),
|
||||
"Create type action correctly selected"
|
||||
);
|
||||
let listTopicSettings = findAll(
|
||||
let listTopicSettings = queryAll(
|
||||
".admin-wizard-container .wizard-custom-action .setting"
|
||||
);
|
||||
assert.ok(
|
||||
|
@ -400,7 +401,7 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
|||
);
|
||||
await actionTypeDropdown.expand();
|
||||
await actionTypeDropdown.selectRowByValue("open_composer");
|
||||
listTopicSettings = findAll(
|
||||
listTopicSettings = queryAll(
|
||||
".admin-wizard-container .wizard-custom-action .setting"
|
||||
);
|
||||
assert.ok(
|
||||
|
@ -409,7 +410,7 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
|||
);
|
||||
await actionTypeDropdown.expand();
|
||||
await actionTypeDropdown.selectRowByValue("update_profile");
|
||||
listTopicSettings = findAll(
|
||||
listTopicSettings = queryAll(
|
||||
".admin-wizard-container .wizard-custom-action .setting"
|
||||
);
|
||||
assert.ok(
|
||||
|
@ -418,7 +419,7 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
|||
);
|
||||
await actionTypeDropdown.expand();
|
||||
await actionTypeDropdown.selectRowByValue("route_to");
|
||||
listTopicSettings = findAll(
|
||||
listTopicSettings = queryAll(
|
||||
".admin-wizard-container .wizard-custom-action .setting"
|
||||
);
|
||||
assert.ok(
|
||||
|
@ -427,7 +428,7 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
|||
);
|
||||
await actionTypeDropdown.expand();
|
||||
await click('[data-name="Select a type"]');
|
||||
listTopicSettings = findAll(
|
||||
listTopicSettings = queryAll(
|
||||
".admin-wizard-container .wizard-custom-action .setting"
|
||||
);
|
||||
assert.ok(
|
||||
|
|
|
@ -207,7 +207,11 @@ acceptance("Field | Fields", function (needs) {
|
|||
await visit("/w/wizard");
|
||||
assert.ok(visible(".wizard-field.category-field .multi-select-header"));
|
||||
await click(".wizard-field.category-field .select-kit-header");
|
||||
assert.ok(exists(".wizard-field.category-field .select-kit-collection li"));
|
||||
assert.ok(
|
||||
exists(
|
||||
".wizard-field.category-field .select-kit-collection .select-kit-row"
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
test("Group", async function (assert) {
|
||||
|
|
Laden …
In neuem Issue referenzieren