Skip to content

Commit

Permalink
logs
Browse files Browse the repository at this point in the history
  • Loading branch information
shaiu committed Sep 20, 2024
1 parent edb4447 commit 016900f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
2 changes: 0 additions & 2 deletions packages/preload/src/commonTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export interface JsonConfig extends OutputVendorConfigBase {
export interface GoogleSheetsConfig extends OutputVendorConfigBase {
options: {
credentials: Credentials;
// credentials: string;
spreadsheetId: string;
};
}
Expand All @@ -82,7 +81,6 @@ export interface YnabConfig extends OutputVendorConfigBase {

export interface AccountToScrapeConfig {
id: string;
// key: CompanyTypes;
key: string;
name: string;
loginFields: Record<string, string>;
Expand Down
19 changes: 5 additions & 14 deletions tests/e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ afterAll(async () => {
});

test('Main window state', async () => {
console.log('start');
const page = await electronApp.firstWindow();
console.log('await electronApp.firstWindow');
const window: JSHandle<BrowserWindow> = await electronApp.browserWindow(page);
console.log('await electronApp.browserWindow(page)');
const windowState = await window.evaluate(
(
mainWindow,
Expand All @@ -38,19 +35,13 @@ test('Main window state', async () => {
});

return new Promise((resolve) => {
/**
* The main window is created hidden, and is shown only when it is ready.
* See {@link ../packages/main/src/mainWindow.ts} function
*/
if (mainWindow.isVisible()) {
resolve(getState());
} else mainWindow.once('ready-to-show', () => resolve(getState()));
});
},
);

console.log('await window.evaluate');

expect(windowState.isCrashed, 'The app has crashed').toBeFalsy();
expect(windowState.isVisible, 'The main window was not visible').toBeTruthy();
expect(
Expand All @@ -61,6 +52,10 @@ test('Main window state', async () => {

test('Main window web content', async () => {
const page = await electronApp.firstWindow();

page.on('console', msg => console.log('PAGE LOG:', msg.text()));
page.on('pageerror', err => console.log('PAGE ERROR:', err));

const element = await page.$('#app', { strict: true });
expect(element, 'Was unable to find the root element').toBeDefined();
expect(
Expand All @@ -77,9 +72,6 @@ test('Preload versions', async () => {
'expect find one element #process-versions',
).toStrictEqual(1);

Check failure on line 73 in tests/e2e.spec.ts

View workflow job for this annotation

GitHub Actions / tests (ubuntu-latest)

tests/e2e.spec.ts > Preload versions

AssertionError: expect find one element #process-versions: expected +0 to strictly equal 1 - Expected + Received - 1 + 0 ❯ tests/e2e.spec.ts:73:5

/**
* In this test we check only text value and don't care about formatting. That's why here we remove any space symbols
*/
const renderedVersions = (await versionsElement.innerText()).replace(
/\s/g,
'',
Expand All @@ -96,7 +88,6 @@ test('Preload versions', async () => {
test('Preload nodeCrypto', async () => {
const page = await electronApp.firstWindow();

// Test hashing a random string
const testString = Math.random().toString(36).slice(2, 7);

const rawInput = page.locator('input#reactive-hash-raw-value');
Expand All @@ -115,4 +106,4 @@ test('Preload nodeCrypto', async () => {
const renderedHash = await hashedInput.inputValue();
const expectedHash = createHash('sha256').update(testString).digest('hex');
expect(renderedHash).toEqual(expectedHash);
});
});

0 comments on commit 016900f

Please sign in to comment.