mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 02:36:05 +00:00
refactor: move tests
This commit is contained in:
parent
ae341a7b94
commit
9f2c786e41
51 changed files with 7 additions and 153 deletions
|
|
@ -51,7 +51,7 @@ npm run test:file <filepath>
|
|||
|
||||
- Unit tests: `npm test` - Uses Jasmine/Karma, tests are co-located with source files (`.spec.ts`)
|
||||
- E2E tests: `npm run e2e` - Uses Nightwatch, located in `/e2e/src/`
|
||||
- Playwright E2E tests: Located in `/e2e-playwright/`
|
||||
- Playwright E2E tests: Located in `/e2e/`
|
||||
- `npm run e2e:playwright` - Run all tests with minimal output (shows failures clearly)
|
||||
- `npm run e2e:playwright:file <path>` - Run a single test file with detailed output
|
||||
- Example: `npm run e2e:playwright:file tests/work-view/work-view.spec.ts`
|
||||
|
|
|
|||
|
|
@ -1,145 +0,0 @@
|
|||
import { test, expect } from '../fixtures/test.fixture';
|
||||
|
||||
test.describe.skip('Debug Project Note', () => {
|
||||
test('debug project creation and note toggle', async ({ page, projectPage }) => {
|
||||
// Create and navigate to default project
|
||||
await projectPage.createAndGoToTestProject();
|
||||
|
||||
// Verify we're in a project context
|
||||
const workCtxTitle = page.locator('.current-work-context-title');
|
||||
const titleText = await workCtxTitle.textContent();
|
||||
console.log('Current work context:', titleText);
|
||||
|
||||
// Check if notes toggle button exists
|
||||
const toggleNotesBtn = page.locator('.e2e-toggle-notes-btn');
|
||||
const toggleExists = await toggleNotesBtn.isVisible();
|
||||
console.log('Toggle notes button exists:', toggleExists);
|
||||
|
||||
if (toggleExists) {
|
||||
await toggleNotesBtn.click();
|
||||
|
||||
// Wait longer for notes section to appear
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Check if notes section appears
|
||||
const notesSection = page.locator('notes');
|
||||
const notesVisible = await notesSection.isVisible({ timeout: 5000 });
|
||||
console.log('Notes section visible after toggle:', notesVisible);
|
||||
|
||||
if (notesVisible) {
|
||||
// Check if add note button exists
|
||||
const addNoteBtn = page.locator('#add-note-btn');
|
||||
const addNoteBtnVisible = await addNoteBtn.isVisible({ timeout: 5000 });
|
||||
console.log('Add note button visible:', addNoteBtnVisible);
|
||||
|
||||
if (addNoteBtnVisible) {
|
||||
// Try to click the add note button
|
||||
console.log('Attempting to click add note button...');
|
||||
|
||||
// Check for any errors or console messages
|
||||
page.on('console', (msg) => console.log('PAGE LOG:', msg.text()));
|
||||
page.on('pageerror', (error) => console.log('PAGE ERROR:', error.message));
|
||||
|
||||
// Try different click strategies
|
||||
try {
|
||||
await addNoteBtn.click();
|
||||
console.log('Regular click succeeded');
|
||||
} catch (e) {
|
||||
console.log('Regular click failed, trying JavaScript click');
|
||||
await addNoteBtn.evaluate((el) => (el as HTMLElement).click());
|
||||
}
|
||||
|
||||
// Wait a moment for potential async operations
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Check what dialogs/overlays exist in DOM
|
||||
const allDialogs = await page.locator('*').evaluateAll((elements) => {
|
||||
return elements
|
||||
.filter(
|
||||
(el) =>
|
||||
el.tagName.toLowerCase().includes('dialog') ||
|
||||
el.className.toString().includes('dialog') ||
|
||||
el.className.toString().includes('overlay'),
|
||||
)
|
||||
.map((el) => ({
|
||||
tag: el.tagName,
|
||||
class: el.className.toString(),
|
||||
id: el.id,
|
||||
}));
|
||||
});
|
||||
console.log('Dialog/Overlay elements found:', allDialogs);
|
||||
|
||||
// Check for any overlay or dialog elements
|
||||
const allOverlays = page.locator('.cdk-overlay-container *');
|
||||
const overlayCount = await allOverlays.count();
|
||||
console.log('Total overlay elements:', overlayCount);
|
||||
|
||||
// Check if dialog appears (it should be in a mat-dialog-container)
|
||||
const matDialog = page.locator('mat-dialog-container');
|
||||
const matDialogVisible = await matDialog.isVisible({ timeout: 2000 });
|
||||
console.log('Mat dialog container visible:', matDialogVisible);
|
||||
|
||||
// Also check for CDK overlay
|
||||
const cdkOverlay = page.locator('.cdk-overlay-container mat-dialog-container');
|
||||
const cdkOverlayVisible = await cdkOverlay.isVisible({ timeout: 2000 });
|
||||
console.log('CDK overlay dialog visible:', cdkOverlayVisible);
|
||||
|
||||
// Check for any dialog-like elements
|
||||
const anyDialog = page.locator(
|
||||
'[role="dialog"], .mat-dialog-container, mat-dialog-container',
|
||||
);
|
||||
const anyDialogCount = await anyDialog.count();
|
||||
console.log('Any dialog elements found:', anyDialogCount);
|
||||
|
||||
if (matDialogVisible || cdkOverlayVisible) {
|
||||
// Check if textarea appears (inside the mat-dialog-container)
|
||||
const textarea = page.locator('mat-dialog-container textarea');
|
||||
const textareaVisible = await textarea.isVisible({ timeout: 5000 });
|
||||
console.log('Textarea visible:', textareaVisible);
|
||||
|
||||
if (textareaVisible) {
|
||||
// Try to fill the textarea
|
||||
await textarea.fill('Test note content');
|
||||
console.log('Filled textarea with test content');
|
||||
|
||||
// Check if save button exists (also inside the dialog)
|
||||
const saveBtn = page.locator('mat-dialog-container #T-save-note');
|
||||
const saveBtnVisible = await saveBtn.isVisible({ timeout: 5000 });
|
||||
console.log('Save button visible:', saveBtnVisible);
|
||||
|
||||
if (saveBtnVisible) {
|
||||
// Click save button
|
||||
console.log('Clicking save button...');
|
||||
await saveBtn.click();
|
||||
console.log('Save button clicked');
|
||||
|
||||
// Wait a moment for the dialog to close and note to be saved
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// Check if note appears in the notes section
|
||||
const noteContent = page.locator('notes note');
|
||||
const noteExists = await noteContent.count();
|
||||
console.log('Number of notes found after save:', noteExists);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Try to find notes section in different ways
|
||||
const notesAlternate = page.locator(
|
||||
'[data-test="notes"], .notes-wrapper, .notes-section',
|
||||
);
|
||||
const notesAlternateExists = await notesAlternate.count();
|
||||
console.log('Alternative notes selectors found:', notesAlternateExists);
|
||||
|
||||
// Check if any elements with 'note' in their tag/class exist
|
||||
const anyNotes = page.locator('*[class*="note"], *[id*="note"]');
|
||||
const anyNotesCount = await anyNotes.count();
|
||||
console.log('Any note-related elements found:', anyNotesCount);
|
||||
}
|
||||
}
|
||||
|
||||
// Add a short wait to see the final state
|
||||
await page.waitForTimeout(2000);
|
||||
});
|
||||
});
|
||||
|
|
@ -52,7 +52,6 @@ test.describe('Planner Navigation', () => {
|
|||
// Navigate to planner
|
||||
await plannerPage.navigateToPlanner();
|
||||
await plannerPage.waitForPlannerView();
|
||||
const urlBeforeRefresh = page.url();
|
||||
|
||||
// Refresh page
|
||||
await page.reload();
|
||||
12
package.json
12
package.json
|
|
@ -53,13 +53,13 @@
|
|||
"dist:win:only": "electron-builder --win",
|
||||
"dist:win:store": "git pull && npm run && copy electron-builder.win-store.yaml electron-builder.yaml && npm run dist:win && git checkout electron-builder.yaml || git checkout electron-builder.yaml",
|
||||
"droid": "npm run buildFrontend:stageWeb:unminified && npx cap sync",
|
||||
"e2e": "npx playwright test --config e2e-playwright/playwright.config.ts --reporter=line",
|
||||
"e2e:ui": "npx playwright test --config e2e-playwright/playwright.config.ts --ui",
|
||||
"e2e:file": "npx playwright test --config e2e-playwright/playwright.config.ts --reporter=list",
|
||||
"e2e:debug": "npx playwright test --config e2e-playwright/playwright.config.ts --debug",
|
||||
"e2e:headed": "npx playwright test --config e2e-playwright/playwright.config.ts --headed",
|
||||
"e2e": "npx playwright test --config e2e/playwright.config.ts --reporter=line",
|
||||
"e2e:ui": "npx playwright test --config e2e/playwright.config.ts --ui",
|
||||
"e2e:file": "npx playwright test --config e2e/playwright.config.ts --reporter=list",
|
||||
"e2e:debug": "npx playwright test --config e2e/playwright.config.ts --debug",
|
||||
"e2e:headed": "npx playwright test --config e2e/playwright.config.ts --headed",
|
||||
"e2e:show-report": "npx playwright show-report .tmp/e2e-test-results/playwright-report",
|
||||
"e2e:report": "PLAYWRIGHT_HTML_REPORT=1 npx playwright test --config e2e-playwright/playwright.config.ts",
|
||||
"e2e:report": "PLAYWRIGHT_HTML_REPORT=1 npx playwright test --config e2e/playwright.config.ts",
|
||||
"e2e:webdav": "WEBDAV_DATA_DIR=./e2e-webdav-data docker compose up -d webdav && sleep 5 && npm run e2e -- --grep webdav; docker compose down",
|
||||
"electron": "NODE_ENV=PROD electron .",
|
||||
"electron:build": "tsc -p electron/tsconfig.electron.json",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue