Skip to content

Commit

Permalink
chore(deps): Update peerDependency to support Cypress ^10.x (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kokogino authored and dmtrKovalenko committed Jun 26, 2022
1 parent cf89a11 commit 827d562
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 77 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/click.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ describe("cy.realClick", () => {
});
});

describe("iframe behavior", () => {
describe("iframe behavior", { retries: 10 }, () => {
beforeEach(() => {
cy.visit("./cypress/fixtures/iframe-page.html");
});
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/hover.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe("cy.realHover", () => {
});
});

describe("iframe behavior", () => {
describe("iframe behavior", { retries: 10 }, () => {
beforeEach(() => {
cy.visit("./cypress/fixtures/iframe-page.html");
});
Expand Down
128 changes: 68 additions & 60 deletions cypress/e2e/mouse.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,73 +260,81 @@ describe("cy.realMouseDown and cy.realMouseUp", () => {
});
});

describe("realMouseDown and realMouseUp iframe behavior", () => {
beforeEach(() => {
cy.visit("./cypress/fixtures/iframe-page.html");
});

it("sets elements inside iframes to active state", () => {
cy.get("iframe")
.then(($firstIframe) => {
return cy.wrap($firstIframe.contents().find("iframe"));
})
.then(($secondIframe) => {
return cy.wrap($secondIframe.contents().find("body"));
})
.within(() => {
cy.get("#target").then(($target) => {
expect($target.css("background-color")).to.equal("rgb(0, 128, 0)");
});

cy.get("#target")
.realMouseDown()
.then(($target) => {
expect($target.css("background-color")).to.equal("rgb(0, 0, 255)");
});
describe(
"realMouseDown and realMouseUp iframe behavior",
{ retries: 10 },
() => {
beforeEach(() => {
cy.visit("./cypress/fixtures/iframe-page.html");
});

// will go in hover state
cy.get("#target")
.realMouseUp()
.then(($target) => {
expect($target.css("background-color")).to.equal(
"rgb(255, 192, 203)"
);
it("sets elements inside iframes to active state", () => {
cy.get("iframe")
.then(($firstIframe) => {
return cy.wrap($firstIframe.contents().find("iframe"));
})
.then(($secondIframe) => {
return cy.wrap($secondIframe.contents().find("body"));
})
.within(() => {
cy.get("#target").then(($target) => {
expect($target.css("background-color")).to.equal("rgb(0, 128, 0)");
});
});
});

it("sets elements inside transformed iframes to active states", () => {
cy.get("iframe")
.then(($firstIframe) => {
$firstIframe.css("transform", "scale(.5)");
return cy.wrap($firstIframe.contents().find("iframe"));
})
.then(($secondIframe) => {
$secondIframe.css("transform", "scale(.75)");
return cy.wrap($secondIframe.contents().find("body"));
})
.within(() => {
cy.get("#target").then(($target) => {
expect($target.css("background-color")).to.equal("rgb(0, 128, 0)");
cy.get("#target")
.realMouseDown()
.then(($target) => {
expect($target.css("background-color")).to.equal(
"rgb(0, 0, 255)"
);
});

// will go in hover state
cy.get("#target")
.realMouseUp()
.then(($target) => {
expect($target.css("background-color")).to.equal(
"rgb(255, 192, 203)"
);
});
});
});

cy.get("#target")
.realMouseDown()
.then(($target) => {
expect($target.css("background-color")).to.equal("rgb(0, 0, 255)");
it("sets elements inside transformed iframes to active states", () => {
cy.get("iframe")
.then(($firstIframe) => {
$firstIframe.css("transform", "scale(.5)");
return cy.wrap($firstIframe.contents().find("iframe"));
})
.then(($secondIframe) => {
$secondIframe.css("transform", "scale(.75)");
return cy.wrap($secondIframe.contents().find("body"));
})
.within(() => {
cy.get("#target").then(($target) => {
expect($target.css("background-color")).to.equal("rgb(0, 128, 0)");
});

// will go in hover state
cy.get("#target")
.realMouseUp()
.then(($target) => {
expect($target.css("background-color")).to.equal(
"rgb(255, 192, 203)"
);
});
});
});
});
cy.get("#target")
.realMouseDown()
.then(($target) => {
expect($target.css("background-color")).to.equal(
"rgb(0, 0, 255)"
);
});

// will go in hover state
cy.get("#target")
.realMouseUp()
.then(($target) => {
expect($target.css("background-color")).to.equal(
"rgb(255, 192, 203)"
);
});
});
});
}
);

describe("realMouseMove", () => {
beforeEach(() => {
Expand Down
28 changes: 14 additions & 14 deletions cypress/e2e/press.cy.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
describe("cy.realPress", () => {
describe("cy.realPress", { retries: 10 }, () => {
it("Can type into an input", () => {
cy.intercept('http://presstest.com/', (req) => {
const html = document.implementation.createHTMLDocument()
html.body.innerHTML = `<input type="text">`
req.reply(html.documentElement.innerHTML)
})
cy.visit('http://presstest.com/')
cy.intercept("http://presstest.com/", (req) => {
const html = document.implementation.createHTMLDocument();
html.body.innerHTML = `<input type="text">`;
req.reply(html.documentElement.innerHTML);
});
cy.visit("http://presstest.com/");
cy.get("input").focus();

cy.realPress("c");
Expand All @@ -20,15 +20,15 @@ describe("cy.realPress", () => {
});

it("Can fire native Tab focus switch", () => {
cy.intercept('http://presstest.com/', (req) => {
const html = document.implementation.createHTMLDocument()
cy.intercept("http://presstest.com/", (req) => {
const html = document.implementation.createHTMLDocument();
html.body.innerHTML = [
`<input type="text">`,
`<button type="button">Click me</button>`
].join('')
req.reply(html.documentElement.innerHTML)
})
cy.visit('http://presstest.com/')
`<button type="button">Click me</button>`,
].join("");
req.reply(html.documentElement.innerHTML);
});
cy.visit("http://presstest.com/");
cy.get("input").click();
cy.realPress("Tab");
cy.get("button").should("be.focused");
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"semantic-release": "semantic-release"
},
"peerDependencies": {
"cypress": "^4.x || ^5.x || ^6.x || ^7.x || ^8.x || ^9.x"
"cypress": "^4.x || ^5.x || ^6.x || ^7.x || ^8.x || ^9.x || ^10.x"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.8.2",
Expand Down

0 comments on commit 827d562

Please sign in to comment.