Skip to content
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

Frontend Testing Tracking Issue #4615

Closed
16 of 25 tasks
dawoodkhan82 opened this issue Jun 21, 2023 · 3 comments
Closed
16 of 25 tasks

Frontend Testing Tracking Issue #4615

dawoodkhan82 opened this issue Jun 21, 2023 · 3 comments
Labels
testing Related to testing and CI tracking Issues that are created for tracking

Comments

@dawoodkhan82
Copy link
Collaborator

dawoodkhan82 commented Jun 21, 2023

Tracking Issue for Frontend tests (E2E, Unit tests, & Visual tests)

Goals

  • Have several fully fleshed out E2E tests (using Playwright) that follow how an actual user would use a demo
  • Unit tests for every frontend component that tests util functions, internal logic, and the correct passing of props.
  • Visual tests using Chromatic. Helpful for UI and visual regressions.

TODOs

End to End Tests
Run tests by:

  • pnpm test:browser:full builds frontend and runs tests
  • pnpm test:browser:verbose see all errors/warnings
  • pnpm test:browser:debug opens chromium browser and allows you to step through each line of the test

Use kitchen_sink.spec.ts as reference.

Unit Tests
Run tests by:
pnpm test:run

Use Textbox.test.ts as reference. List based on most used components

Visual Testing

@abidlabs abidlabs added testing Related to testing and CI tracking Issues that are created for tracking labels Jun 21, 2023
@pngwn
Copy link
Member

pngwn commented Jun 22, 2023

Some testing resources.

Playwright docs are excellent (and extensive). The API docs will be the most helpful as we write tests. The page class in particularly will probably be the mots commonly used.
Page API: https://playwright.dev/docs/api/class-page

When you actually get an element that you want to interact with it will return an instance of Locator which has lots of useful methods:
Locator API: https://playwright.dev/docs/api/class-locator

Playwright also have a nice document about best practices with some examples:
Best Practices: https://playwright.dev/docs/best-practices

They also have other useful guides (check the sidebar and scroll down). Everything i know about playwright is from trial + error and the official docs.

For vitest (untit and integration tests that run in node) we generally use two things.

@testing-library/svelte for getting elements and performing interactions and vitest's expect module

Testing library DOM functions: https://testing-library.com/docs/queries/about
expect API: https://vitest.dev/api/expect.html

Have a look around other parts of these sites too, testing tools like this often have some nice examples and good best practices that can be useful.

@pngwn
Copy link
Member

pngwn commented Jul 5, 2023

Doing a bit of an inventory of our test coverage. Probably won't be complete but it is a start.

Component value visible elem_id elem_classes container label show_label
AnnotatedImage
Audio
BarPlot
Button
Chatbot
Checkbox
CheckboxGroup
ClearButton
Code
ColorPicker
Dataframe
Dataset
Dropdown
File
Gallery
HTML
HighlightedText
Image
Interpretation
JSON
Label
Lineplot
Markdown
Model3D
Number
Plot
Radio
ScatterPlot
Slider
State
Textbox
Timeseries
UploadButton
Video

@pngwn
Copy link
Member

pngwn commented Apr 25, 2024

Pretty happy that we are on our way with this now. I don't think we need to track it any more, we have pretty much everything in place.

@pngwn pngwn closed this as completed Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Related to testing and CI tracking Issues that are created for tracking
Projects
None yet
Development

No branches or pull requests

3 participants