diff options
author | Chocobozzz <me@florianbigard.com> | 2023-02-15 16:25:52 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-02-15 16:26:21 +0100 |
commit | 1ec4835dcac769d0711bbfeaa63b4e1743fde265 (patch) | |
tree | c50faa5a51ebe4827d2762e6b7b4f418da2a9948 /client/e2e/src/utils | |
parent | 366d5aea5d5b320b54b9cfea9a646d7828de7bae (diff) | |
download | PeerTube-1ec4835dcac769d0711bbfeaa63b4e1743fde265.tar.gz PeerTube-1ec4835dcac769d0711bbfeaa63b4e1743fde265.tar.zst PeerTube-1ec4835dcac769d0711bbfeaa63b4e1743fde265.zip |
Create screenshots directory when needed
Diffstat (limited to 'client/e2e/src/utils')
-rw-r--r-- | client/e2e/src/utils/files.ts | 17 | ||||
-rw-r--r-- | client/e2e/src/utils/hooks.ts | 5 | ||||
-rw-r--r-- | client/e2e/src/utils/index.ts | 1 |
3 files changed, 22 insertions, 1 deletions
diff --git a/client/e2e/src/utils/files.ts b/client/e2e/src/utils/files.ts new file mode 100644 index 000000000..c532c987e --- /dev/null +++ b/client/e2e/src/utils/files.ts | |||
@@ -0,0 +1,17 @@ | |||
1 | import { mkdirSync } from 'fs' | ||
2 | import { join } from 'path' | ||
3 | |||
4 | const SCREENSHOTS_DIRECTORY = 'screenshots' | ||
5 | |||
6 | function createScreenshotsDirectory () { | ||
7 | mkdirSync(SCREENSHOTS_DIRECTORY, { recursive: true }) | ||
8 | } | ||
9 | |||
10 | function getScreenshotPath (filename: string) { | ||
11 | return join(SCREENSHOTS_DIRECTORY, filename) | ||
12 | } | ||
13 | |||
14 | export { | ||
15 | createScreenshotsDirectory, | ||
16 | getScreenshotPath | ||
17 | } | ||
diff --git a/client/e2e/src/utils/hooks.ts b/client/e2e/src/utils/hooks.ts index 7fe247681..8baf9fb44 100644 --- a/client/e2e/src/utils/hooks.ts +++ b/client/e2e/src/utils/hooks.ts | |||
@@ -1,7 +1,8 @@ | |||
1 | import { ChildProcessWithoutNullStreams } from 'child_process' | 1 | import { ChildProcessWithoutNullStreams } from 'child_process' |
2 | import { basename } from 'path' | 2 | import { basename } from 'path' |
3 | import { runCommand, runServer } from './server' | ||
4 | import { setValue } from '@wdio/shared-store-service' | 3 | import { setValue } from '@wdio/shared-store-service' |
4 | import { createScreenshotsDirectory } from './files' | ||
5 | import { runCommand, runServer } from './server' | ||
5 | 6 | ||
6 | let appInstance: number | 7 | let appInstance: number |
7 | let app: ChildProcessWithoutNullStreams | 8 | let app: ChildProcessWithoutNullStreams |
@@ -21,6 +22,8 @@ function afterLocalSuite () { | |||
21 | } | 22 | } |
22 | 23 | ||
23 | async function beforeLocalSession (config: { baseUrl: string }, capabilities: { browserName: string }) { | 24 | async function beforeLocalSession (config: { baseUrl: string }, capabilities: { browserName: string }) { |
25 | await createScreenshotsDirectory() | ||
26 | |||
24 | appInstance = capabilities['browserName'] === 'chrome' | 27 | appInstance = capabilities['browserName'] === 'chrome' |
25 | ? 1 | 28 | ? 1 |
26 | : 2 | 29 | : 2 |
diff --git a/client/e2e/src/utils/index.ts b/client/e2e/src/utils/index.ts index 420fd239e..0770cb0f4 100644 --- a/client/e2e/src/utils/index.ts +++ b/client/e2e/src/utils/index.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | export * from './common' | 1 | export * from './common' |
2 | export * from './elements' | 2 | export * from './elements' |
3 | export * from './email' | 3 | export * from './email' |
4 | export * from './files' | ||
4 | export * from './hooks' | 5 | export * from './hooks' |
5 | export * from './mock-smtp' | 6 | export * from './mock-smtp' |
6 | export * from './server' | 7 | export * from './server' |