Files
iNaturalistReactNative/scripts/check-test-user.js
Johannes Klein ba0016365f Crud e2e (#696)
* Update comment

* Scaffold for e2e test

* Upload observation

* Update the observation by adding a comment

* Checking that comment appears

* Delete the observation

* Check that the comment is added succesfully

* Do not invalidate searchObservations query cache after observation deletion

* Update test IDs

* Script to check if e2e test user has observations

* Log out api response

* Increase default test timeout
2023-09-13 13:48:50 +02:00

25 lines
915 B
JavaScript

require( "dotenv" ).config();
const inaturalistjs = require( "inaturalistjs" );
const testUser = process.env.E2E_TEST_USERNAME;
const checkTestUsersObservations = async ( ) => {
// eslint-disable-next-line camelcase
const apiResponse = await inaturalistjs.observations.search( {
user_id: testUser
} );
console.log( "apiResponse :>> ", apiResponse );
// eslint-disable-next-line camelcase
if ( apiResponse.total_results !== 0 ) {
// eslint-disable-next-line max-len
console.log( "The e2e test user has observations associated with it, this will break the e2e tests." );
console.log( "Please, manually remove those observations from the production database." );
console.log( "If this happens repeatedly something might be fixed or automated." );
process.exit( 1 );
}
console.log( "E2e test user has no observations" );
process.exit( 0 );
};
checkTestUsersObservations( );