Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…-js-api into hotfix/SUIT-16525-log-level-v3
  • Loading branch information
Maxym committed Feb 21, 2023
2 parents b6c9f87 + ba9a861 commit c9317de
Show file tree
Hide file tree
Showing 55 changed files with 258 additions and 131 deletions.
36 changes: 27 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,36 @@
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
version: 2.1

executors:
node-14:
docker:
- image: cimg/node:14.21
node-16:
docker:
- image: cimg/node:16.18
node-18:
docker:
- image: cimg/node:18.12

jobs:
build:
environment:
CC_TEST_REPORTER_ID: b8382b02e5d130520012123a7fcc97b478a6294991078cdabb721315bd2a9dd9
docker:
# specify the version you desire here
- image: circleci/node:14

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/mongo:3.4.4
working_directory: ~/suitest-js-api

working_directory: ~/repo
parameters:
version:
type: string
executor: node-<< parameters.version >>

steps:
- checkout

- run: node --version

- run:
name: Install dependencies
command: |
Expand All @@ -46,3 +57,10 @@ jobs:
name: Check TypeScript definitions
command: |
npm run test-definitions
workflows:
workflow:
jobs:
- build:
matrix:
parameters:
version: ["14", "16", "18"]
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,20 @@ etc.
- Locally installed Chrome, Firefox, Safari and Edge
- Apple tvOS, iOS and iPadOS devices, including simulators
- Roku
- Vizio

Suitest supports automating end-to-end testing of:

- HbbTV / Freeview Play apps
- Samsung Orsay and Tizen apps
- LG NetCast and webOS apps
- HTML apps for other TV's or set-top boxes
- Android TV apps (including FireTV)
- tvOS apps
- Android TV and mobile apps (including FireTV)
- Apple TV (tvOS), iOS and iPadOS apps
- Xbox One and Xbox Series S and X apps
- PlayStation 4 / 5 apps
- Roku apps
- Vizio SmartCast
- Traditional websites and web apps for desktop browsers.

## Contributing
Expand Down
2 changes: 1 addition & 1 deletion config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const timestamp = require('../lib/constants/timestamp');
const {validate, validators} = require('../lib/validation');
const {invalidConfigObj} = require('../lib/texts');
const {pickNonNil} = require('../lib/utils/common');
const envVars = require('../lib/constants/enviroment');
const envVars = require('../lib/constants/environment');

const sentryDsn = 'https://1f74b885d0c44549b57f307733d60351:[email protected]/288812';
const DEFAULT_TIMEOUT = 2000;
Expand Down
21 changes: 12 additions & 9 deletions lib/composers/acceptModalComposer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ const {invalidInputMessage} = require('../texts');
* Accept modal dialog, optionally sending message
* @param {String} [message] - text to be send to modal dialog
*/
const acceptModalComposer = makeModifierComposer(composers.ACCEPT_MODAL, ['acceptModal'], (_, meta, message = null) => ({
...meta,
isAcceptModal: true,
acceptModalMessage: validate(
validators.NON_EMPTY_STRING_OR_NUll,
message,
invalidInputMessage('acceptModal', 'Message value'),
),
}));
const acceptModalComposer = makeModifierComposer(
composers.ACCEPT_MODAL,
['acceptModal'],
(_, meta, message = null) => ({
...meta,
isAcceptModal: true,
acceptModalMessage: validate(
validators.NON_EMPTY_STRING_OR_NUll,
message,
invalidInputMessage('acceptModal', 'Message value'),
),
}));

module.exports = acceptModalComposer;
2 changes: 1 addition & 1 deletion lib/composers/cloneComposer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const cloneComposer = makeModifierComposer(
composers.CLONE,
['clone'],
(_, meta) => ({...meta}),
{unregisterParent: false}
{unregisterParent: false},
);

module.exports = cloneComposer;
2 changes: 1 addition & 1 deletion lib/composers/matchBrightScriptComposer.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const matchBrightScriptComposer = makeModifierComposer(
val: res,
},
};
}
},
);

module.exports = matchBrightScriptComposer;
25 changes: 14 additions & 11 deletions lib/composers/matchRepoComposer.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,19 @@ const processMatchRepoArgs = makeArgumentsProcessor(
}),
);

const matchRepoComposer = makeModifierComposer(composers.MATCH_REPO, ['matchRepo', 'matchesRepo'], (_, data, ...args) => ({
...data,
comparator: {
type: SUBJ_COMPARATOR.MATCH,
props: validation.validate(
validation.validators.ELEMENT_REPO_PROPS,
processMatchRepoArgs(args),
invalidInputMessage('matchRepo', 'Property')
),
},
}));
const matchRepoComposer = makeModifierComposer(
composers.MATCH_REPO,
['matchRepo', 'matchesRepo'],
(_, data, ...args) => ({
...data,
comparator: {
type: SUBJ_COMPARATOR.MATCH,
props: validation.validate(
validation.validators.ELEMENT_REPO_PROPS,
processMatchRepoArgs(args),
invalidInputMessage('matchRepo', 'Property'),
),
},
}));

module.exports = matchRepoComposer;
2 changes: 1 addition & 1 deletion lib/composers/repeatComposer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const {invalidInputMessage} = require('../texts');
*/
const repeatComposer = makeModifierComposer(composers.REPEAT, ['repeat'], (_, meta, value) => ({
...meta,
repeat: validate(validators.ST_VAR_OR_POSITIVE_NUMBER, value, invalidInputMessage('repeat', 'Repeat')),
repeat: validate(validators.ST_VAR_OR_POSITIVE_NUMBER_NOT_ZERO, value, invalidInputMessage('repeat', 'Repeat')),
}));

module.exports = repeatComposer;
4 changes: 2 additions & 2 deletions lib/composers/requestMatchesComposer.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const processRequestArgs = makeArgumentsProcessor(
*/
({name, val, type = PROP_COMPARATOR.EQUAL}) => getRequestMatchItem(name, val, type),
objArg => 'name' in objArg && 'val' in objArg,
getRequestMatchItem
getRequestMatchItem,
);

const requestMatchesComposer = makeModifierComposer(
Expand All @@ -47,7 +47,7 @@ const requestMatchesComposer = makeModifierComposer(
invalidInputMessage('requestMatch', 'Header'),
),
},
})
}),
);

module.exports = requestMatchesComposer;
6 changes: 3 additions & 3 deletions lib/composers/responseMatchesComposer.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const processResponseArgs = makeArgumentsProcessor(
*/
({name, val, type = PROP_COMPARATOR.EQUAL}) => getResponseMatchComposers(name, val, type),
objArg => 'name' in objArg && 'val' in objArg,
getResponseMatchComposers
getResponseMatchComposers,
);

const responseMatchesComposer = makeModifierComposer(
Expand All @@ -45,10 +45,10 @@ const responseMatchesComposer = makeModifierComposer(
props: validation.validate(
validation.validators.RESPONSE_MATCHES,
processResponseArgs(args),
invalidInputMessage('responseMatch', 'Header')
invalidInputMessage('responseMatch', 'Header'),
),
},
})
}),
);

module.exports = responseMatchesComposer;
23 changes: 16 additions & 7 deletions lib/composers/swipeComposer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@ const {invalidInputMessage} = require('../texts');
/**
* Defines click method
*/
const swipeComposer = makeModifierComposer(composers.TAP, ['swipe', 'flick'], (_, meta, direction, distance, duration) => ({
...meta,
isSwipe: true,
direction: validate(validators.DIRECTIONS, direction, invalidInputMessage('swipe/flick', 'direction')),
distance: validate(validators.ST_VAR_OR_POSITIVE_NUMBER, distance, invalidInputMessage('swipe/flick', 'distance')),
duration: validate(validators.ST_VAR_OR_POSITIVE_NUMBER, duration, invalidInputMessage('swipe/flick', 'duration')),
}));
const swipeComposer = makeModifierComposer(
composers.TAP,
['swipe', 'flick'],
(_, meta, direction, distance, duration) => ({
...meta,
isSwipe: true,
direction: validate(validators.DIRECTIONS, direction, invalidInputMessage('swipe/flick', 'direction')),
distance: validate(
validators.ST_VAR_OR_POSITIVE_NUMBER, distance,
invalidInputMessage('swipe/flick', 'distance'),
),
duration: validate(
validators.ST_VAR_OR_POSITIVE_NUMBER, duration,
invalidInputMessage('swipe/flick', 'duration'),
),
}));

module.exports = swipeComposer;
4 changes: 2 additions & 2 deletions lib/constants/enviroment.js → lib/constants/environment.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const ENVIROMENT_VARS = Object.freeze({
const ENVIRONMENT_VARS = Object.freeze({
/**
* @description indicates that session is running as launcher child process, contains deviceId|configId|ipcPortNumber
*/
Expand All @@ -7,4 +7,4 @@ const ENVIROMENT_VARS = Object.freeze({
SUITEST_BE_SERVER: 'SUITEST_BE_SERVER',
});

module.exports = ENVIROMENT_VARS;
module.exports = ENVIRONMENT_VARS;
7 changes: 7 additions & 0 deletions lib/constants/keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ const KEY = {
SUBTRACT: '[[Subtract]]',
TAB: '[[Tab]]',
UP_ARROW: '[[Up arrow]]',
SEARCH: '[[Search]]',
DONE: '[[Done]]',
UP: '[[Up]]',
DOWN: '[[Down]]',
LEFT: '[[Left]]',
RIGHT: '[[Right]]',
OK: '[[Ok]]',
};

Object.freeze(KEY);
Expand Down
2 changes: 2 additions & 0 deletions lib/constants/screenOrientation.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable key-spacing */

const screenOrientation = {
PORTRAIT: 'portrait',
PORTRAIT_REVERSED: 'portraitReversed',
Expand Down
1 change: 1 addition & 0 deletions lib/constants/validationKeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const validationKeys = {
NON_EMPTY_STRING: Symbol('nonEmptyString'),
POSITIVE_NUMBER: Symbol('positiveNumber'),
ST_VAR_OR_POSITIVE_NUMBER: Symbol('stVarOrPositiveNumber'),
ST_VAR_OR_POSITIVE_NUMBER_NOT_ZERO: Symbol('stVarOrPositiveNumberNotZero'),
ST_VAR_OR_NUMBER: Symbol('stVarOrNumber'),
NON_EMPTY_STRING_OR_UNDEFINED: Symbol('nonEmptyStringOrUndefined'),
NON_EMPTY_STRING_OR_NUll: Symbol('nonEmptyStringOrNull'),
Expand Down
11 changes: 11 additions & 0 deletions lib/testLauncher/commands/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,21 @@ const builder = yargs => {
describe: 'Will launch user command with --inspect-brk execArgv, used for debugging',
global: false,
})
.option('override-config-file', {
describe: 'Specifies an additional config file which properties have precedence over properties in a standard configuration file.',
global: false,
type: 'string',
})
.option('base-config-file', {
describe: 'Path to a config file to override standard configuration files. Standard configuration files are ignored.',
global: false,
type: 'string',
})
.option('config-file', {
describe: texts.cliConfig(),
global: false,
type: 'string',
deprecate: 'Can have unexpected behaviour. Use --base-config-file or --override-config-file.',
})
.option('default-timeout', {
describe: texts.defaultTimeout(),
Expand Down
Loading

0 comments on commit c9317de

Please sign in to comment.