Skip to content

1679 setup end to end tests #1585

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

Open
wants to merge 27 commits into
base: v2-development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6d39dff
Playwright initial create
gogo4ds Mar 19, 2025
5a64102
webserver setup
gogo4ds Mar 19, 2025
fec22b5
Added auth fixture
gogo4ds Mar 19, 2025
1e6f81b
Added workflow
gogo4ds Mar 19, 2025
93547c4
Merge branch 'v2-development' of https://github.com/SoftUni-Internal/…
gogo4ds Mar 19, 2025
61c9c5e
Updated scripts to run real env tests
gogo4ds Mar 19, 2025
5a1d09e
Updated eslint
gogo4ds Mar 25, 2025
b68b3d7
Added more rules
gogo4ds Mar 25, 2025
165fe56
Eslint update and fixes
gogo4ds Mar 25, 2025
bc9cdad
Stylelint fixes
gogo4ds Mar 25, 2025
3ecd50e
Added playwright eslint config
gogo4ds Mar 25, 2025
685069d
Fixes
gogo4ds Mar 26, 2025
02a83db
Merge branch 'v2-development' of https://github.com/SoftUni-Internal/…
gogo4ds Mar 26, 2025
f9f8daa
Stylelint fixes
gogo4ds Mar 26, 2025
e8e7480
Added redirect to /login in /profile
gogo4ds Mar 31, 2025
d0cd12c
Merge branch 'v2-development' of https://github.com/SoftUni-Internal/…
gogo4ds Apr 3, 2025
a3ac12b
Used eslint error
gogo4ds Apr 3, 2025
c90a847
fix
gogo4ds Apr 3, 2025
c3caff7
Merge branch 'v2-development' of https://github.com/SoftUni-Internal/…
gogo4ds Apr 3, 2025
15d8455
fix
gogo4ds Apr 3, 2025
b06e69d
Made RememberMe selected by default
gogo4ds Apr 3, 2025
d301be5
Merge branch 'v2-development' of https://github.com/SoftUni-Internal/…
gogo4ds Jun 25, 2025
c498829
Refactored JSX to improve code readability and reduce redundant paren…
gogo4ds Jun 25, 2025
abf9329
Redirect unauthenticated users to login when accessing the personal p…
gogo4ds Jun 25, 2025
089ccd9
Update `start:backend` script to include `--build` flag for Docker Co…
gogo4ds Jun 25, 2025
de31bd7
Updated dependencies, refined TypeScript configuration, and improved …
gogo4ds Jun 26, 2025
bfe9812
Refactor password input change logic in `ContestPasswordForm` for str…
gogo4ds Jun 26, 2025
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
Prev Previous commit
Next Next commit
Merge branch 'v2-development' of https://github.com/SoftUni-Internal/…
…OpenJudgeSystem into 1679-setup-end-to-end-tests
  • Loading branch information
gogo4ds committed Apr 3, 2025
commit d0cd12cd6ecf28fd29f1bd0e0dc5f430c95fd876
28 changes: 28 additions & 0 deletions Servers/UI/OJS.Servers.Ui/ClientApp/src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,34 @@ interface IContestsBulkEdit {
categoryId: number;
}

interface IProfilePageContests {
id: number;
name: string;
startTime: Date;
endTime: Date;
practiceStartTime: Date;
practiceEndTime: Date;
canBePracticed: boolean;
canBeCompeted: boolean;
hasContestPassword: boolean;
hasPracticePassword: boolean;
isOnlineExam: boolean;
isWithRandomTasks: boolean;
category: string;
categoryId: number | null;
isLoading: boolean;
numberOfProblems: number;
practiceResults: number;
competeResults: number;
competeMaximumPoints: number;
practiceMaximumPoints: number;
userParticipationResult?: IUserParticipationResult;
createdOn: Date;
modifiedOn: Date | null;
officialParticipants: number;
requirePasswordForCompete: boolean;
requirePasswordForPractice: boolean;
}

export type {
IIndexContestsType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,59 +110,113 @@ const ProfileContestParticipations = ({ userIsProfileOwner, isChosenInToggle }:
setUserContestParticipationsPage(page);
}, []);

const renderContestCard = useCallback(
(contest: IIndexContestsType) =>
<ContestCard
contest={contest}
showPoints={userIsProfileOwner || internalUser.isAdmin}
/>
, [ internalUser, userIsProfileOwner ],
// Precompute contests for each category
const categoryContestsMap = useMemo(() => {
if (!allParticipatedContests) {
return new Map<number, IIndexContestsType[]>();
}

const categoryMap = new Map<number, IIndexContestsType[]>();

allParticipatedContests.forEach((contest) => {
if (contest.categoryId) {
if (!categoryMap.has(contest.categoryId)) {
categoryMap.set(contest.categoryId, []);
}
categoryMap.get(contest.categoryId)!.push(contest);
}
});

return categoryMap;
}, [ allParticipatedContests ]);

// Precompute dropdown items for each category
const contestDropdownItemsMap = useMemo(() => {
const dropdownMap = new Map<number, IDropdownItem[]>();

categoryContestsMap.forEach((contests, categoryId) => {
dropdownMap.set(
categoryId,
contests.map((contest) => ({
id: contest.id,
name: `${contest.name} (${contest.category})`,
})),
);
});

// Add a special entry for "all contests" (category not selected)
dropdownMap.set(0, allParticipatedContests?.map((contest) => ({
id: contest.id,
name: `${contest.name} (${contest.category})`,
})) || []);

return dropdownMap;
}, [ categoryContestsMap, allParticipatedContests ]);

// Get contests for the selected category efficiently
const filteredContestDropdownItems = useMemo(
() => contestDropdownItemsMap
.get(selectedCategory === null
? 0
: Number(selectedCategory.id)) ||
[],
[ selectedCategory, contestDropdownItemsMap ],
);

const render = useCallback(() => {
if (areContestParticipationsLoading) {
return <div style={{ ...flexCenterObjectStyles }}><SpinningLoader /></div>;
const categoryDropdownItems = useMemo(() => {
if (!allParticipatedContests) {
return [];
}

if (!isNil(contestParticipationsQueryError)) {
return <span>Error fetching user contest participations</span>;
}
const uniqueCategories = new Map<number, string>();
allParticipatedContests.forEach((contest) => {
if (contest.categoryId && contest.category && !uniqueCategories.has(contest.categoryId)) {
uniqueCategories.set(contest.categoryId, contest.category);
}
});

if (!shouldRender) {
return null;
}
return Array.from(uniqueCategories.entries())
.map(([ id, name ]) => ({
id,
name: `${name} (#${id})`,
}))
.sort((a, b) => a.name.localeCompare(b.name));
}, [ allParticipatedContests ]);

const handleContestSelect = useCallback((item: IDropdownItem | undefined) => {
setSelectedContest(item || null);
setUserContestParticipationsPage(1);
}, []);

const handleContestClear = useCallback(() => {
setSelectedContest(null);
setUserContestParticipationsPage(1);
}, []);

const handleCategorySelect = useCallback((item: IDropdownItem | undefined) => {
setSelectedCategory(item || null);
setSelectedContest(null);
setUserContestParticipationsPage(1);
}, []);

const handleCategoryClear = useCallback(() => {
setSelectedCategory(null);
setUserContestParticipationsPage(1);
}, []);

const renderContestCard = useCallback((contest: IIndexContestsType) => (
<ContestCard
key={contest.id}
contest={contest}
showPoints={userIsProfileOwner || internalUser.isAdmin}
/>
, [ internalUser, userIsProfileOwner ],
);

if (areContestParticipationsLoading || areAllContestsLoading) {
return (
<div>
{ ((!isLoggedIn || isLoggedIn && !userIsProfileOwner && !internalUser.canAccessAdministration) &&
userContestParticipations !== undefined &&
!isNilOrEmpty(userContestParticipations.items) &&
<h2 className={styles.participationsHeading}>Participated In:</h2>)}
<List
values={userContestParticipations!.items}
itemFunc={renderContestCard}
orientation={Orientation.vertical}
fullWidth
/>
{!isEmpty(userContestParticipations) && userContestParticipations.pagesCount > 1 &&
<PaginationControls
count={userContestParticipations.pagesCount}
page={userContestParticipations.pageNumber}
onChange={onPageChange}
/>
}
{ isChosenInToggle &&
userContestParticipations !== undefined &&
isNilOrEmpty(userContestParticipations.items) &&

<div className={concatClassNames(
styles.noParticipationsText,
getColorClassName(themeColors.textColor),
)}
>
No participations in contests yet
</div>
}
<div style={{ ...flexCenterObjectStyles, minHeight: '200px' }}>
<SpinningLoader />
</div>
);
}
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.