This repository has been archived by the owner on Feb 7, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests(storybook): adding selection commands for text
- Loading branch information
1 parent
2e189ca
commit 815fc92
Showing
2 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
packages/storybook/cypress/storybook/markdownEditorMarks.spec.js
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,19 @@ | ||
// https://www.cypress.io/blog/2020/02/12/working-with-iframes-in-cypress/ | ||
const getIframeDocument = () => | ||
cy.get("#storybook-preview-iframe").its("0.contentDocument").should("exist"); | ||
|
||
const getIframeBody = () => | ||
getIframeDocument().its("body").should("not.be.undefined").then(cy.wrap); | ||
|
||
describe('Marks', () => { | ||
describe('Bold', () => { | ||
it('should visit markdown editor', () => { | ||
cy.visit("/"); | ||
cy.get("#markdown-editor").click(); | ||
}) | ||
|
||
it('should make paragraph text bold', () => { | ||
getIframeBody().setSelection("#ap-rich-text-editor > p:nth-child(3)",'This','.'); | ||
}) | ||
}) | ||
}) |
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