Skip to content

Commit da45289

Browse files
BrettClearyNocccerflavioislima
authored
[Release] 0.2.3 (#341)
* Add e2e testing (#330) * [Tests] Add automated e2e testing (#2586) * add playwright, window.api tests, and ipcMainInvoke tests * add support for testing unpackaged builds * add legendary and gog version tests * dockerize tests, add github workflows * change docker env variable to string * update readme * change github action step name * Clean up docker enviroment for e2e * Remove unessecary branch in workflow * Automatically set user permissions for e2e * Fix e2e workflows * Fix e2e workflows (2) * Update github workflows * Set permission to root * Debug * Fix permissions * Set Permissions (2) * Remove dependency cross-env * Remove root permission for packaged e2e * Use playwright directly without container for ci * Fix typo * Run e2e on windows and mac aswell * Fix entrypoint.sh build step * Adapt workflows * fix: try to fix tests * fix: tests another try * fix yarn test e2e * fix yarn test e2e packaged * fix ci windows * scalable e2e tests --------- Co-authored-by: Nocccer <Nocccer@gmail.com> Co-authored-by: Flavio F Lima <flavioislima@gmail.com> * run on develop pr * replace heroic, fix module resolution * update eslintrc * update broken ui package version * update workflows * revert to develop version of ui * update tests, run e2e on push * update test timeout * test longer timeout * error handling for get page test * get hp page in common setup * increase timeout, improve logging, handle wait for window error * check for pages that are already loaded * fix readme --------- Co-authored-by: Nocccer <Nocccer@gmail.com> Co-authored-by: Flavio F Lima <flavioislima@gmail.com> * merge main 0.2.2 (#335) * [Fix] Installation of HP games, statuses, filters, stuck download and more (#328) * fix: unzip, disk write and throttle progress * fix: progress on download screen * chore: mac notarize var env * feat: implement getExtraInfo for HP * fix: hide non-working items from submenu * feat: improve initial download and logging * chore: remove unused warning * feat: show extracting message on gamepage * fix: default platform on install dialog * fix: logging and button label * fix: OS filters for HP games * fix: downloaded bytes * fix: platform name and install size on gamepage * chore: log and mac build * add unit tests, fix extractZip * prettier --------- Co-authored-by: BrettCleary <27568879+BrettCleary@users.noreply.github.com> * Support HyperPlay Store Games Hosted on Epic (#322) * add nav to epic handler * check url * merge hp game info if epic hosted * prettier * point to main proxy server * rm unnecessary await * point to main (#332) * [Fix] Hotfix (#333) * allow parallel downloads for chunking * fix zoom range wrapper css * ui: add 'preparing' status * feat: base n of connections based on CDN cache --------- Co-authored-by: Flavio F Lima <flavioislima@gmail.com> * bump to 0.2.2 (#334) --------- Co-authored-by: Flávio Fearn <flavioislima@gmail.com> * encode download url (#337) * [FIX] Unzip native macOS files (#338) * [Fix] Installation of HP games, statuses, filters, stuck download and more (#328) * fix: unzip, disk write and throttle progress * fix: progress on download screen * chore: mac notarize var env * feat: implement getExtraInfo for HP * fix: hide non-working items from submenu * feat: improve initial download and logging * chore: remove unused warning * feat: show extracting message on gamepage * fix: default platform on install dialog * fix: logging and button label * fix: OS filters for HP games * fix: downloaded bytes * fix: platform name and install size on gamepage * chore: log and mac build * add unit tests, fix extractZip * prettier --------- Co-authored-by: BrettCleary <27568879+BrettCleary@users.noreply.github.com> * Support HyperPlay Store Games Hosted on Epic (#322) * add nav to epic handler * check url * merge hp game info if epic hosted * prettier * point to main proxy server * rm unnecessary await * point to main (#332) * [Fix] Hotfix (#333) * allow parallel downloads for chunking * fix zoom range wrapper css * ui: add 'preparing' status * feat: base n of connections based on CDN cache --------- Co-authored-by: Flavio F Lima <flavioislima@gmail.com> * bump to 0.2.2 (#334) * [FIX] Unzip native macOS files * chore: bump version and add some logs * tests: add extract zip tests * tests: reorganize * ui: fix search bar autocomplete background * prettier-fix --------- Co-authored-by: BrettCleary <27568879+BrettCleary@users.noreply.github.com> * rm unzipper types, unused vars --------- Co-authored-by: Nocccer <Nocccer@gmail.com> Co-authored-by: Flavio F Lima <flavioislima@gmail.com>
1 parent e392ae9 commit da45289

19 files changed

+610
-141
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
npm-debug.log

.eslintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"ecmaVersion": 12,
2020
"sourceType": "module",
21-
"project": ["./tsconfig.json"]
21+
"project": ["./tsconfig.eslint.json"]
2222
},
2323
"plugins": ["react", "@typescript-eslint", "import"],
2424
"settings": {

.github/workflows/test-e2e-dev.yml

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Test E2E Dev
2+
3+
on:
4+
pull_request:
5+
branches: [main, develop]
6+
push:
7+
branches: [main, develop]
8+
workflow_dispatch:
9+
10+
env:
11+
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
12+
GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
13+
RUDDERSTACK_CLIENT_ID: ${{ secrets.RUDDERSTACK_CLIENT_ID }}
14+
15+
jobs:
16+
linux:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout repository.
20+
uses: actions/checkout@v3
21+
with:
22+
submodules: 'recursive'
23+
token: ${{ secrets.pat }}
24+
- name: Setup NodeJS
25+
uses: actions/setup-node@v2
26+
with:
27+
node-version: '18'
28+
- name: Reconfigure git to use HTTP authentication
29+
run: >
30+
git config --global url."https://github.com/".insteadOf
31+
ssh://git@github.com/
32+
- name: Authenticate with private NPM package
33+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
34+
- name: Install modules.
35+
run: yarn
36+
env:
37+
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
38+
- name: Build and Test
39+
run: yarn test:e2e-ci
40+
41+
mac:
42+
runs-on: macos-latest
43+
steps:
44+
- name: Checkout repository.
45+
uses: actions/checkout@v3
46+
with:
47+
submodules: 'recursive'
48+
token: ${{ secrets.pat }}
49+
- name: Setup NodeJS
50+
uses: actions/setup-node@v2
51+
with:
52+
node-version: '18'
53+
- name: Reconfigure git to use HTTP authentication
54+
run: >
55+
git config --global url."https://github.com/".insteadOf
56+
ssh://git@github.com/
57+
- name: Authenticate with private NPM package
58+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
59+
- name: Install modules.
60+
run: yarn
61+
env:
62+
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
63+
- name: Build and Test
64+
run: yarn test:e2e-ci
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
67+
GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
68+
CSC_IDENTITY_AUTO_DISCOVERY: false
69+
70+
windows:
71+
runs-on: windows-latest
72+
steps:
73+
- name: Checkout repository.
74+
uses: actions/checkout@v3
75+
with:
76+
submodules: 'recursive'
77+
token: ${{ secrets.pat }}
78+
- name: Setup NodeJS
79+
uses: actions/setup-node@v2
80+
with:
81+
node-version: '18'
82+
- name: Reconfigure git to use HTTP authentication
83+
run: >
84+
git config --global url."https://github.com/".insteadOf
85+
ssh://git@github.com/
86+
- name: Authenticate with private NPM package
87+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
88+
- name: Install modules.
89+
run: npm i --legacy-peer-deps
90+
env:
91+
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
92+
- name: Build and Test
93+
run: yarn test:e2e-ci
94+
env:
95+
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
96+
GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Test E2E Packaged
2+
3+
on:
4+
pull_request:
5+
branches: [main, develop]
6+
push:
7+
branches: [main, develop]
8+
workflow_dispatch:
9+
10+
env:
11+
TEST_PACKAGED: true
12+
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
13+
GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
14+
RUDDERSTACK_CLIENT_ID: ${{ secrets.RUDDERSTACK_CLIENT_ID }}
15+
16+
jobs:
17+
linux:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout repository.
21+
uses: actions/checkout@v3
22+
with:
23+
submodules: 'recursive'
24+
token: ${{ secrets.pat }}
25+
- name: Setup NodeJS
26+
uses: actions/setup-node@v2
27+
with:
28+
node-version: '18'
29+
- name: Reconfigure git to use HTTP authentication
30+
run: >
31+
git config --global url."https://github.com/".insteadOf
32+
ssh://git@github.com/
33+
- name: Authenticate with private NPM package
34+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
35+
- name: Install modules.
36+
run: yarn
37+
env:
38+
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
39+
- name: Build and Test
40+
run: yarn test:e2ePackaged-ci
41+
42+
mac:
43+
runs-on: macos-latest
44+
steps:
45+
- name: Checkout repository.
46+
uses: actions/checkout@v3
47+
with:
48+
submodules: 'recursive'
49+
token: ${{ secrets.pat }}
50+
- name: Setup NodeJS
51+
uses: actions/setup-node@v2
52+
with:
53+
node-version: '18'
54+
- name: Reconfigure git to use HTTP authentication
55+
run: >
56+
git config --global url."https://github.com/".insteadOf
57+
ssh://git@github.com/
58+
- name: Authenticate with private NPM package
59+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
60+
- name: Install modules.
61+
run: yarn
62+
env:
63+
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
64+
- name: Build and Test
65+
run: yarn test:e2ePackaged-ci
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
68+
GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
69+
CSC_IDENTITY_AUTO_DISCOVERY: false
70+
71+
windows:
72+
runs-on: windows-latest
73+
steps:
74+
- name: Checkout repository.
75+
uses: actions/checkout@v3
76+
with:
77+
submodules: 'recursive'
78+
token: ${{ secrets.pat }}
79+
- name: Setup NodeJS
80+
uses: actions/setup-node@v2
81+
with:
82+
node-version: '18'
83+
- name: Reconfigure git to use HTTP authentication
84+
run: >
85+
git config --global url."https://github.com/".insteadOf
86+
ssh://git@github.com/
87+
- name: Authenticate with private NPM package
88+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
89+
- name: Install modules.
90+
run: npm i --legacy-peer-deps
91+
env:
92+
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
93+
- name: Build and Test
94+
run: yarn test:e2ePackaged-ci
95+
env:
96+
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
97+
GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}

README.md

+19
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ HyperPlay is built with Web3 and Web2 Technologies like: TypeScript, React, Node
1616
- [Other Distributions (TAR.XZ)](#other-distributions-tarxz)
1717
- [Windows](#windows)
1818
- [macOS](#macos)
19+
- [Testing with Docker](#testing-with-docker)
1920
- [Credits](#credits)
2021

2122
## Supported Operating Systems
@@ -71,6 +72,24 @@ Download HyperPlay-x.x.x.dmg and move the HyperPlay App to the Applications fold
7172
<img width="1417" alt="image" src="https://user-images.githubusercontent.com/26871415/221288900-aa7c3168-d610-4598-8011-7f6c4dc4148f.png">
7273
<img width="1427" alt="image" src="https://user-images.githubusercontent.com/26871415/221288973-eb897dec-34fe-4edf-8c3d-32836ca59a04.png">
7374

75+
### Testing with Docker
76+
77+
It is recommended to run end to end tests with Docker so you don't alter your local config files or have your local config files interfere with the tests.
78+
79+
To run e2e tests on the unpackaged app running in dev mode.
80+
From the root of your local Heroic directory, run:
81+
82+
```bash
83+
yarn test:e2e
84+
```
85+
86+
To run e2e tests on the packaged app.
87+
From the root of your local Heroic directory, run:
88+
89+
```bash
90+
yarn test:e2ePackaged
91+
```
92+
7493
## Credits
7594

7695
### Those Awesome Guys: Gamepad prompts images

e2e/Dockerfile.test

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM node:18 AS node
2+
3+
FROM node AS headless
4+
5+
RUN apt-get update && \
6+
apt-get install -y xvfb \
7+
libgbm1 \
8+
libxss1 \
9+
libnss3 \
10+
libgtk-3-dev \
11+
libasound2-dev \
12+
unzip \
13+
dos2unix \
14+
&& rm -rf /var/lib/apt/lists/*
15+
16+
FROM headless AS final
17+
18+
EXPOSE 9515
19+
ENV ELECTRON_ENABLE_STACK_DUMPING=true
20+
ENV ELECTRON_ENABLE_LOGGING=true
21+
22+
# Create app directory
23+
WORKDIR /app
24+
25+
# Install app dependencies
26+
COPY package.json ./
27+
28+
# Bundle app source
29+
COPY . .

e2e/__specs__/api.spec.ts

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { DiskSpaceData } from '../../src/common/types'
2+
import { expect, test } from '@playwright/test'
3+
import { ipcMainInvokeHandler } from 'electron-playwright-helpers'
4+
import { Page } from 'playwright'
5+
import { compareVersions } from 'compare-versions'
6+
import { platform as platformOS } from 'os'
7+
import commonSetup, { electronApp, hpPage } from './common-setup'
8+
9+
test.describe('api e2e test', function () {
10+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
11+
// @ts-ignore: this is the correct usage
12+
commonSetup.call(this)
13+
14+
let page: Page
15+
test('renders the first page', async () => {
16+
test.setTimeout(600000)
17+
page = await hpPage
18+
19+
const title = await page.title()
20+
expect(title).toBe('HyperPlay')
21+
})
22+
23+
test('gets app, legendary, and gog versions', async () => {
24+
test.setTimeout(600000)
25+
const appVersion = await page.evaluate(async () => {
26+
return window.api.getAppVersion()
27+
})
28+
console.log('HyperPlay Version: ', appVersion)
29+
// check that hyperplay version is newer or equal to 0.2.0
30+
expect(compareVersions(appVersion, '0.2.0')).toBeGreaterThanOrEqual(0)
31+
32+
let legendaryVersion = await page.evaluate(async () => {
33+
return window.api.getLegendaryVersion()
34+
})
35+
legendaryVersion = legendaryVersion.trim().split(' ')[0]
36+
console.log('Legendary Version: ', legendaryVersion)
37+
expect(compareVersions(legendaryVersion, '0.20.32')).toBeGreaterThanOrEqual(
38+
0
39+
)
40+
41+
const gogdlVersion = await page.evaluate(async () => {
42+
return window.api.getGogdlVersion()
43+
})
44+
console.log('Gogdl Version: ', gogdlVersion)
45+
expect(compareVersions(gogdlVersion, '0.6')).toBeGreaterThanOrEqual(0)
46+
})
47+
48+
test('test ipcMainInvokeHandler', async () => {
49+
test.setTimeout(600000)
50+
const platform: DiskSpaceData = (await ipcMainInvokeHandler(
51+
electronApp,
52+
'getPlatform'
53+
)) as DiskSpaceData
54+
console.log('Platform: ', platform)
55+
expect(platform).toEqual(platformOS())
56+
})
57+
})

0 commit comments

Comments
 (0)