0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-24 18:30:27 +01:00

Fix deprecations and broken tests

Dieser Commit ist enthalten in:
Angus McLeod 2024-01-26 16:18:11 +01:00
Ursprung 41e240df09
Commit 389d02068c
13 geänderte Dateien mit 121 neuen und 84 gelöschten Zeilen

Datei anzeigen

@ -66,9 +66,9 @@
{{#each wizards as |wizard|}} {{#each wizards as |wizard|}}
<tr data-wizard-id={{dasherize wizard.id}}> <tr data-wizard-id={{dasherize wizard.id}}>
<td> <td>
{{#link-to "adminWizardsWizardShow" (dasherize wizard.id)}} <LinkTo @route="adminWizardsWizardShow" @model={{dasherize wizard.id}}>
{{wizard.name}} {{wizard.name}}
{{/link-to}} </LinkTo>
</td> </td>
<td class="control-column"> <td class="control-column">
<Input <Input

Datei anzeigen

@ -144,9 +144,9 @@
{{/if}} {{/if}}
{{#if isUser}} {{#if isUser}}
{{#link-to "user" value.username}} <LinkTo @route="user" @model={{value.username}}>
{{avatar value imageSize="tiny"}} {{avatar value imageSize="tiny"}}
{{/link-to}} </LinkTo>
{{/if}} {{/if}}
{{#if showUsername}} {{#if showUsername}}

Datei anzeigen

@ -3,6 +3,16 @@ body.custom-wizard {
color: var(--primary); color: var(--primary);
font-size: 1.1em; 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 { .wizard-column {
position: relative; position: relative;
z-index: 11; z-index: 11;

Datei anzeigen

@ -158,7 +158,7 @@ describe CustomWizard::Action do
action.perform action.perform
expect(action.result.success?).to eq(true) 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
end end

Datei anzeigen

@ -9,6 +9,7 @@ describe CustomWizard::AdminApiController do
end end
it "does not save if user does not have relevant subscription" do 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 put "/admin/wizards/api/:name.json", params: api_json.to_h
expect(response.status).to eq(400) expect(response.status).to eq(400)
end end

Datei anzeigen

@ -1,10 +1,11 @@
import { import {
acceptance, acceptance,
query, query,
queryAll,
visible, visible,
} from "discourse/tests/helpers/qunit-helpers"; } from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit"; 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 selectKit from "discourse/tests/helpers/select-kit-helper";
import { import {
getCustomFields, getCustomFields,
@ -93,9 +94,9 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) {
test("Navigate to custom fields tab", async (assert) => { test("Navigate to custom fields tab", async (assert) => {
await visit("/admin/wizards/custom-fields"); await visit("/admin/wizards/custom-fields");
assert.ok(find("table")); assert.ok(query("table"));
assert.ok( assert.ok(
findAll("table tbody tr").length === 4, queryAll("table tbody tr").length === 4,
"Display loaded custom fields" "Display loaded custom fields"
); );
assert.ok( 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"])' '.admin-wizard-container details:has(summary[name="Filter by: Select a class"])'
); );
await dropdown1.expand(); 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)' '.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' '.admin-wizard-container details:has(summary[name="Filter by: Select a class"]) ul li.disabled'
); );
assert.equal( 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"])' '.admin-wizard-container details:has(summary[name="Filter by: Select a type"])'
); );
await dropdown2.expand(); 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)' '.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' '.admin-wizard-container details:has(summary[name="Filter by: Select a type"]) ul li.disabled'
); );
assert.equal( assert.equal(
@ -174,7 +175,7 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) {
".admin-wizard-container details.multi-select" ".admin-wizard-container details.multi-select"
); );
await serializerDropdown.expand(); await serializerDropdown.expand();
let enabledOptions1 = findAll( let enabledOptions1 = queryAll(
".admin-wizard-container details.multi-select ul li" ".admin-wizard-container details.multi-select ul li"
); );
assert.equal( assert.equal(
@ -189,7 +190,7 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) {
await dropdown2.expand(); await dropdown2.expand();
await click('.select-kit-collection li[data-value="post"]'); await click('.select-kit-collection li[data-value="post"]');
await serializerDropdown.expand(); await serializerDropdown.expand();
let enabledOptions2 = findAll( let enabledOptions2 = queryAll(
".admin-wizard-container details.multi-select ul li" ".admin-wizard-container details.multi-select ul li"
); );
assert.equal( assert.equal(
@ -202,7 +203,7 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) {
test("Create Topic and Post custom fields", async (assert) => { test("Create Topic and Post custom fields", async (assert) => {
await visit("/admin/wizards/custom-fields"); await visit("/admin/wizards/custom-fields");
assert.ok( assert.ok(
findAll("table tbody tr").length === 4, queryAll("table tbody tr").length === 4,
"Display loaded custom fields" "Display loaded custom fields"
); );
await click(".admin-wizard-controls .btn-icon-text"); 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" "Post custom field name is displayed"
); );
assert.ok( assert.ok(
findAll("table tbody tr").length === 6, queryAll("table tbody tr").length === 6,
"Display added custom fields" "Display added custom fields"
); );
}); });
@ -330,7 +331,7 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) {
test("Delete Topic custom field", async (assert) => { test("Delete Topic custom field", async (assert) => {
await visit("/admin/wizards/custom-fields"); await visit("/admin/wizards/custom-fields");
assert.ok( assert.ok(
findAll("table tbody tr").length === 4, queryAll("table tbody tr").length === 4,
"Display loaded custom fields" "Display loaded custom fields"
); );
await click(".admin-wizard-controls .btn-icon-text"); await click(".admin-wizard-controls .btn-icon-text");
@ -349,13 +350,13 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) {
await click(".actions .save"); await click(".actions .save");
await waitForSaveMessage(); await waitForSaveMessage();
assert.ok( assert.ok(
findAll("table tbody tr").length === 5, queryAll("table tbody tr").length === 5,
"Display added custom fields" "Display added custom fields"
); );
await click(".admin-wizard-container tbody tr:first-child button"); await click(".admin-wizard-container tbody tr:first-child button");
await click(".actions .destroy"); await click(".actions .destroy");
assert.ok( assert.ok(
findAll("table tbody tr").length === 4, queryAll("table tbody tr").length === 4,
"Display custom fields without deleted fields" "Display custom fields without deleted fields"
); );
}); });

Datei anzeigen

@ -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 { 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 selectKit from "discourse/tests/helpers/select-kit-helper";
import { import {
getSuppliers, getSuppliers,
@ -55,19 +59,19 @@ acceptance("Admin | Logs", function (needs) {
), ),
"it displays logs for a selected wizard" "it displays logs for a selected wizard"
); );
assert.ok(find("table")); assert.ok(queryAll("table"));
assert.ok(findAll("table tbody tr").length === 2, "Displays logs list"); assert.ok(queryAll("table tbody tr").length === 2, "Displays logs list");
await click(".refresh.btn"); await click(".refresh.btn");
assert.ok(find("table")); assert.ok(queryAll("table"));
assert.ok( assert.ok(
findAll("table tbody tr").length === 2, queryAll("table tbody tr").length === 2,
"Refresh button works correctly" "Refresh button works correctly"
); );
await wizards.expand(); await wizards.expand();
await click('[data-name="Select a wizard"]'); 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"); assert.ok(wizardContainerDiv.children().length === 0, "the div is empty");
}); });
}); });

Datei anzeigen

@ -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 { 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 selectKit from "discourse/tests/helpers/select-kit-helper";
import { import {
getAnotherWizardSubmission, getAnotherWizardSubmission,
@ -61,7 +65,7 @@ acceptance("Admin | Submissions", function (needs) {
"it displays submissions for a selected wizard" "it displays submissions for a selected wizard"
); );
const submissions = getWizardSubmissions.submissions; // Get submissions data from your JSON file 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++) { for (let i = 0; i < submissions.length; i++) {
const dateCell = rows[i].querySelector("td:nth-child(1)"); const dateCell = rows[i].querySelector("td:nth-child(1)");
@ -88,14 +92,14 @@ acceptance("Admin | Submissions", function (needs) {
); );
} }
assert.ok( assert.ok(
findAll("table tbody tr").length >= 1, queryAll("table tbody tr").length >= 1,
"Displays submissions list" "Displays submissions list"
); );
await wizards.expand(); await wizards.expand();
await click('[data-name="Select a wizard"]'); await click('[data-name="Select a wizard"]');
const wizardContainerDiv = find(".admin-wizard-container"); const wizardContainerDiv = query(".admin-wizard-container");
assert.ok(wizardContainerDiv.children().length === 0, "the div is empty"); assert.ok(wizardContainerDiv.children.length === 0, "the div is empty");
}); });
test("View submissions tab for another wizard with more steps", async (assert) => { test("View submissions tab for another wizard with more steps", async (assert) => {
await visit("/admin/wizards/submissions"); 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 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++) { for (let i = 0; i < submissions.length; i++) {
const dateCell = rows[i].querySelector("td:nth-child(1)"); const dateCell = rows[i].querySelector("td:nth-child(1)");
@ -147,7 +151,7 @@ acceptance("Admin | Submissions", function (needs) {
} }
assert.ok( assert.ok(
findAll("table tbody tr").length >= 1, queryAll("table tbody tr").length >= 1,
"Displays submissions list for another wizard" "Displays submissions list for another wizard"
); );
}); });
@ -158,9 +162,9 @@ acceptance("Admin | Submissions", function (needs) {
await wizards.selectRowByValue("this_is_testing_wizard"); await wizards.selectRowByValue("this_is_testing_wizard");
await click(".open-edit-columns-btn"); 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" ".edit-directory-columns-container .edit-directory-column:nth-child(2) .left-content .column-name input"
); );
assert.ok(userCheckbox, "User checkbox is present"); assert.ok(userCheckbox, "User checkbox is present");
@ -177,7 +181,7 @@ acceptance("Admin | Submissions", function (needs) {
.doesNotIncludeText("User", "User column is not displayed"); .doesNotIncludeText("User", "User column is not displayed");
await click(".open-edit-columns-btn"); 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" ".edit-directory-columns-container .edit-directory-column:nth-child(1) .left-content .column-name input"
); );
assert.ok(submittedAtCheckbox, "Submitted At checkbox is present"); assert.ok(submittedAtCheckbox, "Submitted At checkbox is present");
@ -215,7 +219,7 @@ acceptance("Admin | Submissions", function (needs) {
await wizards.expand(); await wizards.expand();
await wizards.selectRowByValue("this_is_testing_wizard"); 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"); assert.ok(downloadLinks.length > 1, "Download links are present");
const downloadLink = downloadLinks[1]; const downloadLink = downloadLinks[1];

Datei anzeigen

@ -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 { test } from "qunit";
import { click, currentURL, fillIn, visit } from "@ember/test-helpers"; import { click, currentURL, fillIn, visit } from "@ember/test-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper"; 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) { test("Visit API tab and fill data", async function (assert) {
await visit("/admin/wizards/api"); await visit("/admin/wizards/api");
const list = find(".admin-controls li"); const list = queryAll(".admin-controls li");
const count = list.length; const count = list.length;
assert.equal(count, 6, "There should be 6 admin tabs"); assert.equal(count, 6, "There should be 6 admin tabs");

Datei anzeigen

@ -2,6 +2,7 @@ import {
acceptance, acceptance,
exists, exists,
query, query,
queryAll,
visible, visible,
} from "discourse/tests/helpers/qunit-helpers"; } from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit"; import { test } from "qunit";
@ -58,7 +59,7 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
test("Displaying all tabs including API", async (assert) => { test("Displaying all tabs including API", async (assert) => {
await visit("/admin/wizards"); await visit("/admin/wizards");
const list = find(".admin-controls li"); const list = queryAll(".admin-controls li");
const count = list.length; const count = list.length;
assert.equal(count, 6, "There should be 6 admin tabs"); assert.equal(count, 6, "There should be 6 admin tabs");
}); });
@ -92,10 +93,11 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
wizardTitle, wizardTitle,
"The title input is inserted" "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(wizardLink.length, 1, "Wizard link was created");
assert.equal( assert.equal(
find(".wizard-subscription-container a:contains('Subscribed')").length, queryAll(".wizard-subscription-container a:contains('Subscribed')")
.length,
1, 1,
"Wizard subscription features are accesible" "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"]' '.wizard-subscription-container .subscription-settings .setting-value input[type="checkbox"]'
); );
assert.ok( assert.ok(
find( queryAll(
'.wizard-subscription-container .subscription-settings .setting-value input[type="checkbox"]' '.wizard-subscription-container .subscription-settings .setting-value input[type="checkbox"]'
).is(":checked"), ).is(":checked"),
"subscription feature available" "subscription feature available"
@ -112,7 +114,7 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
// Step 2: Creating a step section // Step 2: Creating a step section
await click(".step .link-list button"); await click(".step .link-list button");
const stepOneText = "step_1 (step_1)"; 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"); assert.equal(stepOneBtn.length, 1, "Creating a step");
const stepTitle = "step title"; const stepTitle = "step title";
await fillIn(".wizard-custom-step input[name='title']", stepTitle); 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" "The step button changes according to title"
); );
assert.equal( assert.equal(
find(".wizard-subscription-container a:contains('Subscribed')").length, queryAll(".wizard-subscription-container a:contains('Subscribed')")
.length,
2, 2,
"Steps subscription features are accesible" "Steps subscription features are accesible"
); );
@ -136,7 +139,7 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
"clear button is not rendered" "clear button is not rendered"
); );
const fieldOneText = "step_1_field_1 (step_1_field_1)"; 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"); assert.equal(fieldOneBtn.length, 1, "Creating a field");
const fieldTitle = "field title"; const fieldTitle = "field title";
await fillIn(".wizard-custom-field input[name='label']", fieldTitle); 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" "Text tipe for field correctly selected"
); );
assert.equal( assert.equal(
find(".wizard-subscription-container a:contains('Subscribed')").length, queryAll(".wizard-subscription-container a:contains('Subscribed')")
.length,
3, 3,
"Field subscription features are accesible" "Field subscription features are accesible"
); );
@ -180,7 +184,7 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
await click(".action .link-list button"); await click(".action .link-list button");
const actionOneText = "action_1 (action_1)"; 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.equal(actionOneBtn.length, 1, "Creating an action");
assert.ok( assert.ok(
query( query(

Datei anzeigen

@ -2,10 +2,11 @@ import {
acceptance, acceptance,
exists, exists,
query, query,
queryAll,
visible, visible,
} from "discourse/tests/helpers/qunit-helpers"; } from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit"; 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 selectKit from "discourse/tests/helpers/select-kit-helper";
import { import {
getAdminTestingWizard, getAdminTestingWizard,
@ -58,7 +59,7 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
test("Displaying all tabs except API", async (assert) => { test("Displaying all tabs except API", async (assert) => {
await visit("/admin/wizards"); await visit("/admin/wizards");
const list = find(".admin-controls li"); const list = queryAll(".admin-controls li");
const count = list.length; const count = list.length;
assert.equal(count, 5, "There should be 5 admin tabs"); assert.equal(count, 5, "There should be 5 admin tabs");
}); });
@ -92,14 +93,15 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
wizardTitle, wizardTitle,
"The title input is inserted" "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(wizardLink.length, 1, "Wizard link was created");
assert.equal( assert.equal(
find(".wizard-subscription-container a:contains('Subscribed')").length, queryAll(".wizard-subscription-container a:contains('Subscribed')")
.length,
1, 1,
"Wizard subscription features are accesible" "Wizard subscription features are accesible"
); );
const subsFeature = find( const subsFeature = queryAll(
".wizard-subscription-container .subscription-settings .setting-value input" ".wizard-subscription-container .subscription-settings .setting-value input"
); );
await click( await click(
@ -109,7 +111,7 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
// ("Step 2: Creating a step section") // ("Step 2: Creating a step section")
await click(".step .link-list button"); await click(".step .link-list button");
const stepOneText = "step_1 (step_1)"; 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"); assert.equal(stepOneBtn.length, 1, "Creating a step");
const stepTitle = "step title"; const stepTitle = "step title";
await fillIn(".wizard-custom-step input[name='title']", stepTitle); 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" "The step button changes according to title"
); );
assert.equal( assert.equal(
find(".wizard-subscription-container a:contains('Subscribed')").length, queryAll(".wizard-subscription-container a:contains('Subscribed')")
.length,
2, 2,
"Steps subscription features are accesible" "Steps subscription features are accesible"
); );
@ -132,7 +135,7 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
"clear button is not rendered" "clear button is not rendered"
); );
const fieldOneText = "step_1_field_1 (step_1_field_1)"; 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"); assert.equal(fieldOneBtn.length, 1, "Creating a field");
const fieldTitle = "field title"; const fieldTitle = "field title";
await fillIn(".wizard-custom-field input[name='label']", fieldTitle); 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" "Text tipe for field correctly selected"
); );
assert.equal( assert.equal(
find(".wizard-subscription-container a:contains('Subscribed')").length, queryAll(".wizard-subscription-container a:contains('Subscribed')")
.length,
3, 3,
"Field subscription features are accesible" "Field subscription features are accesible"
); );
// ("Step 4: Creating a action section") // ("Step 4: Creating a action section")
await click(".action .link-list button"); await click(".action .link-list button");
const actionOneText = "action_1 (action_1)"; 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.equal(actionOneBtn.length, 1, "Creating an action");
assert.ok( assert.ok(
query( query(
@ -186,10 +190,10 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
".wizard-custom-action .setting-value .select-kit" ".wizard-custom-action .setting-value .select-kit"
); );
await actionTypeDropdown.expand(); await actionTypeDropdown.expand();
const listEnabled = findAll( const listEnabled = queryAll(
".wizard-custom-action .setting .setting-value ul li:not(.disabled)" ".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" ".wizard-custom-action .setting .setting-value ul li.disabled"
); );
assert.ok( assert.ok(
@ -207,7 +211,7 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
), ),
"Create type action correctly selected" "Create type action correctly selected"
); );
let listTopicSettings = findAll( let listTopicSettings = queryAll(
".admin-wizard-container .wizard-custom-action .setting" ".admin-wizard-container .wizard-custom-action .setting"
); );
assert.ok( assert.ok(
@ -216,7 +220,7 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
); );
await actionTypeDropdown.expand(); await actionTypeDropdown.expand();
await actionTypeDropdown.selectRowByValue("send_message"); await actionTypeDropdown.selectRowByValue("send_message");
listTopicSettings = findAll( listTopicSettings = queryAll(
".admin-wizard-container .wizard-custom-action .setting" ".admin-wizard-container .wizard-custom-action .setting"
); );
assert.ok( assert.ok(
@ -225,7 +229,7 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
); );
await actionTypeDropdown.expand(); await actionTypeDropdown.expand();
await actionTypeDropdown.selectRowByValue("watch_categories"); await actionTypeDropdown.selectRowByValue("watch_categories");
listTopicSettings = findAll( listTopicSettings = queryAll(
".admin-wizard-container .wizard-custom-action .setting" ".admin-wizard-container .wizard-custom-action .setting"
); );
assert.ok( assert.ok(
@ -234,7 +238,7 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
); );
await actionTypeDropdown.expand(); await actionTypeDropdown.expand();
await actionTypeDropdown.selectRowByValue("add_to_group"); await actionTypeDropdown.selectRowByValue("add_to_group");
listTopicSettings = findAll( listTopicSettings = queryAll(
".admin-wizard-container .wizard-custom-action .setting" ".admin-wizard-container .wizard-custom-action .setting"
); );
assert.ok( assert.ok(

Datei anzeigen

@ -2,10 +2,11 @@ import {
acceptance, acceptance,
exists, exists,
query, query,
queryAll,
visible, visible,
} from "discourse/tests/helpers/qunit-helpers"; } from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit"; 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 selectKit from "discourse/tests/helpers/select-kit-helper";
import { import {
getAdminTestingWizard, getAdminTestingWizard,
@ -71,7 +72,7 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
test("Displaying all tabs except API", async (assert) => { test("Displaying all tabs except API", async (assert) => {
await visit("/admin/wizards"); await visit("/admin/wizards");
const list = find(".admin-controls li"); const list = queryAll(".admin-controls li");
const count = list.length; const count = list.length;
assert.equal(count, 5, "There should be 5 admin tabs"); assert.equal(count, 5, "There should be 5 admin tabs");
}); });
@ -104,7 +105,7 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
wizardTitle, wizardTitle,
"The title input is inserted" "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(wizardLink.length, 1, "Wizard link was created");
await click(".btn-after-time"); await click(".btn-after-time");
assert.ok( assert.ok(
@ -122,13 +123,13 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
"Show messsage and link of user not subscribed" "Show messsage and link of user not subscribed"
); );
assert.equal( assert.equal(
find(".wizard-subscription-container").length, queryAll(".wizard-subscription-container").length,
1, 1,
"Wizard subscription features are not accesible" "Wizard subscription features are not accesible"
); );
await click(".step .link-list button"); await click(".step .link-list button");
const stepOneText = "step_1 (step_1)"; 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"); assert.equal(stepOneBtn.length, 1, "Creating a step");
const stepTitle = "step title"; const stepTitle = "step title";
await fillIn(".wizard-custom-step input[name='title']", stepTitle); 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" "The step button changes according to title"
); );
assert.equal( assert.equal(
find(".wizard-subscription-container").length, queryAll(".wizard-subscription-container").length,
2, 2,
"Steps subscription features are not accesible" "Steps subscription features are not accesible"
); );
@ -209,7 +210,7 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
".wizard-custom-step .wizard-text-editor textarea", ".wizard-custom-step .wizard-text-editor textarea",
`\n\n* List item\n* List item` `\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" ".wizard-custom-step .wizard-text-editor .d-editor-preview-wrapper ul li"
); );
assert.strictEqual( assert.strictEqual(
@ -231,7 +232,7 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
".wizard-custom-step .wizard-text-editor textarea", ".wizard-custom-step .wizard-text-editor textarea",
`\n\n1. List item\n1. List item` `\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" ".wizard-custom-step .wizard-text-editor .d-editor-preview-wrapper ol li"
); );
assert.strictEqual( assert.strictEqual(
@ -308,7 +309,7 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
"clear button is not rendered" "clear button is not rendered"
); );
const fieldOneText = "step_1_field_1 (step_1_field_1)"; 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"); assert.equal(fieldOneBtn.length, 1, "Creating a field");
const fieldTitle = "field title"; const fieldTitle = "field title";
await fillIn(".wizard-custom-field input[name='label']", fieldTitle); 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" "Text tipe for field correctly selected"
); );
assert.equal( assert.equal(
find(".wizard-subscription-container").length, queryAll(".wizard-subscription-container").length,
3, 3,
"Field subscription features are not accesible" "Field subscription features are not accesible"
); );
await click(".action .link-list button"); await click(".action .link-list button");
const actionOneText = "action_1 (action_1)"; 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.equal(actionOneBtn.length, 1, "Creating an action");
assert.ok( assert.ok(
query( query(
@ -370,10 +371,10 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
".wizard-custom-action .setting-value .select-kit" ".wizard-custom-action .setting-value .select-kit"
); );
await actionTypeDropdown.expand(); await actionTypeDropdown.expand();
const listEnabled = findAll( const listEnabled = queryAll(
".wizard-custom-action .setting .setting-value ul li:not(.disabled)" ".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" ".wizard-custom-action .setting .setting-value ul li.disabled"
); );
assert.ok( assert.ok(
@ -391,7 +392,7 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
), ),
"Create type action correctly selected" "Create type action correctly selected"
); );
let listTopicSettings = findAll( let listTopicSettings = queryAll(
".admin-wizard-container .wizard-custom-action .setting" ".admin-wizard-container .wizard-custom-action .setting"
); );
assert.ok( assert.ok(
@ -400,7 +401,7 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
); );
await actionTypeDropdown.expand(); await actionTypeDropdown.expand();
await actionTypeDropdown.selectRowByValue("open_composer"); await actionTypeDropdown.selectRowByValue("open_composer");
listTopicSettings = findAll( listTopicSettings = queryAll(
".admin-wizard-container .wizard-custom-action .setting" ".admin-wizard-container .wizard-custom-action .setting"
); );
assert.ok( assert.ok(
@ -409,7 +410,7 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
); );
await actionTypeDropdown.expand(); await actionTypeDropdown.expand();
await actionTypeDropdown.selectRowByValue("update_profile"); await actionTypeDropdown.selectRowByValue("update_profile");
listTopicSettings = findAll( listTopicSettings = queryAll(
".admin-wizard-container .wizard-custom-action .setting" ".admin-wizard-container .wizard-custom-action .setting"
); );
assert.ok( assert.ok(
@ -418,7 +419,7 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
); );
await actionTypeDropdown.expand(); await actionTypeDropdown.expand();
await actionTypeDropdown.selectRowByValue("route_to"); await actionTypeDropdown.selectRowByValue("route_to");
listTopicSettings = findAll( listTopicSettings = queryAll(
".admin-wizard-container .wizard-custom-action .setting" ".admin-wizard-container .wizard-custom-action .setting"
); );
assert.ok( assert.ok(
@ -427,7 +428,7 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
); );
await actionTypeDropdown.expand(); await actionTypeDropdown.expand();
await click('[data-name="Select a type"]'); await click('[data-name="Select a type"]');
listTopicSettings = findAll( listTopicSettings = queryAll(
".admin-wizard-container .wizard-custom-action .setting" ".admin-wizard-container .wizard-custom-action .setting"
); );
assert.ok( assert.ok(

Datei anzeigen

@ -207,7 +207,11 @@ acceptance("Field | Fields", function (needs) {
await visit("/w/wizard"); await visit("/w/wizard");
assert.ok(visible(".wizard-field.category-field .multi-select-header")); assert.ok(visible(".wizard-field.category-field .multi-select-header"));
await click(".wizard-field.category-field .select-kit-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) { test("Group", async function (assert) {