|
| 1 | +import { expect, test } from '@playwright/test' |
| 2 | +import { login } from './helpers.js' |
| 3 | + |
| 4 | +test('DOG FOODING TIME - Create a service that uses the StackCraft GitHub repository. Clone, install, build and run the service', async ({ |
| 5 | + page, |
| 6 | + browserName, |
| 7 | +}) => { |
| 8 | + const uuid = crypto.randomUUID() |
| 9 | + |
| 10 | + const stackName = `e2e-dog-fooding-time-${uuid}` |
| 11 | + const displayName = `E2E Test Stack - ${browserName} - ${uuid}` |
| 12 | + |
| 13 | + const workingDirectory = `/tmp/e2e-dog-fooding-time-${uuid}` |
| 14 | + |
| 15 | + await page.goto('/') |
| 16 | + await login(page) |
| 17 | + |
| 18 | + // Create stack |
| 19 | + await page.locator('button', { hasText: 'Create Stack' }).first().click() |
| 20 | + await expect(page.locator('shade-create-stack')).toBeVisible() |
| 21 | + |
| 22 | + await page.locator('input[name="name"]').fill(stackName) |
| 23 | + await page.locator('input[name="displayName"]').fill(displayName) |
| 24 | + await page.locator('textarea[name="description"]').fill('Created by E2E test') |
| 25 | + await page.locator('input[name="mainDirectory"]').fill('/tmp/e2e-test') |
| 26 | + await page.locator('button', { hasText: 'Create' }).click() |
| 27 | + |
| 28 | + await expect(page.locator('shade-noty-list')).toContainText(`Stack "${displayName}" was created successfully.`) |
| 29 | + |
| 30 | + await expect(page.locator('shade-dashboard')).toBeVisible() |
| 31 | + |
| 32 | + await expect(page.getByTestId('page-header-title')).toContainText(displayName) |
| 33 | + |
| 34 | + // Create the service with the StackCraft GitHub repository |
| 35 | + await page.locator('button', { hasText: 'Create Service' }).first().click() |
| 36 | + await expect(page.locator('shade-create-service-wizard')).toBeVisible() |
| 37 | + |
| 38 | + await page.locator('input[name="displayName"]').fill('StackCraft DOG FOODING TIME!') |
| 39 | + await page.locator('input[name="workingDirectory"]').fill(workingDirectory) |
| 40 | + await page.locator('input[name="runCommand"]').fill('yarn start:service') |
| 41 | + |
| 42 | + await page.locator('input[name="installCommand"]').fill('yarn install') |
| 43 | + await page.locator('input[name="buildCommand"]').fill('yarn build') |
| 44 | + await page.locator('input[name="runCommand"]').fill('yarn start:service') |
| 45 | + |
| 46 | + await page.locator('button', { hasText: 'Create' }).click() |
| 47 | + |
| 48 | + await page.locator('button', { hasText: 'Set up now' }).click() |
| 49 | + |
| 50 | + await expect(page.locator('shade-dashboard')).toBeVisible() |
| 51 | + await expect(page.locator(`text=${displayName}`)).toBeVisible() |
| 52 | + |
| 53 | + // Verify the service is running |
| 54 | + await expect(page.locator('shade-service-logs')).toBeVisible() |
| 55 | +}) |
0 commit comments