Skip to content

Commit

Permalink
try show bg page
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaMan123 committed Dec 2, 2024
1 parent 29a7ec9 commit fa25ca7
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: nesting-results-${{ matrix.os }}
path: ~/Downloads/nesting-*
path: output/
retention-days: 1
15 changes: 10 additions & 5 deletions .github/workflows/robot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@ on:
branches: [main, master]
jobs:
exec:
if: false
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 5
runs-on: ubuntu-20.04
steps:
- name: boost+chromium
- name: boost
run: sudo apt-get update && sudo apt-get install -yq libboost-dev
- name: Install chromium
if: matrix.os == 'ubuntu-20.04'
# https://launchpad.net/ubuntu/+source/chromium-browser/101.0.4951.64-0ubuntu0.18.04.1
run: sudo apt-get update && sudo apt-get install -yq libboost-dev chromium-browser=101.0.4951.64
run: sudo apt-get install chromium-browser=101.0.4951.64
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
Expand All @@ -24,5 +29,5 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: nesting
path: test-results/
path: output/
retention-days: 1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/bin
/minkowski
/deepnest-*win32-x64
/output
# package-lock.json
git_token.rtf
.idea
Expand Down
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# *
# !/tests/*
main/
main/
main.js
6 changes: 3 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function createMainWindow() {
width: Math.ceil(width*0.9),
height: Math.ceil(height*0.9),
frame: !frameless,
show: false,
show: !!process.env.CI,
webPreferences: {
contextIsolation: false,
enableRemoteModule: true,
Expand Down Expand Up @@ -136,7 +136,7 @@ function createBackgroundWindows() {
// used to have 8, now just 1 background window
if(winCount < 1){
var back = new BrowserWindow({
show: false,
show: !!process.env.CI,
webPreferences: {
contextIsolation: false,
enableRemoteModule: true,
Expand All @@ -147,7 +147,7 @@ function createBackgroundWindows() {

require('@electron/remote/main').enable(back.webContents)

if (process.env["deepnest_debug"] === '1')
if (process.env["deepnest_debug"] === '1' || process.env.CI)
back.webContents.openDevTools();

back.loadURL(url.format({
Expand Down
9 changes: 5 additions & 4 deletions main.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ const { ensureDirSync } = require("fs-extra");

const robotFile = path.resolve(__dirname, "robot.js");
const inputDir = path.resolve(app.getAppPath(), "input");
const outputDir = path.resolve(
app.getPath("downloads"),
`nesting-${new Date().toISOString()}`
);
// const outputDir = path.resolve(
// app.getPath("downloads"),
// `nesting-${new Date().toISOString()}`
// );
const outputDir = path.resolve(__dirname, "output");
ensureDirSync(outputDir);
const downloadFile = path.resolve(outputDir, "result.svg");
const dataFile = path.resolve(outputDir, "data.json");
Expand Down
38 changes: 19 additions & 19 deletions tests/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,17 @@ test("Nest", async ({}, testInfo) => {
// }
// );

await electronApp.evaluate(
({ dialog }, paths) => {
dialog.showOpenDialog = async (): Promise<OpenDialogReturnValue> => ({
filePaths: paths,
canceled: false,
});
},
[
path.resolve(process.cwd(), "input", "letters.svg"),
path.resolve(process.cwd(), "input", "letters2.svg"),
path.resolve(process.cwd(), "input", "letters3.svg"),
]
);
const inputDir = path.resolve(process.cwd(), "input");
const files = (await readdir(inputDir))
.filter((file) => path.extname(file) === ".svg")
.map((file) => path.resolve(inputDir, file));

await electronApp.evaluate(({ dialog }, paths) => {
dialog.showOpenDialog = async (): Promise<OpenDialogReturnValue> => ({
filePaths: paths,
canceled: false,
});
}, files);
await window.click("id=import");

await window.click("id=addsheet");
Expand Down Expand Up @@ -168,12 +166,14 @@ test("Nest", async ({}, testInfo) => {

// await expect(window.locator("id=progressbar")).toBeVisible();
const n = 1;
await expect(
window
.locator("id=nestlist")
.locator("span")
.nth(n - 1)
).toBeVisible({ timeout: 10_000 });
await expect(() =>
expect(
window
.locator("id=nestlist")
.locator("span")
.nth(n - 1)
).toBeVisible()
).toPass();
await expect(window.locator("id=nestinfo").locator("h1").nth(0)).toHaveText(
"1"
);
Expand Down

0 comments on commit fa25ca7

Please sign in to comment.