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

Enable cypress for v8 #21678

Merged
merged 4 commits into from
Feb 12, 2022
Merged

Enable cypress for v8 #21678

merged 4 commits into from
Feb 12, 2022

Conversation

ecraig12345
Copy link
Member

@ecraig12345 ecraig12345 commented Feb 9, 2022

Current Behavior

In v9 we can use cypress to run interactive tests in a real browser. This isn't possible today in v8.

Running tests in a real browser is desirable for testing related to interactive features such as focus that aren't realistically simulated in jsdom.

New Behavior

Enable cypress tests for v8 and add one test for FocusTrapZone as an example.

Our cypress wrapper (scripts/cypress.js) was hardcoded to always load the react-components storybook in PR builds, so I added a --package option.

Since the storybook for v8 is in react-examples, it's easiest to also have the e2e tests and e2e-specific stories live there. Longer-term once v8 is migrated to the new build system, the e2e tests and stories could potentially be relocated to the react package itself.

To facilitate having e2e-only stories that don't show up on the doc site, I updated react-examples/.storybook/preview.js to look for a e2e=1 query parameter which determines whether to show stories with /e2e/ in their path. (Storybook appears to preserve any user-provided query parameters when changing stories.)

Related Issue(s)

Fixes #21662

@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 9, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 47fbc8a:

Sandbox Source
@fluentui/react 8 starter Configuration
@fluentui/react-components 9 starter Configuration

@size-auditor
Copy link

size-auditor bot commented Feb 9, 2022

Asset size changes

Size Auditor did not detect a change in bundle size for any component!

Baseline commit: 21ad43bbd1664a7f409b28c4b7f21e50d7039a4d (build)

@fabricteam
Copy link
Collaborator

fabricteam commented Feb 9, 2022

📊 Bundle size report

Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-accordion
Accordion (including children components)
54.905 kB
17.567 kB
react-avatar
Avatar
44.89 kB
13.02 kB
react-badge
Badge
20.831 kB
6.533 kB
react-badge
CounterBadge
21.699 kB
6.827 kB
react-badge
PresenceBadge
21.785 kB
6.507 kB
react-button
Button
27.932 kB
8.025 kB
react-button
CompoundButton
33.196 kB
8.987 kB
react-button
MenuButton
29.584 kB
8.598 kB
react-button
SplitButton
35.751 kB
9.683 kB
react-button
ToggleButton
37.209 kB
8.627 kB
react-card
Card - All
47.867 kB
14.195 kB
react-card
Card
43.56 kB
13.004 kB
react-card
CardFooter
7.615 kB
3.23 kB
react-card
CardHeader
8.893 kB
3.675 kB
react-card
CardPreview
7.588 kB
3.255 kB
react-combobox
Combobox
23.741 kB
9.039 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
165.744 kB
46.848 kB
react-components
react-components: FluentProvider & webLightTheme
32.479 kB
10.625 kB
react-divider
Divider
15.256 kB
5.511 kB
react-image
Image
10.067 kB
3.934 kB
react-input
Input
21.5 kB
7.116 kB
react-label
Label
8.303 kB
3.472 kB
react-link
Link
11.064 kB
4.487 kB
react-menu
Menu (including children components)
102.914 kB
31.69 kB
react-menu
Menu (including selectable components)
105.269 kB
32.056 kB
react-popover
Popover
95.841 kB
29.229 kB
react-portal
Portal
6.249 kB
2.163 kB
react-positioning
usePopper
22.828 kB
7.951 kB
react-provider
FluentProvider
13.962 kB
5.231 kB
react-select
Select
7.716 kB
3.24 kB
react-slider
Slider
22.928 kB
7.747 kB
react-spinner
Spinner
6.773 kB
2.879 kB
react-switch
Switch
25.387 kB
8.204 kB
react-text
Text - Default
10.755 kB
4.212 kB
react-text
Text - Wrappers
14.067 kB
4.558 kB
react-theme
Single theme token import
69 B
89 B
react-theme
Teams: all themes
29.426 kB
6.551 kB
react-theme
Teams: Light theme
18.42 kB
5.27 kB
react-tooltip
Tooltip
42.479 kB
14.593 kB
react-utilities
SSRProvider
189 B
161 B
🤖 This report was generated against 21ad43bbd1664a7f409b28c4b7f21e50d7039a4d

@fabricteam
Copy link
Collaborator

fabricteam commented Feb 9, 2022

Perf Analysis (@fluentui/react)

Scenario Render type Master Ticks PR Ticks Iterations Status
ContextualMenu mount 17440 8600 1000 Possible regression
All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 915 916 5000
BaseButton mount 995 972 5000
Breadcrumb mount 2705 2664 1000
ButtonNext mount 503 503 5000
Checkbox mount 1614 1581 5000
CheckboxBase mount 1354 1368 5000
ChoiceGroup mount 4886 4942 5000
ComboBox mount 1018 1028 1000
CommandBar mount 10454 10544 1000
ContextualMenu mount 17440 8600 1000 Possible regression
DefaultButton mount 1169 1203 5000
DetailsRow mount 3820 3842 5000
DetailsRowFast mount 3881 3880 5000
DetailsRowNoStyles mount 3674 3653 5000
Dialog mount 2317 2337 1000
DocumentCardTitle mount 189 195 1000
Dropdown mount 3300 3332 5000
FluentProviderNext mount 1948 1957 5000
FluentProviderWithTheme mount 187 172 10
FluentProviderWithTheme virtual-rerender 115 119 10
FluentProviderWithTheme virtual-rerender-with-unmount 208 214 10
FocusTrapZone mount 1958 1932 5000
FocusZone mount 1861 1869 5000
IconButton mount 1806 1801 5000
Label mount 363 390 5000
Layer mount 3111 3043 5000
Link mount 517 503 5000
MakeStyles mount 1725 1771 50000
MenuButton mount 1562 1532 5000
MessageBar mount 2041 2070 5000
Nav mount 3362 3434 1000
OverflowSet mount 1181 1150 5000
Panel mount 2284 2233 1000
Persona mount 896 913 1000
Pivot mount 1503 1485 1000
PrimaryButton mount 1352 1356 5000
Rating mount 7985 7867 5000
SearchBox mount 1419 1409 5000
Shimmer mount 2595 2613 5000
Slider mount 2042 2047 5000
SpinButton mount 5159 5153 5000
Spinner mount 453 478 5000
SplitButton mount 3300 3245 5000
Stack mount 550 558 5000
StackWithIntrinsicChildren mount 2377 2454 5000
StackWithTextChildren mount 5426 5516 5000
SwatchColorPicker mount 11855 11842 5000
TagPicker mount 2709 2761 5000
TeachingBubble mount 13538 13665 5000
Text mount 465 477 5000
TextField mount 1435 1462 5000
ThemeProvider mount 1277 1277 5000
ThemeProvider virtual-rerender 673 674 5000
ThemeProvider virtual-rerender-with-unmount 1954 1950 5000
Toggle mount 851 874 5000
buttonNative mount 168 162 5000

Perf Analysis (@fluentui/react-northstar)

Perf tests with no regressions
Scenario Current PR Ticks Baseline Ticks Ratio
TreeWith60ListItems.default 221 178 1.24:1
FormMinimalPerf.default 445 399 1.12:1
HeaderMinimalPerf.default 392 359 1.09:1
ButtonMinimalPerf.default 186 174 1.07:1
RefMinimalPerf.default 260 243 1.07:1
AccordionMinimalPerf.default 165 155 1.06:1
LabelMinimalPerf.default 406 388 1.05:1
ProviderMinimalPerf.default 1196 1136 1.05:1
SegmentMinimalPerf.default 374 355 1.05:1
DatepickerMinimalPerf.default 5860 5643 1.04:1
RadioGroupMinimalPerf.default 483 463 1.04:1
TableMinimalPerf.default 428 411 1.04:1
AttachmentSlotsPerf.default 1115 1086 1.03:1
GridMinimalPerf.default 363 354 1.03:1
ImageMinimalPerf.default 388 375 1.03:1
StatusMinimalPerf.default 704 685 1.03:1
AttachmentMinimalPerf.default 167 164 1.02:1
CarouselMinimalPerf.default 495 485 1.02:1
DividerMinimalPerf.default 381 375 1.02:1
EmbedMinimalPerf.default 4273 4203 1.02:1
InputMinimalPerf.default 1332 1304 1.02:1
MenuMinimalPerf.default 871 858 1.02:1
PortalMinimalPerf.default 187 183 1.02:1
ReactionMinimalPerf.default 388 381 1.02:1
SkeletonMinimalPerf.default 360 352 1.02:1
SplitButtonMinimalPerf.default 4391 4322 1.02:1
TooltipMinimalPerf.default 1067 1051 1.02:1
AvatarMinimalPerf.default 204 202 1.01:1
ButtonSlotsPerf.default 576 573 1.01:1
CardMinimalPerf.default 570 565 1.01:1
CheckboxMinimalPerf.default 2771 2752 1.01:1
DropdownManyItemsPerf.default 680 672 1.01:1
HeaderSlotsPerf.default 794 786 1.01:1
ItemLayoutMinimalPerf.default 1229 1217 1.01:1
ListMinimalPerf.default 534 528 1.01:1
LoaderMinimalPerf.default 706 702 1.01:1
SliderMinimalPerf.default 1711 1699 1.01:1
TextMinimalPerf.default 356 353 1.01:1
CustomToolbarPrototype.default 4174 4125 1.01:1
DialogMinimalPerf.default 784 781 1:1
DropdownMinimalPerf.default 3092 3087 1:1
LayoutMinimalPerf.default 366 365 1:1
ListCommonPerf.default 650 653 1:1
ListWith60ListItems.default 660 659 1:1
RosterPerf.default 1217 1222 1:1
ProviderMergeThemesPerf.default 1781 1777 1:1
AlertMinimalPerf.default 278 280 0.99:1
AnimationMinimalPerf.default 557 563 0.99:1
ChatWithPopoverPerf.default 390 393 0.99:1
PopupMinimalPerf.default 634 639 0.99:1
ToolbarMinimalPerf.default 949 957 0.99:1
BoxMinimalPerf.default 362 370 0.98:1
MenuButtonMinimalPerf.default 1662 1690 0.98:1
IconMinimalPerf.default 618 631 0.98:1
TableManyItemsPerf.default 1923 1958 0.98:1
VideoMinimalPerf.default 649 662 0.98:1
ChatDuplicateMessagesPerf.default 304 315 0.97:1
ListNestedPerf.default 557 575 0.97:1
TreeMinimalPerf.default 819 843 0.97:1
ChatMinimalPerf.default 745 776 0.96:1
ButtonOverridesMissPerf.default 1720 1802 0.95:1
FlexMinimalPerf.default 300 315 0.95:1
TextAreaMinimalPerf.default 495 523 0.95:1

.vscode/settings.json Show resolved Hide resolved
@@ -62,7 +64,9 @@ function loadStories() {

for (const req of contexts) {
req.keys().forEach(key => {
generateStoriesFromExamples(key, stories, req);
if (includeE2E || !key.includes('/e2e/')) {
Copy link
Member

Choose a reason for hiding this comment

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

do stories in react-examples actually show up in the docsite ? I thought that it was an internal only dev loop

Copy link
Member Author

Choose a reason for hiding this comment

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

They're also for our public docs: all the examples on the individual control pages here https://developer.microsoft.com/en-us/fluentui#/controls/web

They're also used in our legacy demo site https://aka.ms/fluentdemo.

Copy link
Member Author

Choose a reason for hiding this comment

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

The list of examples to include in both of those cases is set up manually, and neither of those use storybook. The query param is just for if someone wants to start with storybook.

@andrefcdias andrefcdias removed their request for review February 10, 2022 15:36
@ecraig12345
Copy link
Member Author

Noticed I had some tests in there referencing currently nonexistent stories, which should have caused the build to fail, but it didn't--turns out this was because the e2e step was scoped to react-components. So I added react to the scope and I'm letting it build to verify that it fails, then will push a fix.

@ecraig12345
Copy link
Member Author

Removed the extra tests, so now it should work.

scripts/cypress.js Outdated Show resolved Hide resolved
scripts/cypress.js Outdated Show resolved Hide resolved
@ecraig12345 ecraig12345 merged commit 525ac96 into microsoft:master Feb 12, 2022
@ecraig12345 ecraig12345 deleted the cypress-v8 branch February 12, 2022 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable cypress for v8
6 participants