-
Notifications
You must be signed in to change notification settings - Fork 8
Add email to org cards; add flip to view leads #295
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
39e6d08
bruh
zhuangy47 854b3b9
test
zhuangy47 4e50471
add text indicating flip, add indicator on card
zhuangy47 5ac42a8
oops
zhuangy47 0cc6a37
coderabbit
zhuangy47 8fdbfdc
thanks coderabbit very cool
zhuangy47 83d55e2
icons are hard
zhuangy47 0fe6faf
Merge branch 'main' of https://github.com/acm-uiuc/website into yanni…
zhuangy47 8b4b0b6
tests are hard
zhuangy47 3c88c01
tests are hard
zhuangy47 4b6371d
bang
zhuangy47 0e13b7c
coderabbit
zhuangy47 8315dff
Merge branch 'main' into yanniz3/cards
devksingh4 b06e6c3
sort alpha
zhuangy47 a3e17d5
Merge branch 'yanniz3/cards' of https://github.com/acm-uiuc/website i…
zhuangy47 c1c5704
coderabbit
zhuangy47 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,131 @@ | ||
| import { test, expect } from '@playwright/test'; | ||
|
|
||
| const mockOrgs = [ | ||
| { | ||
| id: 'TEST01', | ||
| name: 'TestSIG', | ||
| type: 'sig', | ||
| description: 'A test SIG', | ||
| email: 'test@example.com', | ||
| website: 'https://example.com', | ||
| leads: [ | ||
| { | ||
| username: 'alice1', | ||
| name: 'Alice Smith', | ||
| title: 'Chair', | ||
| nonVotingMember: false, | ||
| }, | ||
| { | ||
| username: 'bob2', | ||
| name: 'Bob Jones', | ||
| title: 'Vice Chair', | ||
| nonVotingMember: false, | ||
| }, | ||
| { username: 'charlie3', title: 'Treasurer', nonVotingMember: true }, | ||
| ], | ||
| }, | ||
| { | ||
| id: 'TEST02', | ||
| name: 'NoLeadsSIG', | ||
| type: 'sig', | ||
| description: 'A SIG with no leads', | ||
| leads: [], | ||
| }, | ||
| ]; | ||
|
|
||
| test.describe('Organization card flip', () => { | ||
| test.beforeEach(async ({ page }) => { | ||
| await page.route('**/api/v1/organizations', (route) => | ||
| route.fulfill({ | ||
| status: 200, | ||
| contentType: 'application/json', | ||
| body: JSON.stringify(mockOrgs), | ||
| }) | ||
| ); | ||
| await page.goto('/'); | ||
| // Wait for mock data to replace SSG data (same pattern as orglist.spec.ts) | ||
| await expect( | ||
| page.locator('[data-testid="org-grid"]').getByText('TestSIG') | ||
| ).toBeVisible(); | ||
| expect( | ||
| await page.locator('[data-testid="org-grid"] h3:visible').count() | ||
| ).toBe(2); | ||
| }); | ||
|
|
||
| test('clicking a card flips it to show leads', async ({ page }) => { | ||
| const card = page.locator('.flip-card').first(); | ||
|
|
||
| // Back face should be hidden before flip | ||
| await expect(card.locator('.flip-card-back')).toBeHidden(); | ||
|
|
||
| // Click to flip | ||
| await card.click(); | ||
| await page.waitForTimeout(700); | ||
|
|
||
| // Back face should now be visible with lead data | ||
| const backFace = card.locator('.flip-card-back'); | ||
| await expect(backFace).toBeVisible(); | ||
| await expect(backFace.getByText('Leadership')).toBeVisible(); | ||
| await expect(backFace.getByText('Alice Smith')).toBeVisible(); | ||
| await expect(backFace.getByText('Chair', { exact: true })).toBeVisible(); | ||
| await expect(backFace.getByText('Bob Jones')).toBeVisible(); | ||
| }); | ||
|
|
||
| test('clicking the back flips the card back to front', async ({ page }) => { | ||
| const card = page.locator('.flip-card').first(); | ||
|
|
||
| // Flip to back | ||
| await card.click(); | ||
| await page.waitForTimeout(700); | ||
| await expect(card.locator('.flip-card-back')).toBeVisible(); | ||
|
|
||
| // Flip back to front | ||
| await card.click(); | ||
| await page.waitForTimeout(700); | ||
|
|
||
| await expect(card.locator('.flip-card-front h3')).toBeVisible(); | ||
| await expect(card.locator('.flip-card-back')).toBeHidden(); | ||
| }); | ||
|
|
||
| test('leads without a name fall back to username', async ({ page }) => { | ||
| const card = page.locator('.flip-card').first(); | ||
| await card.click(); | ||
| await page.waitForTimeout(700); | ||
|
|
||
| const backFace = card.locator('.flip-card-back'); | ||
| // charlie3 has no name, should show username | ||
| await expect(backFace.getByText('charlie3')).toBeVisible(); | ||
| await expect(backFace.getByText('Treasurer')).toBeVisible(); | ||
| }); | ||
|
|
||
| test('card with no leads shows fallback message', async ({ page }) => { | ||
| const card = page.locator('.flip-card').nth(1); | ||
| await card.click(); | ||
| await page.waitForTimeout(700); | ||
|
|
||
| await expect( | ||
| card.locator('.flip-card-back').getByText('No leads listed') | ||
| ).toBeVisible(); | ||
| }); | ||
|
|
||
| test('clicking social links does not flip the card', async ({ page }) => { | ||
| const card = page.locator('.flip-card').first(); | ||
| // Click a link inside the card (stopPropagation should prevent flip) | ||
| const link = card.locator('.flip-card-front a').first(); | ||
| await expect(link).toBeVisible(); | ||
| await link.click(); | ||
|
|
||
| // Card should NOT have flipped | ||
| await expect(card.locator('.flip-card-back')).toBeHidden(); | ||
| }); | ||
|
|
||
| test('flip card shows tap to flip back hint', async ({ page }) => { | ||
| const card = page.locator('.flip-card').first(); | ||
| await card.click(); | ||
| await page.waitForTimeout(700); | ||
|
|
||
| await expect( | ||
| card.locator('.flip-card-back').getByText('Tap to flip back') | ||
| ).toBeVisible(); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.