-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests(storybook): adding selection commands for text #313
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4063bde
Merge pull request #1 from accordproject/master
Cronus1007 d921339
Merge pull request #3 from accordproject/master
Cronus1007 1a70996
Merge pull request #4 from accordproject/master
Cronus1007 2e189ca
Merge pull request #5 from accordproject/master
Cronus1007 5f548e4
tests(storybook): adding selection commands for text
Cronus1007 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@irmerk Yes you are on the right path.Here the
$el
should identify the text as node although I have wrapped a node here inselection
custom command.But still it is taking up the text rather than the element.Here I want to refer to this as well since Slate follows nested and recursive structure but still it is unable to capture node.A problem may be there in selection Custom Command.
Plus @sanketshevkar PR #311 would also fail until we found a way to select the text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#311 does not require the text to be selected, its about placing the cursor in a para and then changing the headings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm not following after all. Why do we need these custom commands when Slate has built in functions for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@irmerk I guess you are not on the right track.Since slate has no connection with the selection of text.The Cypress automates that work which a user has to do.The selection of text must be done by Cypress.