|
| 1 | +import { expect, test } from '@playwright/test' |
| 2 | + |
| 3 | +test.describe('Talent Pools', () => { |
| 4 | + test('should display seeded talent pools', async ({ page }) => { |
| 5 | + await page.goto('/talent-pools') |
| 6 | + await page.waitForSelector('table') |
| 7 | + |
| 8 | + // not_submitted pools should appear (sorted first) |
| 9 | + await expect(page.locator('text=Cloudflare')).toBeVisible() |
| 10 | + await expect(page.locator('text=Vercel')).toBeVisible() |
| 11 | + |
| 12 | + // submitted pools should appear |
| 13 | + await expect(page.locator('text=Datadog')).toBeVisible() |
| 14 | + await expect(page.locator('text=Stripe')).toBeVisible() |
| 15 | + }) |
| 16 | + |
| 17 | + test('should navigate to talent pools from home page', async ({ page }) => { |
| 18 | + await page.goto('/') |
| 19 | + await page.waitForSelector('table') |
| 20 | + |
| 21 | + await page.click('a:has-text("Talent Pools")') |
| 22 | + await page.waitForURL('/talent-pools') |
| 23 | + await page.waitForSelector('table') |
| 24 | + |
| 25 | + await expect( |
| 26 | + page.locator('h1:has-text("Talent Pools")'), |
| 27 | + ).toBeVisible() |
| 28 | + }) |
| 29 | + |
| 30 | + test('should add a new talent pool', async ({ page }) => { |
| 31 | + await page.goto('/talent-pools') |
| 32 | + await page.waitForSelector('table') |
| 33 | + |
| 34 | + await page.click('button:has-text("Add Pool")') |
| 35 | + |
| 36 | + const dialog = page.locator('[data-slot="dialog-content"]') |
| 37 | + await expect(dialog).toBeVisible() |
| 38 | + await dialog.locator('#add-companyName').fill('GitHub') |
| 39 | + await dialog.locator('#add-url').fill('https://github.com/about/careers') |
| 40 | + await dialog.locator('#add-notes').fill('Great engineering culture.') |
| 41 | + await dialog.locator('button:has-text("Save")').click() |
| 42 | + |
| 43 | + await expect(page.locator('text=GitHub')).toBeVisible({ timeout: 10000 }) |
| 44 | + }) |
| 45 | + |
| 46 | + test('should edit a talent pool', async ({ page }) => { |
| 47 | + await page.goto('/talent-pools') |
| 48 | + await page.waitForSelector('table') |
| 49 | + |
| 50 | + const row = page.locator('tr:has-text("Vercel")') |
| 51 | + await row.locator('button:has-text("Edit")').click() |
| 52 | + |
| 53 | + const dialog = page.locator('[data-slot="dialog-content"]') |
| 54 | + await expect(dialog).toBeVisible() |
| 55 | + |
| 56 | + await dialog.locator('#edit-companyName').fill('Vercel Inc.') |
| 57 | + await dialog.locator('button:has-text("Save")').click() |
| 58 | + |
| 59 | + await expect(page.locator('text=Vercel Inc.')).toBeVisible({ |
| 60 | + timeout: 10000, |
| 61 | + }) |
| 62 | + }) |
| 63 | + |
| 64 | + test('should delete a talent pool', async ({ page }) => { |
| 65 | + await page.goto('/talent-pools') |
| 66 | + await page.waitForSelector('table') |
| 67 | + |
| 68 | + const row = page.locator('tr:has-text("Cloudflare")') |
| 69 | + await row.locator('button:has-text("Delete")').click() |
| 70 | + |
| 71 | + const dialog = page.locator('[data-slot="dialog-content"]') |
| 72 | + await expect(dialog).toBeVisible() |
| 73 | + await expect(dialog.locator('text=Are you sure')).toBeVisible() |
| 74 | + |
| 75 | + await dialog.locator('button:has-text("Delete")').click() |
| 76 | + |
| 77 | + await expect(page.locator('text=Cloudflare')).not.toBeVisible({ |
| 78 | + timeout: 10000, |
| 79 | + }) |
| 80 | + }) |
| 81 | + |
| 82 | + test('should toggle status', async ({ page }) => { |
| 83 | + await page.goto('/talent-pools') |
| 84 | + await page.waitForSelector('table') |
| 85 | + |
| 86 | + // Vercel is "not_submitted" - toggle to "submitted" |
| 87 | + const row = page.locator('tr:has-text("Vercel")') |
| 88 | + await expect(row.locator('text=Not Submitted')).toBeVisible() |
| 89 | + |
| 90 | + await row.locator('button:has([data-slot="badge"])').click() |
| 91 | + |
| 92 | + await expect(row.locator('text=Submitted')).toBeVisible({ |
| 93 | + timeout: 10000, |
| 94 | + }) |
| 95 | + }) |
| 96 | + |
| 97 | + test('should have working external links', async ({ page }) => { |
| 98 | + await page.goto('/talent-pools') |
| 99 | + await page.waitForSelector('table') |
| 100 | + |
| 101 | + const link = page.locator('a:has-text("Stripe")') |
| 102 | + await expect(link).toHaveAttribute( |
| 103 | + 'href', |
| 104 | + 'https://stripe.com/jobs/talent', |
| 105 | + ) |
| 106 | + await expect(link).toHaveAttribute('target', '_blank') |
| 107 | + }) |
| 108 | + |
| 109 | + test('should navigate back to jobs from talent pools page', async ({ |
| 110 | + page, |
| 111 | + }) => { |
| 112 | + await page.goto('/talent-pools') |
| 113 | + await page.waitForSelector('table') |
| 114 | + |
| 115 | + await page.click('a:has-text("Back to Jobs")') |
| 116 | + await page.waitForURL('/') |
| 117 | + await page.waitForSelector('table') |
| 118 | + |
| 119 | + await expect(page.locator('h1:has-text("Job Openings")')).toBeVisible() |
| 120 | + }) |
| 121 | +}) |
0 commit comments