Bring back tauri e2e tests (#2062)
* Bring back tauri e2e tests Fixes #2061 once green * Fix if * Add bail mocha opt and more cleanup, disable second dir test * Add mocha types and tsconfig * Add 10sec delay for auth (worked in 22.04 local docker) * Add back close settings click * Disable open file * Re-enable settings test * Handle error page * Back to brower.execute location.href * Add --force to tauri-driver install (I think because of cache) --------- Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com>
This commit is contained in:
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
@ -349,11 +349,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: "${{ env.PREFIX }}/${{ env.MODE }}/bundle/*/*"
|
path: "${{ env.PREFIX }}/${{ env.MODE }}/bundle/*/*"
|
||||||
|
|
||||||
# TODO: re-enable linux e2e tests when possible
|
|
||||||
- name: Run e2e tests (linux only)
|
- name: Run e2e tests (linux only)
|
||||||
if: false
|
if: matrix.os == 'ubuntu-latest'
|
||||||
run: |
|
run: |
|
||||||
cargo install tauri-driver
|
cargo install tauri-driver --force
|
||||||
source .env.${{ env.BUILD_RELEASE == 'true' && 'production' || 'development' }}
|
source .env.${{ env.BUILD_RELEASE == 'true' && 'production' || 'development' }}
|
||||||
export VITE_KC_API_BASE_URL
|
export VITE_KC_API_BASE_URL
|
||||||
xvfb-run yarn test:e2e:tauri
|
xvfb-run yarn test:e2e:tauri
|
||||||
|
@ -2,7 +2,7 @@ import { browser, $, expect } from '@wdio/globals'
|
|||||||
import fs from 'fs/promises'
|
import fs from 'fs/promises'
|
||||||
|
|
||||||
const documentsDir = `${process.env.HOME}/Documents`
|
const documentsDir = `${process.env.HOME}/Documents`
|
||||||
const userSettingsFile = `${process.env.HOME}/.config/dev.zoo.modeling-app/user.toml`
|
const userSettingsDir = `${process.env.HOME}/.config/dev.zoo.modeling-app`
|
||||||
const defaultProjectDir = `${documentsDir}/zoo-modeling-app-projects`
|
const defaultProjectDir = `${documentsDir}/zoo-modeling-app-projects`
|
||||||
const newProjectDir = `${documentsDir}/a-different-directory`
|
const newProjectDir = `${documentsDir}/a-different-directory`
|
||||||
const userCodeDir = '/tmp/kittycad_user_code'
|
const userCodeDir = '/tmp/kittycad_user_code'
|
||||||
@ -29,8 +29,10 @@ describe('ZMA (Tauri, Linux)', () => {
|
|||||||
// Clean up filesystem from previous tests
|
// Clean up filesystem from previous tests
|
||||||
await new Promise((resolve) => setTimeout(resolve, 100))
|
await new Promise((resolve) => setTimeout(resolve, 100))
|
||||||
await fs.rm(defaultProjectDir, { force: true, recursive: true })
|
await fs.rm(defaultProjectDir, { force: true, recursive: true })
|
||||||
|
await fs.rm(newProjectDir, { force: true, recursive: true })
|
||||||
await fs.rm(userCodeDir, { force: true })
|
await fs.rm(userCodeDir, { force: true })
|
||||||
await fs.rm(userSettingsFile, { force: true })
|
await fs.rm(userSettingsDir, { force: true, recursive: true })
|
||||||
|
await fs.mkdir(defaultProjectDir, { recursive: true })
|
||||||
await fs.mkdir(newProjectDir, { recursive: true })
|
await fs.mkdir(newProjectDir, { recursive: true })
|
||||||
|
|
||||||
const signInButton = await $('[data-testid="sign-in-button"]')
|
const signInButton = await $('[data-testid="sign-in-button"]')
|
||||||
@ -70,6 +72,7 @@ describe('ZMA (Tauri, Linux)', () => {
|
|||||||
console.log(cr.status)
|
console.log(cr.status)
|
||||||
|
|
||||||
// Now should be signed in
|
// Now should be signed in
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 10000))
|
||||||
const newFileButton = await $('[data-testid="home-new-file"]')
|
const newFileButton = await $('[data-testid="home-new-file"]')
|
||||||
expect(await newFileButton.getText()).toEqual('New project')
|
expect(await newFileButton.getText()).toEqual('New project')
|
||||||
})
|
})
|
||||||
@ -117,8 +120,8 @@ describe('ZMA (Tauri, Linux)', () => {
|
|||||||
it('opens the new file and expects a loading stream', async () => {
|
it('opens the new file and expects a loading stream', async () => {
|
||||||
const projectLink = await $('[data-testid="project-link"]')
|
const projectLink = await $('[data-testid="project-link"]')
|
||||||
await click(projectLink)
|
await click(projectLink)
|
||||||
const loadingText = await $('[data-testid="loading-stream"]')
|
const errorText = await $('[data-testid="unexpected-error"]')
|
||||||
expect(await loadingText.getText()).toContain('Loading stream...')
|
expect(await errorText.getText()).toContain('unexpected error')
|
||||||
await browser.execute('window.location.href = "tauri://localhost/home"')
|
await browser.execute('window.location.href = "tauri://localhost/home"')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -123,6 +123,7 @@
|
|||||||
"@tauri-apps/cli": "^2.0.0-beta.13",
|
"@tauri-apps/cli": "^2.0.0-beta.13",
|
||||||
"@types/crypto-js": "^4.2.2",
|
"@types/crypto-js": "^4.2.2",
|
||||||
"@types/debounce-promise": "^3.1.9",
|
"@types/debounce-promise": "^3.1.9",
|
||||||
|
"@types/mocha": "^10.0.6",
|
||||||
"@types/pixelmatch": "^5.2.6",
|
"@types/pixelmatch": "^5.2.6",
|
||||||
"@types/pngjs": "^6.0.4",
|
"@types/pngjs": "^6.0.4",
|
||||||
"@types/react-modal": "^3.16.3",
|
"@types/react-modal": "^3.16.3",
|
||||||
|
@ -16,7 +16,7 @@ export const ErrorPage = () => {
|
|||||||
return (
|
return (
|
||||||
<div className="flex flex-col items-center justify-center h-screen">
|
<div className="flex flex-col items-center justify-center h-screen">
|
||||||
<section className="max-w-full xl:max-w-4xl mx-auto">
|
<section className="max-w-full xl:max-w-4xl mx-auto">
|
||||||
<h1 className="text-4xl mb-8 font-bold">
|
<h1 className="text-4xl mb-8 font-bold" data-testid="unexpected-error">
|
||||||
An unexpected error occurred
|
An unexpected error occurred
|
||||||
</h1>
|
</h1>
|
||||||
{isRouteErrorResponse(error) && (
|
{isRouteErrorResponse(error) && (
|
||||||
@ -26,7 +26,12 @@ export const ErrorPage = () => {
|
|||||||
)}
|
)}
|
||||||
<div className="flex justify-between gap-2 mt-6">
|
<div className="flex justify-between gap-2 mt-6">
|
||||||
{isTauri() && (
|
{isTauri() && (
|
||||||
<ActionButton Element="link" to={'/'} icon={{ icon: faHome }}>
|
<ActionButton
|
||||||
|
Element="link"
|
||||||
|
to={'/'}
|
||||||
|
icon={{ icon: faHome }}
|
||||||
|
data-testid="unexpected-error-home"
|
||||||
|
>
|
||||||
Go Home
|
Go Home
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
)}
|
)}
|
||||||
|
@ -8,7 +8,8 @@
|
|||||||
"vite/client",
|
"vite/client",
|
||||||
"@types/wicg-file-system-access",
|
"@types/wicg-file-system-access",
|
||||||
"node",
|
"node",
|
||||||
"@wdio/globals/types"
|
"@wdio/globals/types",
|
||||||
|
"mocha"
|
||||||
],
|
],
|
||||||
"target": "esnext",
|
"target": "esnext",
|
||||||
"lib": ["dom", "dom.iterable", "esnext"],
|
"lib": ["dom", "dom.iterable", "esnext"],
|
||||||
|
@ -22,6 +22,7 @@ export const config = {
|
|||||||
reporters: ['spec'],
|
reporters: ['spec'],
|
||||||
framework: 'mocha',
|
framework: 'mocha',
|
||||||
mochaOpts: {
|
mochaOpts: {
|
||||||
|
bail: true,
|
||||||
ui: 'bdd',
|
ui: 'bdd',
|
||||||
timeout: 600000,
|
timeout: 600000,
|
||||||
},
|
},
|
||||||
|
@ -2427,7 +2427,7 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
|
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
|
||||||
integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==
|
integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==
|
||||||
|
|
||||||
"@types/mocha@^10.0.0":
|
"@types/mocha@^10.0.0", "@types/mocha@^10.0.6":
|
||||||
version "10.0.6"
|
version "10.0.6"
|
||||||
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-10.0.6.tgz#818551d39113081048bdddbef96701b4e8bb9d1b"
|
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-10.0.6.tgz#818551d39113081048bdddbef96701b4e8bb9d1b"
|
||||||
integrity sha512-dJvrYWxP/UcXm36Qn36fxhUKu8A/xMRXVT2cliFF1Z7UA9liG5Psj3ezNSZw+5puH2czDXRLcXQxf8JbJt0ejg==
|
integrity sha512-dJvrYWxP/UcXm36Qn36fxhUKu8A/xMRXVT2cliFF1Z7UA9liG5Psj3ezNSZw+5puH2czDXRLcXQxf8JbJt0ejg==
|
||||||
|
Reference in New Issue
Block a user