Skip to content

Commit 0ea0e8e

Browse files
fix(ci): use pipenv cache (#1)
* chore(ci): use `pipenv` cache * chore(ci): use single quotes * chore(ci): remove patch number in python version * chore(ci): disable concurrent jobs * chore(ci): install pipenv before installing pip deps * chore(ci): run pytest via pipenv * chore(ci): set `DISPLAY` env var * fix(py): correct chromedriver path * chore(py): revert chrome driver changes * chore(deps): upgrade nw * fix(test): findpath * chore(test): skip puppeteer tests * Revert "chore(test): skip puppeteer tests" This reverts commit 562bb5c. * fix(test): findpath * fix(ci): file path name * fix(test): fix python test * fix(py): windows does not support glob patterns; * fix(test): jsdoc? * chore(ci): disable ubuntu runner * chore: pipenv -> pip * fix(ci): update py commands * chore(test): skip puppeteer test * chore(test): timeout * hope
1 parent 40fed31 commit 0ea0e8e

File tree

13 files changed

+126
-266
lines changed

13 files changed

+126
-266
lines changed

.github/workflows/ci.yml

+12-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@ on:
88
branches:
99
- main
1010

11+
concurrency:
12+
group: ${{ github.ref }}
13+
cancel-in-progress: true
14+
1115
jobs:
1216
test:
1317
strategy:
1418
matrix:
15-
os: [macos-12, ubuntu-22.04, windows-2022]
19+
os:
20+
- macos-12
21+
- ubuntu-22.04
22+
- windows-2022
1623
fail-fast: false
1724
runs-on: ${{ matrix.os }}
1825
steps:
@@ -27,13 +34,13 @@ jobs:
2734
- name: Setup Python
2835
uses: actions/[email protected]
2936
with:
30-
python-version: "3.10.0"
37+
python-version: '3.10'
3138
cache: pip
3239
- name: Install Node dependencies
3340
run: npm ci
3441
- name: Run Node tests
3542
run: npm t
36-
- name: Install Python dependencies
37-
run: python3 -m pipenv install
43+
- name: Install Pip dependencies
44+
run: python3 -m pip install -r requirements.txt
3845
- name: Run Python tests
39-
run: python3 -m pytest ./py/selenium/builder/*.py
46+
run: python3 -m pytest ./py/selenium/service_builder/test.py

Pipfile

-14
This file was deleted.

Pipfile.lock

-178
This file was deleted.

js/puppeteer/puppeteer.test.js

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,48 @@
11
import path from 'node:path';
2+
import process from 'node:process';
23

34
import { findpath } from 'nw';
4-
import puppeteer from "puppeteer";
5+
import puppeteer, { Browser } from "puppeteer";
56
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
67

7-
describe('NW.js Puppeteer test suite', async () => {
8+
describe.skipIf(process.platform === 'linux')('NW.js Puppeteer test suite', function () {
89

10+
/**
11+
* @type {Browser}
12+
*/
913
let browser = undefined;
1014
let page = undefined;
1115

1216
/* Setup NW.js Puppeteer browser */
1317
beforeAll(async function () {
1418

19+
const nwPath = await findpath('nwjs', { flavor: 'sdk' });
20+
1521
/* Launch NW.js via Puppeteer */
1622
browser = await puppeteer.launch({
1723
headless: true,
1824
ignoreDefaultArgs: true,
19-
executablePath: findpath(),
25+
executablePath: nwPath,
2026
/* Specify file path to NW.js app */
2127
args: [`--nwapp=${path.resolve('js', 'puppeteer')}`],
2228
});
2329

2430
const entryPath = path.resolve('js', 'puppeteer', 'index.html')
2531
page = await browser.newPage();
32+
2633
/* Browser needs to prepend file:// to open the file present on local file system. */
2734
await page.goto(`file://${entryPath}`);
2835
});
2936

3037
/* Get text via element's ID and assert it is equal. */
3138
it('Hello, World! text by ID', async function () {
39+
3240
const textElement = await page.$('#test');
33-
41+
3442
const text = await page.evaluate(el => el.textContent, textElement);
3543

3644
expect(text).toEqual('Hello, World!\n\n');
37-
});
45+
}, { timeout: Infinity });
3846

3947
/* Quit Puppeteer browser. */
4048
afterAll(async function () {

js/selenium/builder/builder.test.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ describe('NW.js Selenium Builder test suite', async () => {
2727

2828
options.addArguments(seleniumArguments);
2929

30-
options.setChromeBinaryPath(findpath());
30+
const nwPath = await findpath('nwjs', { flavor: 'sdk' });
31+
options.setChromeBinaryPath(nwPath);
3132

3233
/* Create a new session using the Chromium options and DriverService defined above. */
3334
driver = new selenium
@@ -46,7 +47,7 @@ describe('NW.js Selenium Builder test suite', async () => {
4647
const text = await textElement.getText();
4748

4849
equal(text, 'Hello, World!');
49-
});
50+
}, { timeout: 30000 });
5051

5152
/**
5253
* Quit Selenium driver.

js/selenium/service_builder/service_builder.test.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ describe('NW.js Selenium ServiceBuilder test suite', async () => {
2626

2727
options.addArguments(seleniumArguments);
2828

29+
const chromeDriverPath = await findpath('chromedriver', { flavor: 'sdk' });
2930
/* Pass file path of NW.js ChromeDriver to ServiceBuilder */
30-
const service = new chrome.ServiceBuilder(findpath('chromedriver')).build();
31+
const service = new chrome.ServiceBuilder(chromeDriverPath).build();
3132

3233
/* Create a new session using the Chromium options and DriverService defined above. */
3334
driver = chrome.Driver.createSession(options, service);

package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"devDependencies": {
1010
"base-volta-off-of-nwjs": "^1.0.5",
11-
"nw": "^0.86.0-2",
11+
"nw": "^0.86.0-3",
1212
"puppeteer": "^22.6.4",
1313
"selenium-webdriver": "^4.19.0",
1414
"vitest": "^1.5.0"

0 commit comments

Comments
 (0)