import { test, expect } from '@playwright/test'; test.describe('Organization Settings', () => { test('can access organization settings', async ({ page }) => { await page.goto('/orgs/settings'); await expect(page).toHaveURL(/\/orgs\/settings/); await expect(page.locator('body')).toBeVisible(); }); test('can view organization details', async ({ page }) => { await page.goto('/orgs/settings'); // Look for organization name/details const orgName = page.locator( 'input[name*="name"], input[id*="name"], :has-text("Organization")' ).first(); if (await orgName.isVisible({ timeout: 2000 }).catch(() => false)) { await expect(orgName).toBeVisible(); } }); test('can edit organization details', async ({ page }) => { await page.goto('/orgs/settings'); // Look for edit button or form const editButton = page.locator( 'button:has-text("Edit"), button:has-text("Save"), button[type="submit"]' ).first(); if (await editButton.isVisible()) { await expect(editButton).toBeVisible(); } }); test('can view team members', async ({ page }) => { await page.goto('/orgs/settings'); // Look for members section const membersSection = page.locator( ':has-text("Members"), :has-text("Team"), a[href*="/members"]' ).first(); if (await membersSection.isVisible({ timeout: 2000 }).catch(() => false)) { await membersSection.click(); await page.waitForTimeout(500); } }); test('can invite team members', async ({ page }) => { await page.goto('/orgs/settings'); // Look for invite button const inviteButton = page.locator( 'button:has-text("Invite"), button:has-text("Add Member"), a:has-text("Invite")' ).first(); if (await inviteButton.isVisible()) { await inviteButton.click(); await page.waitForTimeout(500); } }); test('can view integrations', async ({ page }) => { await page.goto('/orgs/settings/integrations'); await expect(page).toHaveURL(/\/orgs\/settings\/integrations/); await expect(page.locator('body')).toBeVisible(); }); test('can configure Slack integration', async ({ page }) => { await page.goto('/orgs/settings/integrations'); // Look for Slack section const slackSection = page.locator( ':has-text("Slack"), button:has-text("Connect Slack")' ).first(); if (await slackSection.isVisible({ timeout: 2000 }).catch(() => false)) { await expect(slackSection).toBeVisible(); } }); test('can configure webhook integration', async ({ page }) => { await page.goto('/orgs/settings/integrations'); // Look for webhook section const webhookSection = page.locator( ':has-text("Webhook"), button:has-text("Add Webhook")' ).first(); if (await webhookSection.isVisible({ timeout: 2000 }).catch(() => false)) { await expect(webhookSection).toBeVisible(); } }); test('can view billing settings', async ({ page }) => { await page.goto('/orgs/settings/billing'); await expect(page).toHaveURL(/\/orgs\/settings\/billing/); await expect(page.locator('body')).toBeVisible(); }); test('can view subscription plan', async ({ page }) => { await page.goto('/orgs/settings/billing'); // Look for plan information const planInfo = page.locator( ':has-text("Plan"), :has-text("Subscription"), :has-text("Free"), :has-text("Pro")' ).first(); if (await planInfo.isVisible({ timeout: 2000 }).catch(() => false)) { await expect(planInfo).toBeVisible(); } }); test('can view device usage', async ({ page }) => { await page.goto('/orgs/settings/billing'); // Look for device count/usage const deviceUsage = page.locator( ':has-text("device"), :has-text("usage"), :has-text("limit")' ).first(); if (await deviceUsage.isVisible({ timeout: 2000 }).catch(() => false)) { await expect(deviceUsage).toBeVisible(); } }); test('can access notification settings', async ({ page }) => { await page.goto('/orgs/settings/notifications'); await expect(page).toHaveURL(/\/orgs\/settings\/notifications/); await expect(page.locator('body')).toBeVisible(); }); test('can configure alert notifications', async ({ page }) => { await page.goto('/orgs/settings/notifications'); // Look for notification preferences const notificationToggle = page.locator( 'input[type="checkbox"], [role="switch"], button[role="switch"]' ).first(); if (await notificationToggle.isVisible({ timeout: 2000 }).catch(() => false)) { await expect(notificationToggle).toBeVisible(); } }); });