diff --git a/packages/backend/src/nest/app.module.ts b/packages/backend/src/nest/app.module.ts index cf2fdc655d..03e987a178 100644 --- a/packages/backend/src/nest/app.module.ts +++ b/packages/backend/src/nest/app.module.ts @@ -127,7 +127,7 @@ export class AppModule { res.end() } }) - + console.log('ok') return { server, io } }, inject: [EXPRESS_PROVIDER], diff --git a/packages/common/src/static.ts b/packages/common/src/static.ts index 270bcdee89..8c297b4d10 100644 --- a/packages/common/src/static.ts +++ b/packages/common/src/static.ts @@ -1,3 +1,6 @@ +export const DESKTOP_DEV_DATA_DIR = 'Quietdev' +export const DESKTOP_DATA_DIR = 'Quiet2' + export enum Site { DOMAIN = 'tryquiet.org', MAIN_PAGE = 'https://tryquiet.org/', diff --git a/packages/desktop/src/main/main.ts b/packages/desktop/src/main/main.ts index 24174c5dd9..3e5ab64daa 100644 --- a/packages/desktop/src/main/main.ts +++ b/packages/desktop/src/main/main.ts @@ -9,9 +9,14 @@ import { getPorts, ApplicationPorts, closeHangingBackendProcess } from './backen import pkijs, { setEngine, CryptoEngine } from 'pkijs' import { Crypto } from '@peculiar/webcrypto' import logger from './logger' -import { DATA_DIR, DEV_DATA_DIR } from '../shared/static' import { fork, ChildProcess } from 'child_process' -import { argvInvitationCode, getFilesData, parseInvitationCodeDeepUrl } from '@quiet/common' +import { + DESKTOP_DATA_DIR, + DESKTOP_DEV_DATA_DIR, + argvInvitationCode, + getFilesData, + parseInvitationCodeDeepUrl, +} from '@quiet/common' import { updateDesktopFile, processInvitationCode } from './invitation' const ElectronStore = require('electron-store') ElectronStore.initRenderer() @@ -33,13 +38,13 @@ const webcrypto = new Crypto() global.crypto = webcrypto -let dataDir = DATA_DIR +let dataDir = DESKTOP_DATA_DIR let mainWindow: BrowserWindow | null let splash: BrowserWindow | null let invitationUrl: string | null if (isDev || process.env.DATA_DIR) { - dataDir = process.env.DATA_DIR || DEV_DATA_DIR + dataDir = process.env.DATA_DIR || DESKTOP_DEV_DATA_DIR } const appDataPath = path.join(app.getPath('appData'), dataDir) diff --git a/packages/desktop/src/renderer/store/reducers.ts b/packages/desktop/src/renderer/store/reducers.ts index d0cc10c344..14a778fcd0 100644 --- a/packages/desktop/src/renderer/store/reducers.ts +++ b/packages/desktop/src/renderer/store/reducers.ts @@ -25,13 +25,14 @@ import { navigationReducer } from './navigation/navigation.slice' import appHandlers from './handlers/app' -import { DEV_DATA_DIR } from '../../shared/static' import { Store } from '../sagas/store.types' +import { DESKTOP_DATA_DIR, DESKTOP_DEV_DATA_DIR } from '@quiet/common' const dataPath = process.env.APPDATA || (process.platform === 'darwin' ? process.env.HOME + '/Library/Application Support' : process.env.HOME + '/.config') -const appPath = process.env.DATA_DIR || (process.env.NODE_ENV === 'development' ? DEV_DATA_DIR : 'Quiet') +const appPath = + process.env.DATA_DIR || (process.env.NODE_ENV === 'development' ? DESKTOP_DEV_DATA_DIR : DESKTOP_DATA_DIR) const options = { projectName: 'quiet', diff --git a/packages/desktop/src/shared/static.ts b/packages/desktop/src/shared/static.ts index b0a95acfd7..c0cca57906 100644 --- a/packages/desktop/src/shared/static.ts +++ b/packages/desktop/src/shared/static.ts @@ -1,8 +1,5 @@ import mirrorKey from 'keymirror' -export const DEV_DATA_DIR = 'Quietdev' -export const DATA_DIR = 'Quiet2' - export const actionTypes = mirrorKey({ SET_APP_VERSION: undefined, }) diff --git a/packages/e2e-tests/src/selectors.ts b/packages/e2e-tests/src/selectors.ts index a6b2b69ef0..2fc1a3b9c5 100644 --- a/packages/e2e-tests/src/selectors.ts +++ b/packages/e2e-tests/src/selectors.ts @@ -445,7 +445,7 @@ export class DebugModeModal { const log = await this.driver.executeScript('arguments[0].click();', button) console.log('executeScript', log) } catch (e) { - console.log('Probably click properly close modal') + console.log('Probably clicked hidden close button on debug modal') } await new Promise(resolve => setTimeout(() => resolve(), 2000)) } diff --git a/packages/e2e-tests/src/tests/invitationLink.test.ts b/packages/e2e-tests/src/tests/invitationLink.test.ts index 8956672981..e4c8d95d97 100644 --- a/packages/e2e-tests/src/tests/invitationLink.test.ts +++ b/packages/e2e-tests/src/tests/invitationLink.test.ts @@ -3,13 +3,12 @@ import { CreateCommunityModal, DebugModeModal, JoinCommunityModal, - JoiningLoadingPanel, RegisterUsernameModal, App, Sidebar, WarningModal, } from '../selectors' -import { capitalizeFirstLetter, composeInvitationDeepUrl, parseInvitationCode, userJoinedMessage } from '@quiet/common' +import { composeInvitationDeepUrl, parseInvitationCode, userJoinedMessage } from '@quiet/common' import { execSync } from 'child_process' import { type SupportedPlatformDesktop } from '@quiet/types' @@ -26,7 +25,7 @@ describe('New user joins using invitation link while having app opened', () => { beforeAll(async () => { ownerApp = new App() - guestApp = new App({ useDataDir: false }) + guestApp = new App({ defaultDataDir: true }) }) beforeEach(async () => { @@ -141,7 +140,9 @@ 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) - execSync(`${command[process.platform as SupportedPlatformDesktop]} "${composeInvitationDeepUrl(data)}"`) + const commandFull = `${command[process.platform as SupportedPlatformDesktop]} "${composeInvitationDeepUrl(data)}"` + console.log(`Calling ${commandFull}`) + execSync(commandFull) console.log('Guest opened invitation link') }) diff --git a/packages/e2e-tests/src/utils.ts b/packages/e2e-tests/src/utils.ts index e424d9b6f8..1abe46ec1d 100644 --- a/packages/e2e-tests/src/utils.ts +++ b/packages/e2e-tests/src/utils.ts @@ -4,11 +4,12 @@ import { type SupportedPlatformDesktop } from '@quiet/types' import getPort from 'get-port' import path from 'path' import fs from 'fs' +import { DESKTOP_DATA_DIR } from '@quiet/common' export interface BuildSetupInit { port?: number debugPort?: number - useDataDir?: boolean + defaultDataDir?: boolean dataDir?: string fileName?: string } @@ -19,19 +20,20 @@ export class BuildSetup { public debugPort?: number public dataDir?: string private child?: ChildProcessWithoutNullStreams - private useDataDir: boolean + private defaultDataDir: boolean private fileName?: string - constructor({ port, debugPort, useDataDir = true, dataDir, fileName }: BuildSetupInit) { + constructor({ port, debugPort, defaultDataDir = false, dataDir, fileName }: BuildSetupInit) { this.port = port this.debugPort = debugPort - this.useDataDir = useDataDir + this.defaultDataDir = defaultDataDir this.dataDir = dataDir this.fileName = fileName if (fileName) { this.copyInstallerFile(fileName) } - if (this.useDataDir && !this.dataDir) { + if (this.defaultDataDir) this.dataDir = DESKTOP_DATA_DIR + if (!this.dataDir) { this.dataDir = `e2e_${(Math.random() * 10 ** 18).toString(36)}` } } @@ -100,8 +102,8 @@ export class BuildSetup { public async createChromeDriver() { await this.initPorts() const env = { - DATA_DIR: this.dataDir || 'Quiet', DEBUG: 'backend*,desktop*,utils*', + DATA_DIR: this.dataDir, } if (process.platform === 'win32') { console.log('!WINDOWS!')