From 389d02068c8d491b01fa8b6dafb6421a4f2db845 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Fri, 26 Jan 2024 16:18:11 +0100 Subject: [PATCH 1/4] Fix deprecations and broken tests --- .../templates/admin-wizards-manager.hbs | 4 +- .../components/wizard-table-field.hbs | 4 +- assets/stylesheets/common/wizard/wizard.scss | 10 +++++ spec/components/custom_wizard/action_spec.rb | 2 +- .../admin/api_controller_spec.rb | 1 + .../admin-custom-fields-unsubscribed-test.js | 29 ++++++++------- .../javascripts/acceptance/admin-logs-test.js | 18 +++++---- .../acceptance/admin-submissions-test.js | 28 ++++++++------ .../acceptance/admin-wizards-api-test.js | 8 +++- ...dmin-wizards-business-subscription-test.js | 22 ++++++----- ...dmin-wizards-standard-subscription-test.js | 36 ++++++++++-------- .../admin-wizards-unsubscribed-test.js | 37 ++++++++++--------- test/javascripts/acceptance/field-test.js | 6 ++- 13 files changed, 121 insertions(+), 84 deletions(-) diff --git a/assets/javascripts/discourse/templates/admin-wizards-manager.hbs b/assets/javascripts/discourse/templates/admin-wizards-manager.hbs index f2de0783..e1844a31 100644 --- a/assets/javascripts/discourse/templates/admin-wizards-manager.hbs +++ b/assets/javascripts/discourse/templates/admin-wizards-manager.hbs @@ -66,9 +66,9 @@ {{#each wizards as |wizard|}} - {{#link-to "adminWizardsWizardShow" (dasherize wizard.id)}} + {{wizard.name}} - {{/link-to}} + {{avatar value imageSize="tiny"}} - {{/link-to}} + {{/if}} {{#if showUsername}} diff --git a/assets/stylesheets/common/wizard/wizard.scss b/assets/stylesheets/common/wizard/wizard.scss index 0155bbab..1bb0d086 100644 --- a/assets/stylesheets/common/wizard/wizard.scss +++ b/assets/stylesheets/common/wizard/wizard.scss @@ -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; diff --git a/spec/components/custom_wizard/action_spec.rb b/spec/components/custom_wizard/action_spec.rb index 3b12f365..fb34ea03 100644 --- a/spec/components/custom_wizard/action_spec.rb +++ b/spec/components/custom_wizard/action_spec.rb @@ -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 diff --git a/spec/requests/custom_wizard/admin/api_controller_spec.rb b/spec/requests/custom_wizard/admin/api_controller_spec.rb index f95681f8..42176f30 100644 --- a/spec/requests/custom_wizard/admin/api_controller_spec.rb +++ b/spec/requests/custom_wizard/admin/api_controller_spec.rb @@ -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 diff --git a/test/javascripts/acceptance/admin-custom-fields-unsubscribed-test.js b/test/javascripts/acceptance/admin-custom-fields-unsubscribed-test.js index 80e80773..b3e7580c 100644 --- a/test/javascripts/acceptance/admin-custom-fields-unsubscribed-test.js +++ b/test/javascripts/acceptance/admin-custom-fields-unsubscribed-test.js @@ -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" ); }); diff --git a/test/javascripts/acceptance/admin-logs-test.js b/test/javascripts/acceptance/admin-logs-test.js index 0b82e93a..1eb07875 100644 --- a/test/javascripts/acceptance/admin-logs-test.js +++ b/test/javascripts/acceptance/admin-logs-test.js @@ -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"); }); }); diff --git a/test/javascripts/acceptance/admin-submissions-test.js b/test/javascripts/acceptance/admin-submissions-test.js index 828decb7..097a5afb 100644 --- a/test/javascripts/acceptance/admin-submissions-test.js +++ b/test/javascripts/acceptance/admin-submissions-test.js @@ -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]; diff --git a/test/javascripts/acceptance/admin-wizards-api-test.js b/test/javascripts/acceptance/admin-wizards-api-test.js index d3afc1f8..f894e2a3 100644 --- a/test/javascripts/acceptance/admin-wizards-api-test.js +++ b/test/javascripts/acceptance/admin-wizards-api-test.js @@ -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"); diff --git a/test/javascripts/acceptance/admin-wizards-business-subscription-test.js b/test/javascripts/acceptance/admin-wizards-business-subscription-test.js index 5a17a023..e7c2f337 100644 --- a/test/javascripts/acceptance/admin-wizards-business-subscription-test.js +++ b/test/javascripts/acceptance/admin-wizards-business-subscription-test.js @@ -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( diff --git a/test/javascripts/acceptance/admin-wizards-standard-subscription-test.js b/test/javascripts/acceptance/admin-wizards-standard-subscription-test.js index ffed5287..7cc05c5c 100644 --- a/test/javascripts/acceptance/admin-wizards-standard-subscription-test.js +++ b/test/javascripts/acceptance/admin-wizards-standard-subscription-test.js @@ -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( diff --git a/test/javascripts/acceptance/admin-wizards-unsubscribed-test.js b/test/javascripts/acceptance/admin-wizards-unsubscribed-test.js index 6c34a935..55c456c7 100644 --- a/test/javascripts/acceptance/admin-wizards-unsubscribed-test.js +++ b/test/javascripts/acceptance/admin-wizards-unsubscribed-test.js @@ -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( diff --git a/test/javascripts/acceptance/field-test.js b/test/javascripts/acceptance/field-test.js index 67ef8c38..455d420d 100644 --- a/test/javascripts/acceptance/field-test.js +++ b/test/javascripts/acceptance/field-test.js @@ -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) { From 61c5355dfc2631b83078fec1fc111d653578d21e Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Fri, 26 Jan 2024 16:18:50 +0100 Subject: [PATCH 2/4] Bump version --- plugin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.rb b/plugin.rb index 02170088..a9cda00a 100644 --- a/plugin.rb +++ b/plugin.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # name: discourse-custom-wizard # about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more. -# version: 2.5.5 +# version: 2.6.0 # authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever, Juan Marcos Gutierrez Ramos # url: https://github.com/paviliondev/discourse-custom-wizard # contact_emails: development@pavilion.tech From 0a63aac3b29dd07ceb0ef96c16e9c380a49b5beb Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Fri, 26 Jan 2024 16:19:54 +0100 Subject: [PATCH 3/4] Add meta topic id --- plugin.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/plugin.rb b/plugin.rb index a9cda00a..23bcb692 100644 --- a/plugin.rb +++ b/plugin.rb @@ -6,6 +6,7 @@ # url: https://github.com/paviliondev/discourse-custom-wizard # contact_emails: development@pavilion.tech # subscription_url: https://coop.pavilion.tech +# meta_topic_id: 73345 gem 'liquid', '5.0.1', require: true gem "discourse_subscription_client", "0.1.1", require_name: "discourse_subscription_client" From f29d1727c34dde5fe710f9b5b1c090034a91534c Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Fri, 26 Jan 2024 16:22:32 +0100 Subject: [PATCH 4/4] Update admin-wizards-manager.hbs --- .../discourse/templates/admin-wizards-manager.hbs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/assets/javascripts/discourse/templates/admin-wizards-manager.hbs b/assets/javascripts/discourse/templates/admin-wizards-manager.hbs index e1844a31..ace62498 100644 --- a/assets/javascripts/discourse/templates/admin-wizards-manager.hbs +++ b/assets/javascripts/discourse/templates/admin-wizards-manager.hbs @@ -66,7 +66,10 @@ {{#each wizards as |wizard|}} - + {{wizard.name}}