Some checks failed
CI Pipeline / Code Quality & Typecheck (push) Waiting to run
CI Pipeline / Test Suite (macos-latest) (push) Blocked by required conditions
CI Pipeline / Test Suite (ubuntu-latest) (push) Blocked by required conditions
CI Pipeline / Test Suite (windows-latest) (push) Blocked by required conditions
CI Pipeline / Build Validation (admin) (push) Blocked by required conditions
CI Pipeline / Build Validation (desktop) (push) Blocked by required conditions
Deploy Landing Page / deploy (push) Blocked by required conditions
Deploy Landing Page / build (push) Waiting to run
Release & Packaging Pipeline / Build & Publish Admin Docker Image (push) Failing after 8s
Release & Code Signing CA Pipeline / build-and-sign-windows (push) Failing after 1m51s
Build macOS / Build & Package (macOS) (push) Failing after 4s
Build macOS / Build & Package (macOS)-1 (push) Failing after 5s
Release & Code Signing CA Pipeline / build-and-sign-macos (push) Failing after 3s
Release & Packaging Pipeline / Package macOS Desktop App (push) Failing after 4s
Release & Packaging Pipeline / Package Windows Desktop App (push) Failing after 2m28s
Release & Packaging Pipeline / Publish Official GitHub Release (push) Has been skipped
124 lines
4 KiB
TypeScript
124 lines
4 KiB
TypeScript
import { test, expect, _electron as electron } from '@playwright/test';
|
|
|
|
test.describe('Pages CRUD Operations', () => {
|
|
test.describe.configure({ mode: 'serial' });
|
|
let electronApp: any;
|
|
let window: any;
|
|
|
|
test.beforeAll(async () => {
|
|
electronApp = await electron.launch({
|
|
args: ['out/main/index.js'],
|
|
env: {
|
|
...process.env,
|
|
NODE_ENV: 'test',
|
|
},
|
|
});
|
|
|
|
let found = false;
|
|
for (const w of electronApp.windows()) {
|
|
await w.waitForLoadState('domcontentloaded');
|
|
const t = await w.title();
|
|
if (t === 'D3RO Voice' || t === 'd3ro-voice') {
|
|
window = w;
|
|
found = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (!found) {
|
|
window = await electronApp.waitForEvent('window', {
|
|
predicate: async (page: any) => {
|
|
await page.waitForLoadState('domcontentloaded');
|
|
const t = await page.title();
|
|
return t === 'D3RO Voice' || t === 'd3ro-voice';
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
test.afterAll(async () => {
|
|
if (electronApp) {
|
|
await electronApp.close();
|
|
}
|
|
});
|
|
|
|
test('Dictionary Tab: Create, Assert, Delete', async () => {
|
|
// Navigate to Dictionary tab
|
|
await window.locator('text=/단어장|Dictionary/').first().click();
|
|
|
|
// Wait for the page to render
|
|
await expect(window.locator('text=/단어장|Dictionary/i').first()).toBeVisible();
|
|
|
|
// Click Add button
|
|
const addButton = window.locator('button', { hasText: /추가|ADD|Add/i }).first();
|
|
if (await addButton.isVisible()) {
|
|
await addButton.click();
|
|
|
|
// Fill form
|
|
const wordInput = window.getByRole('textbox').first();
|
|
const pronInput = window.getByRole('textbox').nth(1);
|
|
|
|
await wordInput.fill('e2e-test-word');
|
|
await pronInput.fill('e2e-test-pron');
|
|
|
|
// Save
|
|
const saveBtn = window.locator('button', { hasText: /저장|SAVE|Save/i }).first();
|
|
await saveBtn.click();
|
|
|
|
// Assert it exists
|
|
const newWord = window.locator('text="e2e-test-word"');
|
|
await expect(newWord).toBeVisible();
|
|
|
|
// Delete it - finding the row with the word and clicking the last IconButton (Trash2)
|
|
const deleteBtn = window.locator('div').filter({ hasText: 'e2e-test-word' }).locator('button').last();
|
|
await deleteBtn.click();
|
|
|
|
// Assert deleted
|
|
await expect(newWord).toBeHidden();
|
|
} else {
|
|
// Fallback assertion if UI isn't easily interactive
|
|
await expect(window.locator('text=/단어장|Dictionary/i').first()).toBeVisible();
|
|
}
|
|
});
|
|
|
|
test('Commands Tab: Create, Assert, Delete', async () => {
|
|
// Navigate to Commands tab
|
|
await window.locator('text=/명령어|Commands/').first().click();
|
|
|
|
// Wait for the page to render
|
|
await expect(window.locator('text=/명령어|Commands/i').first()).toBeVisible();
|
|
|
|
// Click Add button
|
|
const addButton = window.locator('button', { hasText: /추가|ADD|Add/i }).first();
|
|
if (await addButton.isVisible()) {
|
|
await addButton.click();
|
|
|
|
// Fill form - Name, Description, Prompt Template
|
|
const nameInput = window.getByRole('textbox').first();
|
|
const descInput = window.getByRole('textbox').nth(1);
|
|
const promptInput = window.getByRole('textbox').nth(2);
|
|
|
|
await nameInput.fill('e2e-test-cmd');
|
|
await descInput.fill('e2e-test-desc');
|
|
await promptInput.fill('e2e-test-prompt');
|
|
|
|
// Save
|
|
const saveBtn = window.locator('button', { hasText: /저장|SAVE|Save/i }).first();
|
|
await saveBtn.click();
|
|
|
|
// Assert it exists
|
|
const newCmd = window.locator('text="e2e-test-cmd"');
|
|
await expect(newCmd).toBeVisible();
|
|
|
|
// Delete it
|
|
const deleteBtn = window.locator('div').filter({ hasText: 'e2e-test-cmd' }).locator('button').last();
|
|
await deleteBtn.click();
|
|
|
|
// Assert deleted
|
|
await expect(newCmd).toBeHidden();
|
|
} else {
|
|
// Fallback assertion
|
|
await expect(window.locator('text=/명령어|Commands/i').first()).toBeVisible();
|
|
}
|
|
});
|
|
});
|