Skip to content
Closed
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ yarn-error.log*
src/SPREADSHEET_SECRETS.js
.firebase/
public/precache-manifest.*

# Project management (internal)
.project/
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,19 @@ To learn, check out the [How to Create Pull Requests](https://help.github.com/en
2. npm run firebase:local
3. npm run localdev

`npm run firebase:local` will configure and start the Firebase emulator suite.
On your first run, you will need to open the emulator suite and add yourself as a user.
`npm run firebase:local` will configure and start the Firebase emulator suite.
On your first run, you will need to open the emulator suite and add yourself as a user.
Any data you modify will be saved locally for future use.

### `Seed Test Data`
To populate the local emulators with test data:
```bash
node scripts/seed-full.js
```
This creates users for all roles (admin, programLeader, siteLeader, coach, teacher) and sample data.

**Test credentials:** `admin@chalk.local` / `admin123`

In the project directory, you can run:

### `npm run livedev`
Expand Down Expand Up @@ -77,6 +86,21 @@ Launches the test runner in the Cypress Cloud Dashboar<br>
1. Instead of helloGET substitute with function Folder name
2. CI/CD Is not done for Cloud Functions so deploy and submit pull request.

## Admin Features

### All Users Dashboard
Available to Admin, Program Leader, and Site Leader roles via the navigation menu.

**Features:**
- View all users with search and filters (role, status)
- Sort by any column (name, email, role, school, status, last login)
- Edit user name and email
- Archive/unarchive users
- Export to Excel
- Pagination (10/25/50 per page)

**Route:** `/AllUsers`

## Learn More
JSDocumentation is Available at [Chalk Docs](https://chalkdocs.web.app).
You can learn more about webpack at [Webpack](https://webpack.js.org/).
Expand Down
119 changes: 119 additions & 0 deletions cypress/integration/admin/all-users.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
describe('All Users Dashboard', () => {
beforeEach(() => {
cy.visit('/')
})

it('Navigates to All Users page as admin', () => {
// Login as admin
cy.get('input[type="email"]').type('admin@chalk.local')
cy.get('input[type="password"]').type('admin123')
cy.get('button[type="submit"]').click()

// Wait for home page to load
cy.url().should('include', '/Home', { timeout: 15000 })

// Open burger menu and click All Users
cy.get('[aria-label="menu"]').first().click()
cy.contains('All Users').click()

// Verify All Users page loads
cy.url().should('include', '/AllUsers')
cy.contains('All Users', { timeout: 10000 })
})

it('Displays users table with data', () => {
// Login
cy.get('input[type="email"]').type('admin@chalk.local')
cy.get('input[type="password"]').type('admin123')
cy.get('button[type="submit"]').click()
cy.url().should('include', '/Home', { timeout: 15000 })

// Navigate to All Users
cy.visit('/AllUsers')

// Verify table headers exist
cy.contains('Last Name', { timeout: 10000 })
cy.contains('First Name')
cy.contains('Email')
cy.contains('Role')
cy.contains('Status')
cy.contains('Last Login')
})

it('Search filters users correctly', () => {
cy.get('input[type="email"]').type('admin@chalk.local')
cy.get('input[type="password"]').type('admin123')
cy.get('button[type="submit"]').click()
cy.url().should('include', '/Home', { timeout: 15000 })

cy.visit('/AllUsers')
cy.contains('Last Name', { timeout: 10000 })

// Search for a specific user
cy.get('input[label="Search"]').type('Admin')
cy.contains('Admin User')
})

it('Role filter works correctly', () => {
cy.get('input[type="email"]').type('admin@chalk.local')
cy.get('input[type="password"]').type('admin123')
cy.get('button[type="submit"]').click()
cy.url().should('include', '/Home', { timeout: 15000 })

cy.visit('/AllUsers')
cy.contains('Last Name', { timeout: 10000 })

// Filter by Coach role
cy.get('#mui-component-select-Role, [aria-labelledby*="Role"]').click()
cy.contains('Coach').click()

// Verify only coaches are shown
cy.get('table tbody tr').each(($row) => {
cy.wrap($row).contains('Coach')
})
})

it('Opens edit dialog when clicking a user', () => {
cy.get('input[type="email"]').type('admin@chalk.local')
cy.get('input[type="password"]').type('admin123')
cy.get('button[type="submit"]').click()
cy.url().should('include', '/Home', { timeout: 15000 })

cy.visit('/AllUsers')
cy.contains('Last Name', { timeout: 10000 })

// Click on a user row
cy.get('table tbody tr').first().click()

// Verify edit dialog opens
cy.contains('Edit User')
cy.get('input[label="First Name"], input[value]').should('exist')
})

it('Export button exists', () => {
cy.get('input[type="email"]').type('admin@chalk.local')
cy.get('input[type="password"]').type('admin123')
cy.get('button[type="submit"]').click()
cy.url().should('include', '/Home', { timeout: 15000 })

cy.visit('/AllUsers')
cy.contains('Last Name', { timeout: 10000 })

// Verify export button exists
cy.contains('Export')
})

it('Pagination controls work', () => {
cy.get('input[type="email"]').type('admin@chalk.local')
cy.get('input[type="password"]').type('admin123')
cy.get('button[type="submit"]').click()
cy.url().should('include', '/Home', { timeout: 15000 })

cy.visit('/AllUsers')
cy.contains('Last Name', { timeout: 10000 })

// Verify pagination exists
cy.contains('Rows per page')
cy.get('[aria-label="Go to next page"], [title="Go to next page"]').should('exist')
})
})
2 changes: 1 addition & 1 deletion functions/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading