diff --git a/.circleci/config.yml b/.circleci/config.yml index 4cd2258..152ed48 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,6 @@ version: 2.1 orbs: - cypress: cypress-io/cypress@3.1.4 + cypress: cypress-io/cypress@3.3.0 jobs: install: executor: cypress/default diff --git a/cypress/e2e/press.cy.ts b/cypress/e2e/press.cy.ts index cfff5c9..4fdb40e 100644 --- a/cypress/e2e/press.cy.ts +++ b/cypress/e2e/press.cy.ts @@ -1,12 +1,7 @@ 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 = ``; - req.reply(html.documentElement.innerHTML); - }); - cy.visit("http://presstest.com/"); - cy.get("input").focus(); + cy.visit("https://w3c.github.io/uievents/tools/key-event-viewer"); + cy.get("#input").focus(); cy.realPress("c"); cy.realPress("y"); @@ -20,18 +15,13 @@ describe("cy.realPress", { retries: 10 }, () => { }); it("Can fire native Tab focus switch", () => { - cy.intercept("http://presstest.com/", (req) => { - const html = document.implementation.createHTMLDocument(); - html.body.innerHTML = [ - ``, - ``, - ].join(""); - req.reply(html.documentElement.innerHTML); - }); - cy.visit("http://presstest.com/"); - cy.get("input").click(); - cy.realPress("Tab"); - cy.get("button").should("be.focused"); + cy.visit("./cypress/fixtures/focus-order.html"); + cy.window().focus(); + cy.get("#tab1").realPress("Tab"); // focus switches to tab2 + cy.get("#tab2").should("have.class", "active"); + + cy.get("#tab2").realPress("Tab"); // focus switches to tab3 + cy.get("#tab3").should("have.class", "active"); }); context("Keyboard a11y testing", () => { diff --git a/cypress/fixtures/focus-order.html b/cypress/fixtures/focus-order.html new file mode 100644 index 0000000..471e5c3 --- /dev/null +++ b/cypress/fixtures/focus-order.html @@ -0,0 +1,66 @@ + + + + +
+ + + + +