Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta Release #2879

Closed
wants to merge 13 commits into from
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion cypress/e2e/content/content.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ describe("Content Specs", () => {
});

it("Currency Field", () => {
cy.get("#12-b35c68-jd1s8s input[type=number]")
cy.get("#12-b35c68-jd1s8s input")
.focus()
.clear()
.type("100.00")
Expand Down
40 changes: 40 additions & 0 deletions cypress/e2e/schema/field.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ const SELECTORS = {
FIELD_SELECT_MEDIA: "FieldItem_images",
FIELD_SELECT_BOOLEAN: "FieldItem_yes_no",
FIELD_SELECT_ONE_TO_ONE: "FieldItem_one_to_one",
FIELD_SELECT_CURRENCY: "FieldItem_currency",
MEDIA_CHECKBOX_LIMIT: "MediaCheckbox_limit",
MEDIA_CHECKBOX_LOCK: "MediaCheckbox_group_id",
DROPDOWN_ADD_OPTION: "DropdownAddOption",
DROPDOWN_DELETE_OPTION: "DeleteOption",
AUTOCOMPLETE_MODEL_ZUID: "Autocomplete_relatedModelZUID",
AUTOCOMPLETE_FIELED_ZUID: "Autocomplete_relatedFieldZUID",
AUTOCOMPLETE_FIELD_CURRENCY: "Autocomplete_currency",
INPUT_LABEL: "FieldFormInput_label",
INPUT_NAME: "FieldFormInput_name",
INPUT_OPTION_LABEL: "OptionLabel",
Expand Down Expand Up @@ -357,6 +359,44 @@ describe("Schema: Fields", () => {
cy.getBySelector(`Field_${fieldName}`).should("exist");
});

it("Creates a currency field", () => {
cy.intercept("**/fields?showDeleted=true").as("getFields");

const fieldLabel = `Currency ${timestamp}`;
const fieldName = `currency_${timestamp}`;

// Open the add field modal
cy.getBySelector(SELECTORS.ADD_FIELD_BTN).should("exist").click();
cy.getBySelector(SELECTORS.ADD_FIELD_MODAL).should("exist");

// Select one-to-one relationship field
cy.getBySelector(SELECTORS.FIELD_SELECT_CURRENCY).should("exist").click();

// Select default currency
cy.getBySelector(SELECTORS.AUTOCOMPLETE_FIELD_CURRENCY).type("phil");
cy.get("[role=listbox] [role=option]").first().click();

// Fill up fields
cy.getBySelector(SELECTORS.INPUT_LABEL).should("exist").type(fieldLabel);

// Navigate to rules tab and add default value
cy.getBySelector(SELECTORS.RULES_TAB_BTN).click();
// click on the default value checkbox
cy.getBySelector(SELECTORS.DEFAULT_VALUE_CHECKBOX).click();
// enter a default value
cy.getBySelector(SELECTORS.DEFAULT_VALUE_INPUT).type("1000.50");
// Verify default currency
cy.getBySelector(SELECTORS.DEFAULT_VALUE_INPUT).contains("PHP");
// Click done
cy.getBySelector(SELECTORS.SAVE_FIELD_BUTTON).should("exist").click();
cy.getBySelector(SELECTORS.ADD_FIELD_MODAL).should("not.exist");

cy.wait("@getFields");

// Check if field exists
cy.getBySelector(`Field_${fieldName}`).should("exist");
});

it("Creates a field via add another field button", () => {
cy.intercept("**/fields?showDeleted=true").as("getFields");

Expand Down
15 changes: 7 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@tinymce/tinymce-react": "^4.3.0",
"@welldone-software/why-did-you-render": "^6.1.1",
"@zesty-io/core": "1.10.0",
"@zesty-io/material": "^0.15.2",
"@zesty-io/material": "^0.15.3",
"chart.js": "^3.8.0",
"chartjs-adapter-moment": "^1.0.1",
"chartjs-plugin-datalabels": "^2.0.0",
Expand Down
Loading
Loading