diff options
-rw-r--r-- | client/e2e/src/suites-local/signup.e2e-spec.ts | 23 | ||||
-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 |
4 files changed, 38 insertions, 8 deletions
diff --git a/client/e2e/src/suites-local/signup.e2e-spec.ts b/client/e2e/src/suites-local/signup.e2e-spec.ts index b6f7ad1a7..7c822a6e6 100644 --- a/client/e2e/src/suites-local/signup.e2e-spec.ts +++ b/client/e2e/src/suites-local/signup.e2e-spec.ts | |||
@@ -2,7 +2,16 @@ import { AdminConfigPage } from '../po/admin-config.po' | |||
2 | import { AdminRegistrationPage } from '../po/admin-registration.po' | 2 | import { AdminRegistrationPage } from '../po/admin-registration.po' |
3 | import { LoginPage } from '../po/login.po' | 3 | import { LoginPage } from '../po/login.po' |
4 | import { SignupPage } from '../po/signup.po' | 4 | import { SignupPage } from '../po/signup.po' |
5 | import { browserSleep, getVerificationLink, go, findEmailTo, isMobileDevice, MockSMTPServer, waitServerUp } from '../utils' | 5 | import { |
6 | browserSleep, | ||
7 | findEmailTo, | ||
8 | getScreenshotPath, | ||
9 | getVerificationLink, | ||
10 | go, | ||
11 | isMobileDevice, | ||
12 | MockSMTPServer, | ||
13 | waitServerUp | ||
14 | } from '../utils' | ||
6 | 15 | ||
7 | function checkEndMessage (options: { | 16 | function checkEndMessage (options: { |
8 | message: string | 17 | message: string |
@@ -155,7 +164,7 @@ describe('Signup', () => { | |||
155 | afterEmailVerification: false | 164 | afterEmailVerification: false |
156 | }) | 165 | }) |
157 | 166 | ||
158 | await browser.saveScreenshot('./screenshots/direct-without-email.png') | 167 | await browser.saveScreenshot(getScreenshotPath('direct-without-email.png')) |
159 | 168 | ||
160 | await loginPage.logout() | 169 | await loginPage.logout() |
161 | }) | 170 | }) |
@@ -203,7 +212,7 @@ describe('Signup', () => { | |||
203 | afterEmailVerification: false | 212 | afterEmailVerification: false |
204 | }) | 213 | }) |
205 | 214 | ||
206 | await browser.saveScreenshot('./screenshots/request-without-email.png') | 215 | await browser.saveScreenshot(getScreenshotPath('request-without-email.png')) |
207 | }) | 216 | }) |
208 | 217 | ||
209 | it('Should display a message when trying to login with this account', async function () { | 218 | it('Should display a message when trying to login with this account', async function () { |
@@ -283,7 +292,7 @@ describe('Signup', () => { | |||
283 | afterEmailVerification: false | 292 | afterEmailVerification: false |
284 | }) | 293 | }) |
285 | 294 | ||
286 | await browser.saveScreenshot('./screenshots/direct-with-email.png') | 295 | await browser.saveScreenshot(getScreenshotPath('direct-with-email.png')) |
287 | }) | 296 | }) |
288 | 297 | ||
289 | it('Should validate the email', async function () { | 298 | it('Should validate the email', async function () { |
@@ -304,7 +313,7 @@ describe('Signup', () => { | |||
304 | afterEmailVerification: true | 313 | afterEmailVerification: true |
305 | }) | 314 | }) |
306 | 315 | ||
307 | await browser.saveScreenshot('./screenshots/direct-after-email.png') | 316 | await browser.saveScreenshot(getScreenshotPath('direct-after-email.png')) |
308 | }) | 317 | }) |
309 | }) | 318 | }) |
310 | 319 | ||
@@ -355,7 +364,7 @@ describe('Signup', () => { | |||
355 | afterEmailVerification: false | 364 | afterEmailVerification: false |
356 | }) | 365 | }) |
357 | 366 | ||
358 | await browser.saveScreenshot('./screenshots/request-with-email.png') | 367 | await browser.saveScreenshot(getScreenshotPath('request-with-email.png')) |
359 | }) | 368 | }) |
360 | 369 | ||
361 | it('Should display a message when trying to login with this account', async function () { | 370 | it('Should display a message when trying to login with this account', async function () { |
@@ -391,7 +400,7 @@ describe('Signup', () => { | |||
391 | afterEmailVerification: true | 400 | afterEmailVerification: true |
392 | }) | 401 | }) |
393 | 402 | ||
394 | await browser.saveScreenshot('./screenshots/request-after-email.png') | 403 | await browser.saveScreenshot(getScreenshotPath('request-after-email.png')) |
395 | }) | 404 | }) |
396 | }) | 405 | }) |
397 | 406 | ||
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' |