-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enforce ownership on editing reviews (#94)
- Loading branch information
Showing
8 changed files
with
432 additions
and
40 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,14 +1,26 @@ | ||
import { expect } from "@playwright/test"; | ||
|
||
export async function loginAsAdmin(page) { | ||
async function loginAsUser(page, username, password) { | ||
await page.goto("/"); | ||
|
||
await page.locator("data-test-id=sign-in-btn").click(); | ||
|
||
await expect(page).toHaveURL("/login"); | ||
await page.locator("id=username").fill("dummyadmin"); | ||
await page.locator("id=password").fill("dummypass"); | ||
await page.locator("id=username").fill(username); | ||
await page.locator("id=password").fill(password); | ||
await page.locator("form input[type='submit']").click(); | ||
|
||
await expect(page).toHaveURL("/reviews"); | ||
} | ||
|
||
export async function loginAsAdmin(page) { | ||
await loginAsUser(page, "dummyadmin", "dummypass"); | ||
} | ||
|
||
export async function loginAsUserA(page) { | ||
await loginAsUser(page, "userA", "password123"); | ||
} | ||
|
||
export async function loginAsUserB(page) { | ||
await loginAsUser(page, "userB", "password456"); | ||
} |
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
Oops, something went wrong.