@ -1,69 +1,6 @@ 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					# Testing Guide 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					## Automated Tests 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					### Setup 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					1. Clone and set up the Endorser server: 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					```bash 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					git clone https://github.com/time-endorser/endorser-ch.git 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					cd endorser-ch 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					npm install 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					test/test.sh 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					cp .env.local .env 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					NODE_ENV=test-local npm run dev 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					``` 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					If that fails, follow the instructions in the endorser-ch directory's README.md. 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					2. Install Playwright browsers: 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					```bash 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					npx playwright install 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					``` 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					### Running Tests 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					#### Full Test Suite 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					To run all tests, make sure XCode is started and either Android Studio is started or an Android device is connected. 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					```bash 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					npm run test:all 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					``` 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					Run only web tests: 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					```bash 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					npm run test:web 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					``` 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					Note: Tests may occasionally fail and succeed on rerun (especially if a different test fails). 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					#### Single Test 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					To run a single test with tracing enabled: 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					```bash  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					npx playwright test -c playwright.config-local.ts --trace on test-playwright/40-add-contact.spec.ts 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					``` 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					#### Global Test Server 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					It's possible to use the global test Endorser (ledger) server, though not all tests currently succeed: 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					```bash 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					VITE_DEFAULT_ENDORSER_API_SERVER=https://test-ledger.time.com npm run dev 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					``` 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					#### Minimal Test Data 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					To run with minimal test data: 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					```bash 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					rm ../endorser-ch-test-local.sqlite3 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					NODE_ENV=test-local npm run flyway migrate 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					NODE_ENV=test-local npm run test test/controller0 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					NODE_ENV=test-local npm run dev 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					``` 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					Start with [README.md ](./README.md ). This file has more details. 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					## Test User Setup