web-components icon indicating copy to clipboard operation
web-components copied to clipboard

User Interaction Testing

Open jolanglinais opened this issue 4 years ago • 32 comments

This issue will track the tests which need to be implemented in order to increase stability of this codebase. Please feel free to add suggestions.

MASTER_MARK_LIST: (@riverceebontu)

  • [ ] bold, italic, hyperlink, code
  • [ ] bold+italic, bold+hyperlink, bold+code
  • [ ] italic+hyperlink, italic+code
  • [ ] code+hyperlink
  • [ ] bold+italic+hyperlink, bold+italic+code
  • [ ] italic+code+hyperlink, italic+code+bold
  • [ ] bold+italic+hyperlink+code

MASTER_BLOCK_TRANSFORM:

  • [ ] block_quote to ul_list
  • [ ] ul_list to block_quote
  • [ ] block_quote to ol_list
  • [ ] ol_list to block_quote
  • [ ] ul_list to ol_list
  • [ ] ol_list to ul_list

MASTER_HISTORY_CHECK:

  • [ ] Undo
  • [ ] Redo

Toolbar

Headings (@sanketshevkar)

  • [ ] Selecting a paragraph and changing to header 1, 2, 3
    • [ ] MASTER_HISTORY_CHECK
  • [ ] Selecting a word in paragraph and changing to header 1, 2, 3
    • [ ] MASTER_HISTORY_CHECK
  • [ ] Placing cursor in paragraph and changing to header 1, 2, 3
    • [ ] MASTER_HISTORY_CHECK
  • [ ] Switching header 1 to header 2, 3, paragraph
    • [ ] MASTER_HISTORY_CHECK
  • [ ] Switching header 2 to header 1, 3, paragraph
    • [ ] MASTER_HISTORY_CHECK
  • [ ] Switching header 3 to header 1, 2, paragraph
    • [ ] MASTER_HISTORY_CHECK
  • [ ] Switching paragraph to header 1, 2, 3
    • [ ] MASTER_HISTORY_CHECK
  • [ ] Switching paragraph with all combinations to header 1, 2, 3
    • [ ] MASTER_HISTORY_CHECK
    • [ ] MASTER_MARK_LIST
    • [ ] MASTER_HISTORY_CHECK
  • [ ] Make a block_quote into header 1, 2, 3
    • [ ] MASTER_HISTORY_CHECK
  • [ ] Make a list_item in ul_list into header 1, 2, 3
    • [ ] MASTER_HISTORY_CHECK
  • [ ] Make a list_item in ol_list into header 1, 2, 3
    • [ ] MASTER_HISTORY_CHECK
  • [ ] Make entire ul_list into header 1, 2, 3
    • [ ] MASTER_HISTORY_CHECK
  • [ ] Make entire ol_list into header 1, 2, 3
    • [ ] MASTER_HISTORY_CHECK

Marks (@Cronus1007)

Bold

  • [ ] Make all combinations bold
    • [ ] Paragraph
    • [ ] Text in paragraph
    • [ ] Text in word
    • [ ] Heading 1, 2, 3
    • [ ] italic, italic+code, code
    • [ ] ul_list and ol_list with MASTER_MARK_LIST
    • [ ] MASTER_HISTORY_CHECK
  • [ ] Undo bold
  • [ ] Enable bold and type more characters
    • [ ] MASTER_HISTORY_CHECK

Italic

  • [ ] Make all combinations italic
    • [ ] Paragraph
    • [ ] Text in paragraph
    • [ ] Text in word
    • [ ] Heading 1, 2, 3
    • [ ] bold, bold+code, code
    • [ ] ul_list and ol_list with MASTER_MARK_LIST
    • [ ] MASTER_HISTORY_CHECK
  • [ ] Undo italic
  • [ ] Enable italic and type more characters
    • [ ] MASTER_HISTORY_CHECK

Code

  • [ ] Make all combinations code
    • [ ] Paragraph
    • [ ] Text in paragraph
    • [ ] Text in word
    • [ ] Heading 1, 2, 3
    • [ ] italic, italic+bold, bold
    • [ ] ul_list and ol_list with MASTER_MARK_LIST
    • [ ] MASTER_HISTORY_CHECK
  • [ ] Undo code
  • [ ] Enable code and type more characters
    • [ ] MASTER_HISTORY_CHECK

Blocks

  • [ ] Swap block types
    • [ ] MASTER_BLOCK_TRANSFORM
    • [ ] MASTER_HISTORY_CHECK
  • [ ] Add mark to block
    • [ ] MASTER_MARK_LIST
    • [ ] Heading 1, 2, 3
    • [ ] MASTER_HISTORY_CHECK
  • [ ] Add hyperlink to block
    • [ ] MASTER_HISTORY_CHECK

Hyperlink

  • [ ] Add hyperlink to MASTER_MARK_LIST text
    • [ ] MASTER_HISTORY_CHECK
  • [ ] Add hyperlink to blocks
    • [ ] MASTER_BLOCK_TRANSFORM
    • [ ] MASTER_HISTORY_CHECK

Images

  • [ ] Add image
    • [ ] MASTER_HISTORY_CHECK
  • [ ] Remove image (backspace)
    • [ ] MASTER_HISTORY_CHECK
  • [ ] Transform and ensure image remains untouched
    • [ ] All headings
    • [ ] All marks
    • [ ] All blocks
    • [ ] Hyperlink

Rendering

Breaks

  • [ ] Softbreak
  • [ ] Linebreak

Actions

Shortcuts

  • [ ] Marks
    • [ ] MASTER_HISTORY_CHECK
  • [ ] Blocks
    • [ ] MASTER_HISTORY_CHECK
  • [ ] Hyperlink
    • [ ] MASTER_HISTORY_CHECK

jolanglinais avatar Mar 10 '20 18:03 jolanglinais

May I start working on this?

sanketshevkar avatar Mar 01 '21 16:03 sanketshevkar

doubt @irmerk I'm not able to find the code for this test.

sanketshevkar avatar Mar 02 '21 18:03 sanketshevkar

@sanketshevkar none of these tests currently exist. The Issue is for creating them.

jolanglinais avatar Mar 02 '21 19:03 jolanglinais

@sanketshevkar none of these tests currently exist. The Issue is for creating them.

No problem, the checkbox was checked, that's why I thought so.

sanketshevkar avatar Mar 02 '21 19:03 sanketshevkar

OH! Yeah I don't know why that is, that must've been a mistake on my part sorry about that.

jolanglinais avatar Mar 02 '21 19:03 jolanglinais

I'm writing the interaction tests using cypress. The storybook documentation also suggested using enzyme or cypress for interaction testing. Also setting up enzyme within storyshots was a bit complicated so decided to use cypress which is working fine. I did some dummy tests with the web-components storybook and seemed to workout, I'll share the video by tomorrow. Just wanted to know whether this approach would be right?

sanketshevkar avatar Mar 03 '21 19:03 sanketshevkar

This approach doesn't strike me as wrong so far, so yeah let's see how this progress goes. Storybook suggesting Cypress is a good sign that it would be a good approach.

jolanglinais avatar Mar 04 '21 16:03 jolanglinais

https://www.loom.com/share/b128d0a885694420bf4d55edda57ab73 Video for cypress test.

  1. Places cursor inside the paragraph:

This is text. This is italic text. This is bold text. This is a link. This is inline code.

  1. Changes it to Header 2.
  2. Undo
  3. Redo

sanketshevkar avatar Mar 04 '21 17:03 sanketshevkar

@irmerk what is the difference between

Selecting a paragraph and changing to header 1, 2, 3

Switching paragraph to header 1, 2, 3

sanketshevkar avatar Mar 04 '21 17:03 sanketshevkar

Very cool. I haven't used Cypress before. It looks like we'll want to set up an OSS plan with them (instructions) and implement this in GitHub Actions for this repo.

These two you mentioned may end up being the same. In my mind I wanted to distinguish the difference between highlighting an entire paragraph with the cursor, placing the cursor inside the paragraph, highlighting a word, and highlighting the paragraph with a triple click.

jolanglinais avatar Mar 04 '21 17:03 jolanglinais

I put in a request to Cypress. If approved, Cypress will provide AP with a plan that allows unlimited test recordings and up to 5 users. All projects we create in the Cypress Dashboard will be public. Data will be retained for 90 days. Our organization will have access to all the features the Cypress Dashboard provides, including parallelization.

CC: @jeromesimeon @DianaLease @dselman @mttrbrts @accordproject/maintainers-ui @accordproject/tsc @accordproject/contributors

jolanglinais avatar Mar 04 '21 17:03 jolanglinais

I think just continue on @sanketshevkar, I'm opening another Issue to track setting up Cypress for this repo.

jolanglinais avatar Mar 04 '21 17:03 jolanglinais

@irmerk That sounds great. Should I create a pr for cypress setup and then start working on the tests?

sanketshevkar avatar Mar 04 '21 18:03 sanketshevkar

What would that involve @sanketshevkar?

jolanglinais avatar Mar 04 '21 18:03 jolanglinais

Basically has two parts:

  1. Setting up cypress on your local machine.
  2. Setting up cypress within your project, which is a simple npm install command, update scripts in package.json, after running the test for the first time it sets up a cypress folder with some sample tests. I'll delete the example tests within the cypress folder and create a file for markdown-editor test.

sanketshevkar avatar Mar 04 '21 18:03 sanketshevkar

Yeah I think that works

jolanglinais avatar Mar 04 '21 18:03 jolanglinais

@irmerk I've made a pull request with the cypress setup.

sanketshevkar avatar Mar 05 '21 18:03 sanketshevkar

@irmerk @sanketshevkar Cypress testing only deals with the automated testing software for e2e whereas there is a need to lay down the setup for unit testing as well.

Cronus1007 avatar Mar 10 '21 12:03 Cronus1007

What do you propose @Cronus1007?

jolanglinais avatar Mar 10 '21 20:03 jolanglinais

@irmerk The Jest will be the best open source tool for unit testing of React Web Apps but I highly prefer a combined mocha and chai for the testing of js applications. Plus can start the work for cypress once #282 gets merged.

Cronus1007 avatar Mar 10 '21 21:03 Cronus1007

We should follow the precedent set in ui-concerto that uses Jest and react-testing-library for unit tests.

mttrbrts avatar Mar 12 '21 13:03 mttrbrts

This issue will track the tests which need to be implemented in order to increase stability of this codebase. Please feel free to add suggestions.

Hotkeys in markdown-editor have not been added i guess.

Cronus1007 avatar Mar 12 '21 14:03 Cronus1007

Now that #282 is finished, this Issue becomes a lot more accessible. I'm going to mark it as unassigned because this is probably the single most important Issue in this repo currently and I want to leave it open for as many people to work on it as possible.

jolanglinais avatar Mar 17 '21 11:03 jolanglinais

Now that #282 is finished, this Issue becomes a lot more accessible. I'm going to mark it as unassigned because this is probably the single most important Issue in this repo currently and I want to leave it open for as many people to work on it as possible.

Works for me 👍.

sanketshevkar avatar Mar 17 '21 11:03 sanketshevkar

@irmerk I wanted to discuss the structure of the tests. Basically, there are two ways we can do it:

  1. mount the component and test the interactions.
  2. load the storybook using the localhost url and test the component interactions.

The first one is suggested by cypress docs and the second one by storybook docs, which one would be preferable? I've tried using the second method and it was working.

sanketshevkar avatar Mar 19 '21 09:03 sanketshevkar

@sanketshevkar Let's be pragmatic, the second option works for you, and we have a sample here: https://github.com/accordproject/web-components/blob/master/packages/storybook/cypress/storybook/storybook.spec.js

Let's go with 2.

One downside is that it requires a contributor to run tests for the storybook package when only making changes to an individual component. However, we can probably mitigate that with some test filtering and good docs.

mttrbrts avatar Mar 19 '21 10:03 mttrbrts

@sanketshevkar Let's be pragmatic, the second option works for you, and we have a sample here: https://github.com/accordproject/web-components/blob/master/packages/storybook/cypress/storybook/storybook.spec.js

Let's go with 2.

One downside is that it requires a contributor to run tests for the storybook package when only making changes to an individual component. However, we can probably mitigate that with some test filtering and good docs.

Okay, that sounds cool. I'll move ahead with this.

sanketshevkar avatar Mar 19 '21 15:03 sanketshevkar

@sanketshevkar Since the issue is very large so lets divide issue.

Cronus1007 avatar Mar 19 '21 16:03 Cronus1007

@sanketshevkar Since the issue is very large so lets divide issue.

I've been anyways unassigned from this one. It's an open issue now. I've started with testing headings. If you want you can join in for that or pick up any other part you want.

sanketshevkar avatar Mar 19 '21 16:03 sanketshevkar

I've been anyways unassigned from this one. It's an open issue now. I've started with testing headings. If you want you can join in for that or pick up any other part you want.

Okk So I will pick up the Marks part then.

Cronus1007 avatar Mar 19 '21 16:03 Cronus1007