mirror of
https://github.com/enso-org/enso.git
synced 2024-12-22 14:51:33 +03:00
6d73dadcee
- Updates the model types for the request/response bodies to match the backend. - Renames `CreatePermissionRequestBody::userSubjects` to match `CreatePermissionRequestBody::actorsIds` on the backend - Renames `UserInfo::organization_id` to camel case - Adds `UserInfo::userId` field to match the backend - Merges `SimpleUser` into `UserInfo` Previously, `UserInfo`'s `OrganizationId` was serialized as `pk`. This is not desired since `pk` is an implementation detail (relating to DynamoDB). This commit renames the field to accurately reflect the type of data it contains. - Renames `User::id` to `User::organizationId`. Previously, the user's organization ID was under the `id` field. As of enso-cloud/cloud-v2#1098, this is no longer the case. The `organizationId` field is no longer a user's primary identifier -- `userId` should be used for that purpose instead. So this field has been renamed to `organizationId` to more clearly describe the purpose of the field. Affects the responses expected from the following endpoints: - `PUT /users/me/picture` - `PUT /users/me` - `GET /users/me` - `PUT /users/{userId}/usergroups` - Adds `User::userId` field. Previously, the user's organization ID was used to uniquely identify a user. Now that multiple users can be invited to an organization, it is no longer appropriate to use organization ID to uniquely refer to a user. For this purpose, the backend has introduced the `userId` field. Affects the responses expected from the following endpoints: - `POST /users` - `PUT /users/me/picture` - `PUT /users/me` - `GET /users/me` - `PUT /users/{userId}/usergroups` Removes the `user` param from `tryGetSingletonOwnerPermission`. This param was previously required. It was required because a `userSubject` was necessary to optimistically generate a `UserPermission`. With recent refactors, a `userId` can be used in place of `userSubject` to generate a `UserPermission`. The existing param `owner` provides the `userId`, so the `user` param is redundant and can be removed. - Removes `UserInfo` from the `FullUserSession`. Previously, `UserInfo` in the `FullUserSession` was required to obtain a `userSubject`. Now, `userSubject` has been deprecated in favour of `userId`. `User` provides `userId`, and is present in the `FullUserSession`. Thus, this commit removes `UserInfo` from the `FullUserSession` since it is redundant. - Renames `UserInfo` fields to `camelCase` Previously, `UserInfo`'s fields were serialized as `snake_case`. This is not desired since the convention for the frontend is to use `camelCase` for field names where possible. This commit renames the fields to be `camelCase`, now that the backend has been updated accordingly. - Sorts by `userId` rather than `email` - Compares by `userId` rather than `email` - Extends `User` from `UserInfo` After refactoring, `UserInfo` is now a subset of `User`. To remove duplication, this commit modifies `User` to extend `UserInfo`.
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
/** @file Test the login flow. */
|
|
import * as test from '@playwright/test'
|
|
|
|
import * as actions from './actions'
|
|
|
|
// =============
|
|
// === Tests ===
|
|
// =============
|
|
|
|
test.test('sign up without organization id', async ({ page }) => {
|
|
await page.goto('/')
|
|
await page.waitForLoadState('domcontentloaded')
|
|
await page.goto('/registration')
|
|
const api = await actions.mockApi({ page })
|
|
api.setCurrentUser(null)
|
|
|
|
// Sign up
|
|
await actions.locateEmailInput(page).fill(actions.VALID_EMAIL)
|
|
await actions.locatePasswordInput(page).fill(actions.VALID_PASSWORD)
|
|
await actions.locateConfirmPasswordInput(page).fill(actions.VALID_PASSWORD)
|
|
await actions.locateRegisterButton(page).click()
|
|
|
|
// Log in
|
|
await actions.locateEmailInput(page).fill(actions.VALID_EMAIL)
|
|
await actions.locatePasswordInput(page).fill(actions.VALID_PASSWORD)
|
|
await actions.locateLoginButton(page).click()
|
|
|
|
// Set username
|
|
await actions.locateUsernameInput(page).fill('arbitrary username')
|
|
await actions.locateSetUsernameButton(page).click()
|
|
|
|
test
|
|
.expect(api.currentUser?.organizationId, 'new user has correct organization id')
|
|
.toBe(api.defaultOrganizationId)
|
|
})
|