Skip to content

Commit

Permalink
Log test name on all test cases in e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
islathehut committed Nov 7, 2024
1 parent b047af2 commit 4828359
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 17 deletions.
16 changes: 9 additions & 7 deletions packages/e2e-tests/src/tests/backwardsCompatibility.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
Sidebar,
} from '../selectors'
import { MessageIds } from '../types'
import { BACKWARD_COMPATIBILITY_BASE_VERSION, BuildSetup, copyInstallerFile, downloadInstaller } from '../utils'
import { BACKWARD_COMPATIBILITY_BASE_VERSION, BuildSetup, copyInstallerFile, downloadInstaller, sleep } from '../utils'
import { createLogger } from '../logger'

const logger = createLogger('backwardsCompatibility')
Expand Down Expand Up @@ -45,16 +45,18 @@ describe('Backwards Compatibility', () => {
})

beforeEach(async () => {
await new Promise<void>(resolve => setTimeout(() => resolve(), 1000))
logger.info(`░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ${expect.getState().currentTestName}`)
await sleep(1_000)
})

afterAll(async () => {
await new Promise<void>(resolve => setTimeout(() => resolve(), 5000))
await sleep(5_000)
await ownerAppNewVersion?.close()
await ownerAppNewVersion?.cleanup()
await ownerAppOldVersion?.close()
await ownerAppOldVersion?.cleanup()
})

describe('User opens app for the first time', () => {
itif(process.platform == 'linux')('Owner opens the app', async () => {
await ownerAppOldVersion.open()
Expand Down Expand Up @@ -159,7 +161,7 @@ describe('Backwards Compatibility', () => {
)
itif(process.platform == 'linux')('User closes the old app', async () => {
await ownerAppOldVersion.close()
await new Promise<void>(resolve => setTimeout(() => resolve(), 5000))
await sleep(5_000)
})

// ________________________________
Expand Down Expand Up @@ -189,7 +191,7 @@ describe('Backwards Compatibility', () => {

itif(process.platform == 'linux')('Confirm that the opened app is the latest version', async () => {
logger.info('New version', 4)
await new Promise<void>(resolve => setTimeout(() => resolve(), 10000))
await sleep(10_000)
const settingsModal = await new Sidebar(ownerAppNewVersion.driver).openSettings()
const isSettingsModal = await settingsModal.element.isDisplayed()
expect(isSettingsModal).toBeTruthy()
Expand All @@ -201,10 +203,10 @@ describe('Backwards Compatibility', () => {

itif(process.platform == 'linux')('Check number of messages on second channel', async () => {
logger.info('New version', 5)
await new Promise<void>(resolve => setTimeout(() => resolve(), 2000))
await sleep(2_000)
sidebar = new Sidebar(ownerAppNewVersion.driver)
await sidebar.switchChannel(newChannelName)
await new Promise<void>(resolve => setTimeout(() => resolve(), 5000))
await sleep(5_000)
secondChannel = new Channel(ownerAppNewVersion.driver, newChannelName)
const currentMessages = await secondChannel.getUserMessages(ownerUsername)
expect(currentMessages.length).toEqual(messagesToCompare.length)
Expand Down
1 change: 1 addition & 0 deletions packages/e2e-tests/src/tests/invitationLink.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ describe('New user joins using invitation link while having app opened', () => {
})

beforeEach(async () => {
logger.info(`░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ${expect.getState().currentTestName}`)
await sleep(1000)
})

Expand Down
7 changes: 6 additions & 1 deletion packages/e2e-tests/src/tests/joiningWithQSS.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { createLogger } from '../logger'

const logger = createLogger('joiningWithQSS')

jest.setTimeout(1200000) // 20 minutes
jest.setTimeout(1_200_000) // 20 minutes

// Run QSS locally before this test
const serverAddress = 'http://127.0.0.1:3000'
Expand Down Expand Up @@ -41,6 +41,11 @@ describe('User joining with storage server', () => {
await users.user1.app.close()
})

beforeEach(async () => {
logger.info(`░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ${expect.getState().currentTestName}`)
await sleep(1_000)
})

describe('Owner creates the community', () => {
it('Owner opens the app', async () => {
await users.owner.app.open()
Expand Down
11 changes: 3 additions & 8 deletions packages/e2e-tests/src/tests/multipleClients.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { jest } from '@jest/globals'

import {
App,
Channel,
Expand Down Expand Up @@ -40,14 +42,6 @@ describe('Multiple Clients', () => {
const generalChannelName = 'general'
const thirdChannelName = 'delete-this'

const sleep = async (time = 1000) => {
await new Promise<void>(resolve =>
setTimeout(() => {
resolve()
}, time)
)
}

beforeAll(async () => {
const commonApp = new App()
users = {
Expand Down Expand Up @@ -82,6 +76,7 @@ describe('Multiple Clients', () => {
})

beforeEach(async () => {
logger.info(`░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ${expect.getState().currentTestName}`)
await sleep(1000)
})

Expand Down
7 changes: 7 additions & 0 deletions packages/e2e-tests/src/tests/oneClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import getPort from 'get-port'
import { fork } from 'child_process'
import path from 'path'
import { createLogger } from '../logger'
import { sleep } from '../utils'

const logger = createLogger('oneClient')

Expand All @@ -32,6 +33,12 @@ describe('One Client', () => {
await app.close()
await app.cleanup()
})

beforeEach(async () => {
logger.info(`░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ${expect.getState().currentTestName}`)
await sleep(200)
})

describe('User opens app for the first time', () => {
it('Get opened app process data', () => {
const processData = app.buildSetup.getProcessData()
Expand Down
3 changes: 2 additions & 1 deletion packages/e2e-tests/src/tests/userProfile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ describe('User Profile Feature', () => {
})

beforeEach(async () => {
await sleep(1000)
logger.info(`░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ${expect.getState().currentTestName}`)
await sleep(1_000)
})

it('Owner opens the app', async () => {
Expand Down

0 comments on commit 4828359

Please sign in to comment.