Skip to content

Conversation

@eps1lon
Copy link
Member

@eps1lon eps1lon commented Mar 19, 2019

Inspired by semantic-ui test suite adds a common test for all core/ components.

We test these things sometimes in each component, sometimes we simply skip it. The approach is also pretty fragmented resulting in many forks of the same approach. This consolidates these test into a single description of a common API for @material-ui/core components.

The endgame is to generate the docs from this descriptor instead of relying on code annotations like @inheritComponent. Following the philosophy that tests are a form of documentation.

Summary

Changes: +1,364 −1,110

-1951 passing (11s)
+2069 passing (11s)

Applied to the following core components:

Apply to all components that are conform
  • AppBar
  • Avatar
  • Backdrop
  • Badge
  • BottomNavigation
  • BottomNavigationAction
  • [ ] Box unstable classnames
  • Breadcrumbs
  • Button
  • ButtonBase
  • [ ] TouchRipple need imperative handle
  • Card
  • CardActionArea
  • CardActions
  • CardContent
  • CardHeader
  • CardMedia
  • Checkbox
  • Chip
  • CircularProgress
  • [ ] ClickAwayListener exotic
  • Collapse
  • [ ] CssBaseline exotic
  • Dialog
  • DialogActions
  • DialogContent
  • DialogContentText
  • DialogTitle
  • Divider
  • Drawer
  • ExpansionPanel
  • ExpansionPanelActions
  • ExpansionPanelDetails
  • ExpansionPanelSummary
  • Fab
  • Fade
  • FilledInpu
  • FormControl
  • FormControlLabel
  • FormGroup
  • FormHelperText
  • FormLabel
  • Grid
  • GridList
  • GridListTile
  • GridListTileBar
  • Grow
  • [ ] Hidden exotic
  • Icon
  • IconButton
  • Input
  • InputAdornment
  • InputBase
  • InputLabel
  • LinearProgress
  • Link
  • List
  • ListItem
  • [ ] ListItemAvatar (conditional root)
  • ListItemIcon
  • ListItemSecondaryAction
  • ListItemText
  • ListSubheader
  • Menu
  • MenuItem
  • MenuList
  • MobileStepper
  • Modal
  • NativeSelect
  • [ ] NoSsr exotic
  • OutlinedInput
  • Paper
  • Popover
  • Popper
  • [ ] Portal exotic
  • Radio
  • RadioGroup
  • [ ] RootRef exotic
  • Select
  • Slide
  • Snackbar
  • SnackbarContent
  • Step
  • StepButton
  • StepConnector
  • StepContent
  • [ ] StepIcon exotic
  • StepLabel
  • Stepper
  • SvgIcon
  • SwipeableDrawer
  • Switch violates
  • Tab
  • Table
  • TableBody
  • TableCell
  • TableFooter
  • TableHead
  • TablePagination
  • TableRow
  • TableSortLabel
  • Tabs
  • TextField
  • Toolbar
  • Tooltip
  • Typography
  • Zoom

@mui-pr-bot
Copy link

mui-pr-bot commented Mar 19, 2019

No bundle size changes comparing f8e9c71...4836f6e

Generated by 🚫 dangerJS against 4836f6e

@eps1lon eps1lon force-pushed the test/conformance-suite branch from 72bf187 to cde4efc Compare March 19, 2019 16:38
Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great win for our test infrastructure!

Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice that we miss the component context in the test fail.

Capture d’écran 2019-03-19 à 21 27 29

@eps1lon
Copy link
Member Author

eps1lon commented Mar 19, 2019

Did forget to push some local changes. Fails are fixed locally.

@eps1lon eps1lon force-pushed the test/conformance-suite branch 2 times, most recently from 8d27782 to 8dd30d4 Compare March 20, 2019 08:27
@eps1lon
Copy link
Member Author

eps1lon commented Mar 22, 2019

I overhauled the implementation of describeConformance quite a bit to accommodate for some problems encountered while adding this all component tests. The biggest issue was that we had to create the tests in a before hook which meant that mocha wouldn't pick them up in the preflight check which cause a couple of issues:

  • they couldn't be isolated with skip or only
  • test reporter wouldn't pick them up
  • it would create very weird test stacks (Material-UI API > Material-UI API > Material-UI API instead of TextField > Material-UI API, Table > Material-UI API`

The plan for this PR is to apply it to every component test where no changes to the implementation are needed. Some components don't quite work like the rest. For those components I will file separate PRs to discuss the implications.

Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully, we will have better tests while having less code to write.

@eps1lon eps1lon force-pushed the test/conformance-suite branch 2 times, most recently from 67feb13 to d243de7 Compare March 23, 2019 13:06
@eps1lon eps1lon force-pushed the test/conformance-suite branch 3 times, most recently from 114939d to 82b23ae Compare March 26, 2019 14:50
@eps1lon eps1lon force-pushed the test/conformance-suite branch from 82b23ae to bd6253e Compare March 26, 2019 16:21
@eps1lon eps1lon merged commit 7123411 into mui:next Mar 27, 2019
@eps1lon eps1lon deleted the test/conformance-suite branch March 27, 2019 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants