@ -1,7 +1,9 @@
 | 
			
		||||
import { browser, $, expect } from '@wdio/globals'
 | 
			
		||||
import { describe, it } from 'mocha'
 | 
			
		||||
import fs from 'fs/promises'
 | 
			
		||||
import path from 'path'
 | 
			
		||||
import os from 'os'
 | 
			
		||||
import { click } from '../utils'
 | 
			
		||||
 | 
			
		||||
const isWin32 = os.platform() === 'win32'
 | 
			
		||||
const documentsDir = path.join(os.homedir(), 'Documents')
 | 
			
		||||
@ -15,12 +17,6 @@ const newProjectDir = path.join(documentsDir, 'a-different-directory')
 | 
			
		||||
const tmp = process.env.TEMP || '/tmp'
 | 
			
		||||
const userCodeDir = path.join(tmp, 'kittycad_user_code')
 | 
			
		||||
 | 
			
		||||
async function click(element: WebdriverIO.Element): Promise<void> {
 | 
			
		||||
  // Workaround for .click(), see https://github.com/tauri-apps/tauri/issues/6541
 | 
			
		||||
  await element.waitForClickable()
 | 
			
		||||
  await browser.execute('arguments[0].click();', element)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Shoutout to @Sheap on Github for a great workaround utility:
 | 
			
		||||
 * https://github.com/tauri-apps/tauri/issues/6541#issue-1638944060
 | 
			
		||||
 */
 | 
			
		||||
@ -33,7 +29,7 @@ async function setDatasetValue(
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
describe('ZMA (Tauri)', () => {
 | 
			
		||||
  it('opens the auth page and signs in', async () => {
 | 
			
		||||
  before(async () => {
 | 
			
		||||
    // Clean up filesystem from previous tests
 | 
			
		||||
    await new Promise((resolve) => setTimeout(resolve, 100))
 | 
			
		||||
    await fs.rm(defaultProjectDir, { force: true, recursive: true })
 | 
			
		||||
@ -42,7 +38,9 @@ describe('ZMA (Tauri)', () => {
 | 
			
		||||
    await fs.rm(userSettingsDir, { force: true, recursive: true })
 | 
			
		||||
    await fs.mkdir(defaultProjectDir, { recursive: true })
 | 
			
		||||
    await fs.mkdir(newProjectDir, { recursive: true })
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('opens the auth page and signs in', async () => {
 | 
			
		||||
    const signInButton = await $('[data-testid="sign-in-button"]')
 | 
			
		||||
    expect(await signInButton.getText()).toEqual('Sign in')
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										5
									
								
								e2e/tauri/utils.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								e2e/tauri/utils.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,5 @@
 | 
			
		||||
export async function click(element: WebdriverIO.Element): Promise<void> {
 | 
			
		||||
  // Workaround for .click(), see https://github.com/tauri-apps/tauri/issues/6541
 | 
			
		||||
  await element.waitForClickable()
 | 
			
		||||
  await browser.execute('arguments[0].click();', element)
 | 
			
		||||
}
 | 
			
		||||
@ -148,6 +148,7 @@
 | 
			
		||||
    "eslint-plugin-css-modules": "^2.12.0",
 | 
			
		||||
    "happy-dom": "^14.3.10",
 | 
			
		||||
    "husky": "^9.0.11",
 | 
			
		||||
    "mocha": "^10.4.0",
 | 
			
		||||
    "pixelmatch": "^5.3.0",
 | 
			
		||||
    "pngjs": "^7.0.0",
 | 
			
		||||
    "postcss": "^8.4.31",
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										48
									
								
								yarn.lock
									
									
									
									
									
								
							
							
						
						
									
										48
									
								
								yarn.lock
									
									
									
									
									
								
							@ -5446,6 +5446,17 @@ glob@7.2.0:
 | 
			
		||||
    once "^1.3.0"
 | 
			
		||||
    path-is-absolute "^1.0.0"
 | 
			
		||||
 | 
			
		||||
glob@8.1.0, glob@^8.0.0:
 | 
			
		||||
  version "8.1.0"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e"
 | 
			
		||||
  integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==
 | 
			
		||||
  dependencies:
 | 
			
		||||
    fs.realpath "^1.0.0"
 | 
			
		||||
    inflight "^1.0.4"
 | 
			
		||||
    inherits "2"
 | 
			
		||||
    minimatch "^5.0.1"
 | 
			
		||||
    once "^1.3.0"
 | 
			
		||||
 | 
			
		||||
glob@^10.0.0, glob@^10.2.2:
 | 
			
		||||
  version "10.3.10"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/glob/-/glob-10.3.10.tgz#0351ebb809fd187fe421ab96af83d3a70715df4b"
 | 
			
		||||
@ -5469,17 +5480,6 @@ glob@^7.1.3:
 | 
			
		||||
    once "^1.3.0"
 | 
			
		||||
    path-is-absolute "^1.0.0"
 | 
			
		||||
 | 
			
		||||
glob@^8.0.0:
 | 
			
		||||
  version "8.1.0"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e"
 | 
			
		||||
  integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==
 | 
			
		||||
  dependencies:
 | 
			
		||||
    fs.realpath "^1.0.0"
 | 
			
		||||
    inflight "^1.0.4"
 | 
			
		||||
    inherits "2"
 | 
			
		||||
    minimatch "^5.0.1"
 | 
			
		||||
    once "^1.3.0"
 | 
			
		||||
 | 
			
		||||
glob@~7.1.1:
 | 
			
		||||
  version "7.1.7"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90"
 | 
			
		||||
@ -6836,6 +6836,32 @@ mocha@^10.0.0:
 | 
			
		||||
    yargs-parser "20.2.4"
 | 
			
		||||
    yargs-unparser "2.0.0"
 | 
			
		||||
 | 
			
		||||
mocha@^10.4.0:
 | 
			
		||||
  version "10.4.0"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.4.0.tgz#ed03db96ee9cfc6d20c56f8e2af07b961dbae261"
 | 
			
		||||
  integrity sha512-eqhGB8JKapEYcC4ytX/xrzKforgEc3j1pGlAXVy3eRwrtAy5/nIfT1SvgGzfN0XZZxeLq0aQWkOUAmqIJiv+bA==
 | 
			
		||||
  dependencies:
 | 
			
		||||
    ansi-colors "4.1.1"
 | 
			
		||||
    browser-stdout "1.3.1"
 | 
			
		||||
    chokidar "3.5.3"
 | 
			
		||||
    debug "4.3.4"
 | 
			
		||||
    diff "5.0.0"
 | 
			
		||||
    escape-string-regexp "4.0.0"
 | 
			
		||||
    find-up "5.0.0"
 | 
			
		||||
    glob "8.1.0"
 | 
			
		||||
    he "1.2.0"
 | 
			
		||||
    js-yaml "4.1.0"
 | 
			
		||||
    log-symbols "4.1.0"
 | 
			
		||||
    minimatch "5.0.1"
 | 
			
		||||
    ms "2.1.3"
 | 
			
		||||
    serialize-javascript "6.0.0"
 | 
			
		||||
    strip-json-comments "3.1.1"
 | 
			
		||||
    supports-color "8.1.1"
 | 
			
		||||
    workerpool "6.2.1"
 | 
			
		||||
    yargs "16.2.0"
 | 
			
		||||
    yargs-parser "20.2.4"
 | 
			
		||||
    yargs-unparser "2.0.0"
 | 
			
		||||
 | 
			
		||||
ms@2.1.2:
 | 
			
		||||
  version "2.1.2"
 | 
			
		||||
  resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user