app.spec.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { test, expect } from '@playwright/test'
  2. /**
  3. * The cheapest possible proof that a build is not dead on arrival: the session
  4. * survives, the main lists render, and the contract the technician app depends
  5. * on still answers.
  6. */
  7. test.describe('smoke', () => {
  8. test('the authenticated shell loads', async ({ page }) => {
  9. await page.goto('/')
  10. await expect(page).not.toHaveURL(/\/auth\//)
  11. await expect(page.locator('#password')).toHaveCount(0)
  12. })
  13. test('the seeded workshop has customers and vehicles', async ({ page }) => {
  14. // Lists render a card for phones and a table for wider screens and hide
  15. // one of them; the table is the visible one at the desktop size used here.
  16. await page.goto('/customers')
  17. await expect(page.getByRole('table').getByText('James Mitchell').first()).toBeVisible()
  18. // The vehicle list opens as a grid of cards, each headed by the vehicle's
  19. // name; searched, so the one asserted on is on the first page.
  20. await page.goto('/vehicles?search=Camry')
  21. await expect(page.getByRole('heading', { name: /Camry/i }).first()).toBeVisible()
  22. })
  23. test('the technician app handshake still answers', async ({ request }) => {
  24. // The mobile app calls this before a technician can type anything else. A
  25. // change to its shape strands every phone, and no unit test would notice.
  26. const response = await request.get('/api/v1/tech/health')
  27. expect(response.status()).toBe(200)
  28. const body = (await response.json()) as {
  29. data?: { service?: string; api?: string; minAppVersion?: string }
  30. }
  31. expect(body.data?.service).toBe('torqvoice')
  32. expect(body.data?.api).toBe('v1')
  33. expect(body.data?.minAppVersion).toMatch(/^\d+\.\d+\.\d+$/)
  34. })
  35. })