-
Notifications
You must be signed in to change notification settings - Fork 102
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
Conversation
fix(ui-markdown-editor): text deselection - accordproject#291 (accordproject#292)
fix(ui-markdown-editor): handle cut image operation - accordproject#294 (accordproject#298)
Signed-off-by: Cronus1007 <[email protected]>
@irmerk @mttrbrts @DianaLease The biggest problem here is referring to Text Node. I used |
Thanks @Cronus1007 we're in the process of migrating the CI pipeline which affects how these tests are run. Please be patient while we complete this work.
Can you describe the issue in some more detail, please? |
@mttrbrts Since cypress doesn't have any api to provide selection of text required in the e2e testing of web-components library. So here I have written commands to select the text but the problem that arises here that I am unable to detect Text Node. It is easy to detect Image Nodes like this
We need a similair way to detect Text Nodes as well in Slate . |
Got it, thanks @Cronus1007. I'll review and get back to you. Unless @dselman @irmerk or @DianaLease has an immediate solution? |
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.
@Cronus1007 can you describe the role of getTextNodeNode function and createTreeWalker function?
|
@Cronus1007 |
@sanketshevkar Here |
Unsure if I'm following, but @Cronus1007 Slate has a number of built in API to identify text. There are some examples throughout the code here in |
Cypress.Commands.add('selection', { prevSubject: true }, (subject, fn) => { | ||
cy.wrap(subject) | ||
.trigger('mousedown') | ||
.then(fn) | ||
.trigger('mouseup'); | ||
|
||
cy.document().trigger('selectionchange'); | ||
return cy.wrap(subject); | ||
}); | ||
|
||
Cypress.Commands.add('setSelection', { prevSubject: true }, (subject, query, endQuery) => { | ||
return cy.wrap(subject) | ||
.selection($el => { |
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 in selection
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.
I am still unfamiliar with Cypress. This PR would need help from @dselman @mttrbrts @rkotangoor |
Stale PR for discussion
Related Issues
Author Checklist
--signoff
option of git commit.master
fromfork:branchname