-
-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Tech] Simplify our E2E tests (#3213)
- Loading branch information
Showing
18 changed files
with
156 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
sign/** | ||
flatpak-build/** | ||
playwright-report/** |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,5 @@ vite-plugin-electron.log | |
#flatpak | ||
flatpak-build | ||
.env | ||
|
||
playwright-report |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ flatpak-build | |
sign/ | ||
.github/workflows/build-base.yml | ||
signatures/version1/cla.json | ||
playwright-report |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { expect, test } from '@playwright/test' | ||
import { compareVersions } from 'compare-versions' | ||
import { electronTest } from './helpers' | ||
|
||
declare const window: { api: typeof import('../src/backend/api').default } | ||
|
||
electronTest('renders the first page', async (app) => { | ||
const page = await app.firstWindow() | ||
await expect(page).toHaveTitle('Heroic Games Launcher') | ||
}) | ||
|
||
electronTest('gets heroic, legendary, and gog versions', async (app) => { | ||
const page = await app.firstWindow() | ||
|
||
await test.step('get heroic version', async () => { | ||
const heroicVersion = await page.evaluate(async () => | ||
window.api.getHeroicVersion() | ||
) | ||
console.log('Heroic Version: ', heroicVersion) | ||
// check that heroic version is newer or equal to 2.6.3 | ||
expect(compareVersions(heroicVersion, '2.6.3')).toBeGreaterThanOrEqual(0) | ||
}) | ||
|
||
await test.step('get legendary version', async () => { | ||
let legendaryVersion = await page.evaluate(async () => | ||
window.api.getLegendaryVersion() | ||
) | ||
legendaryVersion = legendaryVersion.trim().split(' ')[0] | ||
console.log('Legendary Version: ', legendaryVersion) | ||
expect(compareVersions(legendaryVersion, '0.20.32')).toBeGreaterThanOrEqual( | ||
0 | ||
) | ||
}) | ||
|
||
await test.step('get gogdl version', async () => { | ||
const gogdlVersion = await page.evaluate(async () => | ||
window.api.getGogdlVersion() | ||
) | ||
console.log('Gogdl Version: ', gogdlVersion) | ||
expect(compareVersions(gogdlVersion, '0.7.1')).toBeGreaterThanOrEqual(0) | ||
}) | ||
}) | ||
|
||
electronTest('test ipcMainInvokeHandler', async (app) => { | ||
const page = await app.firstWindow() | ||
const platform = await page.evaluate(async () => window.api.getPlatform()) | ||
console.log('Platform: ', platform) | ||
expect(platform).toEqual(process.platform) | ||
}) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { join } from 'path' | ||
import { | ||
test, | ||
_electron as electron, | ||
type ElectronApplication | ||
} from '@playwright/test' | ||
|
||
const main_js = join(__dirname, '../build/electron/main.js') | ||
|
||
/** | ||
* Helper function to define a test requiring Heroic to be running | ||
* @param name The name of the test | ||
* @param func The test callback | ||
*/ | ||
function electronTest( | ||
name: string, | ||
func: (app: ElectronApplication) => void | Promise<void> | ||
) { | ||
test(name, async () => { | ||
const app = await electron.launch({ | ||
args: [main_js] | ||
}) | ||
await func(app) | ||
await app.close() | ||
}) | ||
} | ||
|
||
export { electronTest } |
Oops, something went wrong.