Files
modeling-app/e2e/playwright/projects.spec.ts

41 lines
1.3 KiB
TypeScript
Raw Normal View History

2024-08-12 18:06:08 -04:00
import { _electron as electron, test } from '@playwright/test';
import {
getUtils,
TEST_COLORS,
setup,
tearDown,
commonPoints,
PERSIST_MODELING_CONTEXT,
} from './test-utils'
test.describe("when a project", async () => {
// This was the very test created. It provides the foundation for the
// rest of the tests we have to write.
test('is created', async ({ page }) => {
// Launch Electron app.
const electronApp = await electron.launch({ args: ['.'] })
// Evaluation expression in the Electron context.
const appPath = await electronApp.evaluate(async ({ app }) => {
// This runs in the main Electron process, parameter here is always
// the result of the require('electron') in the main app script.
return app.getAppPath();
});
console.log(appPath);
// Get the first window that the app opens, wait if necessary.
const window = await electronApp.firstWindow();
// Print the title.
console.log(await window.title());
// Capture a screenshot.
await window.screenshot({ path: 'intro.png' });
// Direct Electron console to Node terminal.
window.on('console', console.log);
// Click button.
await window.click('text=Click me');
// Exit app.
await electronApp.close();
})
})