Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-09 20:02:54 +01:00
DEV: Update standard subscription acceptance test
Dieser Commit ist enthalten in:
Ursprung
51624ac819
Commit
fcb6b2a359
1 geänderte Dateien mit 15 neuen und 30 gelöschten Zeilen
|
@ -4,7 +4,7 @@ import {
|
|||
visible,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
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 {
|
||||
getAdminTestingWizard,
|
||||
|
@ -60,14 +60,14 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
|||
|
||||
test("creting a new wizard", async (assert) => {
|
||||
await visit("/admin/wizards/wizard");
|
||||
await click('button:contains("Create Wizard")');
|
||||
await click(".admin-wizard-controls button");
|
||||
assert.ok(
|
||||
query(".message-content").innerText.includes(
|
||||
"You're creating a new wizard"
|
||||
),
|
||||
"it displays wizard creation message"
|
||||
);
|
||||
assert.step("Step 1: Inserting a title");
|
||||
// ("Step 1: Inserting a title")
|
||||
const wizardTitle = "New wizard for testing";
|
||||
await fillIn(".wizard-header input", wizardTitle);
|
||||
assert.equal(
|
||||
|
@ -85,11 +85,12 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
|||
const subsFeature = find(
|
||||
".wizard-subscription-container .subscription-settings .setting-value input"
|
||||
);
|
||||
await click(subsFeature);
|
||||
await click(
|
||||
".wizard-subscription-container .subscription-settings .setting-value input"
|
||||
);
|
||||
assert.ok(subsFeature.is(":checked"), "subscription feature available");
|
||||
assert.step("Step 2: Creating a step section");
|
||||
const stepAddBtn = find(".step .link-list button:contains('Add')");
|
||||
await click(stepAddBtn);
|
||||
// ("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})`);
|
||||
assert.equal(stepOneBtn.length, 1, "Creating a step");
|
||||
|
@ -107,9 +108,8 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
|||
2,
|
||||
"Steps subscription features are accesible"
|
||||
);
|
||||
assert.step("Step 3: Creating a field section");
|
||||
const fieldAddBtn = find(".field .link-list button:contains('Add')");
|
||||
await click(fieldAddBtn);
|
||||
// step("Step 3: Creating a field section")
|
||||
await click(".field .link-list button");
|
||||
assert.ok(
|
||||
!visible(".wizard-custom-field button.undo-changes"),
|
||||
"clear button is not rendered"
|
||||
|
@ -130,8 +130,7 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
|||
fieldButtonText.includes(fieldTitle),
|
||||
"The step button changes according to title"
|
||||
);
|
||||
const clearBtn = find(`.wizard-custom-field button.undo-changes`);
|
||||
await click(clearBtn);
|
||||
await click(`.wizard-custom-field button.undo-changes`);
|
||||
fieldButtonText = $(".field div[data-id='step_1_field_1'] button")
|
||||
.text()
|
||||
.trim();
|
||||
|
@ -155,9 +154,8 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
|||
3,
|
||||
"Field subscription features are accesible"
|
||||
);
|
||||
assert.step("Step 4: Creating a action section");
|
||||
const actionAddBtn = find(".action .link-list button:contains('Add')");
|
||||
await click(actionAddBtn);
|
||||
// ("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})`);
|
||||
assert.equal(actionOneBtn.length, 1, "Creating an action");
|
||||
|
@ -228,15 +226,12 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
|||
);
|
||||
await actionTypeDropdown.expand();
|
||||
await actionTypeDropdown.selectRowByValue("create_topic");
|
||||
assert.step("Step 5: Save wizard");
|
||||
const saveButton = find(
|
||||
'.admin-wizard-buttons button:contains("Save Changes")'
|
||||
);
|
||||
// step("Step 5: Save wizard");
|
||||
assert.ok(
|
||||
!visible('.admin-wizard-buttons button:contains("Delete Wizard")'),
|
||||
"delete wizard button not displayed"
|
||||
);
|
||||
await click(saveButton);
|
||||
await click(".admin-wizard-buttons button");
|
||||
assert.equal(
|
||||
currentURL(),
|
||||
"/admin/wizards/wizard/new_wizard_for_testing",
|
||||
|
@ -246,15 +241,5 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
|||
visible('.admin-wizard-buttons button:contains("Delete Wizard")'),
|
||||
"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