-
Notifications
You must be signed in to change notification settings - Fork 0
Fix UI bugs #375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix UI bugs #375
Changes from all commits
00e400c
ca8c88d
afbaf48
6e76620
7479a0c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,9 @@ import { | |
| GetSecretValueCommand, | ||
| } from "@aws-sdk/client-secrets-manager"; | ||
|
|
||
| export interface RecursiveRecord | ||
| extends Record<string, any | RecursiveRecord> {} | ||
|
|
||
| export const getSecretValue = async ( | ||
| secretId: string, | ||
| ): Promise<Record<string, string | number | boolean> | null> => { | ||
|
|
@@ -71,12 +74,12 @@ export async function getUpcomingEvents() { | |
| const data = await fetch( | ||
| "https://core.aws.qa.acmuiuc.org/api/v1/events?upcomingOnly=true", | ||
| ); | ||
| return (await data.json()) as Record<string, string>[]; | ||
| return (await data.json()) as RecursiveRecord[]; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVerify that API responses contain nested structures. The return type was broadened from Run the following script to inspect the actual API response shape: Also applies to: 82-82 🏁 Script executed: #!/bin/bash
# Fetch sample API responses to verify nested structure
echo "=== Upcoming Events Response ==="
curl -s "https://core.aws.qa.acmuiuc.org/api/v1/events?upcomingOnly=true" | jq 'if type == "array" then .[0] else . end | .. | select(type == "object" or type == "array") | type' | sort | uniq -c
echo -e "\n=== All Events Response ==="
curl -s "https://core.aws.qa.acmuiuc.org/api/v1/events" | jq 'if type == "array" then .[0] else . end | .. | select(type == "object" or type == "array") | type' | sort | uniq -cLength of output: 95 I need to inspect the actual API response structure more directly. Let me gather additional information: Now let me inspect the codebase to find the RecursiveRecord definition and verify the actual API response: Length of output: 27 🏁 Script executed: #!/bin/bash
# Get actual API response to inspect structure
echo "=== Upcoming Events Response (pretty-printed) ==="
curl -s "https://core.aws.qa.acmuiuc.org/api/v1/events?upcomingOnly=true" | jq '.[0]' 2>/dev/null | head -50
echo -e "\n=== Response type info ==="
curl -s "https://core.aws.qa.acmuiuc.org/api/v1/events?upcomingOnly=true" | jq 'type'Length of output: 361 Let me search for the RecursiveRecord definition and check the test file context: 🏁 Script executed: #!/bin/bash
# Find RecursiveRecord type definition (fix file type error)
rg -n "RecursiveRecord" --type ts -B2 -A5Length of output: 2826 🏁 Script executed: #!/bin/bash
# Check the test file for context around the type change
cat tests/e2e/base.ts | head -100Length of output: 2793 Revert type to more specific definition for events responses. The events API responses are flat structures containing only primitive values (strings, booleans), not nested objects. The change to 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| export async function getAllEvents() { | ||
| const data = await fetch("https://core.aws.qa.acmuiuc.org/api/v1/events"); | ||
| return (await data.json()) as Record<string, string>[]; | ||
| return (await data.json()) as RecursiveRecord[]; | ||
| } | ||
|
|
||
| export const test = base.extend<{ becomeUser: (page: Page) => Promise<void> }>({ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| import { expect } from "@playwright/test"; | ||
| import { RecursiveRecord, test } from "./base.js"; | ||
| import { describe } from "node:test"; | ||
|
|
||
| describe("Organization Info Tests", () => { | ||
| test("A user can update org metadata", async ({ page, becomeUser }) => { | ||
| const date = new Date().toISOString(); | ||
| await becomeUser(page); | ||
| await expect( | ||
| page.locator("a").filter({ hasText: "Management Portal DEV ENV" }), | ||
| ).toBeVisible(); | ||
| await expect( | ||
| page.locator("a").filter({ hasText: "Organization Info" }), | ||
| ).toBeVisible(); | ||
| await page.locator("a").filter({ hasText: "Organization Info" }).click(); | ||
| await expect(page.getByRole("heading")).toContainText( | ||
| "Manage Organization Info", | ||
| ); | ||
| await page.getByRole("textbox", { name: "Select an organization" }).click(); | ||
| await page.getByText("Infrastructure Committee").click(); | ||
| await page.getByRole("textbox", { name: "Description" }).click(); | ||
| await page | ||
| .getByRole("textbox", { name: "Description" }) | ||
| .fill(`Populated by E2E tests on ${date}`); | ||
| await page | ||
| .getByRole("textbox", { name: "Website" }) | ||
| .fill(`https://infra.acm.illinois.edu?date=${date}`); | ||
|
|
||
| const existingOtherLink = page.locator("text=Other").first(); | ||
| const hasExistingOther = await existingOtherLink | ||
| .isVisible() | ||
| .catch(() => false); | ||
|
|
||
| if (!hasExistingOther) { | ||
| await page.getByRole("button", { name: "Add Link" }).click(); | ||
| await page.getByRole("textbox", { name: "Type" }).click(); | ||
| await page.getByRole("option", { name: "Other" }).click(); | ||
| } | ||
|
|
||
| await page.getByRole("textbox", { name: "URL" }).click(); | ||
| await page | ||
| .getByRole("textbox", { name: "URL" }) | ||
| .fill(`https://infra.acm.illinois.edu/e2e?date=${date}`); | ||
| await page | ||
| .locator("form") | ||
| .getByRole("button", { name: "Save Changes" }) | ||
| .click(); | ||
| await expect( | ||
| page.getByText("Infrastructure Committee updated"), | ||
| ).toBeVisible(); | ||
|
|
||
| const data = await fetch( | ||
| `https://core.aws.qa.acmuiuc.org/api/v1/organizations?date=${date}`, | ||
| ); | ||
| const json = (await data.json()) as RecursiveRecord[]; | ||
| const infraEntry = json.find((x) => x.id === "Infrastructure Committee"); | ||
|
|
||
| expect(infraEntry).toBeDefined(); | ||
| expect(infraEntry?.description).toBe(`Populated by E2E tests on ${date}`); | ||
| expect(infraEntry?.website).toBe( | ||
| `https://infra.acm.illinois.edu?date=${date}`, | ||
| ); | ||
|
|
||
| const links = infraEntry?.links as RecursiveRecord[]; | ||
| expect(links).toBeDefined(); | ||
| const otherLink = links.find((link) => link.type === "OTHER"); | ||
| expect(otherLink).toBeDefined(); | ||
| expect(otherLink?.url).toBe( | ||
| `https://infra.acm.illinois.edu/e2e?date=${date}`, | ||
| ); | ||
| }); | ||
| }); |
Uh oh!
There was an error while loading. Please reload this page.