Skip to content

Commit 57151d0

Browse files
committed
fix linting/formatting
1 parent 35770b1 commit 57151d0

File tree

2 files changed

+54
-32
lines changed

2 files changed

+54
-32
lines changed

tests/e2e/base.ts

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test as base } from '@playwright/test';
1+
import { test as base } from "@playwright/test";
22
import {
33
SecretsManagerClient,
44
GetSecretValueCommand,
@@ -25,32 +25,40 @@ export const getSecretValue = async (
2525
};
2626

2727
async function getSecrets() {
28-
let response = { PLAYWRIGHT_USERNAME: '', PLAYWRIGHT_PASSWORD: '' }
28+
let response = { PLAYWRIGHT_USERNAME: "", PLAYWRIGHT_PASSWORD: "" };
2929
let keyData;
3030
if (!process.env.PLAYWRIGHT_USERNAME || !process.env.PLAYWRIGHT_PASSWORD) {
31-
keyData = await getSecretValue('infra-core-api-config')
31+
keyData = await getSecretValue("infra-core-api-config");
3232
}
33-
response['PLAYWRIGHT_USERNAME'] = process.env.PLAYWRIGHT_USERNAME || (keyData ? keyData['playwright_username'] : '');
34-
response['PLAYWRIGHT_PASSWORD'] = process.env.PLAYWRIGHT_PASSWORD || (keyData ? keyData['playwright_password'] : '');
33+
response["PLAYWRIGHT_USERNAME"] =
34+
process.env.PLAYWRIGHT_USERNAME ||
35+
(keyData ? keyData["playwright_username"] : "");
36+
response["PLAYWRIGHT_PASSWORD"] =
37+
process.env.PLAYWRIGHT_PASSWORD ||
38+
(keyData ? keyData["playwright_password"] : "");
3539
return response;
3640
}
3741

3842
const secrets = await getSecrets();
3943

4044
async function becomeUser(page) {
41-
await page.goto('https://manage.qa.acmuiuc.org/login');
42-
await page.getByRole('button', { name: 'Sign in with Illinois NetID' }).click();
43-
await page.getByPlaceholder('[email protected]').click();
44-
await page.getByPlaceholder('[email protected]').fill(secrets['PLAYWRIGHT_USERNAME']);
45-
await page.getByPlaceholder('[email protected]').press('Enter');
46-
await page.getByPlaceholder('Password').click();
47-
await page.getByPlaceholder('Password').fill(secrets['PLAYWRIGHT_PASSWORD']);
48-
await page.getByRole('button', { name: 'Sign in' }).click();
49-
await page.getByRole('button', { name: 'No' }).click();
45+
await page.goto("https://manage.qa.acmuiuc.org/login");
46+
await page
47+
.getByRole("button", { name: "Sign in with Illinois NetID" })
48+
.click();
49+
await page.getByPlaceholder("[email protected]").click();
50+
await page
51+
.getByPlaceholder("[email protected]")
52+
.fill(secrets["PLAYWRIGHT_USERNAME"]);
53+
await page.getByPlaceholder("[email protected]").press("Enter");
54+
await page.getByPlaceholder("Password").click();
55+
await page.getByPlaceholder("Password").fill(secrets["PLAYWRIGHT_PASSWORD"]);
56+
await page.getByRole("button", { name: "Sign in" }).click();
57+
await page.getByRole("button", { name: "No" }).click();
5058
}
5159

5260
export const test = base.extend<{ becomeUser: (page) => Promise<void> }>({
53-
becomeUser: async ({ }, use) => {
54-
use(becomeUser)
61+
becomeUser: async ({}, use) => {
62+
use(becomeUser);
5563
},
5664
});

tests/e2e/login.spec.ts

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,34 @@
1-
2-
import { expect } from '@playwright/test';
3-
import { test } from './base';
4-
import { describe } from 'node:test';
1+
import { expect } from "@playwright/test";
2+
import { test } from "./base";
3+
import { describe } from "node:test";
54

65
describe("Login tests", () => {
7-
test('A user can login and view the home screen', async ({ page, becomeUser }) => {
6+
test("A user can login and view the home screen", async ({
7+
page,
8+
becomeUser,
9+
}) => {
810
await becomeUser(page);
9-
await expect(page.locator('a').filter({ hasText: 'Management Portal DEV ENV' })).toBeVisible();
10-
await expect(page.locator('a').filter({ hasText: 'Events' })).toBeVisible();
11-
await expect(page.locator('a').filter({ hasText: 'Ticketing/Merch' })).toBeVisible();
12-
await expect(page.locator('a').filter({ hasText: 'IAM' })).toBeVisible();
13-
await expect(page.getByRole('link', { name: 'ACM Logo Management Portal' })).toBeVisible();
14-
await expect(page.getByRole('link', { name: 'P', exact: true })).toBeVisible();
15-
await page.getByRole('link', { name: 'P', exact: true }).click();
16-
await expect(page.getByLabel('PMy Account')).toContainText('Name Playwright Core User');
17-
await expect(page.getByLabel('PMy Account')).toContainText('[email protected]');
18-
expect(page.url()).toEqual('https://manage.qa.acmuiuc.org/home');
11+
await expect(
12+
page.locator("a").filter({ hasText: "Management Portal DEV ENV" }),
13+
).toBeVisible();
14+
await expect(page.locator("a").filter({ hasText: "Events" })).toBeVisible();
15+
await expect(
16+
page.locator("a").filter({ hasText: "Ticketing/Merch" }),
17+
).toBeVisible();
18+
await expect(page.locator("a").filter({ hasText: "IAM" })).toBeVisible();
19+
await expect(
20+
page.getByRole("link", { name: "ACM Logo Management Portal" }),
21+
).toBeVisible();
22+
await expect(
23+
page.getByRole("link", { name: "P", exact: true }),
24+
).toBeVisible();
25+
await page.getByRole("link", { name: "P", exact: true }).click();
26+
await expect(page.getByLabel("PMy Account")).toContainText(
27+
"Name Playwright Core User",
28+
);
29+
await expect(page.getByLabel("PMy Account")).toContainText(
30+
31+
);
32+
expect(page.url()).toEqual("https://manage.qa.acmuiuc.org/home");
1933
});
20-
})
34+
});

0 commit comments

Comments
 (0)