Skip to content

Commit

Permalink
Merge pull request #14 from Parrit/qa_fixes
Browse files Browse the repository at this point in the history
Handle null people in pairing history
  • Loading branch information
Pinwheeler authored Jan 10, 2025
2 parents 51f35a5 + e43254b commit 9132b5f
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 9 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ jobs:
exit 0
fi
done
- name: Trigger Pages Workflow
run: |
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/actions/workflows/pages.yml/dispatches \
-d '{"ref":"gh-pages"}'
- name: Output Report URL as Workflow Annotation
run: |
FULL_HTML_REPORT_URL=https://parrit.github.io/parrit-remix-netlify/$HTML_REPORT_URL_PATH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export default async (
peopleSet.add(localPeople[r.person_id])
);

instance.people = Array.from(peopleSet);
instance.people = Array.from(peopleSet).filter((p) => p !== null);
snapshot.pairingInstances[idx] = instance;
snapshots[pairingTime] = snapshot;
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
import { DateTime } from "luxon";
import React, { useContext } from "react";
import { ProjectPairingSnapshot } from "~/api/common/interfaces/parrit.interfaces";
import {
Person,
ProjectPairingSnapshot,
} from "~/api/common/interfaces/parrit.interfaces";
import { ProjectContext } from "../../contexts/ProjectContext";
import { TrashIcon } from "~/ui/TrashIcon";

interface Props {
pairingArrangement: ProjectPairingSnapshot;
}

const snip = (person?: Person): string => {
if (!person) {
return "null";
}
return person.name.slice(0, 3);
};

const PairingHistoryRecord: React.FC<Props> = (props) => {
const { pairingArrangement } = props;
const formattedDate = DateTime.fromISO(
Expand All @@ -20,7 +30,7 @@ const PairingHistoryRecord: React.FC<Props> = (props) => {
.map((instance) => {
const pbName = instance.pairingBoardName ?? "null";
// get the first 3 letters of each person's name
const names = instance.people.map((person) => person.name.slice(0, 3));
const names = instance.people.map(snip);
names.push(pbName.slice(0, 3));
// alphabetize the names
names.sort();
Expand Down
2 changes: 2 additions & 0 deletions app/routes/project.$projectId/contexts/ProjectContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@ export const ProjectProvider: React.FC<Props> = (props) => {
);
};

console.log("Project", project);

const value = {
findPairingBoardByRole,
findPairingBoardByPerson,
Expand Down
4 changes: 2 additions & 2 deletions app/routes/project.$projectId/hydrateProject.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ export default async ({ request }: LoaderFunctionArgs): Promise<Project> => {
name: "Floating",
exempt: false,
},
people: Array.from(peopleMap.values()),
roles: Array.from(roleMap.values()),
people: Array.from(peopleMap.values()).filter((v) => v !== null),
roles: Array.from(roleMap.values()).filter((v) => v !== null),
};

return project;
Expand Down
4 changes: 2 additions & 2 deletions e2e_tests/fixtures/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { ProjectPage } from "./ProjectPage";
import { test as base, expect as baseExpect, Page } from "@playwright/test";

const UI_DELAY = 2000;
const UI_DELAY = 2500;

export interface LoginInfo {
projectName: string;
Expand Down Expand Up @@ -44,7 +44,7 @@ export const test = base.extend<ParritFixtures>({
await freshPage.getByTestId("projectName").press("Tab");
await freshPage.getByTestId("password").fill(password);
await freshPage.getByTestId("submit").click();
await freshPage.waitForTimeout(UI_DELAY);
await freshPage.waitForURL(/project/, { timeout: 30000 });
await freshPage.getByTestId("banner-action").click();
// get the project id from the url
const url = freshPage.url();
Expand Down
4 changes: 2 additions & 2 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export default defineConfig({
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
workers: undefined,
retries: process.env.CI ? 2 : 1,
workers: 2,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [
["html", { open: "never" }],
Expand Down

0 comments on commit 9132b5f

Please sign in to comment.