Skip to content

Commit ac3241d

Browse files
authored
Merge pull request #40 from vaibhavbansal23/state-fix-and-cypress-tests into multiple/e2e-ikimage-bugfix
Fix for issue #36 and cypress e2e tests for lazy loading and lqip
2 parents d2d77d9 + 81b8b0e commit ac3241d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+26697
-103
lines changed

.github/workflows/nodejs.yml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on: [push]
44

55
jobs:
66
build:
7-
87
runs-on: ubuntu-latest
98

109
strategy:
@@ -13,11 +12,13 @@ jobs:
1312

1413
steps:
1514
- uses: actions/checkout@v1
15+
1616
- name: Use Node.js ${{ matrix.node-version }}
1717
uses: actions/setup-node@v1
1818
with:
1919
node-version: ${{ matrix.node-version }}
20-
- name: npm install, build, and test
20+
21+
- name: Setup module and run unit tests
2122
run: |
2223
npm install
2324
npm run test:ci
@@ -26,3 +27,38 @@ jobs:
2627
REACT_APP_PUBLIC_KEY: ${{ secrets.ik_public_key }}
2728
REACT_APP_PRIVATE_KEY: ${{ secrets.ik_private_key }}
2829
REACT_APP_URL_ENDPOINT: ${{ secrets.ik_url_endopint }}
30+
31+
e2e:
32+
runs-on: ubuntu-latest
33+
34+
strategy:
35+
matrix:
36+
node-version: [12.x]
37+
38+
steps:
39+
- uses: actions/checkout@v1
40+
41+
- name: Use Node.js ${{ matrix.node-version }}
42+
uses: actions/setup-node@v1
43+
with:
44+
node-version: ${{ matrix.node-version }}
45+
46+
- name: Setup module and build test-app
47+
run: |
48+
npm install
49+
npm run build
50+
cd tests/test-app
51+
echo REACT_APP_URL_ENDPOINT = ${{ secrets.ik_url_endopint }} > .env;
52+
npm install
53+
npm run build
54+
55+
- name: Run E2E tests
56+
uses: cypress-io/github-action@v2
57+
with:
58+
start: npm run start:test-app
59+
wait-on: http://localhost:3001
60+
env:
61+
CI: true
62+
REACT_APP_PUBLIC_KEY: ${{ secrets.ik_public_key }}
63+
REACT_APP_PRIVATE_KEY: ${{ secrets.ik_private_key }}
64+
REACT_APP_URL_ENDPOINT: ${{ secrets.ik_url_endopint }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ node_modules
44
lib
55
dist
66
coverage
7+
*/.DS_Store
8+
*/*/.DS_Store

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ npm run build
1212

1313
## Running test cases
1414

15-
The designated directory for tests is `/src/test` folder. All tests will be run against the assertion present in the `/src/test/__snapshot__` folder. To create this file you need to just run below command just once. Any update in the tests can be updated to by pressing `u` while the test environment is running.
15+
The designated directory for tests is `/test/jest` folder. All tests will be run against the assertion present in the `/test/jest/__snapshot__` folder. To create this file you need to just run below command just once. Any update in the tests can be updated to by pressing `u` while the test environment is running.
1616

1717
Execute following command from the root folder to start testing.
1818
```sh

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ The `IKImage` component renders an `img` tag. It is used for rendering and manip
177177
| transformation | Array of objects |Optional. An array of objects specifying the transformation to be applied in the URL. The transformation name and the value should be specified as a key-value pair in the object. See list of [different tranformations](#list-of-supported-transformations). Different steps of a [chained transformation](https://docs.imagekit.io/features/image-transformations/chained-transformations) can be specified as the Array's different objects. The complete list of supported transformations in the SDK and some examples of using them are given later. If you use a transformation name that is not specified in the SDK, it is applied in the URL as it is. |
178178
| transformationPosition | String |Optional. The default value is `path` that places the transformation string as a URL path parameter. It can also be specified as `query`, which adds the transformation string as the URL's query parameter i.e.`tr`. If you use `src` parameter to create the URL, then the transformation string is always added as a query parameter. |
179179
| queryParameters | Object |Optional. These are the other query parameters that you want to add to the final URL. These can be any query parameters and not necessarily related to ImageKit. Especially useful if you want to add some versioning parameter to your URLs. |
180-
| loading | String |Optional. Pass `lazy` to lazy load images |
181-
| lqip | Object |Optional. You can use this to show a low-quality blurred placeholder while the original image is being loaded e.g. `{active:true, quality: 20, blur: 6`}. The default value of `quality` is `20` and `blur` is `6`.|
180+
| loading | String |Optional. Pass `lazy` to lazy load images. Note: Component does not accept change in this value after it has mounted. |
181+
| lqip | Object |Optional. You can use this to show a low-quality blurred placeholder while the original image is being loaded e.g. `{active:true, quality: 20, blur: 6`}. The default value of `quality` is `20` and `blur` is `6`. <br /> Note: Component does not accept change in this value after it has mounted.|
182182

183183
### Basic resizing examples
184184

cypress.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"fixturesFolder": "tests/cypress/fixtures",
3+
"integrationFolder": "tests/cypress/integration",
4+
"pluginsFile": "tests/cypress/plugins/index.js",
5+
"screenshotsFolder": "tests/cypress/screenshots",
6+
"videosFolder": "tests/cypress/videos",
7+
"supportFile": "tests/cypress/support/index.js",
8+
"env": {
9+
"APP_HOST": "http://localhost:3001/"
10+
}
11+
}

0 commit comments

Comments
 (0)