mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-02-20 07:44:01 -05:00
* add firebase emulator, add registration script, add signup spec * Upgrade firebase emulator and make it pass the E2E tests --------- Co-authored-by: MartinBraquet <martin.braquet@gmail.com>
43 lines
958 B
TypeScript
43 lines
958 B
TypeScript
import { test as base } from '@playwright/test';
|
|
import axios from 'axios';
|
|
import { config } from '../SPEC_CONFIG';
|
|
|
|
const baseUrl = 'http://localhost:9099/identitytoolkit.googleapis.com/v1';
|
|
|
|
async function deleteUser(email: string, password: string) {
|
|
try {
|
|
const login = await axios.post(
|
|
`${baseUrl}/accounts:signInWithPassword?key=fake-api-key`,
|
|
{
|
|
email,
|
|
password,
|
|
returnSecureToken: true
|
|
}
|
|
);
|
|
|
|
await axios.post(
|
|
`${baseUrl}/accounts:delete?key=fake-api-key`,
|
|
{ idToken: login.data.idToken }
|
|
);
|
|
} catch (err: any) {
|
|
console.log(err);
|
|
}
|
|
}
|
|
|
|
type CleanupFixtures = {
|
|
cleanupUsers: void;
|
|
};
|
|
|
|
export const test = base.extend<CleanupFixtures>({
|
|
cleanupUsers: [
|
|
async ({}, use) => {
|
|
// Run all tests first
|
|
await use();
|
|
|
|
//then delete users
|
|
await deleteUser(config.USERS.SPEC.EMAIL, config.USERS.SPEC.PASSWORD);
|
|
},
|
|
{ auto: true },
|
|
],
|
|
});
|