How to run web with API-Mock
- Run api-mock
yarn dev
in your local (github), It will be started on localhost:3000
- Go to www/packages/payment and start dev
NODE_CONFIG_ENV=test MOCK_API=true MOCK_API_URL='http://localhost:3000' yarn dev
- Clear all the browser Cookies.
- First, generate encoded tvLifetime that contain the mock states. We can use api-mock bulkchangebehavior endpoint to generate it. We need list of mock states from the file in mock-state folder. This is the Sample CURL
- Copy encoded tvLifetime in response data.context and inject it to browser cookies (Find cookie
tvl
in Developer tools > Application > Cookies, double click column Value and paste the encoded tvLifetime there)
- Refresh the test page, it should using the api-mock endpoint - you can check the log in api-mock process.
How to Record
- Run
MOCK_STATE_FOLDER=<path-to-folder> yarn dev
in api-mock service
- Go to www/packages/payment and start
yarn record
- Open the designated page & wait until all XHR finished
- Stop api-mock service to write the file
- Update threshold in payment package
- payment/desktop/threshold.js
- payment/mobile/threshold.js