Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into beta-releases
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Oct 11, 2024
2 parents d80a02f + 22677d9 commit 98f186e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 66 deletions.
33 changes: 21 additions & 12 deletions packages/compass-e2e-tests/helpers/compass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1020,19 +1020,28 @@ export async function init(
// For browser.executeAsync(). Trying to see if it will work for browser.execute() too.
await browser.setTimeout({ script: 5_000 });

// larger window for more consistent results
const [width, height] = await browser.execute(() => {
// in case setWindowSize() below doesn't work
window.resizeTo(window.screen.availWidth, window.screen.availHeight);
if (TEST_COMPASS_WEB) {
// larger window for more consistent results
const [width, height] = await browser.execute(() => {
// in case setWindowSize() below doesn't work
window.resizeTo(window.screen.availWidth, window.screen.availHeight);

return [window.screen.availWidth, window.screen.availHeight];
});
debug(`available width=${width}, height=${height}`);
try {
// window.resizeTo() doesn't work on firefox
await browser.setWindowSize(width, height);
} catch (err: any) {
console.error(err?.stack);
return [window.screen.availWidth, window.screen.availHeight];
});
// getting available width=1512, height=944 in electron on mac which is arbitrary
debug(`available width=${width}, height=${height}`);
try {
// window.resizeTo() doesn't work on firefox
await browser.setWindowSize(width, height);
} catch (err: any) {
console.error(err?.stack);
}
} else {
await browser.execute(() => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { ipcRenderer } = require('electron');
ipcRenderer.invoke('compass:maximize');
});
}

if (compass.needsCloseWelcomeModal) {
Expand Down
55 changes: 1 addition & 54 deletions packages/compass-e2e-tests/tests/collection-import.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -813,60 +813,7 @@ describe('Collection import', function () {

const result = await getFirstListDocument(browser);

// The values are the text as they appear in the page, so numbers are
// strings, strings have double-quotes inside them and dates got formatted.
// Arrays and objects start off collapsed.
try {
expect(result).to.deep.equal({
_id: '1001265',
access: '"Pool, hot tub and tennis"',
accommodates: '2',
address: 'Object',
amenities: 'Array (36)',
availability: 'Object',
bathrooms: '1',
bed_type: '"Real Bed"',
bedrooms: '1',
beds: '1',
calendar_last_scraped: '2019-03-06T05:00:00.000+00:00',
cancellation_policy: '"strict_14_with_grace_period"',
cleaning_fee: '100',
description:
'"A short distance from Honolulu\'s billion dollar mall, and the same dis…"',
extra_people: '0',
first_review: '2013-05-24T04:00:00.000+00:00',
guests_included: '1',
host: 'Object',
house_rules:
'"The general welfare and well being of all the community."',
images: 'Object',
interaction:
'"We try our best at creating, simple responsive management which never …"',
last_review: '2019-02-07T05:00:00.000+00:00',
last_scraped: '2019-03-06T05:00:00.000+00:00',
listing_url: '"https://www.airbnb.com/rooms/1001265"',
maximum_nights: '365',
minimum_nights: '3',
monthly_price: '2150',
name: '"Ocean View Waikiki Marina w/prkg"',
neighborhood_overview: '"You can breath ocean as well as aloha."',
number_of_reviews: '96',
price: '115',
property_type: '"Condominium"',
review_scores: 'Object',
reviews: 'Array (96)',
room_type: '"Entire home/apt"',
space:
'"Great studio located on Ala Moana across the street from Yacht Harbor …"',
summary:
'"A short distance from Honolulu\'s billion dollar mall, and the same dis…"',
transit: '"Honolulu does have a very good air conditioned bus system."',
weekly_price: '650',
});
} catch (err) {
console.log(JSON.stringify(result, null, 2));
throw err;
}
expect(result._id).to.equal('1001265');
});

it('supports CSV files with BOM', async function () {
Expand Down
8 changes: 8 additions & 0 deletions packages/compass/src/main/window-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,14 @@ class CompassWindowManager {
shell.showItemInFolder(filename);
});

// To resize an electron window you have to do it from the main process.
// This is here so that the e2e tests can resize the window from the
// renderer process.
ipcMain?.handle('compass:maximize', () => {
const first = BrowserWindow.getAllWindows()[0];
first.maximize();
});

await electronApp.whenReady();
await onAppReady();

Expand Down

0 comments on commit 98f186e

Please sign in to comment.