-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: limited to the number of boards they can join
- Loading branch information
Showing
8 changed files
with
240 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,92 @@ | ||
INSERT INTO "public"."boards" ("id", "owner_id", "created_at", "updated_at", "deleted_at") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc07419e', '122e14c5-1e9f-40a7-b376-e3dce21ff85a', '2024-08-07 04:14:19.416824', '2024-08-07 04:14:19.416824', NULL); | ||
|
||
INSERT INTO "public"."boards" ("id", "owner_id", "created_at", "updated_at", "deleted_at") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc07419f', '122e14c5-1e9f-40a7-b376-e3dce21ff85b', '2024-08-07 04:14:19.416824', '2024-08-07 04:14:19.416824', NULL); | ||
|
||
INSERT INTO "public"."boards" ("id", "owner_id", "created_at", "updated_at", "deleted_at") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074110', '122e14c5-1e9f-40a7-b376-e3dce21ff85c', '2024-08-07 04:14:19.416824', '2024-08-07 04:14:19.416824', NULL); | ||
|
||
INSERT INTO "public"."boards" ("id", "owner_id", "created_at", "updated_at", "deleted_at") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074111', '122e14c5-1e9f-40a7-b376-e3dce21ff85d', '2024-08-07 04:14:19.416824', '2024-08-07 04:14:19.416824', NULL); | ||
|
||
INSERT INTO "public"."boards" ("id", "owner_id", "created_at", "updated_at", "deleted_at") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074112', '122e14c5-1e9f-40a7-b376-e3dce21ff85e', '2024-08-07 04:14:19.416824', '2024-08-07 04:14:19.416824', NULL); | ||
|
||
INSERT INTO "public"."boards" ("id", "owner_id", "created_at", "updated_at", "deleted_at") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074113', '122e14c5-1e9f-40a7-b376-e3dce21ff85f', '2024-08-07 04:14:19.416824', '2024-08-07 04:14:19.416824', NULL); | ||
|
||
INSERT INTO "public"."boards" ("id", "owner_id", "created_at", "updated_at", "deleted_at") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074114', '122e14c5-1e9f-40a7-b376-e3dce21ff860', '2024-08-07 04:14:19.416824', '2024-08-07 04:14:19.416824', NULL); | ||
|
||
INSERT INTO "public"."boards" ("id", "owner_id", "created_at", "updated_at", "deleted_at") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074115', '122e14c5-1e9f-40a7-b376-e3dce21ff861', '2024-08-07 04:14:19.416824', '2024-08-07 04:14:19.416824', NULL); | ||
|
||
INSERT INTO "public"."boards" ("id", "owner_id", "created_at", "updated_at", "deleted_at") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074116', '122e14c5-1e9f-40a7-b376-e3dce21ff862', '2024-08-07 04:14:19.416824', '2024-08-07 04:14:19.416824', NULL); | ||
|
||
INSERT INTO "public"."boards" ("id", "owner_id", "created_at", "updated_at", "deleted_at") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074117', '122e14c5-1e9f-40a7-b376-e3dce21ff863', '2024-08-07 04:14:19.416824', '2024-08-07 04:14:19.416824', NULL); | ||
|
||
INSERT INTO "public"."boards" ("id", "owner_id", "created_at", "updated_at", "deleted_at") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074118', '122e14c5-1e9f-40a7-b376-e3dce21ff864', '2024-08-07 04:14:19.416824', '2024-08-07 04:14:19.416824', NULL); | ||
|
||
INSERT INTO "public"."boards_users" ("board_id", "user_id") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc07419e', '122e14c5-1e9f-40a7-b376-e3dce21ff85a'); | ||
|
||
INSERT INTO "public"."boards_users" ("board_id", "user_id") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc07419f', '122e14c5-1e9f-40a7-b376-e3dce21ff85b'); | ||
|
||
INSERT INTO "public"."boards_users" ("board_id", "user_id") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074110', '122e14c5-1e9f-40a7-b376-e3dce21ff85c'); | ||
|
||
INSERT INTO "public"."boards_users" ("board_id", "user_id") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074111', '122e14c5-1e9f-40a7-b376-e3dce21ff85d'); | ||
|
||
INSERT INTO "public"."boards_users" ("board_id", "user_id") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074112', '122e14c5-1e9f-40a7-b376-e3dce21ff85e'); | ||
|
||
INSERT INTO "public"."boards_users" ("board_id", "user_id") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074113', '122e14c5-1e9f-40a7-b376-e3dce21ff85f'); | ||
|
||
INSERT INTO "public"."boards_users" ("board_id", "user_id") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074114', '122e14c5-1e9f-40a7-b376-e3dce21ff860'); | ||
|
||
INSERT INTO "public"."boards_users" ("board_id", "user_id") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074115', '122e14c5-1e9f-40a7-b376-e3dce21ff861'); | ||
|
||
INSERT INTO "public"."boards_users" ("board_id", "user_id") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074116', '122e14c5-1e9f-40a7-b376-e3dce21ff862'); | ||
|
||
INSERT INTO "public"."boards_users" ("board_id", "user_id") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074117', '122e14c5-1e9f-40a7-b376-e3dce21ff863'); | ||
|
||
INSERT INTO "public"."boards_users" ("board_id", "user_id") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074118', '122e14c5-1e9f-40a7-b376-e3dce21ff864'); | ||
|
||
INSERT INTO "public"."boards_users" ("board_id", "user_id") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc07419e', '122e14c5-1e9f-40a7-b376-e3dce21ff864'); | ||
|
||
INSERT INTO "public"."boards_users" ("board_id", "user_id") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc07419f', '122e14c5-1e9f-40a7-b376-e3dce21ff864'); | ||
|
||
INSERT INTO "public"."boards_users" ("board_id", "user_id") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074110', '122e14c5-1e9f-40a7-b376-e3dce21ff864'); | ||
|
||
INSERT INTO "public"."boards_users" ("board_id", "user_id") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074111', '122e14c5-1e9f-40a7-b376-e3dce21ff864'); | ||
|
||
INSERT INTO "public"."boards_users" ("board_id", "user_id") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074112', '122e14c5-1e9f-40a7-b376-e3dce21ff864'); | ||
|
||
INSERT INTO "public"."boards_users" ("board_id", "user_id") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074113', '122e14c5-1e9f-40a7-b376-e3dce21ff864'); | ||
|
||
INSERT INTO "public"."boards_users" ("board_id", "user_id") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074114', '122e14c5-1e9f-40a7-b376-e3dce21ff864'); | ||
|
||
INSERT INTO "public"."boards_users" ("board_id", "user_id") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074115', '122e14c5-1e9f-40a7-b376-e3dce21ff864'); | ||
|
||
INSERT INTO "public"."boards_users" ("board_id", "user_id") VALUES | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc07419e', '122e14c5-1e9f-40a7-b376-e3dce21ff85a'); | ||
('1cde4b2c-5f94-4feb-9b11-cb23dc074116', '122e14c5-1e9f-40a7-b376-e3dce21ff864'); |
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 |
---|---|---|
@@ -1,2 +1,32 @@ | ||
INSERT INTO "public"."users" ("id", "email", "password", "is_verified", "created_at", "updated_at", "deleted_at") VALUES | ||
('122e14c5-1e9f-40a7-b376-e3dce21ff85a', '[email protected]', '$2a$12$jR9mJLpurR6ej45plBgP2u7pZ.DMTaQDDgqtiFaHSiENtyoHnIKZK', 't', NULL, NULL, NULL); | ||
('122e14c5-1e9f-40a7-b376-e3dce21ff85a', '[email protected]', '$2a$12$jR9mJLpurR6ej45plBgP2u7pZ.DMTaQDDgqtiFaHSiENtyoHnIKZK', 't', NULL, NULL, NULL); | ||
|
||
INSERT INTO "public"."users" ("id", "email", "password", "is_verified", "created_at", "updated_at", "deleted_at") VALUES | ||
('122e14c5-1e9f-40a7-b376-e3dce21ff85b', '[email protected]', '$2a$12$jR9mJLpurR6ej45plBgP2u7pZ.DMTaQDDgqtiFaHSiENtyoHnIKZK', 't', NULL, NULL, NULL); | ||
|
||
INSERT INTO "public"."users" ("id", "email", "password", "is_verified", "created_at", "updated_at", "deleted_at") VALUES | ||
('122e14c5-1e9f-40a7-b376-e3dce21ff85c', '[email protected]', '$2a$12$jR9mJLpurR6ej45plBgP2u7pZ.DMTaQDDgqtiFaHSiENtyoHnIKZK', 't', NULL, NULL, NULL); | ||
|
||
INSERT INTO "public"."users" ("id", "email", "password", "is_verified", "created_at", "updated_at", "deleted_at") VALUES | ||
('122e14c5-1e9f-40a7-b376-e3dce21ff85d', '[email protected]', '$2a$12$jR9mJLpurR6ej45plBgP2u7pZ.DMTaQDDgqtiFaHSiENtyoHnIKZK', 't', NULL, NULL, NULL); | ||
|
||
INSERT INTO "public"."users" ("id", "email", "password", "is_verified", "created_at", "updated_at", "deleted_at") VALUES | ||
('122e14c5-1e9f-40a7-b376-e3dce21ff85e', '[email protected]', '$2a$12$jR9mJLpurR6ej45plBgP2u7pZ.DMTaQDDgqtiFaHSiENtyoHnIKZK', 't', NULL, NULL, NULL); | ||
|
||
INSERT INTO "public"."users" ("id", "email", "password", "is_verified", "created_at", "updated_at", "deleted_at") VALUES | ||
('122e14c5-1e9f-40a7-b376-e3dce21ff85f', '[email protected]', '$2a$12$jR9mJLpurR6ej45plBgP2u7pZ.DMTaQDDgqtiFaHSiENtyoHnIKZK', 't', NULL, NULL, NULL); | ||
|
||
INSERT INTO "public"."users" ("id", "email", "password", "is_verified", "created_at", "updated_at", "deleted_at") VALUES | ||
('122e14c5-1e9f-40a7-b376-e3dce21ff860', '[email protected]', '$2a$12$jR9mJLpurR6ej45plBgP2u7pZ.DMTaQDDgqtiFaHSiENtyoHnIKZK', 't', NULL, NULL, NULL); | ||
|
||
INSERT INTO "public"."users" ("id", "email", "password", "is_verified", "created_at", "updated_at", "deleted_at") VALUES | ||
('122e14c5-1e9f-40a7-b376-e3dce21ff861', '[email protected]', '$2a$12$jR9mJLpurR6ej45plBgP2u7pZ.DMTaQDDgqtiFaHSiENtyoHnIKZK', 't', NULL, NULL, NULL); | ||
|
||
INSERT INTO "public"."users" ("id", "email", "password", "is_verified", "created_at", "updated_at", "deleted_at") VALUES | ||
('122e14c5-1e9f-40a7-b376-e3dce21ff862', '[email protected]', '$2a$12$jR9mJLpurR6ej45plBgP2u7pZ.DMTaQDDgqtiFaHSiENtyoHnIKZK', 't', NULL, NULL, NULL); | ||
|
||
INSERT INTO "public"."users" ("id", "email", "password", "is_verified", "created_at", "updated_at", "deleted_at") VALUES | ||
('122e14c5-1e9f-40a7-b376-e3dce21ff863', '[email protected]', '$2a$12$jR9mJLpurR6ej45plBgP2u7pZ.DMTaQDDgqtiFaHSiENtyoHnIKZK', 't', NULL, NULL, NULL); | ||
|
||
INSERT INTO "public"."users" ("id", "email", "password", "is_verified", "created_at", "updated_at", "deleted_at") VALUES | ||
('122e14c5-1e9f-40a7-b376-e3dce21ff864', '[email protected]', '$2a$12$jR9mJLpurR6ej45plBgP2u7pZ.DMTaQDDgqtiFaHSiENtyoHnIKZK', 't', NULL, NULL, NULL); |
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 |
---|---|---|
|
@@ -117,3 +117,55 @@ test.describe('Item', () => { | |
await expect(page.getByTestId("done-items")).toContainText([TODO_ITEMS[0]]); | ||
}) | ||
}); | ||
|
||
test.describe('Validate', () => { | ||
test('should allow me to add user', async ({ page, context }) => { | ||
await page.getByTestId("show-menu").click(); | ||
|
||
const [newPage] = await Promise.all([ | ||
context.waitForEvent('page'), // get `context` by destructuring with `page` in the test params; 'page' is a built-in event, and **you must wait for this like this,**, or `newPage` will just be the response object, rather than an actual Playwright page object. | ||
await page.getByTestId("invite").click() // note that, like all waiting in Playwright, this is somewhat unintuitive. This is the action which is *causing the navigation*; you have to set up the wait *before* it happens, hence the use of Promise.all(). | ||
]); | ||
|
||
await newPage.waitForLoadState(); // wait for the new tab to fully load | ||
// now, use `newPage` to access the newly opened tab, rather than `page`, which will still refer to the original page/tab. | ||
await expect(newPage).toHaveURL(/invite/); | ||
|
||
const email = await newPage.getByPlaceholder('Please enter email'); | ||
|
||
email.fill('[email protected]'); | ||
|
||
const responseSubmit = newPage.waitForResponse('**/invite'); | ||
|
||
await newPage.getByTestId("submit").click(); | ||
|
||
const response = await responseSubmit; | ||
expect(response.status()).toBe(200); | ||
expect(newPage.getByText('Invitation Successful!')).toBeVisible(); | ||
|
||
}); | ||
|
||
test('should not allow me to add user when the user is limited to the number of boards they can join', async ({ page, context }) => { | ||
await page.getByTestId("show-menu").click(); | ||
|
||
const [newPage] = await Promise.all([ | ||
context.waitForEvent('page'), // get `context` by destructuring with `page` in the test params; 'page' is a built-in event, and **you must wait for this like this,**, or `newPage` will just be the response object, rather than an actual Playwright page object. | ||
await page.getByTestId("invite").click() // note that, like all waiting in Playwright, this is somewhat unintuitive. This is the action which is *causing the navigation*; you have to set up the wait *before* it happens, hence the use of Promise.all(). | ||
]); | ||
|
||
await newPage.waitForLoadState(); // wait for the new tab to fully load | ||
// now, use `newPage` to access the newly opened tab, rather than `page`, which will still refer to the original page/tab. | ||
await expect(newPage).toHaveURL(/invite/); | ||
|
||
const email = await newPage.getByPlaceholder('Please enter email'); | ||
|
||
email.fill('[email protected]'); | ||
|
||
const responseSubmit = newPage.waitForResponse('**/invite'); | ||
|
||
await newPage.getByTestId("submit").click(); | ||
|
||
const response = await responseSubmit; | ||
expect(response.status()).toBe(403); | ||
}); | ||
}); |
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