-
Notifications
You must be signed in to change notification settings - Fork 2
Добавлены тесты производительности с помощью Reassure #1
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
Closed
Closed
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
42a7f0b
feat(reassure): установлен reassure для тестирования производительности
isokolovskii af7861a
feat(reassure): тесты производительности Accordion
isokolovskii 356b9f5
feat(reassure): добавлены тесты производительности Avatar
isokolovskii 3b9c676
feat(reassure): добавлены тесты производительности для Badge
isokolovskii b9d4c3c
feat(reassure): переиспользуемая утилитарная функция для замера произ…
isokolovskii b439084
feat(reassure): тесты производительности компонента Button
isokolovskii b527391
feat(reassure): тесты производительности компонента Checkbox
isokolovskii b6d270b
feat(reassure): тесты производительности компонента Chip
isokolovskii 49872e9
feat(reassure): тесты производительности компонента Dialog
isokolovskii 862bead
feat(reassure): тесты производительности компонента Divider
isokolovskii bfc2c7c
feat(reassure): тесты производительности компонента Input
isokolovskii bb319de
feat(reassure): тесты производительности компонента List
isokolovskii 97400ad
feat(reassure): тесты производительности компонента MenuItemTemplate
isokolovskii 64eef9b
feat(reassure): тесты производительности компонента Message
isokolovskii 4946415
feat(reassure): тесты производительности компонента ProgressBar
isokolovskii 3a99a23
refactor(tests): исправлены замечания линтера в тестах и поправлен за…
isokolovskii 04f1c32
feat(reassure): тесты производительности компонента ProgressSpinner
isokolovskii 6a9c1f5
feat(reassure): тесты производительности компонента RadioButton
isokolovskii 88750af
feat(reassure): тесты производительности компонента Rating
isokolovskii 473ecde
feat(reassure): тесты производительности компонента SelectButton
isokolovskii 069fada
feat(reassure): тесты производительности компонента Skeleton
isokolovskii 77a2ed6
feat(reassure): тесты производительности компонента Slider
isokolovskii d7aaf14
feat(reassure): тесты производительности компонента Tabs
isokolovskii 752c47e
feat(reassure): тесты производительности компонента Tag
isokolovskii 36ff71e
feat(reassure): тесты производительности компонента Timer
isokolovskii fde667b
feat(reassure): тесты производительности компонента ToggleButton
isokolovskii 6e57219
fix(reassure): исправление тестов производительности RadioButton и Se…
isokolovskii 105de20
feat(reassure): тесты производительности компонента InputSwitch
isokolovskii 52c8292
feat(reassure): тесты производительности компонентов ButtonBadge и Bu…
isokolovskii 3e3bc49
feat(reassure): тесты производительности компонентов типографики
isokolovskii 1caf9a8
feat(reassure): добавлены дополнительные тесты для компонента Accordion
isokolovskii 6d985d4
feat(reassure): добавлены дополнительные тесты для компонента Avatar
isokolovskii c393559
feat(reassure): добавлены дополнительные тесты для компонента Dialog
isokolovskii 11362d0
feat(reassure): добавлены дополнительные тесты для компонента Input
isokolovskii 5ee301e
feat(reassure): добавлены дополнительные тесты для компонента Slider
isokolovskii c486e7f
feat(reassure): workflow для линтера, тестов, проверок и тестов на пр…
isokolovskii f2aec41
fix(reassure): исправление тестов производительности Slider
isokolovskii d096d3d
ci(reassure): правки в GitHub Workflows
isokolovskii ead6068
chore(reassure): правки замечаний линтера
isokolovskii 994521b
fix(tests): исправление упавших тестов
isokolovskii c2501c8
fix(reassure): исправление запуска reassure в CI
isokolovskii 03f0194
chore(reassure): небольшие изменения
isokolovskii File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| name: Lint | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: ["**"] | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. По моему это не обязательно, и так должен на всех ветках запускаться
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Над проверить. Я вообще вынесу экшоны из этого PR я думаю |
||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.head_ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| lint: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Setup Node.js with Dependencies | ||
| uses: ./.github/actions/setup-node | ||
|
|
||
| - name: Lint | ||
| run: yarn lint:check | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| name: Test Performance Stability | ||
|
|
||
| on: [workflow_dispatch] | ||
|
|
||
| permissions: read-all | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: ${{ !contains(github.ref, 'main')}} | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Performance Stability | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Setup Node.js with Dependencies | ||
| uses: ./.github/actions/setup-node | ||
|
|
||
| - name: Run stability checks | ||
| run: yarn reassure check-stability |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| name: Performance Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: ["**"] | ||
|
|
||
| permissions: | ||
| pull-requests: write # required for Danger to post comments | ||
| statuses: write # required for Danger to post commit statuses | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.head_ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| test_performance: | ||
| name: Performance Tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 # Required for git operations in reassure-tests.sh | ||
|
|
||
| - name: Setup Node.js with Dependencies | ||
| uses: ./.github/actions/setup-node | ||
|
|
||
| - name: Run Reassure Performance Tests | ||
| run: ./reassure-tests.sh | ||
| env: | ||
| REASSURE_OUTPUT_FILE: .reassure/output.md | ||
|
|
||
| - name: Run Danger | ||
| run: yarn danger ci | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Upload Reassure report | ||
| uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: reassure-report | ||
| path: .reassure/output.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| name: Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: ["**"] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.head_ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Setup Node.js with Dependencies | ||
| uses: ./.github/actions/setup-node | ||
|
|
||
| - name: Test | ||
| run: yarn test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| name: Typecheck | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: ["**"] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.head_ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| typecheck: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Setup Node.js with Dependencies | ||
| uses: ./.github/actions/setup-node | ||
|
|
||
| - name: Typecheck | ||
| run: yarn tsc --noEmit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,3 +55,5 @@ web-build/ | |
|
|
||
| # direnv | ||
| .envrc | ||
| # Reassure output directory | ||
| .reassure | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,4 +49,7 @@ expo | |
| .prettierignore | ||
| .vscode | ||
| xcode-installation.png | ||
| configs | ||
| configs | ||
| dangerfile.js | ||
| .reassure | ||
| reassure-tests.sh | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| // eslint-disable-next-line import-x/no-nodejs-modules | ||
| import path from 'path' | ||
|
|
||
| import { dangerReassure } from 'reassure' | ||
|
|
||
| dangerReassure({ inputFilePath: path.join(__dirname, './.reassure/output.md') }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #!/usr/bin/env bash | ||
| set -e | ||
|
|
||
| BASELINE_BRANCH=${GITHUB_BASE_REF:="main"} | ||
|
|
||
| # Required for `git switch` on CI | ||
| git fetch origin | ||
|
|
||
| # Gather baseline perf measurements | ||
| git switch "$BASELINE_BRANCH" | ||
|
|
||
| yarn install --immutable | ||
| yarn reassure --baseline | ||
|
|
||
| # Gather current perf measurements & compare results | ||
| git switch --detach - | ||
|
|
||
| yarn install --immutable | ||
| yarn reassure --branch |
77 changes: 77 additions & 0 deletions
77
src/components/Accordion/__tests__/Accordion.perf-test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| import { IconUser, IconDiamond } from '@tabler/icons-react-native' | ||
| import { fireEvent, screen } from '@testing-library/react-native' | ||
| import { View } from 'react-native' | ||
|
|
||
| import { measureComponentPerformance } from '../../../utils/__tests__/perf-utils' | ||
| import { Accordion, AccordionTestIds } from '../Accordion' | ||
|
|
||
| describe('Accordion performance', () => { | ||
| test('initial render (collapsed)', async () => { | ||
| await measureComponentPerformance( | ||
| <Accordion title='Accordion'> | ||
| <View style={{ height: 100 }} /> | ||
| </Accordion> | ||
| ) | ||
| }) | ||
|
|
||
| test('initial render (expanded)', async () => { | ||
| await measureComponentPerformance( | ||
| <Accordion isInitiallyExpanded title='Accordion'> | ||
| <View style={{ height: 100 }} /> | ||
| </Accordion> | ||
| ) | ||
| }) | ||
|
|
||
| test('initial render with Icon', async () => { | ||
| await measureComponentPerformance( | ||
| <Accordion Icon={IconUser} title='Accordion'> | ||
| <View style={{ height: 100 }} /> | ||
| </Accordion> | ||
| ) | ||
| }) | ||
|
|
||
| test('initial render with titleExtra', async () => { | ||
| await measureComponentPerformance( | ||
| <Accordion title='Accordion' titleExtra={<IconDiamond />}> | ||
| <View style={{ height: 100 }} /> | ||
| </Accordion> | ||
| ) | ||
| }) | ||
|
|
||
| test('initial render with withSeparator', async () => { | ||
| await measureComponentPerformance( | ||
| <Accordion withSeparator title='Accordion'> | ||
| <View style={{ height: 100 }} /> | ||
| </Accordion> | ||
| ) | ||
| }) | ||
|
|
||
| test('initial render when disabled', async () => { | ||
| await measureComponentPerformance( | ||
| <Accordion disabled title='Accordion'> | ||
| <View style={{ height: 100 }} /> | ||
| </Accordion> | ||
| ) | ||
| }) | ||
|
|
||
| test('toggle performance', async () => { | ||
| const scenario = async () => { | ||
| fireEvent( | ||
| screen.getByTestId(AccordionTestIds.contentWrapper, { | ||
| includeHiddenElements: true, | ||
| }), | ||
| 'layout', | ||
| { nativeEvent: { layout: { height: 100, width: 200, x: 0, y: 0 } } } | ||
| ) | ||
|
|
||
| fireEvent.press(screen.getByText('Accordion')) | ||
| } | ||
|
|
||
| await measureComponentPerformance( | ||
| <Accordion title='Accordion'> | ||
| <View style={{ height: 100 }} /> | ||
| </Accordion>, | ||
| { scenario } | ||
| ) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| import { IconUser } from '@tabler/icons-react-native' | ||
|
|
||
| import { measureComponentPerformance } from '../../../utils/__tests__/perf-utils' | ||
| import { Badge } from '../../Badge' | ||
|
|
||
| import { Avatar } from '../Avatar' | ||
|
|
||
| describe('Avatar performance', () => { | ||
| test('label', async () => { | ||
| await measureComponentPerformance( | ||
| <Avatar shape='circle' size='large' type='label'> | ||
| A | ||
| </Avatar> | ||
| ) | ||
| }) | ||
|
|
||
| test('icon', async () => { | ||
| await measureComponentPerformance( | ||
| <Avatar Icon={IconUser} shape='circle' size='large' type='icon' /> | ||
| ) | ||
| }) | ||
|
|
||
| test('image', async () => { | ||
| await measureComponentPerformance( | ||
| <Avatar | ||
| shape='circle' | ||
| size='large' | ||
| source={require('../testImage.png')} | ||
| type='image' | ||
| /> | ||
| ) | ||
| }) | ||
|
|
||
| test('size normal', async () => { | ||
| await measureComponentPerformance( | ||
| <Avatar shape='circle' size='normal' type='label'> | ||
| A | ||
| </Avatar> | ||
| ) | ||
| }) | ||
|
|
||
| test('size large', async () => { | ||
| await measureComponentPerformance( | ||
| <Avatar shape='circle' size='large' type='label'> | ||
| A | ||
| </Avatar> | ||
| ) | ||
| }) | ||
|
|
||
| test('size xlarge', async () => { | ||
| await measureComponentPerformance( | ||
| <Avatar shape='circle' size='xlarge' type='label'> | ||
| A | ||
| </Avatar> | ||
| ) | ||
| }) | ||
|
|
||
| test('size custom', async () => { | ||
| await measureComponentPerformance( | ||
| <Avatar shape='circle' size={100} type='label'> | ||
| A | ||
| </Avatar> | ||
| ) | ||
| }) | ||
|
|
||
| test('shape square', async () => { | ||
| await measureComponentPerformance( | ||
| <Avatar shape='square' size='large' type='label'> | ||
| A | ||
| </Avatar> | ||
| ) | ||
| }) | ||
|
|
||
| test('with badge', async () => { | ||
| await measureComponentPerformance( | ||
| <Avatar | ||
| badge={<Badge severity='danger'>9</Badge>} | ||
| shape='circle' | ||
| size='large' | ||
| type='label' | ||
| > | ||
| A | ||
| </Avatar> | ||
| ) | ||
| }) | ||
| }) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
А нужно ли отдельно запускать на пуш в main? Я бы просто добавил все проверки в релизном воркфлоу
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.
Ну... Вообще если допустить что никогда никто и никак в main не запушит - то может и не стоит
В релизном как раз кажется лишнее - релиз на то и релиз, зачем там проверять линтер