-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Running multiple devices * Fix getLogMessage type for return * Add some new stuff for run devices without browsers * Some changes to support devices * Fix tests * Merge master * Add info to Readme * Fix version in Readme
- Loading branch information
Showing
6 changed files
with
173 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,39 @@ | ||
import { checkBrowserEnv } from '../utils' | ||
import { BrowserType } from '../constants' | ||
|
||
export const checkBrowsers = (browsers?: BrowserType[]): void => { | ||
if (!browsers || !browsers.length) { | ||
export const checkCommand = ( | ||
browsers: BrowserType[], | ||
devices: string[], | ||
): void => { | ||
if (!browsers.length && !devices.length) { | ||
throw new Error( | ||
'You should define browsers with your jest-playwright.config.js', | ||
'You should define browsers or devices with your jest-playwright.config.js', | ||
) | ||
} | ||
browsers.forEach(checkBrowserEnv) | ||
// TODO Add check for devices | ||
// devices.forEach(checkDeviceEnv) | ||
} | ||
|
||
export const getResultByStatus = (status: number | null): string => { | ||
return status !== 0 ? 'Failed' : 'Passed' | ||
} | ||
|
||
export const getLogMessage = ( | ||
browser: BrowserType, | ||
status: number | null, | ||
device: string | null, | ||
): string => { | ||
return `${getResultByStatus(status)} tests for browser: ${browser} ${ | ||
device ? `and device: ${device}` : '' | ||
}\n\n` | ||
} | ||
|
||
export const getExitCode = (exitCodes: (number | null)[]): void => { | ||
if (exitCodes.every(code => code === 0)) { | ||
process.exit(0) | ||
} else { | ||
console.log('One of the test has not passed successfully') | ||
process.exit(1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters