Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
61 changes: 1 addition & 60 deletions app/cypress/e2e/critical_flows.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,4 @@ describe('Critical Event App Flows', () => {
cy.visit('/');
// Set mock user session using our Cypress hook
cy.window().then(win => {
win.setMockUser(
{
uid: 'student-test-uid',
displayName: 'Jane Doe',
email: 'jane.doe@uni.edu',
},
'student',
{
name: 'Jane Doe',
email: 'jane.doe@uni.edu',
branch: 'Computer Science',
year: '3rd Year',
points: 120,
},
);
});
});

it('should render the event feed home page correctly', () => {
// Verify welcome text is loaded from the mock user displayName
cy.contains('Welcome,').should('be.visible');
cy.contains('Jane Doe').should('be.visible');

// Verify search bar is visible
cy.get('input[placeholder="Search events..."]').should('be.visible');

// Verify recommendations section header is visible
cy.contains('RECOMMENDED FOR YOU').should('be.visible');
});

it('should support tab navigation to Leaderboard and Profile', () => {
// We should be able to navigate to Leaderboard using tab bar
cy.contains('Rankings').click();

// Verify Leaderboard screen is shown
cy.contains('LEADERBOARD').should('be.visible');
cy.contains('Top Contributors').should('be.visible');

// Navigate to Profile using tab bar
cy.contains('Profile').click();

// Verify Profile screen renders correctly
cy.contains('Jane Doe').should('be.visible');
cy.contains('jane.doe@uni.edu').should('be.visible');
cy.contains('Computer Science').should('be.visible');
cy.contains('3rd Year').should('be.visible');
cy.contains('Student Settings').should('be.visible');
});

it('should allow searching for events in the feed', () => {
const searchQuery = 'Hackathon';
// Type search query
cy.get('input[placeholder="Search events..."]')
.type(searchQuery)
.should('have.value', searchQuery);

// Verify close icon appears via stable testID
cy.get('[data-testid="clear-search-button"]').should('exist');
});
});
.catch(err => console.error(err))
Comment on lines 5 to +6

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Files:"
git ls-files | rg '(^|/)(critical_flows\.cy\.js|AttendanceDashboard\.js)$' || true

echo
echo "critical_flows outline/size:"
if [ -f app/cypress/e2e/critical_flows.cy.js ]; then
  wc -l app/cypress/e2e/critical_flows.cy.js
  seq 1 50 | while read -r n; do printf '%5d  ' "$n"; sed -n "${n}p" app/cypress/e2e/critical_flows.cy.js | cat -n -v; done
fi

echo
echo "AttendanceDashboard relevant lines:"
if [ -f app/src/screens/AttendanceDashboard.js ]; then
  wc -l app/src/screens/AttendanceDashboard.js
  sed -n '130,190p' app/src/screens/AttendanceDashboard.js | nl -ba -v130
fi

echo
echo "Syntax check with node:"
node --check app/cypress/e2e/critical_flows.cy.js 2>&1 || true
node --check app/src/screens/AttendanceDashboard.js 2>&1 || true

Repository: roshankumar0036singh/Uni-Event

Length of output: 362


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "critical_flows file:"
wc -l app/cypress/e2e/critical_flows.cy.js
awk '{printf "%5d  %s\n", NR, $0}' app/cypress/e2e/critical_flows.cy.js

echo
echo "AttendanceDashboard relevant lines:"
wc -l app/src/screens/AttendanceDashboard.js
awk 'NR>=130 && NR<=195 {printf "%5d  %s\n", NR, $0}' app/src/screens/AttendanceDashboard.js

echo
echo "Syntax check with node:"
node --check app/cypress/e2e/critical_flows.cy.js 2>&1 || true
node --check app/src/screens/AttendanceDashboard.js 2>&1 || true

echo
echo "Promise/then/catch pattern around AttendanceDashboard:"
grep -n "getDoc\\\(|.then\\|catch\\|useEffect" app/src/screens/AttendanceDashboard.js || true

Repository: roshankumar0036singh/Uni-Event

Length of output: 2708


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "AttendanceDashboard outline:"
ast-grep outline app/src/screens/AttendanceDashboard.js --view expanded || true

echo
echo "AttendanceDashboard top/structure:"
awk 'NR>=1 && NR<=90 {printf "%5d  %s\n", NR, $0}' app/src/screens/AttendanceDashboard.js

echo
echo "GetDoc usages and hooks/effects context:"
grep -n "getDoc\\|useEffect\\|const\\|function\\|\\}" app/src/screens/AttendanceDashboard.js | awk 'NR>=1 && NR<=120'

Repository: roshankumar0036singh/Uni-Event

Length of output: 7392


Fix both incomplete rejection-handler chains before merging.

Both sites parse as invalid JavaScript because .catch(...) is not attached to a complete preceding callback body. Attach the handler to the intended promise/callback chain and close all open blocks.

  • app/cypress/e2e/critical_flows.cy.js#L5-L6: cy.window().then(...) has no function body; close or remove it, then use supported Cypress failure handling.
  • app/src/screens/AttendanceDashboard.js#L165-L167: the .then() callback body is missing before .catch(...), and the useEffect plus component body are unterminated.
🧰 Tools
🪛 Biome (2.5.5)

[error] 6-6: Expected a statement but instead found '.catch(err => console.error(err))'.

(parse)


[error] 6-6: expected } but instead the file ends

(parse)

📍 Affects 2 files
  • app/cypress/e2e/critical_flows.cy.js#L5-L6 (this comment)
  • app/src/screens/AttendanceDashboard.js#L167-L167
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/cypress/e2e/critical_flows.cy.js` around lines 5 - 6, Fix the incomplete
rejection-handler chains in app/cypress/e2e/critical_flows.cy.js lines 5-6 and
app/src/screens/AttendanceDashboard.js lines 167-167: complete or remove the
cy.window().then chain and use supported Cypress failure handling, complete the
.then() callback before attaching .catch, and close the surrounding useEffect
and component blocks.

Source: Linters/SAST tools

Loading