Setup cypress (#3436)

* Setup Cypress tests for box and button

* Add container tests

* Add Cypress workflow

* Use npm install

* Update Cypress workflow

* Add Jekyll build

* Test other action

* Test custom setup

* Use other ruby action

* Test without flag

* Move cypress to docs folder

* Record runs

* Add Content, Icon, Image specs

* Add Notification specs

* Add Progress and Table specs

* Add Tags specs

* Add Title specs

* Add breadcrumb specs

* Add more specs

* Add media specs

* Add menu specs

* Add modal specs

* Add navbar specs

* Add pagination specs

* Add panel specs

* Add tabs specs, Add form checkbox radio specs

* Add utils

* Add file specs

* Add input textarea specs

* Add select specs

* Add form tools specs

* Add other elements specs

* Add footer and hero specs

* Add Hero specs

* Add section specs

* Add grid specs

* Add column sizes specs

* Add tiles specs

* Add generic specs

* Fix generic tests

* Make font family test looser

* Remove system-ui test

* Remove important flag

* Fix disabled select color
This commit is contained in:
Jeremy Thomas
2022-05-08 13:55:16 +01:00
committed by GitHub
parent 895b77b3a9
commit 0ce084170a
97 changed files with 20259 additions and 15 deletions

2
docs/cypress/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
/screenshots
/videos

View File

@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}

2
docs/cypress/integration/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
1-getting-started
2-advanced-examples

View File

@@ -0,0 +1,147 @@
import { familyPrimary } from "../utils";
describe("Base/Generic", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/base/generic/");
});
it("has a correct html", () => {
cy.get("html").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("scheme-main"));
expect(cs.fontSize).to.equal("16px");
expect(cs.minWidth).to.equal("300px");
expect(cs.overflowX).to.equal("hidden");
expect(cs.overflowY).to.equal("scroll");
expect(cs.textRendering).to.equal("optimizelegibility");
expect(cs.textSizeAdjust).to.equal("100%");
expect(cs.webkitFontSmoothing).to.equal("antialiased");
});
});
it("has correct HTML5 elements", () => {
cy.get("article, aside, figure, footer, header, hgroup, section").then(
($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("block");
}
);
});
it("has correct form elements", () => {
cy.get("body, button, input, optgroup, select, textarea").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontFamily).to.contains("-apple-system");
expect(cs.fontFamily).to.contains("Helvetica");
expect(cs.fontFamily).to.contains("Arial");
expect(cs.fontFamily).to.contains("sans-serif");
});
});
it("has correct monospace elements", () => {
cy.get("pre, code").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontFamily).to.equal(Cypress.env("family-code"));
expect(cs.webkitFontSmoothing).to.equal("auto");
});
});
it("has a correct body", () => {
cy.get("body").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("text"));
expect(cs.fontFamily).to.contains("-apple-system");
expect(cs.fontFamily).to.contains("Helvetica");
expect(cs.fontFamily).to.contains("Arial");
expect(cs.fontFamily).to.contains("sans-serif");
expect(cs.fontSize).to.equal("16px");
expect(cs.fontWeight).to.equal("400");
expect(cs.lineHeight).to.equal("24px");
});
});
it("has a correct a", () => {
cy.get("a").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("link"));
expect(cs.cursor).to.equal("pointer");
expect(cs.textDecorationLine).to.equal("none");
});
});
it("has a correct code", () => {
cy.get("code").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("white-ter"));
expect(cs.color).to.equal(Cypress.env("code"));
});
});
it("has a correct hr", () => {
cy.get("hr").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("white-ter"));
expect(cs.borderStyle).to.equal("none");
expect(cs.display).to.equal("block");
expect(cs.height).to.equal("2px");
expect(cs.margin).to.equal("24px 0px");
});
});
it("has a correct img", () => {
cy.get("img").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.height).to.equal("28px");
expect(cs.width).to.equal("112px");
});
});
it("has a correct checkbox", () => {
cy.get("input[type='checkbox']").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.verticalAlign).to.equal("baseline");
});
});
it("has a correct radio", () => {
cy.get("input[type='radio']").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.verticalAlign).to.equal("baseline");
});
});
it("has a correct small", () => {
cy.get("small").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal("14px");
});
});
it("has a correct fieldset", () => {
cy.get("fieldset").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderStyle).to.equal("none");
});
});
it("has a correct pre", () => {
cy.get("pre").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("white-ter"));
expect(cs.color).to.equal(Cypress.env("text"));
expect(cs.fontSize).to.equal("14px");
expect(cs.overflowX).to.equal("auto");
expect(cs.padding).to.equal("20px 24px");
expect(cs.whiteSpace).to.equal("pre");
expect(cs.wordWrap).to.equal("normal");
});
cy.get("pre code").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("transparent"));
expect(cs.color).to.equal(Cypress.env("text"));
expect(cs.fontSize).to.equal("14px");
expect(cs.padding).to.equal("0px");
});
});
});

View File

@@ -0,0 +1,98 @@
describe("Components/Breadcrumb", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/components/breadcrumb/");
});
it("has a Breadcrumb", () => {
cy.get(".breadcrumb").should("exist");
});
it("has a correct Breadcrumb", () => {
cy.get("#breadcrumb").then(($) => {
const cs = window.getComputedStyle($[0]);
});
cy.get("#breadcrumb li:nth-child(2) a").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("link"));
expect(cs.padding).to.equal("0px 12px");
});
cy.get("#breadcrumb li.is-active a").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("text-strong"));
expect(cs.padding).to.equal("0px 12px");
});
});
it("has correct Breadcrumb alignments", () => {
cy.get("#breadcrumb-centered ul").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.justifyContent).to.equal("center");
});
cy.get("#breadcrumb-right ul").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.justifyContent).to.equal("flex-end");
});
});
it("has correct Breadcrumb sizes", () => {
cy.get("#breadcrumb-small").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal(`${Cypress.env("sizes").small}px`);
});
cy.get("#breadcrumb-normal").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal(`${Cypress.env("sizes").normal}px`);
});
cy.get("#breadcrumb-medium").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal(`${Cypress.env("sizes").medium}px`);
});
cy.get("#breadcrumb-large").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal(`${Cypress.env("sizes").large}px`);
});
});
it("has correct Breadcrumb separators", () => {
cy.get("#breadcrumb li:nth-child(2)").then(($) => {
const content = window
.getComputedStyle($[0], "before")
.getPropertyValue("content");
expect(content).to.equal('"/"');
});
cy.get("#breadcrumb-arrow li:nth-child(2)").then(($) => {
const content = window
.getComputedStyle($[0], "before")
.getPropertyValue("content");
expect(content).to.equal('"→"');
});
cy.get("#breadcrumb-bullet li:nth-child(2)").then(($) => {
const content = window
.getComputedStyle($[0], "before")
.getPropertyValue("content");
expect(content).to.equal('"•"');
});
cy.get("#breadcrumb-dot li:nth-child(2)").then(($) => {
const content = window
.getComputedStyle($[0], "before")
.getPropertyValue("content");
expect(content).to.equal('"·"');
});
cy.get("#breadcrumb-succeeds li:nth-child(2)").then(($) => {
const content = window
.getComputedStyle($[0], "before")
.getPropertyValue("content");
expect(content).to.equal('"≻"');
});
});
});

View File

@@ -0,0 +1,76 @@
describe("Components/Card", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/components/card/");
});
it("has a Card", () => {
cy.get(".card").should("exist");
});
it("has a correct Card", () => {
cy.get("#card").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("white"));
expect(cs.color).to.equal(Cypress.env("text"));
expect(cs.boxShadow).to.equal(
"rgba(10, 10, 10, 0.1) 0px 8px 16px -2px, rgba(10, 10, 10, 0.02) 0px 0px 0px 1px"
);
});
});
it("has correct Card Item border-radius", () => {
cy.get("#card-only-content > .card-content:first-child").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderTopLeftRadius).to.equal("4px");
expect(cs.borderTopRightRadius).to.equal("4px");
});
cy.get("#card-only-content > .card-content:last-child").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderBottomLeftRadius).to.equal("4px");
expect(cs.borderBottomRightRadius).to.equal("4px");
});
});
it("has correct Card Header", () => {
cy.get("#card-header-content > .card-header").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("transparent"));
expect(cs.boxShadow).to.equal("rgba(10, 10, 10, 0.1) 0px 2px 4px 0px");
});
cy.get("#card-header-content .card-header-title").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("text-strong"));
expect(cs.fontWeight).to.equal("700");
expect(cs.padding).to.equal("12px 16px");
});
cy.get("#card-header-content .card-header-icon").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.padding).to.equal("12px 16px");
});
});
it("has correct Card Content", () => {
cy.get("#card .card-content").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.padding).to.equal("24px");
});
});
it("has correct Card Footer", () => {
cy.get("#card .card-footer").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("transparent"));
expect(cs.borderTopColor).to.equal(Cypress.env("grey-lightest"));
expect(cs.borderTopStyle).to.equal("solid");
expect(cs.borderTopWidth).to.equal("1px");
});
cy.get("#card .card-footer-item").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.padding).to.equal("12px");
});
});
});

View File

@@ -0,0 +1,64 @@
describe("Components/Dropdown", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/components/dropdown/");
});
it("has a Dropdown", () => {
cy.get(".dropdown").should("exist");
});
it("has a correct Dropdown Content", () => {
cy.get("#dropdown .dropdown-content").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("white"));
expect(cs.borderRadius).to.equal("4px");
expect(cs.boxShadow).to.equal(
"rgba(10, 10, 10, 0.1) 0px 8px 16px -2px, rgba(10, 10, 10, 0.02) 0px 0px 0px 1px"
);
expect(cs.paddingBottom).to.equal("8px");
expect(cs.paddingTop).to.equal("8px");
});
});
it("has a correct Dropdown Menu", () => {
cy.get("#dropdown .dropdown-menu").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("none");
expect(cs.paddingTop).to.equal("4px");
expect(cs.position).to.equal("absolute");
expect(cs.zIndex).to.equal("20");
});
cy.get("#dropdown-active .dropdown-menu").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("block");
});
});
it("has a correct Dropdown Item", () => {
cy.get("#dropdown .dropdown-item").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("text"));
expect(cs.display).to.equal("block");
});
cy.get("#dropdown a.dropdown-item").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.width).to.equal("100%");
});
cy.get("#dropdown a.dropdown-item.is-active").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("link"));
expect(cs.color).to.equal(Cypress.env("link-invert"));
});
});
it("has a correct Dropdown Divider", () => {
cy.get("#dropdown .dropdown-divider").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("grey-lightest"));
expect(cs.height).to.equal("1px");
});
});
});

View File

@@ -0,0 +1,50 @@
describe("Layout/Level", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/layout/level/");
});
it("has a Level", () => {
cy.get(".level").should("exist");
});
it("has a correct Level", () => {
cy.get("#level").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.alignItems).to.equal("center");
expect(cs.display).to.equal("flex");
});
});
it("has a correct Level Item", () => {
cy.get("#level .level-item").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.alignItems).to.equal("center");
expect(cs.display).to.equal("flex");
expect(cs.flexGrow).to.equal("0");
expect(cs.flexShrink).to.equal("0");
});
cy.get("#level-centered .level-item .title").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.marginBottom).to.equal("0px");
});
});
it("has correct Level Left and Right", () => {
cy.get("#level .level-left").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.alignItems).to.equal("center");
expect(cs.flexGrow).to.equal("0");
expect(cs.flexShrink).to.equal("0");
expect(cs.justifyContent).to.equal("flex-start");
});
cy.get("#level .level-right").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.alignItems).to.equal("center");
expect(cs.flexGrow).to.equal("0");
expect(cs.flexShrink).to.equal("0");
expect(cs.justifyContent).to.equal("flex-end");
});
});
});

View File

@@ -0,0 +1,52 @@
describe("Components/Media", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/layout/media/");
});
it("has a Media", () => {
cy.get(".media").should("exist");
});
it("has a correct Media", () => {
cy.get("#media").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.alignItems).to.equal("flex-start");
expect(cs.display).to.equal("flex");
});
});
it("has a correct nested Media", () => {
cy.get("#media-nested .media-content .media + .media").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderTopColor).to.equal("rgba(219, 219, 219, 0.5)");
expect(cs.borderTopStyle).to.equal("solid");
expect(cs.borderTopWidth).to.equal("1px");
expect(cs.marginTop).to.equal("8px");
expect(cs.paddingTop).to.equal("8px");
});
});
it("has a correct Media Content", () => {
cy.get("#media .media-content").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.flexGrow).to.equal("1");
expect(cs.flexShrink).to.equal("1");
});
});
it("has correct Media Left and Right", () => {
cy.get("#media .media-left").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.flexGrow).to.equal("0");
expect(cs.flexShrink).to.equal("0");
expect(cs.marginRight).to.equal("16px");
});
cy.get("#media .media-right").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.flexGrow).to.equal("0");
expect(cs.flexShrink).to.equal("0");
expect(cs.marginLeft).to.equal("16px");
});
});
});

View File

@@ -0,0 +1,68 @@
describe("Components/Menu", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/components/menu/");
});
it("has a Menu", () => {
cy.get(".menu").should("exist");
});
it("has a correct Menu", () => {
cy.get("#menu").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal("16px");
});
});
it("has a correct Menu List", () => {
cy.get("#menu .menu-list").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.lineHeight).to.equal("20px");
});
cy.get("#menu .menu-list a").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderRadius).to.equal("2px");
expect(cs.color).to.equal(Cypress.env("text"));
expect(cs.display).to.equal("block");
expect(cs.padding).to.equal("8px 12px");
});
cy.get("#menu .menu-list a.is-active").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("link"));
expect(cs.color).to.equal(Cypress.env("link-invert"));
});
});
it("has a correct nested Menu List", () => {
cy.get("#menu .menu-list ul").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderLeftColor).to.equal(Cypress.env("border"));
expect(cs.borderLeftStyle).to.equal("solid");
expect(cs.borderLeftWidth).to.equal("1px");
expect(cs.margin).to.equal("12px");
expect(cs.paddingLeft).to.equal("12px");
});
});
it("has a correct Menu Label", () => {
cy.get("#menu .menu-label").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("text-light"));
expect(cs.fontSize).to.equal("12px");
expect(cs.letterSpacing).to.equal("1.2px");
expect(cs.textTransform).to.equal("uppercase");
});
cy.get("#menu .menu-label:not(:first-child)").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.marginTop).to.equal("12px");
});
cy.get("#menu .menu-label:not(:last-child)").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.marginBottom).to.equal("12px");
});
});
});

View File

@@ -0,0 +1,74 @@
describe("Components/Message", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/components/message/");
});
it("has a Message", () => {
cy.get(".message").should("exist");
});
it("has a correct Message", () => {
cy.get("#message").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("white-ter"));
expect(cs.borderRadius).to.equal("4px");
expect(cs.fontSize).to.equal("16px");
});
});
it(`has a correct Message Header`, () => {
cy.get("#message .message-header").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("text"));
expect(cs.color).to.equal(Cypress.env("text-invert"));
expect(cs.display).to.equal("flex");
expect(cs.fontWeight).to.equal("700");
expect(cs.padding).to.equal("12px 16px");
});
});
it(`has a correct Message Body`, () => {
cy.get("#message-no-header .message-body").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderColor).to.equal(Cypress.env("border"));
expect(cs.borderRadius).to.equal("4px");
expect(cs.borderWidth).to.equal("0px 0px 0px 4px");
expect(cs.color).to.equal(Cypress.env("text"));
expect(cs.padding).to.equal("20px 24px");
});
cy.get("#message .message-body").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderTopLeftRadius).to.equal("0px");
expect(cs.borderTopRightRadius).to.equal("0px");
expect(cs.borderWidth).to.equal("0px");
});
});
it(`has correct color Messages`, () => {
for (let i = 0; i < Cypress.env("color-names").length; i++) {
const name = Cypress.env("color-names")[i];
const baseColor = Cypress.env(name);
const invertColor = Cypress.env(`${name}-invert`);
const lightColor = Cypress.env(`${name}-light`);
const darkColor = Cypress.env(`${name}-dark`);
cy.get(`#message-${name}`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(lightColor);
});
cy.get(`#message-${name} .message-header`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(baseColor);
expect(cs.color).to.equal(invertColor);
});
cy.get(`#message-${name} .message-body`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderColor).to.equal(baseColor);
expect(cs.color).to.equal(darkColor);
});
}
});
});

View File

@@ -0,0 +1,95 @@
describe("Components/Modal", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/components/modal/");
});
it("has a Modal", () => {
cy.get(".modal").should("exist");
});
it("has a correct Modal", () => {
cy.get("#modal").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("none");
expect(cs.flexDirection).to.equal("column");
expect(cs.overflow).to.equal("hidden");
expect(cs.position).to.equal("fixed");
expect(cs.zIndex).to.equal("40");
});
cy.get("#modal-active").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("flex");
});
});
it("has a correct Modal Background", () => {
cy.get("#modal .modal-background").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal("rgba(10, 10, 10, 0.86)");
expect(cs.position).to.equal("absolute");
});
});
it("has a correct Modal Content", () => {
cy.get("#modal .modal-content").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.margin).to.equal("0px auto");
expect(cs.width).to.equal("640px");
});
});
it("has a correct Modal Card", () => {
cy.get("#modal-card .modal-card").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("flex");
});
cy.get("#modal-card .modal-card-head, #modal-card .modal-card-foot").then(
($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("white-ter"));
expect(cs.display).to.equal("flex");
expect(cs.flexShrink).to.equal("0");
expect(cs.padding).to.equal("20px");
expect(cs.position).to.equal("relative");
}
);
cy.get("#modal-card .modal-card-head").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderBottomColor).to.equal(Cypress.env("border"));
expect(cs.borderBottomStyle).to.equal("solid");
expect(cs.borderBottomWidth).to.equal("1px");
expect(cs.borderTopLeftRadius).to.equal("6px");
expect(cs.borderTopRightRadius).to.equal("6px");
});
cy.get("#modal-card .modal-card-foot").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderTopColor).to.equal(Cypress.env("border"));
expect(cs.borderTopStyle).to.equal("solid");
expect(cs.borderTopWidth).to.equal("1px");
expect(cs.borderBottomLeftRadius).to.equal("6px");
expect(cs.borderBottomRightRadius).to.equal("6px");
});
cy.get("#modal-card .modal-card-title").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("text-strong"));
expect(cs.flexGrow).to.equal("1");
expect(cs.flexShrink).to.equal("0");
expect(cs.fontSize).to.equal("24px");
expect(cs.lineHeight).to.equal("24px");
});
cy.get("#modal-card .modal-card-body").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("white"));
expect(cs.flexGrow).to.equal("1");
expect(cs.flexShrink).to.equal("1");
expect(cs.overflow).to.equal("auto");
expect(cs.padding).to.equal("20px");
});
});
});

View File

@@ -0,0 +1,257 @@
import { setMobile, setDesktop } from "../utils";
describe("Components/Navbar", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/components/navbar/");
});
it("has a Navbar", () => {
cy.get(".navbar").should("exist");
});
it("has a correct Navbar", () => {
cy.get("#navbar").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("white"));
expect(cs.minHeight).to.equal("52px");
expect(cs.position).to.equal("relative");
expect(cs.zIndex).to.equal("30");
});
});
it(`has correct color Navbars`, () => {
for (let i = 0; i < Cypress.env("color-names").length; i++) {
const name = Cypress.env("color-names")[i];
const baseColor = Cypress.env(name);
const invertColor = Cypress.env(`${name}-invert`);
const lightColor = Cypress.env(`${name}-light`);
const darkColor = Cypress.env(`${name}-dark`);
cy.get(`#navbar-${name}`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(baseColor);
expect(cs.color).to.equal(invertColor);
});
cy.get(`#navbar-${name} .navbar-burger`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(invertColor);
});
}
});
it("has a correct Navbar Shadow", () => {
cy.get("#navbar-has-shadow").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.boxShadow).to.equal(
`${Cypress.env("white-ter")} 0px 2px 0px 0px`
);
});
});
it("has correct fixed Navbar", () => {
cy.get("#navbar-is-fixed-top").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.position).to.equal("fixed");
expect(cs.top).to.equal("0px");
expect(cs.zIndex).to.equal("30");
});
cy.get("#navbar-is-fixed-bottom").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.bottom).to.equal("0px");
expect(cs.position).to.equal("fixed");
expect(cs.zIndex).to.equal("30");
});
});
it("has a correct Navbar Item", () => {
cy.get("#navbar .navbar-start .navbar-item").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("text"));
expect(cs.flexGrow).to.equal("0");
expect(cs.flexShrink).to.equal("0");
expect(cs.lineHeight).to.equal("24px");
expect(cs.padding).to.equal("8px 12px");
});
cy.get("#navbar .navbar-start .navbar-item.has-dropdown").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.padding).to.equal("0px");
});
});
it("has a correct Navbar Link", () => {
cy.get("#navbar .navbar-link").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.paddingRight).to.equal("40px");
});
});
it("has a correct Navbar Drodpown", () => {
cy.get("#navbar .navbar-dropdown").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal("14px");
expect(cs.paddingBottom).to.equal("8px");
expect(cs.paddingTop).to.equal("8px");
});
cy.get("#navbar .navbar-dropdown .navbar-item").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.paddingLeft).to.equal("24px");
expect(cs.paddingRight).to.equal("24px");
});
});
it("has a correct Navbar Divider", () => {
cy.get("#navbar .navbar-divider").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("white-ter"));
expect(cs.height).to.equal("2px");
expect(cs.margin).to.equal("8px 0px");
});
});
it("has a correct Navbar Brand", () => {
cy.get("#navbar .navbar-brand").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.alignItems).to.equal("stretch");
expect(cs.display).to.equal("flex");
expect(cs.flexShrink).to.equal("0");
expect(cs.minHeight).to.equal("52px");
});
});
});
// Mobile
describe("Components/Navbar Mobile", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/components/navbar/");
setMobile();
});
it("has a Navbar", () => {
cy.get(".navbar").should("exist");
});
it("has a correct Navbar Container", () => {
cy.get("#navbar-container > .container").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("block");
});
});
it("has a correct Navbar Item", () => {
cy.get("#navbar .navbar-start .navbar-item").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("block");
});
});
it("has a correct active Navbar Item", () => {
cy.get("#navbar .navbar-start .navbar-item.is-active").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("white-bis"));
});
});
it("has a correct Navbar Burger", () => {
cy.get("#navbar .navbar-burger").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.appearance).to.equal("none");
});
});
it("has a correct Navbar Menu", () => {
cy.get("#navbar .navbar-menu").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("none");
});
});
it("has a correct Navbar Divider", () => {
cy.get("#navbar .navbar-divider").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("none");
});
});
});
// Desktop
describe("Components/Navbar Desktop", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/components/navbar/");
setDesktop();
});
it("has a Navbar", () => {
cy.get(".navbar").should("exist");
});
it("has a correct Navbar Container", () => {
cy.get("#navbar-container > .container").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("flex");
});
});
it("has a correct Navbar Item", () => {
cy.get("#navbar .navbar-start .navbar-item").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("flex");
});
});
it("has a correct active Navbar Item", () => {
cy.get("#navbar .navbar-start .navbar-item.is-active").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("transparent"));
});
});
it("has a correct Navbar Burger", () => {
cy.get("#navbar .navbar-burger").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.appearance).to.equal("none");
expect(cs.display).to.equal("none");
expect(cs.margin).to.equal("0px 0px 0px auto");
});
});
it("has a correct Navbar Menu", () => {
cy.get("#navbar .navbar-menu").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("flex");
});
});
it("has a correct Navbar Divider", () => {
cy.get("#navbar .navbar-divider").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("block");
});
});
it(`has correct color Navbars`, () => {
for (let i = 0; i < Cypress.env("color-names").length; i++) {
const name = Cypress.env("color-names")[i];
const baseColor = Cypress.env(name);
const invertColor = Cypress.env(`${name}-invert`);
const lightColor = Cypress.env(`${name}-light`);
const darkColor = Cypress.env(`${name}-dark`);
cy.get(`#navbar-${name} .navbar-link`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(invertColor);
});
cy.get(`#navbar-${name} .navbar-dropdown a.navbar-item.is-active`).then(
($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(baseColor);
expect(cs.color).to.equal(invertColor);
}
);
}
});
});

View File

@@ -0,0 +1,185 @@
import { setMobile, setTablet } from "../utils";
describe("Components/Pagination", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/components/pagination/");
});
it("has a Pagination", () => {
cy.get(".pagination").should("exist");
});
it("has a correct Pagination", () => {
cy.get("#pagination").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.alignItems).to.equal("center");
expect(cs.display).to.equal("flex");
expect(cs.textAlign).to.equal("center");
});
});
it("has a correct Pagination", () => {
cy.get(
"#pagination .pagination-previous,#pagination .pagination-next,#pagination .pagination-link,#pagination .pagination-ellipsis"
).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal("16px");
expect(cs.justifyContent).to.equal("center");
expect(cs.paddingLeft).to.equal("12px");
expect(cs.paddingRight).to.equal("12px");
expect(cs.textAlign).to.equal("center");
});
cy.get(
"#pagination .pagination-previous:not(.is-disabled),#pagination .pagination-next:not(.is-disabled),#pagination .pagination-link:not(.is-current)"
).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderColor).to.equal(Cypress.env("border"));
expect(cs.color).to.equal(Cypress.env("text-strong"));
expect(cs.minWidth).to.equal("40px");
});
cy.get("#pagination .pagination-previous.is-disabled").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("border"));
expect(cs.borderColor).to.equal(Cypress.env("border"));
expect(cs.boxShadow).to.equal("none");
expect(cs.color).to.equal(Cypress.env("text-light"));
expect(cs.opacity).to.equal("0.5");
});
cy.get("#pagination .pagination-link.is-current").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("link"));
expect(cs.borderColor).to.equal(Cypress.env("link"));
expect(cs.color).to.equal(Cypress.env("link-invert"));
});
cy.get(
"#pagination .pagination-previous:not(.is-disabled),#pagination .pagination-next:not(.is-disabled)"
).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.paddingLeft).to.equal("12px");
expect(cs.paddingRight).to.equal("12px");
expect(cs.whiteSpace).to.equal("nowrap");
});
cy.get("#pagination .pagination-ellipsis").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("grey-light"));
expect(cs.pointerEvents).to.equal("none");
});
cy.get("#pagination .pagination-list").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.flexWrap).to.equal("wrap");
});
});
});
// Mobile
describe("Components/Pagination Mobile", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/components/pagination/");
setMobile();
});
it("has a correct Pagination", () => {
cy.get("#pagination").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.flexWrap).to.equal("wrap");
expect(cs.justifyContent).to.equal("center");
});
cy.get(
"#pagination .pagination-previous,#pagination .pagination-next,#pagination .pagination-list li"
).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.flexGrow).to.equal("1");
expect(cs.flexShrink).to.equal("1");
});
cy.get(
"#pagination .pagination-previous,#pagination .pagination-next,#pagination .pagination-link,#pagination .pagination-ellipsis"
).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.margin).to.equal("4px");
});
});
});
// Tablet
describe("Components/Navbar Tablet", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/components/pagination/");
setTablet();
});
it("has a correct Pagination", () => {
cy.get("#pagination .pagination-list").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.marginBottom).to.equal("0px");
expect(cs.marginTop).to.equal("0px");
});
cy.get("#pagination .pagination-list").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.flexGrow).to.equal("1");
expect(cs.flexShrink).to.equal("1");
expect(cs.justifyContent).to.equal("flex-start");
expect(cs.order).to.equal("1");
});
cy.get(
"#pagination .pagination-previous,#pagination .pagination-next,#pagination .pagination-link,#pagination .pagination-ellipsis"
).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.marginBottom).to.equal("0px");
expect(cs.marginTop).to.equal("0px");
});
cy.get("#pagination .pagination-previous").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.order).to.equal("2");
});
cy.get("#pagination .pagination-next").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.order).to.equal("3");
});
});
it("has a correct Pagination alignments", () => {
cy.get("#pagination-centered .pagination-previous").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.order).to.equal("1");
});
cy.get("#pagination-centered .pagination-list").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.justifyContent).to.equal("center");
expect(cs.order).to.equal("2");
});
cy.get("#pagination-centered .pagination-next").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.order).to.equal("3");
});
cy.get("#pagination-right .pagination-previous").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.order).to.equal("1");
});
cy.get("#pagination-right .pagination-list").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.justifyContent).to.equal("flex-end");
expect(cs.order).to.equal("3");
});
cy.get("#pagination-right .pagination-next").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.order).to.equal("2");
});
});
});

View File

@@ -0,0 +1,124 @@
describe("Components/Panel", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/components/panel/");
});
it("has a Panel", () => {
cy.get(".panel").should("exist");
});
it("has a correct Panel", () => {
cy.get("#panel").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderRadius).to.equal("6px");
expect(cs.boxShadow).to.equal(
"rgba(10, 10, 10, 0.1) 0px 8px 16px -2px, rgba(10, 10, 10, 0.02) 0px 0px 0px 1px"
);
expect(cs.fontSize).to.equal("16px");
});
});
it("has a correct Panel colors", () => {
for (let i = 0; i < Cypress.env("color-names").length; i++) {
const name = Cypress.env("color-names")[i];
const baseColor = Cypress.env(name);
const invertColor = Cypress.env(`${name}-invert`);
const lightColor = Cypress.env(`${name}-light`);
const darkColor = Cypress.env(`${name}-dark`);
cy.get(`#panel-${name} .panel-heading`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(baseColor);
expect(cs.color).to.equal(invertColor);
});
cy.get(`#panel-${name} .panel-tabs a.is-active`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderBottomColor).to.equal(baseColor);
});
cy.get(`#panel-${name} .panel-block.is-active .panel-icon`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(baseColor);
});
}
});
it("has a correct Panel Heading", () => {
cy.get("#panel .panel-heading").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("grey-lightest"));
expect(cs.borderRadius).to.equal("6px 6px 0px 0px");
expect(cs.color).to.equal(Cypress.env("text-strong"));
expect(cs.fontSize).to.equal("20px");
expect(cs.fontWeight).to.equal("700");
expect(cs.lineHeight).to.equal("25px");
expect(cs.padding).to.equal("15px 20px");
});
});
it("has correct Panel Tabs", () => {
cy.get("#panel .panel-tabs").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.alignItems).to.equal("flex-end");
expect(cs.display).to.equal("flex");
expect(cs.fontSize).to.equal("14px");
expect(cs.justifyContent).to.equal("center");
});
cy.get("#panel .panel-tabs a:not(.is-active)").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderBottomColor).to.equal(Cypress.env("border"));
expect(cs.borderBottomStyle).to.equal("solid");
expect(cs.borderBottomWidth).to.equal("1px");
expect(cs.marginBottom).to.equal("-1px");
expect(cs.padding).to.equal("7px");
});
cy.get("#panel .panel-tabs a.is-active").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderBottomColor).to.equal(Cypress.env("grey-dark"));
expect(cs.color).to.equal(Cypress.env("grey-darker"));
});
});
it("has correct Panel Block", () => {
cy.get("#panel .panel-block").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.alignItems).to.equal("center");
expect(cs.color).to.equal(Cypress.env("text-strong"));
expect(cs.display).to.equal("flex");
expect(cs.justifyContent).to.equal("flex-start");
expect(cs.padding).to.equal("8px 12px");
});
cy.get("#panel .panel-block.is-wrapped").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.flexWrap).to.equal("wrap");
});
cy.get("#panel .panel-block.is-active").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderLeftColor).to.equal(Cypress.env("link"));
expect(cs.color).to.equal(Cypress.env("grey-darker"));
});
cy.get("#panel .panel-block.is-active .panel-icon").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("link"));
});
cy.get("#panel .panel-block:last-child").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderBottomLeftRadius).to.equal("6px");
expect(cs.borderBottomRightRadius).to.equal("6px");
});
});
it("has correct Panel Icon", () => {
cy.get("#panel .panel-block:not(.is-active) .panel-icon").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("text-light"));
});
});
});

View File

@@ -0,0 +1,103 @@
describe("Components/Tabs", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/components/tabs/");
});
it("has a Tabs", () => {
cy.get(".tabs").should("exist");
});
it("has a correct Tabs", () => {
cy.get("#tabs").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.alignItems).to.equal("stretch");
expect(cs.display).to.equal("flex");
expect(cs.fontSize).to.equal("16px");
expect(cs.justifyContent).to.equal("space-between");
expect(cs.whiteSpace).to.equal("nowrap");
});
cy.get("#tabs li:not(.is-active) a").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.alignItems).to.equal("center");
expect(cs.borderBottomColor).to.equal(Cypress.env("border"));
expect(cs.borderBottomStyle).to.equal("solid");
expect(cs.borderBottomWidth).to.equal("1px");
expect(cs.color).to.equal(Cypress.env("text"));
expect(cs.display).to.equal("flex");
expect(cs.justifyContent).to.equal("center");
expect(cs.marginBottom).to.equal("-1px");
expect(cs.padding).to.equal("8px 16px");
expect(cs.verticalAlign).to.equal("top");
});
cy.get("#tabs li.is-active a").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderBottomColor).to.equal(Cypress.env("link"));
expect(cs.color).to.equal(Cypress.env("link"));
});
cy.get("#tabs ul").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.alignItems).to.equal("center");
expect(cs.borderBottomColor).to.equal(Cypress.env("border"));
expect(cs.borderBottomStyle).to.equal("solid");
expect(cs.borderBottomWidth).to.equal("1px");
expect(cs.display).to.equal("flex");
expect(cs.flexGrow).to.equal("1");
expect(cs.flexShrink).to.equal("0");
expect(cs.justifyContent).to.equal("flex-start");
});
});
it("has a correct Tabs alignments", () => {
cy.get("#tabs-centered ul").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.justifyContent).to.equal("center");
});
cy.get("#tabs-right ul").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.justifyContent).to.equal("flex-end");
});
});
it("has a correct Tabs lists alignments", () => {
cy.get("#tabs-lists ul.is-left").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.paddingRight).to.equal("12px");
});
cy.get("#tabs-lists ul.is-center").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.flex).to.equal("0 0 auto");
expect(cs.justifyContent).to.equal("center");
expect(cs.paddingLeft).to.equal("12px");
expect(cs.paddingRight).to.equal("12px");
});
cy.get("#tabs-lists ul.is-right").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.justifyContent).to.equal("flex-end");
expect(cs.paddingLeft).to.equal("12px");
});
});
it("has a correct boxed Tabs", () => {
cy.get("#tabs-boxed li:not(.is-active) a").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderColor).to.equal(Cypress.env("transparent"));
expect(cs.borderRadius).to.equal("4px 4px 0px 0px");
});
cy.get("#tabs-boxed li.is-active a").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("scheme-main"));
expect(cs.borderColor).to.equal(
`${Cypress.env("border")} ${Cypress.env("border")} ${Cypress.env(
"transparent"
)}`
);
});
});
});

View File

@@ -0,0 +1,22 @@
describe("Elements/Box", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/elements/box/");
});
it("has a Box element", () => {
cy.get(".box").should("exist");
});
it("has a correct Box", () => {
cy.get(".box").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("scheme-main"));
expect(cs.borderRadius).to.equal("6px");
expect(cs.boxShadow).to.equal(
"rgba(10, 10, 10, 0.1) 0px 8px 16px -2px, rgba(10, 10, 10, 0.02) 0px 0px 0px 1px"
);
expect(cs.color).to.equal(Cypress.env("text"));
expect(cs.padding).to.equal("20px");
});
});
});

View File

@@ -0,0 +1,124 @@
describe("Elements/Button", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/elements/button/");
});
it("has a Button", () => {
cy.get(".button").should("exist");
});
it("has a correct Button", () => {
cy.get("#button-default").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("white"));
expect(cs.borderColor).to.equal(Cypress.env("grey-lighter"));
expect(cs.borderRadius).to.equal("4px");
expect(cs.color).to.equal(Cypress.env("grey-darker"));
expect(cs.height).to.equal("40px");
expect(cs.lineHeight).to.equal("24px");
expect(cs.padding).to.equal("7px 16px");
});
});
// States
it("has a correct hover Button", () => {
cy.get("#button-hover").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("white"));
expect(cs.borderColor).to.equal(Cypress.env("grey-light"));
expect(cs.borderRadius).to.equal("4px");
expect(cs.color).to.equal(Cypress.env("grey-darker"));
expect(cs.height).to.equal("40px");
expect(cs.lineHeight).to.equal("24px");
expect(cs.padding).to.equal("7px 16px");
});
});
it("has a correct focus Button", () => {
cy.get("#button-focus").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("white"));
expect(cs.borderColor).to.equal(Cypress.env("blue"));
expect(cs.borderRadius).to.equal("4px");
expect(cs.boxShadow).to.equal(
`rgba${Cypress.env("blue").slice(3, -1)}, 0.25) 0px 0px 0px 2px`
);
expect(cs.color).to.equal(Cypress.env("grey-darker"));
expect(cs.height).to.equal("40px");
expect(cs.lineHeight).to.equal("24px");
expect(cs.padding).to.equal("7px 16px");
});
});
// Colors
it(`has correct color Buttons`, () => {
for (let i = 0; i < Cypress.env("color-names").length; i++) {
const name = Cypress.env("color-names")[i];
const baseColor = Cypress.env(name);
const invertColor = Cypress.env(`${name}-invert`);
const lightColor = Cypress.env(`${name}-light`);
const darkColor = Cypress.env(`${name}-dark`);
cy.get(`#button-${name}`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(baseColor);
expect(cs.borderColor).to.equal(Cypress.env("transparent"));
expect(cs.color).to.equal(invertColor);
});
cy.get(`#button-${name}-hover`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderColor).to.equal(Cypress.env("transparent"));
expect(cs.color).to.equal(invertColor);
});
cy.get(`#button-${name}-focus`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.boxShadow).to.equal(
`rgba${baseColor.slice(3, -1)}, 0.25) 0px 0px 0px 2px`
);
expect(cs.borderColor).to.equal(Cypress.env("transparent"));
expect(cs.color).to.equal(invertColor);
});
cy.get(`#button-${name}-active`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderColor).to.equal(Cypress.env("transparent"));
expect(cs.color).to.equal(invertColor);
});
cy.get(`#button-${name}-inverted`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(invertColor);
expect(cs.color).to.equal(baseColor);
});
cy.get(`#button-${name}-outlined`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("transparent"));
expect(cs.borderColor).to.equal(baseColor);
expect(cs.color).to.equal(baseColor);
});
cy.get(`#button-${name}-outlined-hover`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(baseColor);
expect(cs.borderColor).to.equal(baseColor);
expect(cs.color).to.equal(invertColor);
});
cy.get(`#button-${name}-inverted-outlined`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("transparent"));
expect(cs.borderColor).to.equal(invertColor);
expect(cs.color).to.equal(invertColor);
});
cy.get(`#button-${name}-light`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(lightColor);
expect(cs.color).to.equal(darkColor);
});
}
});
});

View File

@@ -0,0 +1,159 @@
import { setMobile, setDesktop, setWidescreen, setFullHD } from "../utils";
describe("Elements/Container", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/elements/container/");
});
it("has a Container element", () => {
cy.get("#container").should("exist");
});
it("has fullwidth mobile Containers", () => {
setMobile();
let viewport;
cy.document()
.then((doc) => {
return doc.documentElement.getBoundingClientRect();
})
.then((rect) => {
viewport = rect;
});
cy.get("#container").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.width).to.equal(`${viewport.width}px`);
});
cy.get("#container-fluid").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.width).to.equal(`${viewport.width}px`);
});
cy.get("#container-max-desktop").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.width).to.equal(`${viewport.width}px`);
});
cy.get("#container-max-widescreen").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.width).to.equal(`${viewport.width}px`);
});
});
it("has centered desktop Containers", () => {
setDesktop();
let viewport;
cy.document()
.then((doc) => {
return doc.documentElement.getBoundingClientRect();
})
.then((rect) => {
viewport = rect;
});
cy.get("#container").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.width).to.equal("960px");
});
cy.get("#container-widescreen").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.width).to.equal(`${viewport.width}px`);
});
cy.get("#container-fullhd").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.width).to.equal(`${viewport.width}px`);
});
});
it("has centered widescreen Containers", () => {
setWidescreen();
let viewport;
cy.document()
.then((doc) => {
return doc.documentElement.getBoundingClientRect();
})
.then((rect) => {
viewport = rect;
});
cy.get("#container").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.width).to.equal("1152px");
});
cy.get("#container-max-desktop").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.width).to.equal("960px");
});
cy.get("#container-widescreen").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.width).to.equal("1152px");
});
cy.get("#container-fullhd").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.width).to.equal(`${viewport.width}px`);
});
});
it("has centered fullhd Containers", () => {
setFullHD();
cy.get("#container").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.width).to.equal("1344px");
});
cy.get("#container-max-desktop").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.width).to.equal("960px");
});
cy.get("#container-max-widescreen").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.width).to.equal("1152px");
});
cy.get("#container-widescreen").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.width).to.equal("1344px");
});
cy.get("#container-fullhd").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.width).to.equal("1344px");
});
});
it("has a fullwidth fluid Container", () => {
cy.viewport(
Cypress.env("viewports").fullhd[0],
Cypress.env("viewports").fullhd[1]
);
let viewport;
cy.document()
.then((doc) => {
return doc.documentElement.getBoundingClientRect();
})
.then((rect) => {
viewport = rect;
});
cy.get("#container-fluid").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.width).to.equal(`${viewport.width}px`);
});
});
});

View File

@@ -0,0 +1,68 @@
describe("Elements/Content", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/elements/content/");
});
it("has a Content element", () => {
cy.get(".content").should("exist");
});
it("has correct headings", () => {
cy.get(".content h1").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal("32px");
});
cy.get(".content h2").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal("28px");
});
cy.get(".content h3").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal("24px");
});
cy.get(".content h4").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal("20px");
});
cy.get(".content h5").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal("18px");
});
cy.get(".content h6").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal("16px");
});
});
it("has a correct blockquote", () => {
cy.get(".content blockquote").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("white-ter"));
expect(cs.padding).to.equal("20px 24px");
});
});
it("has correct lists", () => {
cy.get(".content ol li").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.listStyleType).to.equal("decimal");
});
cy.get(".content ul li").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.listStyleType).to.equal("disc");
});
});
it("has a correct pre", () => {
cy.get(".content pre").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.padding).to.equal("17.5px 21px");
});
});
});

View File

@@ -0,0 +1,60 @@
describe("Elements/Icon", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/elements/icon/");
});
it("has a .icon element", () => {
cy.get(".icon").should("exist");
});
it("has a correct Icon element", () => {
cy.get("#icon").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.height).to.equal("24px");
expect(cs.width).to.equal("24px");
});
});
it("has correct Icon sizes", () => {
cy.get("#icon-small").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.height).to.equal("16px");
expect(cs.width).to.equal("16px");
});
cy.get("#icon-normal").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.height).to.equal("24px");
expect(cs.width).to.equal("24px");
});
cy.get("#icon-medium").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.height).to.equal("32px");
expect(cs.width).to.equal("32px");
});
cy.get("#icon-large").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.height).to.equal("48px");
expect(cs.width).to.equal("48px");
});
});
it("has correct Icon Text elements", () => {
cy.get("#icon-text").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("inline-flex");
});
cy.get("#icon-text > .icon").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.marginRight).to.equal("4px");
});
cy.get("#icon-text-div").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("flex");
});
});
});

View File

@@ -0,0 +1,63 @@
describe("Elements/Image", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/elements/image/");
});
it("has a Image", () => {
cy.get(".image").should("exist");
});
it("has a correct Image", () => {
cy.get("#image").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.height).to.equal("128px");
expect(cs.width).to.equal("128px");
});
});
it("has a correct rounded Image", () => {
cy.get("#image-rounded img").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderRadius).to.equal("9999px");
});
});
it("has a correct Image dimensions", () => {
[16, 24, 32, 48, 64, 96, 128].forEach((dimension) => {
cy.get(`#image-${dimension}`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.height).to.equal(`${dimension}px`);
expect(cs.width).to.equal(`${dimension}px`);
});
});
});
it("has correct Image ratios", () => {
[
["1by1", 1],
["5by4", 0.8],
["4by3", 0.75],
["3by2", 0.6666],
["5by3", 0.6],
["16by9", 0.5625],
["2by1", 0.5],
["3by1", 0.3333],
["4by5", 1.25],
["3by4", 1.3333],
["2by3", 1.5],
["3by5", 1.6666],
["9by16", 1.7777],
["1by2", 2],
["1by3", 3],
].forEach((ratio) => {
cy.get(`#image-${ratio[0]} img`).then(($) => {
const cs = window.getComputedStyle($[0]);
const height = cs.height.substring(0, cs.height.length - 2);
expect(`${Math.round(height)}px`).to.equal(
`${Math.round(100 * ratio[1])}px`
);
expect(cs.width).to.equal("100px");
});
});
});
});

View File

@@ -0,0 +1,40 @@
describe("Elements/Notification", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/elements/notification/");
});
it("has a Notification element", () => {
cy.get("#notification").should("exist");
});
it("has a correct Notification", () => {
cy.get("#notification").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("white-ter"));
expect(cs.borderRadius).to.equal("4px");
expect(cs.padding).to.equal("20px 40px 20px 24px");
});
});
it(`has correct color Notifications`, () => {
for (let i = 0; i < Cypress.env("color-names").length; i++) {
const name = Cypress.env("color-names")[i];
const baseColor = Cypress.env(name);
const invertColor = Cypress.env(`${name}-invert`);
const lightColor = Cypress.env(`${name}-light`);
const darkColor = Cypress.env(`${name}-dark`);
cy.get(`#notification-${name}`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(baseColor);
expect(cs.color).to.equal(invertColor);
});
cy.get(`#notification-${name}-light`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(lightColor);
expect(cs.color).to.equal(darkColor);
});
}
});
});

View File

@@ -0,0 +1,126 @@
describe("Elements/Other", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/elements/other/");
});
it("has a Block element", () => {
cy.get(".block").should("exist");
});
it("has a correct Block", () => {
cy.get("#block").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.marginBottom).to.equal("24px");
});
});
it("has a Delete element", () => {
cy.get(".delete").should("exist");
});
it("has a correct Delete", () => {
cy.get("#delete").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal("rgba(10, 10, 10, 0.2)");
expect(cs.borderColor).to.equal(Cypress.env("grey-dark"));
expect(cs.borderStyle).to.equal("none");
expect(cs.borderRadius).to.equal("9999px");
expect(cs.borderWidth).to.equal("0px");
expect(cs.cursor).to.equal("pointer");
expect(cs.display).to.equal("inline-block");
expect(cs.flexGrow).to.equal("0");
expect(cs.flexShrink).to.equal("0");
expect(cs.fontSize).to.equal("0px");
expect(cs.height).to.equal("20px");
expect(cs.maxHeight).to.equal("20px");
expect(cs.maxWidth).to.equal("20px");
expect(cs.minHeight).to.equal("20px");
expect(cs.minWidth).to.equal("20px");
expect(cs.outlineColor).to.equal(Cypress.env("grey-dark"));
expect(cs.outlineStyle).to.equal("none");
expect(cs.outlineWidth).to.equal("0px");
expect(cs.pointerEvents).to.equal("auto");
expect(cs.position).to.equal("relative");
expect(cs.verticalAlign).to.equal("top");
expect(cs.width).to.equal("20px");
const before = window.getComputedStyle($[0], "before");
expect(before.backgroundColor).to.equal(Cypress.env("scheme-main"));
expect(before.content).to.equal('""');
expect(before.display).to.equal("block");
expect(before.height).to.equal("2px");
expect(before.left).to.equal("10px");
expect(before.position).to.equal("absolute");
expect(before.top).to.equal("10px");
expect(before.width).to.equal("10px");
const after = window.getComputedStyle($[0], "after");
expect(after.backgroundColor).to.equal(Cypress.env("scheme-main"));
expect(after.content).to.equal('""');
expect(after.display).to.equal("block");
expect(after.height).to.equal("10px");
expect(after.left).to.equal("10px");
expect(after.position).to.equal("absolute");
expect(after.top).to.equal("10px");
expect(after.width).to.equal("2px");
});
});
it("has a correct small Delete", () => {
cy.get("#delete-small").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.height).to.equal("16px");
expect(cs.maxHeight).to.equal("16px");
expect(cs.maxWidth).to.equal("16px");
expect(cs.minHeight).to.equal("16px");
expect(cs.minWidth).to.equal("16px");
expect(cs.width).to.equal("16px");
});
});
it("has a correct medium Delete", () => {
cy.get("#delete-medium").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.height).to.equal("24px");
expect(cs.maxHeight).to.equal("24px");
expect(cs.maxWidth).to.equal("24px");
expect(cs.minHeight).to.equal("24px");
expect(cs.minWidth).to.equal("24px");
expect(cs.width).to.equal("24px");
});
});
it("has a correct large Delete", () => {
cy.get("#delete-large").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.height).to.equal("32px");
expect(cs.maxHeight).to.equal("32px");
expect(cs.maxWidth).to.equal("32px");
expect(cs.minHeight).to.equal("32px");
expect(cs.minWidth).to.equal("32px");
expect(cs.width).to.equal("32px");
});
});
it("has a correct Loader", () => {
cy.get("#loader").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.animationDuration).to.equal("0.5s");
expect(cs.animationIterationCount).to.equal("infinite");
expect(cs.animationName).to.equal("spinAround");
expect(cs.animationTimingFunction).to.equal("linear");
expect(cs.borderBottomColor).to.equal(Cypress.env("grey-lighter"));
expect(cs.borderLeftColor).to.equal(Cypress.env("grey-lighter"));
expect(cs.borderRightColor).to.equal(Cypress.env("transparent"));
expect(cs.borderTopColor).to.equal(Cypress.env("transparent"));
expect(cs.borderRadius).to.equal("9999px");
expect(cs.borderStyle).to.equal("solid");
expect(cs.borderWidth).to.equal("2px");
expect(cs.content).to.equal('""');
expect(cs.display).to.equal("block");
expect(cs.height).to.equal("16px");
expect(cs.position).to.equal("relative");
expect(cs.width).to.equal("16px");
});
});
});

View File

@@ -0,0 +1,38 @@
describe("Elements/Progress", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/elements/progress/");
});
it("has a Progress element", () => {
cy.get("#progress").should("exist");
});
it("has a correct Progress", () => {
cy.get("#progress").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.height).to.equal(`${Cypress.env("sizes").normal}px`);
});
});
it("has correct Progress sizes", () => {
cy.get("#progress-small").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.height).to.equal(`${Cypress.env("sizes").small}px`);
});
cy.get("#progress-normal").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.height).to.equal(`${Cypress.env("sizes").normal}px`);
});
cy.get("#progress-medium").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.height).to.equal(`${Cypress.env("sizes").medium}px`);
});
cy.get("#progress-large").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.height).to.equal(`${Cypress.env("sizes").large}px`);
});
});
});

View File

@@ -0,0 +1,53 @@
describe("Elements/Table", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/elements/table/");
});
it("has a Table element", () => {
cy.get("#table").should("exist");
});
it("has a correct Table", () => {
cy.get("#table").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("white"));
expect(cs.color).to.equal(Cypress.env("text-strong"));
});
cy.get("#table tr.is-selected").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("primary"));
expect(cs.color).to.equal(Cypress.env("primary-invert"));
});
});
it("has a correct bordered Table", () => {
cy.get("#table-bordered th, #table-bordered td").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderWidth).to.equal("1px");
});
});
it("has a correct striped Table", () => {
cy.get("#table-striped tbody tr:not(.is-selected):nth-child(even)").then(
($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("white-bis"));
}
);
});
it("has a correct narrow Table", () => {
cy.get("#table-narrow th, #table-narrow td").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.padding).to.equal("4px 8px");
});
});
it("has a correct fullwidth Table", () => {
cy.get("#table-fullwidth").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.width).to.equal("800px");
});
});
});

View File

@@ -0,0 +1,107 @@
describe("Elements/Tag", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/elements/tag/");
});
it("has a Tag", () => {
cy.get(".tag").should("exist");
});
it("has a correct Tag", () => {
cy.get("#tag").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("white-ter"));
expect(cs.borderRadius).to.equal("4px");
expect(cs.color).to.equal(Cypress.env("grey-dark"));
expect(cs.fontSize).to.equal("12px");
expect(cs.height).to.equal("24px");
expect(cs.padding).to.equal("0px 9px");
});
cy.get("#tag-rounded").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderRadius).to.equal("9999px");
});
});
it("has a correct Tag sizes", () => {
cy.get("#tag-normal").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal("12px");
expect(cs.height).to.equal("24px");
});
cy.get("#tag-medium").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal("16px");
expect(cs.height).to.equal("32px");
});
cy.get("#tag-large").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal("20px");
expect(cs.height).to.equal("40px");
});
});
// Colors
it(`has correct color Tags`, () => {
for (let i = 0; i < Cypress.env("color-names").length; i++) {
const name = Cypress.env("color-names")[i];
const baseColor = Cypress.env(name);
const invertColor = Cypress.env(`${name}-invert`);
const lightColor = Cypress.env(`${name}-light`);
const darkColor = Cypress.env(`${name}-dark`);
cy.get(`#tag-${name}`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(baseColor);
expect(cs.color).to.equal(invertColor);
});
cy.get(`#tag-${name}-light`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(lightColor);
expect(cs.color).to.equal(darkColor);
});
}
});
it("has correct Tags containers", () => {
cy.get("#tags").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("flex");
});
cy.get("#tags .tag").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.marginBottom).to.equal("8px");
});
cy.get("#tags-medium .tag").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal("16px");
});
cy.get("#tags-large .tag").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal("20px");
});
cy.get("#tags-centered").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.justifyContent).to.equal("center");
});
cy.get("#tags-right").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.justifyContent).to.equal("flex-end");
});
cy.get("#tags-addons .tag:nth-child(2)").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderRadius).to.equal("0px");
expect(cs.marginRight).to.equal("0px");
});
});
});

View File

@@ -0,0 +1,63 @@
describe("Elements/Title", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/elements/title/");
});
it("has a Title", () => {
cy.get(".title").should("exist");
});
it("has a correct Title", () => {
cy.get("#title").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("text-strong"));
expect(cs.fontSize).to.equal(`${Cypress.env("sizes")["3"]}px`);
expect(cs.fontWeight).to.equal("600");
expect(cs.lineHeight).to.equal(`${Cypress.env("sizes")["3"] * 1.125}px`);
});
cy.get("#title strong").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("text-strong"));
expect(cs.fontWeight).to.equal("600");
});
});
it("has correct Title sizes", () => {
for (let i = 1; i <= 7; i++) {
cy.get(`#title-${i}`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal(`${Cypress.env("sizes")[i]}px`);
});
}
});
it("has a Subtitle", () => {
cy.get(".subtitle").should("exist");
});
it("has a correct Subtitle", () => {
cy.get("#subtitle").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("text"));
expect(cs.fontSize).to.equal(`${Cypress.env("sizes")["5"]}px`);
expect(cs.fontWeight).to.equal("400");
expect(cs.lineHeight).to.equal(`${Cypress.env("sizes")["5"] * 1.25}px`);
});
cy.get("#subtitle strong").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("text-strong"));
expect(cs.fontWeight).to.equal("600");
});
});
it("has correct Subtitle sizes", () => {
for (let i = 1; i <= 7; i++) {
cy.get(`#subtitle-${i}`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal(`${Cypress.env("sizes")[i]}px`);
});
}
});
});

View File

@@ -0,0 +1,77 @@
describe("Form/Checkbox", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/form/checkbox-radio/");
});
it("has a Checkbox", () => {
cy.get(".checkbox").should("exist");
});
it("has a correct Checkbox", () => {
cy.get("#checkbox").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.cursor).to.equal("pointer");
expect(cs.display).to.equal("inline-block");
expect(cs.lineHeight).to.equal("20px");
expect(cs.position).to.equal("relative");
});
cy.get("#checkbox input").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.cursor).to.equal("pointer");
});
});
it("has a correct disabled Checkbox", () => {
cy.get("#checkbox-disabled").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("text-light"));
expect(cs.cursor).to.equal("not-allowed");
});
cy.get("#checkbox-disabled input").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.cursor).to.equal("not-allowed");
});
});
});
describe("Form/Radio", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/form/checkbox-radio/");
});
it("has a Radio", () => {
cy.get(".radio").should("exist");
});
it("has a correct Radio", () => {
cy.get("#radio .radio").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.cursor).to.equal("pointer");
expect(cs.display).to.equal("inline-block");
expect(cs.lineHeight).to.equal("20px");
expect(cs.position).to.equal("relative");
});
cy.get("#radio input").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.cursor).to.equal("pointer");
});
});
it("has a correct disabled Radio", () => {
cy.get("#radio .radio[disabled]").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("text-light"));
expect(cs.cursor).to.equal("not-allowed");
});
});
it("has correct Radio spacing", () => {
cy.get("#radio .radio + .radio").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.marginLeft).to.equal("8px");
});
});
});

View File

@@ -0,0 +1,156 @@
describe("Form/File", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/form/file/");
});
it("has a File", () => {
cy.get(".file").should("exist");
});
it("has a correct File", () => {
cy.get("#file").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("flex");
expect(cs.justifyContent).to.equal("flex-start");
expect(cs.position).to.equal("relative");
});
cy.get("#file .file-input").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.opacity).to.equal("0");
expect(cs.position).to.equal("absolute");
});
cy.get("#file .file-cta, #file .file-name").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderColor).to.equal(Cypress.env("border"));
expect(cs.borderRadius).to.equal("4px");
});
cy.get("#file .file-cta").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("scheme-main-ter"));
expect(cs.color).to.equal(Cypress.env("text"));
});
cy.get("#file .file-icon").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.alignItems).to.equal("center");
expect(cs.display).to.equal("flex");
expect(cs.height).to.equal("16px");
expect(cs.justifyContent).to.equal("center");
expect(cs.width).to.equal("16px");
});
});
it(`has correct color File`, () => {
for (let i = 0; i < Cypress.env("color-names").length; i++) {
const name = Cypress.env("color-names")[i];
const baseColor = Cypress.env(name);
const invertColor = Cypress.env(`${name}-invert`);
const lightColor = Cypress.env(`${name}-light`);
const darkColor = Cypress.env(`${name}-dark`);
cy.get(`#file-${name} .file-cta`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(baseColor);
expect(cs.color).to.equal(invertColor);
});
}
});
it("has correct File sizes", () => {
cy.get("#file-small").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal(`${Cypress.env("sizes").small}px`);
});
cy.get("#file-normal").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal(`${Cypress.env("sizes").normal}px`);
});
cy.get("#file-medium").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal(`${Cypress.env("sizes").medium}px`);
});
cy.get("#file-large").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal(`${Cypress.env("sizes").large}px`);
});
});
it("has correct File With Name", () => {
cy.get("#file-with-name .file-cta").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderBottomRightRadius).to.equal("0px");
expect(cs.borderTopRightRadius).to.equal("0px");
});
cy.get("#file-with-name .file-name").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderColor).to.equal(Cypress.env("border"));
expect(cs.borderStyle).to.equal("solid");
expect(cs.borderWidth).to.equal("1px 1px 1px 0px");
expect(cs.borderBottomLeftRadius).to.equal("0px");
expect(cs.borderTopLeftRadius).to.equal("0px");
expect(cs.display).to.equal("block");
expect(cs.overflow).to.equal("hidden");
});
});
it("has correct File Boxed", () => {
cy.get("#file-boxed .file-label").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.flexDirection).to.equal("column");
});
cy.get("#file-boxed .file-cta").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.flexDirection).to.equal("column");
expect(cs.padding).to.equal("16px 48px");
});
cy.get("#file-boxed .file-name").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderWidth).to.equal("0px 1px 1px");
});
});
it("has correct File Centered", () => {
cy.get("#file-centered").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.justifyContent).to.equal("center");
});
});
it("has correct File Right", () => {
cy.get("#file-right").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.justifyContent).to.equal("flex-end");
});
cy.get("#file-right .file-cta").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderBottomLeftRadius).to.equal("0px");
expect(cs.borderTopLeftRadius).to.equal("0px");
});
cy.get("#file-right .file-name").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderBottomRightRadius).to.equal("0px");
expect(cs.borderTopRightRadius).to.equal("0px");
expect(cs.borderWidth).to.equal("1px 0px 1px 1px");
expect(cs.order).to.equal("-1");
});
});
it("has correct File fullwidth", () => {
cy.get("#file-fullwidth .file-name").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.flexGrow).to.equal("1");
expect(cs.maxWidth).to.equal("none");
});
});
});

View File

@@ -0,0 +1,153 @@
describe("Form/Input", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/form/input-textarea/");
});
it("has a Input", () => {
cy.get(".input").should("exist");
});
it("has a correct Input", () => {
cy.get("#input").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.alignItems).to.equal("center");
expect(cs.borderStyle).to.equal("solid");
expect(cs.borderWidth).to.equal("1px");
expect(cs.borderRadius).to.equal(Cypress.env("control-radius"));
expect(cs.boxShadow).to.equal(Cypress.env("input-shadow"));
expect(cs.display).to.equal("inline-flex");
expect(cs.fontSize).to.equal(Cypress.env("size-normal"));
expect(cs.height).to.equal(Cypress.env("control-height"));
expect(cs.justifyContent).to.equal("flex-start");
expect(cs.lineHeight).to.equal(Cypress.env("control-line-height"));
expect(cs.paddingBottom).to.equal(
Cypress.env("control-padding-vertical")
);
expect(cs.paddingLeft).to.equal(
Cypress.env("control-padding-horizontal")
);
expect(cs.paddingRight).to.equal(
Cypress.env("control-padding-horizontal")
);
expect(cs.paddingTop).to.equal(Cypress.env("control-padding-vertical"));
expect(cs.position).to.equal("relative");
expect(cs.verticalAlign).to.equal("top");
});
});
it(`has correct color Input`, () => {
for (let i = 0; i < Cypress.env("color-names").length; i++) {
const name = Cypress.env("color-names")[i];
const baseColor = Cypress.env(name);
const invertColor = Cypress.env(`${name}-invert`);
const lightColor = Cypress.env(`${name}-light`);
const darkColor = Cypress.env(`${name}-dark`);
cy.get(`#input-${name}`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderColor).to.equal(baseColor);
});
}
});
it("has correct Input sizes", () => {
for (let i = 0; i < Cypress.env("just-sizes").length; i++) {
const size = Cypress.env("just-sizes")[i];
cy.get(`#input-${size}`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal(`${Cypress.env("sizes")[size]}px`);
});
}
});
it("has a correct fullwidth Input", () => {
let viewport;
cy.document()
.then((doc) => {
return doc.documentElement.getBoundingClientRect();
})
.then((rect) => {
viewport = rect;
});
cy.get("#input-fullwidth").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("block");
expect(cs.width).to.equal(`${viewport.width}px`);
});
});
it("has a correct fullwidth Input", () => {
cy.get("#input-inline").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("inline");
});
});
it("has a correct rounded Input", () => {
cy.get("#input-rounded").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderRadius).to.equal("9999px");
expect(cs.paddingLeft).to.equal("17px");
expect(cs.paddingRight).to.equal("17px");
});
});
it("has a correct static Input", () => {
cy.get("#input-static").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("transparent"));
expect(cs.borderColor).to.equal(Cypress.env("transparent"));
expect(cs.boxShadow).to.equal("none");
expect(cs.paddingLeft).to.equal("0px");
expect(cs.paddingRight).to.equal("0px");
});
});
});
describe("Form/Textarea", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/form/input-textarea/");
});
it("has a Textarea", () => {
cy.get(".textarea").should("exist");
});
it("has a correct Textarea", () => {
cy.get("#textarea").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.alignItems).to.equal("center");
expect(cs.borderStyle).to.equal("solid");
expect(cs.borderWidth).to.equal("1px");
expect(cs.borderRadius).to.equal(Cypress.env("control-radius"));
expect(cs.boxShadow).to.equal(Cypress.env("input-shadow"));
expect(cs.display).to.equal("block");
expect(cs.fontSize).to.equal(Cypress.env("size-normal"));
expect(cs.justifyContent).to.equal("flex-start");
expect(cs.lineHeight).to.equal(Cypress.env("control-line-height"));
expect(cs.paddingBottom).to.equal(
Cypress.env("control-padding-horizontal")
);
expect(cs.paddingLeft).to.equal(
Cypress.env("control-padding-horizontal")
);
expect(cs.paddingRight).to.equal(
Cypress.env("control-padding-horizontal")
);
expect(cs.paddingTop).to.equal(Cypress.env("control-padding-horizontal"));
expect(cs.position).to.equal("relative");
expect(cs.resize).to.equal("vertical");
expect(cs.verticalAlign).to.equal("top");
});
});
it("has a correct Textarea fixed", () => {
cy.get("#textarea-fixed").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.resize).to.equal("none");
});
});
});

View File

@@ -0,0 +1,86 @@
describe("Form/Select", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/form/select/");
});
it("has a Select", () => {
cy.get(".select").should("exist");
});
it("has a correct Select", () => {
cy.get("#select").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("inline-block");
expect(cs.height).to.equal(Cypress.env("control-height"));
expect(cs.maxWidth).to.equal("100%");
expect(cs.position).to.equal("relative");
expect(cs.verticalAlign).to.equal("top");
const after = window.getComputedStyle($[0], "after");
expect(after.borderColor).to.equal(Cypress.env("link"));
});
cy.get("#select select").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.cursor).to.equal("pointer");
expect(cs.display).to.equal("block");
expect(cs.fontSize).to.equal("16px");
expect(cs.height).to.equal(Cypress.env("control-height"));
expect(cs.maxWidth).to.equal("100%");
});
});
it(`has correct color Select`, () => {
for (let i = 0; i < Cypress.env("color-names").length; i++) {
const name = Cypress.env("color-names")[i];
const baseColor = Cypress.env(name);
const invertColor = Cypress.env(`${name}-invert`);
const lightColor = Cypress.env(`${name}-light`);
const darkColor = Cypress.env(`${name}-dark`);
cy.get(`#select-${name}`).then(($) => {
const after = window.getComputedStyle($[0], "after");
expect(after.borderColor).to.equal(baseColor);
});
cy.get(`#select-${name} select`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderColor).to.equal(baseColor);
});
}
});
it("has correct Select sizes", () => {
for (let i = 0; i < Cypress.env("just-sizes").length; i++) {
const size = Cypress.env("just-sizes")[i];
cy.get(`#select-${size}`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal(`${Cypress.env("sizes")[size]}px`);
});
}
});
it("has a correct Select multiple", () => {
cy.get("#select-multiple").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.height).to.not.equal(Cypress.env("control-height"));
});
cy.get("#select-multiple select").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.cursor).to.equal("pointer");
expect(cs.display).to.equal("block");
expect(cs.fontSize).to.equal("16px");
expect(cs.height).to.not.equal(Cypress.env("control-height"));
expect(cs.maxWidth).to.equal("100%");
});
});
it("has a correct Select disabled", () => {
cy.get("#select-disabled").then(($) => {
const after = window.getComputedStyle($[0], "after");
expect(after.borderColor).to.equal(Cypress.env("text-light"));
});
});
});

View File

@@ -0,0 +1,316 @@
import { setDesktop } from "../utils";
describe("Form/Label", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/form/tools/");
});
it("has a Label", () => {
cy.get(".label").should("exist");
});
it("has a correct Label", () => {
cy.get("#label").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("text-strong"));
expect(cs.display).to.equal("block");
expect(cs.fontSize).to.equal(Cypress.env("size-normal"));
expect(cs.fontWeight).to.equal(Cypress.env("weight-bold"));
});
});
it("has correct Label sizes", () => {
for (let i = 0; i < Cypress.env("just-sizes").length; i++) {
const size = Cypress.env("just-sizes")[i];
cy.get(`#label-${size}`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal(`${Cypress.env("sizes")[size]}px`);
});
}
});
});
describe("Form/Help", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/form/tools/");
});
it("has a Help", () => {
cy.get(".help").should("exist");
});
it("has a correct Help", () => {
cy.get("#help").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("block");
expect(cs.fontSize).to.equal(Cypress.env("size-small"));
expect(cs.marginTop).to.equal("4px");
});
});
it("has correct Help colors", () => {
for (let i = 0; i < Cypress.env("color-names").length; i++) {
const name = Cypress.env("color-names")[i];
const baseColor = Cypress.env(name);
const invertColor = Cypress.env(`${name}-invert`);
const lightColor = Cypress.env(`${name}-light`);
const darkColor = Cypress.env(`${name}-dark`);
cy.get(`#help-${name}`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(baseColor);
});
}
});
});
describe("Form/Field", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/form/tools/");
setDesktop();
});
it("has a Field", () => {
cy.get(".field").should("exist");
});
it("has a correct Field", () => {
cy.get("#field").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.marginBottom).to.equal("12px");
});
});
it("has a correct Field with addons", () => {
cy.get("#field-has-addons").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("flex");
expect(cs.justifyContent).to.equal("flex-start");
});
});
it("has a correct Field with addons centered", () => {
cy.get("#field-has-addons-centered").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.justifyContent).to.equal("center");
});
});
it("has a correct Field with addons right", () => {
cy.get("#field-has-addons-right").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.justifyContent).to.equal("flex-end");
});
});
it("has a correct Field with addons fullwidth .control", () => {
cy.get("#field-has-addons-fullwidth .control").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.flexGrow).to.equal("1");
expect(cs.flexShrink).to.equal("0");
});
});
it("has a correct Field grouped", () => {
cy.get("#field-is-grouped").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("flex");
expect(cs.justifyContent).to.equal("flex-start");
});
});
it("has a correct Field grouped centered", () => {
cy.get("#field-is-grouped-centered").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.justifyContent).to.equal("center");
});
});
it("has a correct Field grouped right", () => {
cy.get("#field-is-grouped-right").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.justifyContent).to.equal("flex-end");
});
});
it("has a correct Field grouped multiline", () => {
cy.get("#field-is-grouped-multiline").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.flexWrap).to.equal("wrap");
});
});
it("has a correct Field horizontal", () => {
cy.get("#field-is-horizontal").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("flex");
});
});
});
describe("Form/Field Label", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/form/tools/");
setDesktop();
});
it("has a Field Label", () => {
cy.get(".field-label").should("exist");
});
it("has a correct Field Label", () => {
cy.get("#field-label").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.flexBasis).to.equal("0px");
expect(cs.flexGrow).to.equal("1");
expect(cs.flexShrink).to.equal("0");
expect(cs.textAlign).to.equal("right");
});
cy.get("#field-label .label").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal("16px");
});
});
it("has correct Field Label sizes", () => {
for (let i = 0; i < Cypress.env("just-sizes").length; i++) {
const size = Cypress.env("just-sizes")[i];
cy.get(`#field-label-${size}`).then(($) => {
const cs = window.getComputedStyle($[0]);
const sizeValue = Cypress.env("sizes")[size];
expect(cs.fontSize).to.equal(`${sizeValue}px`);
expect(cs.paddingTop).to.equal(`${sizeValue * 0.375}px`);
});
}
});
});
describe("Form/Field Body", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/form/tools/");
setDesktop();
});
it("has a Field Body", () => {
cy.get(".field-body").should("exist");
});
it("has a correct Field Body", () => {
cy.get("#field-body").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("flex");
expect(cs.flexBasis).to.equal("0px");
expect(cs.flexGrow).to.equal("5");
expect(cs.flexShrink).to.equal("1");
});
cy.get("#field-body .field").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.marginBottom).to.equal("0px");
});
cy.get("#field-body > .field").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.flexShrink).to.equal("1");
});
cy.get("#field-body .field .field").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.marginBottom).to.equal("0px");
});
});
});
describe("Form/Control", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/form/tools/");
setDesktop();
});
it("has a Control", () => {
cy.get(".control").should("exist");
});
it("has a correct Control", () => {
cy.get("#control").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.boxSizing).to.equal("border-box");
expect(cs.clear).to.equal("both");
expect(cs.fontSize).to.equal(Cypress.env("size-normal"));
expect(cs.position).to.equal("relative");
expect(cs.textAlign).to.equal("start");
});
});
it("has a correct Control with icons left", () => {
cy.get("#control-has-icons-left .icon").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("grey-lighter"));
expect(cs.height).to.equal(Cypress.env("control-height"));
expect(cs.left).to.equal("0px");
expect(cs.pointerEvents).to.equal("none");
expect(cs.position).to.equal("absolute");
expect(cs.top).to.equal("0px");
expect(cs.width).to.equal(Cypress.env("control-height"));
expect(cs.zIndex).to.equal("4");
});
});
it("has a correct Control with icons right", () => {
cy.get("#control-has-icons-right .icon").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("grey-lighter"));
expect(cs.height).to.equal(Cypress.env("control-height"));
expect(cs.pointerEvents).to.equal("none");
expect(cs.position).to.equal("absolute");
expect(cs.right).to.equal("0px");
expect(cs.top).to.equal("0px");
expect(cs.width).to.equal(Cypress.env("control-height"));
expect(cs.zIndex).to.equal("4");
});
});
it("has a correct loading Control", () => {
cy.get("#control-loading").then(($) => {
const after = window.getComputedStyle($[0], "after");
expect(after.animationDuration).to.equal("0.5s");
expect(after.animationIterationCount).to.equal("infinite");
expect(after.animationName).to.equal("spinAround");
expect(after.animationTimingFunction).to.equal("linear");
expect(after.borderBottomColor).to.equal(Cypress.env("grey-lighter"));
expect(after.borderLeftColor).to.equal(Cypress.env("grey-lighter"));
expect(after.borderRightColor).to.equal(Cypress.env("transparent"));
expect(after.borderTopColor).to.equal(Cypress.env("transparent"));
expect(after.borderRadius).to.equal("9999px");
expect(after.borderStyle).to.equal("solid");
expect(after.borderWidth).to.equal("2px");
expect(after.content).to.equal('""');
expect(after.display).to.equal("block");
expect(after.height).to.equal("16px");
expect(after.position).to.equal("absolute");
expect(after.top).to.equal(`${0.625 * 16}px`);
expect(after.width).to.equal("16px");
expect(after.zIndex).to.equal("4");
});
cy.get("#control-loading-small").then(($) => {
const after = window.getComputedStyle($[0], "after");
expect(after.fontSize).to.equal(Cypress.env("size-small"));
});
cy.get("#control-loading-medium").then(($) => {
const after = window.getComputedStyle($[0], "after");
expect(after.fontSize).to.equal(Cypress.env("size-medium"));
});
cy.get("#control-loading-large").then(($) => {
const after = window.getComputedStyle($[0], "after");
expect(after.fontSize).to.equal(Cypress.env("size-large"));
});
});
});

View File

@@ -0,0 +1,242 @@
import {
setMobile,
setTablet,
setDesktop,
setWidescreen,
setFullHD,
} from "../utils";
const SCREENS = [
["-mobile", setMobile],
["-tablet", setTablet],
["-desktop", setDesktop],
["-widescreen", setWidescreen],
["-fullhd", setFullHD],
];
const WIDTHS = [
["three-quarters", 0.75],
["two-thirds", 0.6666],
["half", 0.5],
["one-third", 0.3333],
["one-quarter", 0.25],
["one-fifth", 0.2],
["two-fifths", 0.4],
["three-fifths", 0.6],
["four-fifths", 0.8],
];
describe("Grid/Columns", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/grid/columns/");
setDesktop();
});
it("has Columns", () => {
cy.get(".columns").should("exist");
});
it("has correct Columns", () => {
cy.get("#columns").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("flex");
expect(cs.marginBottom).to.equal("12px");
expect(cs.marginLeft).to.equal("-12px");
expect(cs.marginRight).to.equal("-12px");
expect(cs.marginTop).to.equal("-12px");
});
});
it("has correct last Columns", () => {
cy.get("#columns-last").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.marginBottom).to.equal("-12px");
});
});
it("has correct centered Columns", () => {
cy.get("#columns-centered").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.justifyContent).to.equal("center");
});
});
it("has correct gapless Columns", () => {
cy.get("#columns-gapless").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.marginBottom).to.equal("24px");
expect(cs.marginLeft).to.equal("0px");
expect(cs.marginRight).to.equal("0px");
expect(cs.marginTop).to.equal("0px");
});
cy.get("#columns-gapless .column").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.margin).to.equal("0px");
expect(cs.padding).to.equal("0px");
});
});
it("has correct gapless last Columns", () => {
cy.get("#columns-gapless-last").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.marginBottom).to.equal("0px");
});
});
it("has correct multiline Columns", () => {
cy.get("#columns-multiline").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.flexWrap).to.equal("wrap");
});
});
it("has correct vcentered Columns", () => {
cy.get("#columns-vcentered").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.alignItems).to.equal("center");
});
});
// Responsiveness
it("has correct mobile Columns", () => {
setMobile();
cy.get("#columns-mobile").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("flex");
});
setDesktop();
cy.get("#columns-mobile").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("flex");
});
});
it("has correct desktop Columns", () => {
setMobile();
cy.get("#columns-desktop").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("block");
});
setTablet();
cy.get("#columns-desktop").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("block");
});
setDesktop();
cy.get("#columns-desktop").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("flex");
});
});
});
describe("Grid/Column", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/grid/columns/");
setTablet();
});
it("has a Column", () => {
cy.get(".column").should("exist");
});
it("has a correct Column", () => {
cy.get("#columns .column").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("block");
expect(cs.flexBasis).to.equal("0px");
expect(cs.flexGrow).to.equal("1");
expect(cs.flexShrink).to.equal("1");
expect(cs.padding).to.equal("12px");
});
});
it("has a correct Column sizes", () => {
SCREENS.forEach((screen) => {
const suffix = screen[0];
const fn = screen[1];
fn();
cy.get(`#columns-special${suffix}`).then(($) => {
const columnsWidth = $[0].clientWidth;
const $full = $.find(`.column.is-full${suffix}`);
const csfull = window.getComputedStyle($full[0]);
const actualFullWidth = csfull.width.substring(
0,
csfull.width.length - 2
);
expect(csfull.flexBasis).to.equal("auto");
expect(csfull.flexGrow).to.equal("0");
expect(csfull.flexShrink).to.equal("0");
expect(`${Math.round(actualFullWidth)}px`).to.equal(
`${Math.round(columnsWidth)}px`
);
const $narrow = $.find(`.column.is-narrow${suffix}`);
const csnarrow = window.getComputedStyle($narrow[0]);
expect(csnarrow.flexBasis).to.equal("auto");
expect(csnarrow.flexGrow).to.equal("0");
expect(csnarrow.flexShrink).to.equal("0");
WIDTHS.forEach((width) => {
const name = width[0];
const factor = width[1];
const $1 = $.find(`.column.is-${name}${suffix}`);
const cs1 = window.getComputedStyle($1[0]);
const actualWidth = cs1.width.substring(0, cs1.width.length - 2);
expect(cs1.flexBasis).to.equal("auto");
expect(cs1.flexGrow).to.equal("0");
expect(cs1.flexShrink).to.equal("0");
expect(`${Math.round(actualWidth)}px`).to.equal(
`${Math.round(factor * columnsWidth)}px`
);
const $2 = $.find(`.column.is-offset-${name}${suffix}`);
const cs2 = window.getComputedStyle($2[0]);
const actualMarginLeft = cs2.marginLeft.substring(
0,
cs2.marginLeft.length - 2
);
expect(`${Math.round(actualMarginLeft)}px`).to.equal(
`${Math.round(factor * columnsWidth)}px`
);
for (let i = 1; i <= 12; i++) {
const $3 = $.find(`.column.is-${i}${suffix}`);
const cs3 = window.getComputedStyle($3[0]);
const actualWidth = cs3.width.substring(0, cs3.width.length - 2);
expect(cs3.flexBasis).to.equal("auto");
expect(cs3.flexGrow).to.equal("0");
expect(cs3.flexShrink).to.equal("0");
expect(`${Math.round(actualWidth)}px`).to.equal(
`${Math.round((i / 12) * columnsWidth)}px`
);
const $4 = $.find(`.column.is-offset-${i}${suffix}`);
const cs4 = window.getComputedStyle($4[0]);
const actualMarginLeft = cs4.marginLeft.substring(
0,
cs4.marginLeft.length - 2
);
expect(`${Math.round(actualMarginLeft)}px`).to.equal(
`${Math.round((i / 12) * columnsWidth)}px`
);
}
});
});
});
});
});

View File

@@ -0,0 +1,96 @@
import {
setMobile,
setTablet,
setDesktop,
setWidescreen,
setFullHD,
} from "../utils";
describe("Grid/Tiles", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/grid/tiles/");
setDesktop();
});
it("has a Tile", () => {
cy.get(".tile").should("exist");
});
it("has a correct Tile", () => {
cy.get("#tile").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.alignItems).to.equal("stretch");
expect(cs.display).to.equal("flex");
expect(cs.flexBasis).to.equal("0px");
expect(cs.flexGrow).to.equal("1");
expect(cs.flexShrink).to.equal("1");
expect(cs.minHeight).to.equal("min-content");
});
});
it("has a correct ancestor Tile", () => {
cy.get("#tile-ancestor").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.marginBottom).to.equal("12px");
expect(cs.marginLeft).to.equal("-12px");
expect(cs.marginRight).to.equal("-12px");
expect(cs.marginTop).to.equal("-12px");
});
});
it("has a correct last ancestor Tile", () => {
cy.get("#tile-ancestor-last").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.marginBottom).to.equal("-12px");
expect(cs.marginLeft).to.equal("-12px");
expect(cs.marginRight).to.equal("-12px");
expect(cs.marginTop).to.equal("-12px");
});
});
it("has a correct parent Tile", () => {
cy.get("#tile-parent").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.padding).to.equal("12px");
});
});
it("has a correct vertical Tile", () => {
cy.get("#tile-vertical").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.flexDirection).to.equal("column");
});
});
it("has a correct child Tile", () => {
cy.get("#tile-child").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.marginBottom).to.equal("0px");
expect(cs.marginLeft).to.equal("0px");
expect(cs.marginRight).to.equal("0px");
expect(cs.marginTop).to.equal("0px");
});
});
it("has a correct vertical child Tile", () => {
cy.get("#tile-vertical-child").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.marginBottom).to.equal("24px");
});
});
it("has a correct Tile sizes", () => {
for (let i = 1; i <= 12; i++) {
cy.get(`#tile-${i}`).then(($) => {
const cs = window.getComputedStyle($[0]);
const actualWidth = cs.width.substring(0, cs.width.length - 2);
expect(cs.flexBasis).to.equal("auto");
expect(cs.flexGrow).to.equal("0");
expect(cs.flexShrink).to.equal("0");
expect(`${Math.round(actualWidth)}px`).to.equal(
`${Math.round((i / 12) * 1000)}px`
);
});
}
});
});

View File

@@ -0,0 +1,17 @@
describe("Layout/Footer", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/layout/footer/");
});
it("has a Footer", () => {
cy.get(".footer").should("exist");
});
it("has a correct Footer", () => {
cy.get("#footer").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("scheme-main-bis"));
expect(cs.padding).to.equal("48px 24px 96px");
});
});
});

View File

@@ -0,0 +1,150 @@
import { setMobile, setDesktop } from "../utils";
describe("Layout/Hero", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/layout/hero/");
setDesktop();
});
it("has a Hero", () => {
cy.get(".hero").should("exist");
});
it("has a correct Hero", () => {
cy.get("#hero").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.alignItems).to.equal("stretch");
expect(cs.display).to.equal("flex");
expect(cs.flexDirection).to.equal("column");
expect(cs.justifyContent).to.equal("space-between");
});
});
it("has a correct Hero colors", () => {
for (let i = 0; i < Cypress.env("color-names").length; i++) {
const name = Cypress.env("color-names")[i];
const baseColor = Cypress.env(name);
const invertColor = Cypress.env(`${name}-invert`);
const lightColor = Cypress.env(`${name}-light`);
const darkColor = Cypress.env(`${name}-dark`);
cy.get(`#hero-${name}`).then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(baseColor);
expect(cs.color).to.equal(invertColor);
});
}
});
it("has a correct small Hero", () => {
cy.get("#hero-small .hero-body").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.padding).to.equal("24px");
});
});
it("has a correct medium Hero", () => {
cy.get("#hero-medium .hero-body").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.padding).to.equal("144px 72px");
});
});
it("has a correct large Hero", () => {
cy.get("#hero-large .hero-body").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.padding).to.equal("288px 96px");
});
});
it("has a correct halfheight Hero", () => {
cy.get("#hero-halfheight").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.minHeight).to.equal(`${Cypress.env("viewports").desktop[1] / 2}px`);
});
cy.get("#hero-halfheight .hero-body").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.alignItems).to.equal("center");
expect(cs.display).to.equal("flex");
});
});
it("has a correct fullheight Hero", () => {
cy.get("#hero-fullheight").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.minHeight).to.equal(`${Cypress.env("viewports").desktop[1]}px`);
});
cy.get("#hero-fullheight .hero-body").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.alignItems).to.equal("center");
expect(cs.display).to.equal("flex");
});
});
it("has a correct Hero with container", () => {
cy.get("#hero-with-container > .container").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.flexGrow).to.equal("1");
expect(cs.flexShrink).to.equal("1");
});
});
it("has a Hero Buttons", () => {
cy.get(".hero-buttons").should("exist");
});
it("has a correct Hero Buttons", () => {
cy.get("#hero-buttons").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("flex");
expect(cs.justifyContent).to.equal("center");
expect(cs.marginTop).to.equal("24px");
});
});
it("has a Hero Head", () => {
cy.get(".hero-head").should("exist");
});
it("has a correct Hero Head", () => {
cy.get("#hero-head").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.flexGrow).to.equal("0");
expect(cs.flexShrink).to.equal("0");
});
});
it("has a Hero Foot", () => {
cy.get(".hero-foot").should("exist");
});
it("has a correct Hero Foot", () => {
cy.get("#hero-foot").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.flexGrow).to.equal("0");
expect(cs.flexShrink).to.equal("0");
});
});
it("has a Hero Body", () => {
cy.get(".hero-body").should("exist");
});
it("has a correct Hero Body", () => {
cy.get("#hero-body").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.flexGrow).to.equal("1");
expect(cs.flexShrink).to.equal("0");
expect(cs.padding).to.equal("48px");
});
setMobile();
cy.get("#hero-body").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.padding).to.equal("48px 24px");
});
});
});

View File

@@ -0,0 +1,40 @@
import { setMobile, setDesktop } from "../utils";
describe("Layout/Section", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/layout/section/");
setDesktop();
});
it("has a Section", () => {
cy.get(".section").should("exist");
});
it("has a correct Section", () => {
cy.get("#section").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.padding).to.equal("48px");
});
setMobile();
cy.get("#section").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.padding).to.equal("48px 24px");
});
});
it("has a correct medium Section", () => {
cy.get("#section-medium").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.padding).to.equal("144px 72px");
});
});
it("has a correct large Section", () => {
cy.get("#section-large").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.padding).to.equal("288px 96px");
});
});
});

View File

@@ -0,0 +1,36 @@
export const setMobile = () => {
cy.viewport(
Cypress.env("viewports").mobile[0],
Cypress.env("viewports").mobile[1]
);
};
export const setTablet = () => {
cy.viewport(
Cypress.env("viewports").tablet[0],
Cypress.env("viewports").tablet[1]
);
};
export const setDesktop = () => {
cy.viewport(
Cypress.env("viewports").desktop[0],
Cypress.env("viewports").desktop[1]
);
};
export const setWidescreen = () => {
cy.viewport(
Cypress.env("viewports").widescreen[0],
Cypress.env("viewports").widescreen[1]
);
};
export const setFullHD = () => {
cy.viewport(
Cypress.env("viewports").fullhd[0],
Cypress.env("viewports").fullhd[1]
);
};
export const familyPrimary = 'system-ui, -apple-system, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Helvetica, Arial, sans-serif';

View File

@@ -0,0 +1,22 @@
/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
/**
* @type {Cypress.PluginConfig}
*/
// eslint-disable-next-line no-unused-vars
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}

View File

@@ -0,0 +1,31 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
// function colorDarken(color, amount) {
// return cy.wrap(color);
// }
// Cypress.Commands.add("colorDarken", colorDarken);

View File

@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands'
// Alternatively you can use CommonJS syntax:
// require('./commands')