Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"devDependencies": {
"@axe-core/playwright": "^4.10.0",
"@eslint/js": "^9.11.1",
"@hmcts/playwright-common": "^1.0.30",
"@hmcts/playwright-common": "^1.0.33",
"@playwright/test": "^1.48.2",
"@types/node": "^22.15.34",
"@typescript-eslint/eslint-plugin": "^8.8.0",
Expand Down
43 changes: 43 additions & 0 deletions playwright-e2e/tests/user-tests.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { test } from "../fixtures";

test.describe("User tests using idam utils", () => {
test("Update user", async ({
page,
config,
citizenUserUtils,
idamPage,
idamUtils,
}) => {
//create citizen user
const token = process.env.CREATE_USER_BEARER_TOKEN as string;
const user = await citizenUserUtils.createUser();
await page.goto(config.urls.citizenUrl);

//login citizen user
await idamPage.login({
username: user.email,
password: user.password,
});

//get user id for citizen user
const userInfo = await idamUtils.getUserInfo({
email: user.email,
bearerToken: token,
});
console.log(userInfo);

//update user with new forename and surname
const userUpdate = await idamUtils.updateUser({
id: userInfo.id,
bearerToken: token,
password: user.password,
user: {
email: user.email,
forename: "changed forename",
surname: "changed surname",
roleNames: ["citizen"],
},
});
console.log(userUpdate);
});
});
2 changes: 1 addition & 1 deletion playwright-e2e/utils/config.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from "path";
import { fileURLToPath } from "url";

// This needs to be placed somewhere before attempting to access any environment variables
dotenv.config({ quiet: true });
dotenv.config();

export interface UserCredentials {
username: string;
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ __metadata:
languageName: node
linkType: hard

"@hmcts/playwright-common@npm:^1.0.30":
version: 1.0.32
resolution: "@hmcts/playwright-common@npm:1.0.32"
"@hmcts/playwright-common@file:/Users/abigailsmith/HMCTS/playwright-common/package.tgz::locator=tcoe-playwright-example%40workspace%3A.":
version: 1.0.33
resolution: "@hmcts/playwright-common@file:/Users/abigailsmith/HMCTS/playwright-common/package.tgz#/Users/abigailsmith/HMCTS/playwright-common/package.tgz::hash=4d1c17&locator=tcoe-playwright-example%40workspace%3A."
dependencies:
"@axe-core/playwright": "npm:^4.10.0"
"@eslint/js": "npm:^9.11.1"
Expand All @@ -170,7 +170,7 @@ __metadata:
typescript-eslint: "npm:^8.8.0"
peerDependencies:
"@playwright/test": ^1.53.0
checksum: 10/cec3a079d220c2402e9621693d3b0581b3e6bac8e33304c93d418ae8de73f05f18611413d9d26697a5c5a55d31610d75381388e79ed2eabd7bc6d21764163496
checksum: 10/287351f1c58d09f131bf15bb6acfc01ec3a1013f4ef25c9992ae2b372ffb2294a5114291da7721b3aaa7b884339b844daefcbfaa0ad11a079bef210942fd553a
languageName: node
linkType: hard

Expand Down Expand Up @@ -3388,7 +3388,7 @@ __metadata:
dependencies:
"@axe-core/playwright": "npm:^4.10.0"
"@eslint/js": "npm:^9.11.1"
"@hmcts/playwright-common": "npm:^1.0.30"
"@hmcts/playwright-common": /Users/abigailsmith/HMCTS/playwright-common/package.tgz
"@playwright/test": "npm:^1.48.2"
"@types/node": "npm:^22.15.34"
"@typescript-eslint/eslint-plugin": "npm:^8.8.0"
Expand Down