fix front end tests
Dieser Commit ist enthalten in:
Ursprung
45db2270ec
Commit
80fcddc45f
11 geänderte Dateien mit 42 neuen und 12 gelöschten Zeilen
|
@ -60,10 +60,9 @@ export default SingleSelectComponent.extend({
|
||||||
name: I18n.t(nameKey(feature, attribute, value)),
|
name: I18n.t(nameKey(feature, attribute, value)),
|
||||||
subscriptionRequired,
|
subscriptionRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (subscriptionRequired) {
|
if (subscriptionRequired) {
|
||||||
let subscribed = allowedSubscriptionTypes.includes(
|
let subscribed = allowedSubscriptionTypes.includes(
|
||||||
this.subscriptionType
|
this.subscription.subscriptionType
|
||||||
);
|
);
|
||||||
let selectorKey = subscribed ? "subscribed" : "not_subscribed";
|
let selectorKey = subscribed ? "subscribed" : "not_subscribed";
|
||||||
let selectorLabel = `admin.wizard.subscription.${selectorKey}.selector`;
|
let selectorLabel = `admin.wizard.subscription.${selectorKey}.selector`;
|
||||||
|
|
|
@ -2,7 +2,6 @@ import Service from "@ember/service";
|
||||||
import { tracked } from "@glimmer/tracking";
|
import { tracked } from "@glimmer/tracking";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
import { equal } from "@ember/object/computed";
|
|
||||||
|
|
||||||
const PRODUCT_PAGE = "https://custom-wizard.pavilion.tech";
|
const PRODUCT_PAGE = "https://custom-wizard.pavilion.tech";
|
||||||
const SUPPORT_MESSAGE =
|
const SUPPORT_MESSAGE =
|
||||||
|
@ -30,9 +29,9 @@ export default class SubscriptionService extends Service {
|
||||||
this.subscribed = result.subscribed;
|
this.subscribed = result.subscribed;
|
||||||
this.subscriptionType = result.subscription_type;
|
this.subscriptionType = result.subscription_type;
|
||||||
this.subscriptionAttributes = result.subscription_attributes;
|
this.subscriptionAttributes = result.subscription_attributes;
|
||||||
this.businessSubscription = equal(this.subscriptionType, "business");
|
this.businessSubscription = this.subscriptionType === "business";
|
||||||
this.communitySubscription = equal(this.subscriptionType, "community");
|
this.communitySubscription = this.subscriptionType === "community";
|
||||||
this.standardSubscription = equal(this.subscriptionType, "standard");
|
this.standardSubscription = this.subscriptionType === "standard";
|
||||||
})
|
})
|
||||||
.catch(popupAjaxError);
|
.catch(popupAjaxError);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import {
|
||||||
getCustomFields,
|
getCustomFields,
|
||||||
getUnsubscribedAdminWizards,
|
getUnsubscribedAdminWizards,
|
||||||
getWizard,
|
getWizard,
|
||||||
|
getSuppliers,
|
||||||
} from "../helpers/admin-wizard";
|
} from "../helpers/admin-wizard";
|
||||||
import { Promise } from "rsvp";
|
import { Promise } from "rsvp";
|
||||||
|
|
||||||
|
@ -19,7 +20,6 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) {
|
||||||
custom_wizard_enabled: true,
|
custom_wizard_enabled: true,
|
||||||
available_locales: JSON.stringify([{ name: "English", value: "en" }]),
|
available_locales: JSON.stringify([{ name: "English", value: "en" }]),
|
||||||
});
|
});
|
||||||
|
|
||||||
needs.pretender((server, helper) => {
|
needs.pretender((server, helper) => {
|
||||||
server.get("/admin/wizards/wizard", () => {
|
server.get("/admin/wizards/wizard", () => {
|
||||||
return helper.response(getWizard);
|
return helper.response(getWizard);
|
||||||
|
@ -36,6 +36,9 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) {
|
||||||
server.delete("/admin/wizards/custom-fields/topic_custom_field", () => {
|
server.delete("/admin/wizards/custom-fields/topic_custom_field", () => {
|
||||||
return helper.response({ success: "OK" });
|
return helper.response({ success: "OK" });
|
||||||
});
|
});
|
||||||
|
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
||||||
|
return helper.response(getSuppliers);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
async function selectTypeAndSerializerAndFillInName(
|
async function selectTypeAndSerializerAndFillInName(
|
||||||
|
|
|
@ -6,6 +6,7 @@ import {
|
||||||
getUnsubscribedAdminWizards,
|
getUnsubscribedAdminWizards,
|
||||||
getWizard,
|
getWizard,
|
||||||
getWizardTestingLog,
|
getWizardTestingLog,
|
||||||
|
getSuppliers,
|
||||||
} from "../helpers/admin-wizard";
|
} from "../helpers/admin-wizard";
|
||||||
|
|
||||||
acceptance("Admin | Logs", function (needs) {
|
acceptance("Admin | Logs", function (needs) {
|
||||||
|
@ -29,6 +30,9 @@ acceptance("Admin | Logs", function (needs) {
|
||||||
server.get("/admin/wizards/wizard", () => {
|
server.get("/admin/wizards/wizard", () => {
|
||||||
return helper.response(getWizard);
|
return helper.response(getWizard);
|
||||||
});
|
});
|
||||||
|
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
||||||
|
return helper.response(getSuppliers);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
test("viewing logs fields tab", async (assert) => {
|
test("viewing logs fields tab", async (assert) => {
|
||||||
await visit("/admin/wizards/logs");
|
await visit("/admin/wizards/logs");
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
getUnsubscribedAdminWizards,
|
getUnsubscribedAdminWizards,
|
||||||
getWizard,
|
getWizard,
|
||||||
getWizardTestingLog,
|
getWizardTestingLog,
|
||||||
|
getSuppliers,
|
||||||
} from "../helpers/admin-wizard";
|
} from "../helpers/admin-wizard";
|
||||||
import { Promise } from "rsvp";
|
import { Promise } from "rsvp";
|
||||||
|
|
||||||
|
@ -33,6 +34,9 @@ acceptance("Admin | Manager", function (needs) {
|
||||||
failures: [],
|
failures: [],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
||||||
|
return helper.response(getSuppliers);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
async function waitForDestructionAndResetMessage() {
|
async function waitForDestructionAndResetMessage() {
|
||||||
await waitUntil(
|
await waitUntil(
|
||||||
|
|
|
@ -7,6 +7,7 @@ import {
|
||||||
getUnsubscribedAdminWizards,
|
getUnsubscribedAdminWizards,
|
||||||
getWizard,
|
getWizard,
|
||||||
getWizardSubmissions,
|
getWizardSubmissions,
|
||||||
|
getSuppliers,
|
||||||
} from "../helpers/admin-wizard";
|
} from "../helpers/admin-wizard";
|
||||||
|
|
||||||
acceptance("Admin | Submissions", function (needs) {
|
acceptance("Admin | Submissions", function (needs) {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import {
|
||||||
getNewApi,
|
getNewApi,
|
||||||
getWizard,
|
getWizard,
|
||||||
putNewApi,
|
putNewApi,
|
||||||
|
getSuppliers,
|
||||||
} from "../helpers/admin-wizard";
|
} from "../helpers/admin-wizard";
|
||||||
|
|
||||||
acceptance("Admin | API tab", function (needs) {
|
acceptance("Admin | API tab", function (needs) {
|
||||||
|
@ -45,6 +46,9 @@ acceptance("Admin | API tab", function (needs) {
|
||||||
server.get("/admin/wizards/api/new_api", () => {
|
server.get("/admin/wizards/api/new_api", () => {
|
||||||
return helper.response(getNewApi);
|
return helper.response(getNewApi);
|
||||||
});
|
});
|
||||||
|
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
||||||
|
return helper.response(getSuppliers);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Visit API tab and fill data", async function (assert) {
|
test("Visit API tab and fill data", async function (assert) {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import {
|
||||||
getCreatedWizard,
|
getCreatedWizard,
|
||||||
getCustomFields,
|
getCustomFields,
|
||||||
getWizard,
|
getWizard,
|
||||||
|
getSuppliers,
|
||||||
} from "../helpers/admin-wizard";
|
} from "../helpers/admin-wizard";
|
||||||
|
|
||||||
acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
|
acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
|
||||||
|
@ -49,6 +50,9 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
|
||||||
server.get("/admin/wizards/wizard/new_wizard_for_testing", () => {
|
server.get("/admin/wizards/wizard/new_wizard_for_testing", () => {
|
||||||
return helper.response(getCreatedWizard);
|
return helper.response(getCreatedWizard);
|
||||||
});
|
});
|
||||||
|
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
||||||
|
return helper.response(getSuppliers);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Displaying all tabs including API", async (assert) => {
|
test("Displaying all tabs including API", async (assert) => {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import {
|
||||||
getCustomFields,
|
getCustomFields,
|
||||||
getStandardAdminWizard,
|
getStandardAdminWizard,
|
||||||
getWizard,
|
getWizard,
|
||||||
|
getSuppliers,
|
||||||
} from "../helpers/admin-wizard";
|
} from "../helpers/admin-wizard";
|
||||||
|
|
||||||
acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
||||||
|
@ -49,6 +50,9 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
||||||
server.get("/admin/wizards/wizard/new_wizard_for_testing", () => {
|
server.get("/admin/wizards/wizard/new_wizard_for_testing", () => {
|
||||||
return helper.response(getCreatedWizard);
|
return helper.response(getCreatedWizard);
|
||||||
});
|
});
|
||||||
|
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
||||||
|
return helper.response(getSuppliers);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Displaying all tabs except API", async (assert) => {
|
test("Displaying all tabs except API", async (assert) => {
|
||||||
|
|
|
@ -14,6 +14,7 @@ import {
|
||||||
getUniqueWizard,
|
getUniqueWizard,
|
||||||
getUnsubscribedAdminWizards,
|
getUnsubscribedAdminWizards,
|
||||||
getWizard,
|
getWizard,
|
||||||
|
getSuppliers,
|
||||||
} from "../helpers/admin-wizard";
|
} from "../helpers/admin-wizard";
|
||||||
|
|
||||||
acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
||||||
|
@ -54,6 +55,9 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
||||||
server.get("/admin/wizards/wizard/unique_wizard", () => {
|
server.get("/admin/wizards/wizard/unique_wizard", () => {
|
||||||
return helper.response(getUniqueWizard);
|
return helper.response(getUniqueWizard);
|
||||||
});
|
});
|
||||||
|
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
||||||
|
return helper.response(getSuppliers);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
async function appendText(selector, text) {
|
async function appendText(selector, text) {
|
|
@ -914,15 +914,19 @@ const putNewApi = {
|
||||||
log: [],
|
log: [],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSuppliers = {
|
const getSuppliers = {
|
||||||
"suppliers": [
|
"suppliers": [
|
||||||
{ "id": 1,
|
{
|
||||||
"name": "Pavilion",
|
"id": 1,
|
||||||
"authorized": false,
|
"name": "Pavilion",
|
||||||
"authorized_at": null,
|
"authorized": false,
|
||||||
"user": null }
|
"authorized_at": null,
|
||||||
|
"user": null
|
||||||
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export {
|
export {
|
||||||
getWizard,
|
getWizard,
|
||||||
getUnsubscribedAdminWizards,
|
getUnsubscribedAdminWizards,
|
||||||
|
|
Laden …
In neuem Issue referenzieren