Skip to content

Commit 737afb3

Browse files
authored
Merge pull request #773 from thomasnordquist/chore/replace-spectron-with-playwright
Chore/replace spectron with playwright
2 parents 5afccac + e21011f commit 737afb3

29 files changed

+412
-1256
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ services:
2525
- docker
2626

2727
install:
28-
- yarn install
28+
- yarn install --frozen-lockfile
2929
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update && sudo apt-get -y install snap squashfs-tools && sudo snap install snapcraft --classic; fi;
3030

3131
script:

app/src/components/Tree/TreeNode/TreeNodeTitle.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TreeNodeTitle extends React.PureComponent<TreeNodeProps, {}> {
1919
const name = this.props.name || (this.props.treeNode.sourceEdge && this.props.treeNode.sourceEdge.name)
2020

2121
return (
22-
<span key="edge" className={this.props.classes.sourceEdge}>
22+
<span key="edge" className={this.props.classes.sourceEdge} data-test-topic={name}>
2323
{name}
2424
</span>
2525
)

app/webpack.config.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
2-
const HtmlWebpackPlugin = require('html-webpack-plugin');
3-
const webpack = require('webpack');
2+
const HtmlWebpackPlugin = require('html-webpack-plugin')
3+
const webpack = require('webpack')
44

55
module.exports = {
66
entry: {
@@ -63,13 +63,8 @@ module.exports = {
6363
use: ['style-loader', 'css-loader'],
6464
},
6565
{
66-
test: /\.(png|jpg|gif)$/,
67-
use: [
68-
{
69-
loader: 'file-loader',
70-
options: {},
71-
},
72-
],
66+
test: /\.(png|jpg|gif)$/i,
67+
type: 'asset/resource',
7368
},
7469
// {
7570
// test: /\.node$/,
@@ -101,4 +96,4 @@ module.exports = {
10196
// "react": "React",
10297
// "react-dom": "ReactDOM"
10398
},
104-
};
99+
}

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ install:
1010
- ps: Install-Product node 19
1111

1212
build_script:
13-
- yarn
13+
- yarn install --frozen-lockfile
1414
- yarn build
1515
- yarn prepare-release
1616
- yarn package appx

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:11-stretch
1+
FROM node:19.8.1-bullseye-slim
22

33
RUN DEBIAN_FRONTEND="noninteractive" apt-get update \
44
&& apt-get install -y --no-install-recommends nano ffmpeg xvfb git-core tmux locales mosquitto x11vnc

docker/cloneBuildAndTest.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ git clone https://github.com/thomasnordquist/MQTT-Explorer.git /app
55
cd /app
66
git checkout travis-ui-tests
77

8-
yarn
8+
yarn install --frozen-lockfile
99
yarn build
1010

1111
yarn ui-test

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
"dev:app": "cd app && npm run dev",
1717
"dev:electron": "tsc && electron . --development",
1818
"lint": "npm-run-all --parallel lint:prettier lint:tslint",
19+
"lint:fix": "npm-run-all lint:tslint:fix lint:prettier:fix",
1920
"lint:prettier": "prettier --check \"**/*.ts{x,}\"",
2021
"lint:prettier:fix": "prettier --write \"**/*.ts{x,}\"",
2122
"lint:tslint": "tslint -p ./",
23+
"lint:tslint:fix": "tslint -p ./ --fix",
2224
"lint:spellcheck": "cspell -e ./build -e \"node_modules\" \"**/*.ts{x,}\"",
2325
"build": "tsc && cd app && yarn run build && cd ..",
2426
"prepare-release": "ts-node scripts/prepare-release.ts",
@@ -88,23 +90,22 @@
8890
"builder-util-runtime": "^9",
8991
"chai": "^4.2.0",
9092
"cspell": "^4.0.28",
91-
"electron": "29.1.1",
93+
"electron": "29.2.0",
9294
"electron-builder": "^24.13.3",
9395
"mocha": "^10.4.0",
9496
"mustache": "4",
9597
"npm-run-all": "^4.1.5",
9698
"nyc": "15",
99+
"playwright": "^1.43.0",
97100
"prettier": "^3.2.5",
98101
"redux-thunk": "^2.3.0",
99102
"source-map-support": "^0.5.9",
100-
"spectron": "19",
101103
"ts-node": "^10.9.2",
102104
"tslint": "^6.1.3",
103105
"tslint-config-airbnb": "^5.11.2",
104106
"tslint-react": "^5.0.0",
105107
"tslint-react-recommended": "^1.0.15",
106-
"typescript": "^4.5.5",
107-
"webdriverio": "7.16"
108+
"typescript": "^4.5.5"
108109
},
109110
"dependencies": {
110111
"about-window": "^1.12.1",

scripts/prepare-release.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ async function prepareRelease() {
1717

1818
// Install app dependencies
1919
chdir('app')
20-
await exec('yarn')
20+
await exec('yarn', ['install', '--frozen-lockfile'])
2121
chdir('..')
2222

2323
// Install electron dependencies
24-
await exec('yarn')
24+
await exec('yarn', ['install', '--frozen-lockfile'])
2525

2626
// Build App and Electron backend
2727
await exec('yarn', ['build'])
2828

2929
// Clean up
3030
await fs.remove('node_modules')
31-
await exec('yarn', ['install', '--production']) // Do not clean up, electron version detection will fail otherwise
31+
await exec('yarn', ['install', '--production', '--frozen-lockfile']) // Do not clean up, electron version detection will fail otherwise
3232
await fs.remove(path.join('app', 'node_modules'))
3333

3434
chdir(originalDir)

scripts/uiTests.sh

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
#!/bin/bash
2-
32
function finish {
4-
echo "Exiting, cleaning up"
5-
tmux send-keys -t record q || echo "No tmux was running"
6-
#echo kill $PID_XVFB $PID_CHROMEDRIVER $PID_MOSQUITTO
7-
#kill $PID_XVFB $PID_CHROMEDRIVER $PID_MOSQUITTO
3+
set +e
4+
echo "Exiting, cleaning up.."
5+
6+
echo "Stopping TMUX session (record).."
7+
tmux kill-session -t record || echo "Already stopped"
8+
9+
if [[ ! -z "$PID_MOSQUITTO" ]]; then
10+
echo "Stopping mosquitto ($PID_MOSQUITTO).."
11+
kill "$PID_MOSQUITTO" || echo "Already stopped"
12+
fi
13+
14+
if [[ ! -z "$PID_VNC" ]]; then
15+
echo "Stopping VNC ($PID_VNC).."
16+
kill "$PID_VNC" || echo "Already stopped"
17+
fi
18+
19+
if [[ ! -z "$PID_XVFB" ]]; then
20+
echo "Stopping XVFB ($PID_XVFB).."
21+
kill "$PID_XVFB" || echo "Already stopped"
22+
fi
823
}
924

1025
trap finish EXIT
@@ -18,28 +33,25 @@ export PID_XVFB=$!
1833
sleep 2
1934

2035
# Debug with VNC
21-
while [ "$TEST_EXIT_CODE" = "" ]; do x11vnc -localhost -passwd "bierbier" -display :$SCR; done &
36+
x11vnc -localhost -rfbport 5900 -passwd "bierbier" -display :$SCR &
2237
export PID_VNC=$!
2338

2439
# Start mqtt broker
2540
mosquitto &
2641
export PID_MOSQUITTO=$!
2742

28-
DISPLAY=:$SCR ./node_modules/.bin/chromedriver --url-base=wd/hub --port=9515 &
29-
export PID_CHROMEDRIVER=$!
30-
sleep 2
31-
3243
# Delete old video
33-
rm ./app.mp4 || echo no need to delete ./app.mp4
44+
rm -f ./app*.mp4
45+
rm -f ./qrawvideorgb24.yuv
3446

3547
# Start recoring in tmux
36-
#tmux new-session -d -s record ffmpeg -f x11grab -draw_mouse 0 -video_size $DIMENSIONS -i :$SCR -codec:v libx264 -r 20 ./app.mp4
48+
# tmux new-session -d -s record ffmpeg -f x11grab -draw_mouse 0 -video_size $DIMENSIONS -i :$SCR -codec:v libx264 -r 20 ./app.mp4
3749
tmux new-session -d -s record ffmpeg -f x11grab -draw_mouse 0 -video_size $DIMENSIONS -i :$SCR -r 20 -vcodec rawvideo -pix_fmt yuv420p qrawvideorgb24.yuv
3850

3951
# Start tests
40-
node dist/src/spec/demoVideo.js
52+
DISPLAY=:$SCR node dist/src/spec/demoVideo.js
4153
TEST_EXIT_CODE=$?
42-
echo "Webriver exitet with $TEST_EXIT_CODE"
54+
echo "Test script exited with $TEST_EXIT_CODE"
4355

4456
# Stop recording
4557
tmux send-keys -t record q

0 commit comments

Comments
 (0)