Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ci): use pipenv cache #1

Merged
merged 24 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
64df9df
chore(ci): use `pipenv` cache
ayushmanchhabra Apr 13, 2024
a9d469c
chore(ci): use single quotes
ayushmanchhabra Apr 14, 2024
6bca9df
chore(ci): remove patch number in python version
ayushmanchhabra Apr 14, 2024
2fcc14c
chore(ci): disable concurrent jobs
ayushmanchhabra Apr 14, 2024
4c534da
chore(ci): install pipenv before installing pip deps
ayushmanchhabra Apr 14, 2024
1283543
chore(ci): run pytest via pipenv
ayushmanchhabra Apr 14, 2024
a97ee0b
chore(ci): set `DISPLAY` env var
ayushmanchhabra Apr 14, 2024
9948d52
fix(py): correct chromedriver path
ayushmanchhabra Apr 14, 2024
244857a
chore(py): revert chrome driver changes
ayushmanchhabra Apr 14, 2024
e9f888d
chore(deps): upgrade nw
ayushmanchhabra Apr 14, 2024
aecd030
fix(test): findpath
ayushmanchhabra Apr 14, 2024
562bb5c
chore(test): skip puppeteer tests
ayushmanchhabra Apr 14, 2024
da1edac
Revert "chore(test): skip puppeteer tests"
ayushmanchhabra Apr 14, 2024
2fa6edc
fix(test): findpath
ayushmanchhabra Apr 14, 2024
c0a81c9
fix(ci): file path name
ayushmanchhabra Apr 14, 2024
254a36a
fix(test): fix python test
ayushmanchhabra Apr 14, 2024
deb8420
fix(py): windows does not support glob patterns;
ayushmanchhabra Apr 14, 2024
83ef2dc
fix(test): jsdoc?
ayushmanchhabra Apr 14, 2024
8104355
chore(ci): disable ubuntu runner
ayushmanchhabra Apr 14, 2024
cfc356f
chore: pipenv -> pip
ayushmanchhabra Apr 20, 2024
c389ce9
fix(ci): update py commands
ayushmanchhabra Apr 20, 2024
bb266f9
chore(test): skip puppeteer test
ayushmanchhabra Apr 20, 2024
a513467
chore(test): timeout
ayushmanchhabra Apr 20, 2024
98c4347
hope
ayushmanchhabra Apr 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,18 @@ on:
branches:
- main

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
test:
strategy:
matrix:
os: [macos-12, ubuntu-22.04, windows-2022]
os:
- macos-12
- ubuntu-22.04
- windows-2022
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -27,13 +34,13 @@ jobs:
- name: Setup Python
uses: actions/[email protected]
with:
python-version: "3.10.0"
python-version: '3.10'
cache: pip
- name: Install Node dependencies
run: npm ci
- name: Run Node tests
run: npm t
- name: Install Python dependencies
run: python3 -m pipenv install
- name: Install Pip dependencies
run: python3 -m pip install -r requirements.txt
- name: Run Python tests
run: python3 -m pytest ./py/selenium/builder/*.py
run: python3 -m pytest ./py/selenium/service_builder/test.py
14 changes: 0 additions & 14 deletions Pipfile

This file was deleted.

178 changes: 0 additions & 178 deletions Pipfile.lock

This file was deleted.

18 changes: 13 additions & 5 deletions js/puppeteer/puppeteer.test.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,48 @@
import path from 'node:path';
import process from 'node:process';

import { findpath } from 'nw';
import puppeteer from "puppeteer";
import puppeteer, { Browser } from "puppeteer";
import { afterAll, beforeAll, describe, expect, it } from 'vitest';

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

/**
* @type {Browser}
*/
let browser = undefined;
let page = undefined;

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

const nwPath = await findpath('nwjs', { flavor: 'sdk' });

/* Launch NW.js via Puppeteer */
browser = await puppeteer.launch({
headless: true,
ignoreDefaultArgs: true,
executablePath: findpath(),
executablePath: nwPath,
/* Specify file path to NW.js app */
args: [`--nwapp=${path.resolve('js', 'puppeteer')}`],
});

const entryPath = path.resolve('js', 'puppeteer', 'index.html')
page = await browser.newPage();

/* Browser needs to prepend file:// to open the file present on local file system. */
await page.goto(`file://${entryPath}`);
});

/* Get text via element's ID and assert it is equal. */
it('Hello, World! text by ID', async function () {

const textElement = await page.$('#test');

const text = await page.evaluate(el => el.textContent, textElement);

expect(text).toEqual('Hello, World!\n\n');
});
}, { timeout: Infinity });

/* Quit Puppeteer browser. */
afterAll(async function () {
Expand Down
5 changes: 3 additions & 2 deletions js/selenium/builder/builder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ describe('NW.js Selenium Builder test suite', async () => {

options.addArguments(seleniumArguments);

options.setChromeBinaryPath(findpath());
const nwPath = await findpath('nwjs', { flavor: 'sdk' });
options.setChromeBinaryPath(nwPath);

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

equal(text, 'Hello, World!');
});
}, { timeout: 30000 });

/**
* Quit Selenium driver.
Expand Down
3 changes: 2 additions & 1 deletion js/selenium/service_builder/service_builder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ describe('NW.js Selenium ServiceBuilder test suite', async () => {

options.addArguments(seleniumArguments);

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

/* Create a new session using the Chromium options and DriverService defined above. */
driver = chrome.Driver.createSession(options, service);
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"devDependencies": {
"base-volta-off-of-nwjs": "^1.0.5",
"nw": "^0.86.0-2",
"nw": "^0.86.0-3",
"puppeteer": "^22.6.4",
"selenium-webdriver": "^4.19.0",
"vitest": "^1.5.0"
Expand Down
Loading
Loading