mirror of
https://github.com/maputnik/editor.git
synced 2026-08-24 22:17:25 +00:00
wip
This commit is contained in:
+34
-43
@@ -2,21 +2,20 @@ import { then } from "@shellygo/cypress-test-utils/assertable";
|
|||||||
import MaputnikDriver from "./maputnik-driver";
|
import MaputnikDriver from "./maputnik-driver";
|
||||||
|
|
||||||
describe("modals", () => {
|
describe("modals", () => {
|
||||||
let { beforeAndAfter, given, when, get, should } = new MaputnikDriver();
|
let { beforeAndAfter, when, get } = new MaputnikDriver();
|
||||||
beforeAndAfter();
|
beforeAndAfter();
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
given.fixture("example-style.json", "file:example-style.json");
|
when.visit("/");
|
||||||
when.setStyle("");
|
|
||||||
});
|
});
|
||||||
describe("open", () => {
|
describe("open", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
when.click("nav:open");
|
when.click("nav:open");
|
||||||
});
|
});
|
||||||
|
|
||||||
it.skip("close", () => {
|
it("close", () => {
|
||||||
// Asserting non existence is an anti-pattern
|
|
||||||
when.modal.close("modal:open");
|
when.modal.close("modal:open");
|
||||||
should.notExist("modal:open");
|
then(get.elementByTestId("modal:open")).shouldNotExist();
|
||||||
});
|
});
|
||||||
|
|
||||||
it.skip("upload", () => {
|
it.skip("upload", () => {
|
||||||
@@ -33,41 +32,22 @@ describe("modals", () => {
|
|||||||
|
|
||||||
when.setValue("modal:open.url.input", styleFileUrl);
|
when.setValue("modal:open.url.input", styleFileUrl);
|
||||||
when.click("modal:open.url.button");
|
when.click("modal:open.url.button");
|
||||||
|
when.wait(200);
|
||||||
});
|
});
|
||||||
it.only("load from url", () => {
|
it("load from url", () => {
|
||||||
// expect(
|
then(get.responseBody("example-style.json")).shouldDeepEqual(
|
||||||
// Cypress._.isMatch(
|
get.maputnikStyleFromLocalStorageObj()
|
||||||
// get.maputnikStyleFromLocalStorageObj(),
|
);
|
||||||
// get.responseBody("example-style.json")
|
|
||||||
// )
|
|
||||||
// ).to.be.true;
|
|
||||||
|
|
||||||
// expect(
|
|
||||||
// Cypress._.isMatch(
|
|
||||||
// get.maputnikStyleFromLocalStorageObj(),
|
|
||||||
// { shelly: true }
|
|
||||||
// //get.responseBody("example-style.json")
|
|
||||||
// )
|
|
||||||
// );
|
|
||||||
should.styleStoreEqualToExampleFileData();
|
|
||||||
// then(get.fixture("file:example-style.json")).should(
|
|
||||||
// "deep.equal",
|
|
||||||
// get.maputnikStyleFromLocalStorageObj()
|
|
||||||
// );
|
|
||||||
// then(get.responseBody("example-style.json")).shouldDeepNestedInclude(
|
|
||||||
// get.maputnikStyleFromLocalStorageObj()
|
|
||||||
// );
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("shortcuts", () => {
|
describe("shortcuts", () => {
|
||||||
it.skip("open/close", () => {
|
it("open/close", () => {
|
||||||
when.setStyle("");
|
when.setStyle("");
|
||||||
when.typeKeys("?");
|
when.typeKeys("?");
|
||||||
when.modal.close("modal:shortcuts");
|
when.modal.close("modal:shortcuts");
|
||||||
// Anti pattern. we should test that things exist. million things don't exist
|
then(get.elementByTestId("modal:shortcuts")).shouldNotExist();
|
||||||
should.notExist("modal:shortcuts");
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -78,7 +58,7 @@ describe("modals", () => {
|
|||||||
|
|
||||||
it.skip("close", () => {
|
it.skip("close", () => {
|
||||||
when.modal.close("modal:export");
|
when.modal.close("modal:export");
|
||||||
should.notExist("modal:export");
|
then(get.elementByTestId("modal:export")).shouldNotExist();
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: Work out how to download a file and check the contents
|
// TODO: Work out how to download a file and check the contents
|
||||||
@@ -104,18 +84,29 @@ describe("modals", () => {
|
|||||||
when.click("nav:settings");
|
when.click("nav:settings");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("name", () => {
|
describe("when click name", () => {
|
||||||
when.click("field-doc-button-Name");
|
beforeEach(() => {
|
||||||
then(get.elementsText("spec-field-doc")).shouldContainText(
|
when.click("field-doc-button-Name");
|
||||||
"name for the style"
|
});
|
||||||
);
|
|
||||||
|
it("name", () => {
|
||||||
|
then(get.elementsText("spec-field-doc")).shouldInclude(
|
||||||
|
"name for the style"
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("show name specifications", () => {
|
describe("when click owner", () => {
|
||||||
when.setValue("modal:settings.name", "foobar");
|
beforeEach(() => {
|
||||||
when.click("modal:settings.owner");
|
when.setValue("modal:settings.name", "foobar");
|
||||||
then(get.maputnikStyleFromLocalStorage()).shouldDeepNestedInclude({
|
when.click("modal:settings.owner");
|
||||||
name: "foobar",
|
when.wait(200);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("show name specifications", () => {
|
||||||
|
then(get.maputnikStyleFromLocalStorage()).shouldDeepNestedInclude({
|
||||||
|
name: "foobar",
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Generated
+112
-864
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -91,7 +91,7 @@
|
|||||||
"@cypress/code-coverage": "^3.12.15",
|
"@cypress/code-coverage": "^3.12.15",
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@rollup/plugin-replace": "^5.0.5",
|
"@rollup/plugin-replace": "^5.0.5",
|
||||||
"@shellygo/cypress-test-utils": "^2.0.14",
|
"@shellygo/cypress-test-utils": "^2.0.15",
|
||||||
"@storybook/addon-a11y": "^7.6.5",
|
"@storybook/addon-a11y": "^7.6.5",
|
||||||
"@storybook/addon-actions": "^7.6.5",
|
"@storybook/addon-actions": "^7.6.5",
|
||||||
"@storybook/addon-links": "^7.6.5",
|
"@storybook/addon-links": "^7.6.5",
|
||||||
|
|||||||
Reference in New Issue
Block a user