generated from cfpb/open-source-project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[e2e] speed up
unavailableApis.spec.ts
, make api calls retries env …
…variable (#968) closes #916 closes #993 ## Changes - dev: Adds `SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS` as an environment variable - dev: Disables `React-Query` _retries_ based on `SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS` - e2e: Updates `unavailableApis.spec.ts` to not wait for retries - e2e: further utilized `uploadFile.ts` to deduplicate code usage - e2e: `yarn test:e2e` edited to include chmod and `./run-playwright.sh` ## How to test this PR 1. Add `SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS="false"` to your `.env` 2. ~~`chmod +x run-playwright.sh`~~ 3. ~~`sh run-playwright.sh` or `sh run-playwright.sh --headless`~~ 4. Run `yarn test:e2e` 5. Run `unavailableApis.spec.ts` 6. Verify the test passes and that the blocked APIs show up only once (see screenshot) ## Screenshots <img width="1392" alt="Screenshot 2024-10-03 at 3 57 20 PM" src="https://github.com/user-attachments/assets/de80dbf5-458a-484b-89e8-8a8c68de9d92"> ## Notes - ~~The tester must now manually set `SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS` to `true` before running tests~~ - The script `run-playwright.sh` is used so that the tester doesn't need to manually flip `SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS` before tests ## Questions - Do we want an actual environment variable to manually control the amount of `React-Query` retries for all requests or is this approach (i.e. `SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS` -- a test flag) sufficient?
- Loading branch information
1 parent
1ab3869
commit 1513c6a
Showing
22 changed files
with
133 additions
and
95 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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,8 @@ | ||
uid,app_date,app_method,app_recipient,ct_credit_product,ct_credit_product_ff,ct_guarantee,ct_guarantee_ff,ct_loan_term_flag,ct_loan_term,credit_purpose,credit_purpose_ff,amount_applied_for_flag,amount_applied_for,amount_approved,action_taken,action_taken_date,denial_reasons,denial_reasons_ff,pricing_interest_rate_type,pricing_init_rate_period,pricing_fixed_rate,pricing_adj_margin,pricing_adj_index_name,pricing_adj_index_name_ff,pricing_adj_index_value,pricing_origination_charges,pricing_broker_fees,pricing_initial_charges,pricing_mca_addcost_flag,pricing_mca_addcost,pricing_prepenalty_allowed,pricing_prepenalty_exists,census_tract_adr_type,census_tract_number,gross_annual_revenue_flag,gross_annual_revenue,naics_code_flag,naics_code,number_of_workers,time_in_business_type,time_in_business,business_ownership_status,num_principal_owners_flag,num_principal_owners,po_1_ethnicity,po_1_ethnicity_ff,po_1_race,po_1_race_anai_ff,po_1_race_asian_ff,po_1_race_baa_ff,po_1_race_pi_ff,po_1_gender_flag,po_1_gender_ff,po_2_ethnicity,po_2_ethnicity_ff,po_2_race,po_2_race_anai_ff,po_2_race_asian_ff,po_2_race_baa_ff,po_2_race_pi_ff,po_2_gender_flag,po_2_gender_ff,po_3_ethnicity,po_3_ethnicity_ff,po_3_race,po_3_race_anai_ff,po_3_race_asian_ff,po_3_race_baa_ff,po_3_race_pi_ff,po_3_gender_flag,po_3_gender_ff,po_4_ethnicity,po_4_ethnicity_ff,po_4_race,po_4_race_anai_ff,po_4_race_asian_ff,po_4_race_baa_ff,po_4_race_pi_ff,po_4_gender_flag,po_4_gender_ff | ||
000TESTFIUIDDONOTUSEXGXVID11XTC1,20241201,1,1,988,,999,,999,,999,,999,,,5,20241231,999,,999,,,,999,,,,,,999,,999,999,988,,988,,988,,988,988,,988,988,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, | ||
000TESTFIUIDDONOTUSEXGXVID12XTC1,20241201,1,1,988,,999,,999,,999,,999,,,5,20241231,999,,999,,,,999,,,,,,999,,999,999,988,,988,,988,,988,988,,988,988,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, | ||
000TESTFIUIDDONOTUSEXGXVID13XTC1,20241201,1,1,988,,999,,999,,999,,999,,,5,20241231,999,,999,,,,999,,,,,,999,,999,999,988,,988,,988,,988,988,,988,988,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, | ||
000TESTFIUIDDONOTUSEXGXVID14XTC1,20241201,1,1,988,,999,,999,,999,,999,,,5,20241231,999,,999,,,,999,,,,,,999,,999,999,988,,988,,988,,988,988,,988,988,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, | ||
000TESTFIUIDDONOTUSEXGXVID21XTC1,20241201,1,1,988,,999,,999,,999,,999,,,5,20241231,999,,999,,,,999,,,,,,999,,999,999,988,,988,,988,,988,988,,988,988,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, | ||
000TESTFIUIDDONOTUSEXGXVID31XTC1,20241201,1,1,988,,999,,999,,999,,999,,,5,20241231,999,,999,,,,999,,,,,,999,,999,999,988,,988,,988,,988,988,,988,988,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, | ||
000TESTFIUIDDONOTUSEXGXVID31XTC2,20241201,2,1,988,,999,,999,,999,,999,,,5,20241231,999,,999,,,,999,,,,,,999,,999,999,988,,988,,988,,988,988,,988,988,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, |
This file contains 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 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 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,33 @@ | ||
#!/bin/bash | ||
|
||
# Set SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS to "true" in the .env file and check if SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS exists in the .env file | ||
if grep -q 'SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS' .env; then | ||
echo 'Updating SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS="true" in .env' | ||
sed -i '' 's/SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS=.*/SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS="true"/' .env | ||
else | ||
echo 'SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS not found, adding SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS="true" to .env' | ||
echo 'SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS="true"' >> .env | ||
fi | ||
|
||
# Check for --headless argument | ||
if [ "$1" == "--headless" ]; then | ||
echo "Running Playwright tests in headless mode..." | ||
yarn playwright test --workers 4 | ||
else | ||
echo "Running Playwright tests with UI..." | ||
yarn playwright test --ui --workers 4 | ||
fi | ||
|
||
# Check if Playwright exited successfully | ||
if [ $? -eq 0 ]; then | ||
echo "Playwright tests completed successfully." | ||
else | ||
echo "Playwright tests failed." | ||
fi | ||
|
||
# Reset SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS to "false" in the .env file | ||
echo 'Resetting SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS="false" in .env' | ||
sed -i '' 's/SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS=.*/SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS="false"/' .env | ||
|
||
# Confirm the changes | ||
echo 'SBL_ENABLE_PLAYWRIGHT_TEST_SETTINGS has been reset to "false" in .env' |
This file contains 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 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
Oops, something went wrong.