Commit Graph

19 Commits

Author SHA1 Message Date
Bartosz Stefańczyk
a089cc2efc feat: e2e snapshot tests (#2338)
<!-- Thanks for submitting a pull request! We appreciate you spending
the time to work on these changes. Please follow the template so that
the reviewers can easily understand what the code changes affect -->

# Summary

This PR adds E2E tests based on view screenshots done via
`react-native-view-shot`. It only works with devices that have their
[pixel ratio](https://reactnative.dev/docs/pixelratio) equal `3`. If you
want to use device with different pixel ratio, you need to adjust it in
`e2e/generateReferences.ts` viewport and regenerate reference images
(see below).

Steps to run tests:
- Run Metro server for example app via `yarn start` in example app's
directory
- Run `example` app on platform of your choice (currently only Android &
iOS are supported) via `yarn android` or `yarn ios` in example app's
directory
- Run `yarn e2e` in project's root directory to start Jest server
- Select `E2E` tab in example app
- Wait for tests to finish
- You can see test results, as well as diffs (actual rendered svg vs
reference image) in `e2e/diffs` directory

Steps to add new test cases:
- Put SVG of your choice to `e2e/cases` directory
- Run `yarn generateE2eRefrences`, this will open headless chrome
browser via `puppeteer` and snapshot all rendered SVGs to .png files and
later use them as reference in tests
- You should see new .png files in `e2e/references`
- When you run E2E tests again, it will use new test case(s) you've
added

## Test Plan


https://github.com/software-mansion/react-native-svg/assets/41289688/24ee5447-ce9a-43b6-9dde-76229d25a30a


https://github.com/software-mansion/react-native-svg/assets/41289688/71d1873f-8155-4494-80bd-e4c1fa72a065


### What's required for testing (prerequisites)?
See Summary

### What are the steps to reproduce (after prerequisites)?
See Summary

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |    	     |
| Android |         |
| Web | 			 |
## Checklist



<!-- Check completed item, when applicable, via: [X] -->

- [X] I have tested this on a device and a simulator
- [x] I added documentation in `README.md`
- [X] I updated the typed files (typescript)
- [X] I added a test for the API in the `__tests__` folder

---------

Co-authored-by: bohdanprog <bohdan.artiukhov@swmansion.com>
Co-authored-by: Jakub Grzywacz <jakub.grzywacz@swmansion.com>
2024-08-23 13:29:38 +02:00
Bohdan Artiukhov
4fd2ccdb94 fix: add new macos examples (#2372)
# Summary
We want to avoid problems with GitHub workflows.
Create a new Macos example for new and old architecture.

## Test Plan

Run GitHub workflows

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| macOS     |         |

---------

Co-authored-by: Jakub Grzywacz <jakub.grzywacz@swmansion.com>
2024-07-29 14:46:00 +02:00
Wojciech Lewicki
416ccc8a86 fix: bump packages, eslint, tsconfig, prettier and resolve all conflicts (#2114)
PR bumping packages, eslint, tsconfig, prettier and resolving all conflicts connected to it.
2023-08-07 17:44:58 +02:00
Mathieu Acthernoene
2fa9645cf6 Add web example (#1717)
Added web example to `Example`
2022-03-07 12:16:50 +01:00
Kexin Zhang
981cf4fb12 use build/ in .gitignore 2020-01-21 16:37:49 -08:00
Mikael Sand
fcd66fbf47 feat(flow): add flowgen to generate flow types from typescript, #1125
upgrade dev deps
2019-10-07 18:59:09 +03:00
Mikael Sand
1b0e4e4975 Merge remote-tracking branch 'origin/master' into ts
# Conflicts:
#	.gitignore
#	index.d.ts
2019-09-09 19:00:53 +03:00
Николай Вовк
766018a9e8 Add ts types for xml.js 2019-09-09 18:37:15 +03:00
Mikael Sand
4f3e34e556 refactor: typescript 2019-09-09 05:44:29 +03:00
Horcrux
fabefb7158 upgrade example`s react-native version to 0.29.0 2016-07-13 17:56:10 +08:00
Horcrux
905df8acc1 remove unnecessary gradle files 2016-06-11 09:37:31 +08:00
Horcrux
cbce096b5c Use eslint, add travis-ci 2016-05-04 17:54:30 +08:00
Horcrux
214af973eb fix .gitignore 2016-04-28 11:25:12 +08:00
Horcrux
d7a9e418ae fix .gitignore 2016-04-25 23:46:48 +08:00
Horcrux
76856ce457 document the circle percentage radius algorithm 2016-04-25 23:46:04 +08:00
Horcrux
2e9334fb9a ignore unfinished documents 2016-04-22 09:36:02 +08:00
Horcrux
c8a04c3d28 remove unused vars 2016-04-19 15:18:16 +08:00
Horcrux
cc8d5f935d fix .gitignore
fix .gitignore
2016-02-18 23:11:09 +08:00
Horcrux
1bd38f2b1e init project
init project
2016-01-17 22:29:06 +08:00