Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
june07 committed Mar 25, 2024
1 parent 35b0511 commit 951b802
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"build:deps": "cross-env NODE_ENV=production node utils/watch-rollup.js",
"watch:rollup:deps": "node utils/watch-rollup.js",
"preview": "vite preview",
"test": "playwright test --project \"edge@latest@localhost\" \"chrome@latest@localhost\" --workers 5 --retries 3",
"test": "playwright test --project \"chrome@latest@localhost\" --workers 5 --retries 3",
"test:local": "playwright test --project \"edge@latest@localhost\" \"chrome@latest@localhost\" --workers 1",
"test:post": "playwright test --project \"edge@latest@localhost\" \"chrome@latest@localhost\" --workers 5 --retries 3"
},
Expand Down
30 changes: 15 additions & 15 deletions tests/default-install-state.spec.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
const { spawn } = require('child_process');
const { test, expect, basename } = require('./fixtures');
const { until } = require('async');
const { spawn } = require('child_process')
const { test, expect, basename } = require('./fixtures')
const { until } = require('async')

module.exports = (async () => {
test.describe(() => {
test.describe.configure({ retries: 3 });
test.describe.configure({ retries: 3 })
test(`popup - ${basename(__filename)} - 1`, async ({ page, context, serviceWorker }) => {
const re = new RegExp(`devtools:\/\/.*ws=localhost:9229.*`);
const process = spawn('node', [`--inspect=9229`, 'tests/hello.js']);
const re = new RegExp(`devtools:\/\/.*ws=localhost:9229.*`)
const process = spawn('node', [`--inspect=9229`, 'tests/hello.js'])

try {
// first check that the auto function is working on the default host/port.
await Promise.race([
new Promise(resolve => setTimeout(resolve, 7000)),
until(
async () => await context.pages().filter(page => page.url().match(re))?.length,
async () => await new Promise(resolve => setTimeout(resolve, 50))
async () => await new Promise(resolve => setTimeout(resolve))
)
]);
])

expect(await context.pages().filter(page => page.url().match(re))?.length).toBe(1);
expect(await context.pages().filter(page => page.url().match(re))?.length).toBe(1)

process.kill();
process.kill()
} finally {
await serviceWorker.evaluate(async () => {
await Promise.all([
chrome.storage.local.clear(),
chrome.storage.session.clear()
]);
});
])
})
}
});
});
})();
})
})
})()

0 comments on commit 951b802

Please sign in to comment.