fix: add cypress tests

This commit is contained in:
Tolulope Adetula 2022-03-29 08:39:34 +01:00
parent a12c183c12
commit e89c454ce5
2 changed files with 44 additions and 11 deletions

View File

@ -8,9 +8,6 @@ describe("Dropdown Widget Functionality", function() {
before(() => {
cy.addDsl(dsl);
});
beforeEach(() => {
cy.wait(7000);
});
it("Add new dropdown widget", () => {
cy.get(explorer.addWidget).click();
@ -93,6 +90,50 @@ describe("Dropdown Widget Functionality", function() {
cy.get(formWidgetsPage.dropdownDefaultButton).should("contain", "Blue");
});
it("should check that special strings are parsed as string in default value", () => {
cy.openPropertyPane("selectwidget");
cy.updateCodeInput(
".t--property-control-options",
`[{
"label": "Blue",
"value": "null"
},
{
"label": "Green",
"value": 100
},
{
"label": "Red",
"value": "120"
}]`,
);
cy.updateCodeInput(".t--property-control-defaultvalue", "null");
cy.get(".t--property-control-defaultvalue .t--codemirror-has-error").should(
"not.exist",
);
cy.get(formWidgetsPage.dropdownDefaultButton).should("contain", "Blue");
cy.openPropertyPane("selectwidget");
cy.updateCodeInput(".t--property-control-defaultvalue", "120");
cy.get(".t--property-control-defaultvalue .t--codemirror-has-error").should(
"not.exist",
);
cy.get(formWidgetsPage.dropdownDefaultButton).should("contain", "Red");
cy.openPropertyPane("selectwidget");
cy.updateCodeInput(".t--property-control-defaultvalue", "{{ 100 }}");
cy.get(".t--property-control-defaultvalue .t--codemirror-has-error").should(
"not.exist",
);
cy.get(formWidgetsPage.dropdownDefaultButton).should("contain", "Green");
cy.openPropertyPane("selectwidget");
cy.updateCodeInput(".t--property-control-defaultvalue", "{{ null }}");
cy.get(".t--property-control-defaultvalue .t--codemirror-has-error").should(
"exist",
);
});
it("Dropdown Functionality To Check disabled Widget", function() {
cy.openPropertyPane("selectwidget");
// Disable the visible JS

View File

@ -15,14 +15,6 @@ describe("defaultOptionValueValidation - ", () => {
});
it("should get tested with number", () => {
const testValues = [
[
"{{1}}",
{
isValid: true,
parsed: 1,
messages: [""],
},
],
[
"1",
{