Skip to content

Commit

Permalink
Fix windows E2E tests
Browse files Browse the repository at this point in the history
  • Loading branch information
islathehut committed Apr 17, 2024
1 parent 6124233 commit bc4eafc
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/e2e-crossplatform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- packages/state-manager/**
- packages/identity/**
- packages/common/**
- packages/e2e-tests/**

jobs:
mac:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ jobs:
- name: Run invitation link test - Includes 2 separate application clients
uses: nick-fields/retry@14672906e672a08bd6eeb15720e9ed3ce869cdd4 # v2.9.0
with:
timeout_minutes: 25
timeout_minutes: 10
max_attempts: 3
shell: bash
command: cd packages/e2e-tests && npm run test invitationLink.test.ts
4 changes: 2 additions & 2 deletions packages/e2e-tests/src/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ export class App {
console.log('App closed', this.buildSetup.dataDir)
}

async cleanup() {
async cleanup(force: boolean = false) {
console.log(`Performing app cleanup`, this.buildSetup.dataDir)
if (this.isOpened) {
throw new Error(`App with dataDir ${this.buildSetup.dataDir} is still open, close before cleaning up!`)
}
this.buildSetup.clearDataDir()
this.buildSetup.clearDataDir(force)
}

get saveStateButton() {
Expand Down
5 changes: 4 additions & 1 deletion packages/e2e-tests/src/tests/invitationLink.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ describe('New user joins using invitation link while having app opened', () => {
beforeAll(async () => {
ownerApp = new App()
guestApp = new App({ defaultDataDir: true })
if (process.platform === 'win32') {
await guestApp.cleanup(true)
}
})

beforeEach(async () => {
Expand Down Expand Up @@ -143,7 +146,7 @@ describe('New user joins using invitation link while having app opened', () => {
const copiedCode = url.hash.substring(1)
expect(() => parseInvitationCode(copiedCode)).not.toThrow()
const data = parseInvitationCode(copiedCode)
const commandFull = `${command[process.platform as SupportedPlatformDesktop]} "${composeInvitationDeepUrl(data)}"`
const commandFull = `${command[process.platform as SupportedPlatformDesktop]} ${process.platform === 'win32' ? '""' : ''} "${composeInvitationDeepUrl(data)}"`
console.log(`Calling ${commandFull}`)
execSync(commandFull)
console.log('Guest opened invitation link')
Expand Down
6 changes: 3 additions & 3 deletions packages/e2e-tests/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ export class BuildSetup {
}

private getBinaryLocation() {
console.log('filename', this.fileName)
switch (process.platform) {
case 'linux':
console.log('filename', this.fileName)
return `${__dirname}/../Quiet/${this.fileName ? this.fileName : BuildSetup.getEnvFileName()}`
case 'win32':
return `${process.env.LOCALAPPDATA}\\Programs\\@quietdesktop\\Quiet.exe`
Expand Down Expand Up @@ -233,8 +233,8 @@ export class BuildSetup {
await this.driver?.close()
}

public clearDataDir() {
if (process.env.IS_CI === 'true') {
public clearDataDir(force: boolean = false) {
if (process.env.IS_CI === 'true' && !force) {
console.warn('Not deleting data directory because we are running in CI')
return
}
Expand Down

0 comments on commit bc4eafc

Please sign in to comment.