Skip to content

Commit

Permalink
Migrate to use chrome for testing
Browse files Browse the repository at this point in the history
Apply security fixes

Use official repos for downloading

Migrate to use typescript

Store download urls in package json

Use new download url's for browser

Re-organize packages

Use chrome for testing

Update files to refer to the re-organized browser files.
Update chrome remote interface

Remove old taiko version info

Move platform resolution to metadata

Append 64 to linux

Fix downloadURL usage

Initialize metadata globally

Use the right platform

Add platform append

Initialize browser metadata outside constructor

Fix typescript versions issues for test

Use latest version of mocha

Uncomment the close browser test

Temporary commit to check behavior

Add prettier fomatting rules for windows

Add a mocha exit option

Upgrade docs test package

Commit the functional tests package-lock json file

Do clean install to remove local node modules

Deprecate beforeunload

Signed-off-by: Zabil Cheriya Maliackal <[email protected]>
  • Loading branch information
zabil committed May 20, 2024
1 parent 532c62c commit e0ff756
Show file tree
Hide file tree
Showing 37 changed files with 3,969 additions and 1,754 deletions.
7 changes: 5 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
],
"rules": {
"prettier/prettier": [
"error"
"error",
{
"endOfLine": "auto"
}
],
"no-control-regex": 0,
"no-instanceof/no-instanceof": [
Expand Down Expand Up @@ -61,4 +64,4 @@
"curly": 2,
"require-atomic-updates": 0
}
}
}
18 changes: 9 additions & 9 deletions .github/workflows/taiko.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node_version: ['16']
node_version: ['20']
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node_version: ['16']
node_version: ['20']
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -97,10 +97,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use NodeJS 16
- name: Use NodeJS 20
uses: actions/setup-node@v1
with:
node-version: 16
node-version: 20
- name: install browser dependencies
run: |
sudo apt-get update
Expand All @@ -115,7 +115,7 @@ jobs:
libgtk-3-0 \
libdrm-dev \
libgbm-dev \
libasound-dev
libasound-dev
- name: install xvfb
run: sudo apt install xvfb
- name: functional-tests-headful
Expand All @@ -128,7 +128,7 @@ jobs:
if: failure()
with:
name: ft-reports-linux-headful
path: test/functional-tests/reports/html-report
path: test/functional-tests/reports/html-report
- name: Upload logs
uses: actions/upload-artifact@v1
if: failure()
Expand All @@ -145,10 +145,10 @@ jobs:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- name: Use NodeJS 16
- name: Use NodeJS 20
uses: actions/setup-node@v1
with:
node-version: '16'
node-version: '20'
- name: install
run: npm install
- name: install browser dependencies
Expand All @@ -174,7 +174,7 @@ jobs:
if: failure()
with:
name: docs-tests-reports-${{ matrix.os }}
path: test/docs-tests/gauge/reports/html-report
path: test/docs-tests/gauge/reports/html-report
- name: Upload logs
uses: actions/upload-artifact@v1
if: failure()
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/update_chromium.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ name: update-chromium
on:
schedule:
# cron job that will run 1st and 15th of every month by 12am
- cron: '0 12 1,15 * *'
- cron: '0 12 1,15 * *'

jobs:
update-to-latest-chromium:

runs-on: ubuntu-latest

steps:
Expand All @@ -16,7 +15,7 @@ jobs:
- name: Use NodeJS 16
uses: actions/setup-node@v1
with:
node-version: '16'
node-version: '20'

- name: Setup
run: |
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ docs/layout/partials/content.html
#test report
test/functional-tests/reports/
test/functional-tests/.gauge/
test/functional-tests/package-lock.json
test/unit-tests/data/*.html

examples/package-lock.json
Expand Down
19 changes: 9 additions & 10 deletions docs/configuring_taiko.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ for specific uses cases

Taiko lets you specify certain Environment variables to customize its behaviour

* `TAIKO_ENABLE_ACTION_OUTPUT` - set to `true` to print output of each action. It's set to `true` by default with Taiko runner and in REPL mode.
* `TAIKO_SKIP_CHROMIUM_DOWNLOAD` - set to `true` to skip downloading chromium
* `TAIKO_HIGHLIGHT_ON_ACTION` - set to `false` to turn off highlighting the element on action
* `TAIKO_CHROMIUM_URL` - set to host url of mirror to download chromium
* `TAIKO_BROWSER_PATH` - set to launch browser from different location
* `TAIKO_BROWSER_ARGS` - set ',' separated browser command line switches to launch browser with extra args
* `TAIKO_EMULATE_DEVICE` - set to device model to emulate device view port
* `TAIKO_EMULATE_NETWORK` - set to the network type for Taiko to simulate. Available options are GPRS, Regular2G, Good2G, Regular3G, Good3G, Regular4G, DSL, WiFi, Offline
* `TAIKO_PLUGIN` - set to the plugin which you want Taiko to load. Takes comma separated values.
* `TAIKO_SKIP_DOCUMENTATION` - set to skip API documentation generation during install.
- `TAIKO_ENABLE_ACTION_OUTPUT` - set to `true` to print output of each action. It's set to `true` by default with Taiko runner and in REPL mode.
- `TAIKO_SKIP_CHROMIUM_DOWNLOAD` - set to `true` to skip downloading chromium
- `TAIKO_HIGHLIGHT_ON_ACTION` - set to `false` to turn off highlighting the element on action
- `TAIKO_BROWSER_PATH` - set to launch browser from different location
- `TAIKO_BROWSER_ARGS` - set ',' separated browser command line switches to launch browser with extra args
- `TAIKO_EMULATE_DEVICE` - set to device model to emulate device view port
- `TAIKO_EMULATE_NETWORK` - set to the network type for Taiko to simulate. Available options are GPRS, Regular2G, Good2G, Regular3G, Good3G, Regular4G, DSL, WiFi, Offline
- `TAIKO_PLUGIN` - set to the plugin which you want Taiko to load. Takes comma separated values.
- `TAIKO_SKIP_DOCUMENTATION` - set to skip API documentation generation during install.
2 changes: 1 addition & 1 deletion examples/01-file_upload.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { goto, fileField, button, above, attach, click, text } = require('taiko'),
path = require('path'),
{ openBrowserAndStartScreencast, closeBrowserAndStopScreencast } = require('./browserLauncher'),
{ openBrowserAndStartScreencast, closeBrowserAndStopScreencast } = require('./browser/launcher'),
expect = require('chai').expect;

(async () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/02-file_download.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { goto, client, click } = require('taiko'),
path = require('path'),
fs = require('fs'),
{ openBrowserAndStartScreencast, closeBrowserAndStopScreencast } = require('./browserLauncher'),
{ openBrowserAndStartScreencast, closeBrowserAndStopScreencast } = require('./browser/launcher'),
expect = require('chai').expect;

(async () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/03-work-with-frames.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { goto, text } = require('taiko'),
path = require('path'),
{ openBrowserAndStartScreencast, closeBrowserAndStopScreencast } = require('./browserLauncher'),
{ openBrowserAndStartScreencast, closeBrowserAndStopScreencast } = require('./browser/launcher'),
expect = require('chai').expect;

(async () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/04-windows-tabs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { goto, click, title, closeTab, currentURL, text } = require('taiko'),
path = require('path'),
{ openBrowserAndStartScreencast, closeBrowserAndStopScreencast } = require('./browserLauncher'),
{ openBrowserAndStartScreencast, closeBrowserAndStopScreencast } = require('./browser/launcher'),
expect = require('chai').expect;

(async () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/05-dropdown.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { goto, dropDown } = require('taiko'),
path = require('path'),
{ openBrowserAndStartScreencast, closeBrowserAndStopScreencast } = require('./browserLauncher'),
{ openBrowserAndStartScreencast, closeBrowserAndStopScreencast } = require('./browser/launcher'),
expect = require('chai').expect;

(async () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/06-basic-auth.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { goto, text } = require('taiko'),
path = require('path'),
{ openBrowserAndStartScreencast, closeBrowserAndStopScreencast } = require('./browserLauncher'),
{ openBrowserAndStartScreencast, closeBrowserAndStopScreencast } = require('./browser/launcher'),
expect = require('chai').expect;

(async () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/07-dynamic-loading.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { goto, click, text } = require('taiko'),
path = require('path'),
{ openBrowserAndStartScreencast, closeBrowserAndStopScreencast } = require('./browserLauncher'),
{ openBrowserAndStartScreencast, closeBrowserAndStopScreencast } = require('./browser/launcher'),
expect = require('chai').expect;

(async () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/08-contenteditable.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { goto, below, textBox, write, into } = require('taiko'),
{ openBrowserAndStartScreencast, closeBrowserAndStopScreencast } = require('./browserLauncher'),
{ openBrowserAndStartScreencast, closeBrowserAndStopScreencast } = require('./browser/launcher'),
path = require('path'),
expect = require('chai').expect;
const cwd = process.cwd();
Expand Down
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ This folder contains samples inspired by some of selenium tips published by [ele

`npm test` runs the examples under a headless chromium.

> **Note:** The examples use `openBrowserAndStartScreencast` and `closeBrowserAndStopScreencast` from [`browserLauncher`](browserLauncher.js) instead of `openBrowser` and `closeBrowser` directly. This is to capture screen recordings. The `browserLauncher` methods can be substituted with `openBrowser` and `closeBrowser` if there is no need for screencast capture.
> **Note:** The examples use `openBrowserAndStartScreencast` and `closeBrowserAndStopScreencast` from [`browserLauncher`](browser/launcher.js) instead of `openBrowser` and `closeBrowser` directly. This is to capture screen recordings. The `browserLauncher` methods can be substituted with `openBrowser` and `closeBrowser` if there is no need for screencast capture.
### Run Options

Expand Down
2 changes: 1 addition & 1 deletion examples/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var server = app.listen(3000, async () => {
var examples = glob
.sync('*.js')
.filter(
(f) => __filename !== path.resolve(f) && 'browserLauncher.js' !== f && f.startsWith(prefix),
(f) => __filename !== path.resolve(f) && 'browser/launcher.js' !== f && f.startsWith(prefix),
)
.map((f) => {
return { file: f, task: () => run(f) };
Expand Down
Loading

0 comments on commit e0ff756

Please sign in to comment.