Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-26 11:00:28 +01:00
FIX: Update creation of wizard on business tier
Dieser Commit ist enthalten in:
Ursprung
60d50afc54
Commit
ebddcb5606
1 geänderte Dateien mit 25 neuen und 35 gelöschten Zeilen
|
@ -4,7 +4,7 @@ import {
|
||||||
visible,
|
visible,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
import { findAll, visit } from "@ember/test-helpers";
|
import { click, findAll, 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,16 +58,16 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
|
||||||
assert.equal(count, 6, "There should be 6 admin tabs");
|
assert.equal(count, 6, "There should be 6 admin tabs");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("creting a new wizard", async (assert) => {
|
test("creating a new wizard", async (assert) => {
|
||||||
await visit("/admin/wizards/wizard");
|
await visit("/admin/wizards/wizard");
|
||||||
await click('button:contains("Create Wizard")');
|
await click(".admin-wizard-controls button");
|
||||||
assert.ok(
|
assert.ok(
|
||||||
query(".message-content").innerText.includes(
|
query(".message-content").innerText.includes(
|
||||||
"You're creating a new wizard"
|
"You're creating a new wizard"
|
||||||
),
|
),
|
||||||
"it displays wizard creation message"
|
"it displays wizard creation message"
|
||||||
);
|
);
|
||||||
assert.step("Step 1: Inserting a title");
|
// "Step 1: Inserting a title
|
||||||
const wizardTitle = "New wizard for testing";
|
const wizardTitle = "New wizard for testing";
|
||||||
await fillIn(".wizard-header input", wizardTitle);
|
await fillIn(".wizard-header input", wizardTitle);
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -82,14 +82,18 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
|
||||||
1,
|
1,
|
||||||
"Wizard subscription features are accesible"
|
"Wizard subscription features are accesible"
|
||||||
);
|
);
|
||||||
const subsFeature = find(
|
await click(
|
||||||
".wizard-subscription-container .subscription-settings .setting-value input"
|
'.wizard-subscription-container .subscription-settings .setting-value input[type="checkbox"]'
|
||||||
);
|
);
|
||||||
await click(subsFeature);
|
assert.ok(
|
||||||
assert.ok(subsFeature.is(":checked"), "subscription feature available");
|
find(
|
||||||
assert.step("Step 2: Creating a step section");
|
'.wizard-subscription-container .subscription-settings .setting-value input[type="checkbox"]'
|
||||||
const stepAddBtn = find(".step .link-list button:contains('Add')");
|
).is(":checked"),
|
||||||
await click(stepAddBtn);
|
"subscription feature available"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Step 2: Creating a step section
|
||||||
|
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 = find(`.step button:contains(${stepOneText})`);
|
||||||
assert.equal(stepOneBtn.length, 1, "Creating a step");
|
assert.equal(stepOneBtn.length, 1, "Creating a step");
|
||||||
|
@ -107,9 +111,9 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
|
||||||
2,
|
2,
|
||||||
"Steps subscription features are accesible"
|
"Steps subscription features are accesible"
|
||||||
);
|
);
|
||||||
assert.step("Step 3: Creating a field section");
|
// Step 3: Creating a field section
|
||||||
const fieldAddBtn = find(".field .link-list button:contains('Add')");
|
await click(".field .link-list button");
|
||||||
await click(fieldAddBtn);
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
!visible(".wizard-custom-field button.undo-changes"),
|
!visible(".wizard-custom-field button.undo-changes"),
|
||||||
"clear button is not rendered"
|
"clear button is not rendered"
|
||||||
|
@ -130,8 +134,7 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
|
||||||
fieldButtonText.includes(fieldTitle),
|
fieldButtonText.includes(fieldTitle),
|
||||||
"The step button changes according to title"
|
"The step button changes according to title"
|
||||||
);
|
);
|
||||||
const clearBtn = find(`.wizard-custom-field button.undo-changes`);
|
await click(`.wizard-custom-field button.undo-changes`);
|
||||||
await click(clearBtn);
|
|
||||||
fieldButtonText = $(".field div[data-id='step_1_field_1'] button")
|
fieldButtonText = $(".field div[data-id='step_1_field_1'] button")
|
||||||
.text()
|
.text()
|
||||||
.trim();
|
.trim();
|
||||||
|
@ -155,11 +158,10 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
|
||||||
3,
|
3,
|
||||||
"Field subscription features are accesible"
|
"Field subscription features are accesible"
|
||||||
);
|
);
|
||||||
// creating action content
|
|
||||||
assert.step("Step 4: Creating a action section");
|
|
||||||
|
|
||||||
const actionAddBtn = find(".action .link-list button:contains('Add')");
|
// Step 4: Creating a action section
|
||||||
await click(actionAddBtn);
|
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 = find(`.action button:contains(${actionOneText})`);
|
||||||
assert.equal(actionOneBtn.length, 1, "Creating an action");
|
assert.equal(actionOneBtn.length, 1, "Creating an action");
|
||||||
|
@ -230,15 +232,13 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
|
||||||
);
|
);
|
||||||
await actionTypeDropdown.expand();
|
await actionTypeDropdown.expand();
|
||||||
await actionTypeDropdown.selectRowByValue("create_topic");
|
await actionTypeDropdown.selectRowByValue("create_topic");
|
||||||
assert.step("Step 5: Save wizard");
|
|
||||||
const saveButton = find(
|
|
||||||
'.admin-wizard-buttons button:contains("Save Changes")'
|
|
||||||
);
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
!visible('.admin-wizard-buttons button:contains("Delete Wizard")'),
|
!visible('.admin-wizard-buttons button:contains("Delete Wizard")'),
|
||||||
"delete wizard button not displayed"
|
"delete wizard button not displayed"
|
||||||
);
|
);
|
||||||
await click(saveButton);
|
//Step 5: Save wizard
|
||||||
|
await click(".admin-wizard-buttons button");
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
currentURL(),
|
currentURL(),
|
||||||
"/admin/wizards/wizard/new_wizard_for_testing",
|
"/admin/wizards/wizard/new_wizard_for_testing",
|
||||||
|
@ -248,15 +248,5 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
|
||||||
visible('.admin-wizard-buttons button:contains("Delete Wizard")'),
|
visible('.admin-wizard-buttons button:contains("Delete Wizard")'),
|
||||||
"delete wizard button visible"
|
"delete wizard button visible"
|
||||||
);
|
);
|
||||||
assert.verifySteps(
|
|
||||||
[
|
|
||||||
"Step 1: Inserting a title",
|
|
||||||
"Step 2: Creating a step section",
|
|
||||||
"Step 3: Creating a field section",
|
|
||||||
"Step 4: Creating a action section",
|
|
||||||
"Step 5: Save wizard",
|
|
||||||
],
|
|
||||||
"All steps completed"
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Laden …
In neuem Issue referenzieren