From 8a8fd38f849c2f9e5d73d7b568149a5d6ada7621 Mon Sep 17 00:00:00 2001 From: Sean Poulter Date: Tue, 5 Mar 2024 08:53:21 -0500 Subject: [PATCH] ci: Add GitHub Workflow --- .github/workflows/ci.yml | 34 ++++++++++++++++++++++++++++++++++ .nvmrc | 1 + .travis.yml | 24 ------------------------ README.md | 6 +++--- package.json | 2 +- protractor.conf.js | 2 +- 6 files changed, 40 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .nvmrc delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b30cf36 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +--- +name: CI + +on: + push: + branches: + - main + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: ['14', '16'] + steps: + - uses: actions/checkout@v4 + - name: Use Node.js v${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - name: Install dependencies + run: | + npm ci + - name: Build + run: npm run build --if-present + - name: Run Tests + run: | + npm run test:ci + npm run e2e:protractor + env: + CHROMEDRIVER_FILEPATH: /usr/local/share/chromedriver-linux64/chromedriver + + timeout-minutes: 10 diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..4a9c19c --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v14.21.3 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3ae907b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -language: node_js -dist: xenial -os: linux -node_js: - - "12" -services: - - xvfb -sudo: required -addons: - chrome: stable - firefox : latest -cache: - directories: - - node_modules -install: - - npm install - - npm i chromedriver@latest --no-save -script: - - mkdir -p dist - - npm run test:ci - - npm run e2e:protractor -after_success: - - npm install -g codecov - - codecov diff --git a/README.md b/README.md index e14e5ff..0eda0a3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/Georgegriff/query-selector-shadow-dom.svg?branch=main)](https://travis-ci.org/Georgegriff/query-selector-shadow-dom) [![npm version](https://badge.fury.io/js/query-selector-shadow-dom.svg)](https://badge.fury.io/js/query-selector-shadow-dom) [![codecov](https://codecov.io/gh/Georgegriff/query-selector-shadow-dom/branch/main/graph/badge.svg)](https://codecov.io/gh/Georgegriff/query-selector-shadow-dom) +[![Build Status](https://travis-ci.org/Georgegriff/query-selector-shadow-dom.svg?branch=main)](https://travis-ci.org/Georgegriff/query-selector-shadow-dom) [![npm version](https://badge.fury.io/js/query-selector-shadow-dom.svg)](https://badge.fury.io/js/query-selector-shadow-dom) # query-selector-shadow-dom @@ -227,7 +227,7 @@ querySelectorShadowDom.querySelectorAllDeep("child", iframe.contentDocument); ``` This library does not allow you to query across iframe boundaries, you will need to get a reference to the iframe you want to interact with.
-If your iframe is inside of a shadow root you could cuse `querySelectorDeep` to find the iframe, then pass the `contentDocument` into the 2nd argument of `querySelectorDeep` or `querySelectorAllDeep`. +If your iframe is inside of a shadow root you could use `querySelectorDeep` to find the iframe, then pass the `contentDocument` into the 2nd argument of `querySelectorDeep` or `querySelectorAllDeep`. ### Chrome downloads page @@ -258,7 +258,7 @@ If using the polyfills and shady DOM, this library will still work. ## Importing - Shipped as an ES6 module to be included using a bundler of your choice (or not). -- ES5 version bundled ontop the window as `window.querySelectorShadowDom` available for easy include into a test framework +- ES5 version bundled on top the window as `window.querySelectorShadowDom` available for easy include into a test framework ## Running the code locally diff --git a/package.json b/package.json index 4e76564..b373837 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "lint": "eslint src/**/*.js", "build": "rollup -c", "test": "karma start", - "test:ci": "karma start --browsers ChromeHeadless,Firefox", + "test:ci": "karma start --browsers ChromeHeadless,FirefoxHeadless", "e2e:protractor": "protractor protractor.conf.js", "watch": "npm-watch", "selenium": "./node_modules/.bin/selenium-standalone install && ./node_modules/.bin/selenium-standalone start" diff --git a/protractor.conf.js b/protractor.conf.js index ee506af..78eba3e 100644 --- a/protractor.conf.js +++ b/protractor.conf.js @@ -1,7 +1,7 @@ exports.config = { baseUrl: 'http://localhost:3000', - chromeDriver: require(`chromedriver/lib/chromedriver`).path, + chromeDriver: process.env.CHROMEDRIVER_FILEPATH || require(`chromedriver/lib/chromedriver`).path, SELENIUM_PROMISE_MANAGER: false, directConnect: true,