bulma/docs/cypress/integration/components/message.spec.js
Jeremy Thomas 0ce084170a
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
2022-05-08 13:55:16 +01:00

75 lines
2.6 KiB
JavaScript

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);
});
}
});
});