-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release 1.11
- Loading branch information
Showing
13 changed files
with
286 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,48 @@ | ||
describe("Events behavior with shiftKey modifier applied", () => { | ||
describe("Events behavior with single modifier applied", () => { | ||
beforeEach(() => { | ||
cy.visit("./cypress/fixtures/modifiers-test.html"); | ||
}); | ||
|
||
// NOTE: for some reason after upgrading CI to use Chrome 116 and Cypress 13 this particular test fails | ||
// and only on CI. Figure out if this is a real issue or some version conflict | cypress bug. | ||
// | ||
// @see https://app.circleci.com/pipelines/github/dmtrKovalenko/cypress-real-events/842/workflows/1f98e690-ec69-4dcf-9e0e-3f8eb67dc709/jobs/2332/parallel-runs/0?filterBy=ALL | ||
it.skip("detects shift key modifier on click", () => { | ||
cy.get("#action-button").realClick({ shiftKey: true }); | ||
cy.contains("Shift key was pressed"); | ||
}); | ||
const modifierKeys = ["shiftKey", "altKey", "ctrlKey", "metaKey"]; | ||
|
||
it("detects shift key modifier on hover", () => { | ||
cy.get("#mouse-move-div").realHover({ shiftKey: true }); | ||
cy.contains("Shift key was pressed"); | ||
}); | ||
function createModifierObject(modifierKey: string) { | ||
const options = {}; | ||
options[modifierKey] = true; | ||
return options; | ||
} | ||
|
||
it("detects shift key modifier on mousedown", () => { | ||
cy.get("#mouse-down-div").realMouseDown({ shiftKey: true }); | ||
cy.contains("Shift key was pressed"); | ||
}); | ||
modifierKeys.forEach((modifierKey) => { | ||
// NOTE: for some reason after upgrading CI to use Chrome 116 and Cypress 13 this particular test fails | ||
// and only on CI. Figure out if this is a real issue or some version conflict | cypress bug. | ||
// | ||
// @see https://app.circleci.com/pipelines/github/dmtrKovalenko/cypress-real-events/842/workflows/1f98e690-ec69-4dcf-9e0e-3f8eb67dc709/jobs/2332/parallel-runs/0?filterBy=ALL | ||
it.skip(`detects ${modifierKey} modifier on click`, () => { | ||
cy.get("#action-button").realClick(createModifierObject(modifierKey)); | ||
cy.contains(`${modifierKey} was pressed`); | ||
}); | ||
|
||
it("detects shift key modifier on mpuseup", () => { | ||
cy.get("#mouse-up-div").realMouseUp({ shiftKey: true }); | ||
cy.contains("Shift key was pressed"); | ||
}); | ||
it(`detects ${modifierKey} modifier on hover`, () => { | ||
cy.get("#mouse-move-div").realHover(createModifierObject(modifierKey)); | ||
cy.contains(`${modifierKey} was pressed`); | ||
}); | ||
|
||
it("detects shift key modifier on mousemove", () => { | ||
cy.get("#mouse-move-div").realMouseMove(100, 50, { shiftKey: true }); | ||
cy.contains("Shift key was pressed"); | ||
it(`detects ${modifierKey} modifier on mousedown`, () => { | ||
cy.get("#mouse-down-div").realMouseDown( | ||
createModifierObject(modifierKey), | ||
); | ||
cy.contains(`${modifierKey} was pressed`); | ||
}); | ||
it(`detects ${modifierKey} modifier on mpuseup`, () => { | ||
cy.get("#mouse-up-div").realMouseUp(createModifierObject(modifierKey)); | ||
cy.contains(`${modifierKey} was pressed`); | ||
}); | ||
it(`detects ${modifierKey} modifier on mousemove`, () => { | ||
cy.get("#mouse-move-div").realMouseMove( | ||
100, | ||
50, | ||
createModifierObject(modifierKey), | ||
); | ||
cy.contains(`${modifierKey} was pressed`); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
describe("Events behavior with modifiers combination applied", () => { | ||
beforeEach(() => { | ||
cy.visit("./cypress/fixtures/modifiers-test.html"); | ||
}); | ||
|
||
const modifierKeys = ["shiftKey", "altKey", "ctrlKey"]; | ||
|
||
function createModifierObject( | ||
modifierKeys: string[], | ||
): Record<string, boolean> { | ||
const options = {}; | ||
for (const key of modifierKeys) { | ||
options[key] = true; | ||
} | ||
return options; | ||
} | ||
|
||
// NOTE: for some reason after upgrading CI to use Chrome 116 and Cypress 13 this particular test fails | ||
// and only on CI. Figure out if this is a real issue or some version conflict | cypress bug. | ||
// | ||
// @see https://app.circleci.com/pipelines/github/dmtrKovalenko/cypress-real-events/842/workflows/1f98e690-ec69-4dcf-9e0e-3f8eb67dc709/jobs/2332/parallel-runs/0?filterBy=ALL | ||
it.skip(`detects ${modifierKeys} modifiers on click`, () => { | ||
cy.get("#action-button").realClick(createModifierObject(modifierKeys)); | ||
for (const key of modifierKeys) { | ||
cy.contains(`${key} was pressed`); | ||
} | ||
}); | ||
|
||
it(`detects ${modifierKeys} modifiers on hover`, () => { | ||
cy.get("#mouse-move-div").realHover(createModifierObject(modifierKeys)); | ||
for (const key of modifierKeys) { | ||
cy.contains(`${key} was pressed`); | ||
} | ||
}); | ||
|
||
it(`detects ${modifierKeys} modifiers on mousedown`, () => { | ||
cy.get("#mouse-down-div").realMouseDown(createModifierObject(modifierKeys)); | ||
for (const key of modifierKeys) { | ||
cy.contains(`${key} was pressed`); | ||
} | ||
}); | ||
|
||
it(`detects ${modifierKeys} modifiers on mpuseup`, () => { | ||
cy.get("#mouse-up-div").realMouseUp(createModifierObject(modifierKeys)); | ||
for (const key of modifierKeys) { | ||
cy.contains(`${key} was pressed`); | ||
} | ||
}); | ||
|
||
it(`detects ${modifierKeys} modifiers on mousemove`, () => { | ||
cy.get("#mouse-move-div").realMouseMove( | ||
100, | ||
50, | ||
createModifierObject(modifierKeys), | ||
); | ||
for (const key of modifierKeys) { | ||
cy.contains(`${key} was pressed`); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.