-
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.
Move user creation and login to fixture
- Loading branch information
Showing
3 changed files
with
50 additions
and
21 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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { test } from "@playwright/test"; | ||
|
||
type Account = { | ||
eveId: number; | ||
name: string; | ||
}; | ||
|
||
export const authFixture = test.extend<{}, { account: Account }>({ | ||
account: [ | ||
async ({}, use, workerInfo) => { | ||
await use({ | ||
eveId: 1000 + workerInfo.workerIndex, | ||
name: `E2E User ${workerInfo.workerIndex}`, | ||
}); | ||
}, | ||
{ scope: "worker" }, | ||
], | ||
|
||
page: async ({ page, request, account }, use) => { | ||
const { name, eveId } = account; | ||
|
||
await request.post("http://localhost:4001/clone-bay-mocking/create-user", { | ||
data: { | ||
main: { | ||
eveId, | ||
name, | ||
corporation: { eveId: 123, name: "Jotain", ticker: "JTN" }, | ||
accessToken: "asd", | ||
refreshToken: "asd", | ||
}, | ||
alts: [], | ||
admin: true, | ||
}, | ||
}); | ||
|
||
await page.goto( | ||
`http://localhost:4001/clone-bay-mocking/login?eveId=${eveId}`, | ||
); | ||
|
||
await use(page); | ||
}, | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { mergeTests } from "@playwright/test"; | ||
import { authFixture } from "./auth.fixture"; | ||
|
||
export const test = mergeTests(authFixture); |
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