- index
- master
- reporter
- ConsoleReporter
- FileReporter
- Reporter
- SpinnerReporter
- scriptwriter
- ScenariosHandler
- ScenariosHandler
- Config
- helpers
- AbstractAction
- ActionsHandler
- ActionsHelper
- BackAction
- ClickAction
- TypeAction
- KNOWN_FATAL_ERROR_MESSAGES
- Browser
- tester
- messanger
- Runner
- DefinedScenarios
- FailingScenarios
- RandomScenarios
- ScenariosHelper
Sets up a QApe run
configOverride
Initializes all QApe workers and handles their communication.
cluster
clusterconfig
Object
Initializes reporter worker. It handles all the test results and the distribution to all defined reporters.
config
Object
src/reporter/reporter/ConsoleReporter.js:7-115
Extends EventEmitter
Console reporter
config
Object
src/reporter/reporter/ConsoleReporter.js:26-28
Handler for scenario:start event
eventData
Object
src/reporter/reporter/ConsoleReporter.js:34-43
Handler for scenario:end event
eventData
Object
src/reporter/reporter/ConsoleReporter.js:49-51
Handler for runner:error event
eventData
Object
src/reporter/reporter/ConsoleReporter.js:57-70
Handler for scenario:end of type 'defined'
-
eventData
ObjecteventData.name
eventData.results
src/reporter/reporter/ConsoleReporter.js:76-82
Handler for scenario:end of type 'failing'
-
eventData
ObjecteventData.minified
eventData.scenario
eventData.errors
src/reporter/reporter/ConsoleReporter.js:88-99
Handler for scenario:end of type 'random'
-
eventData
ObjecteventData.results
src/reporter/reporter/ConsoleReporter.js:107-114
Logs scenario to console
src/reporter/reporter/FileReporter.js:11-104
Extends EventEmitter
Default reporter
config
Object
src/reporter/reporter/FileReporter.js:29-33
Handler for scenario:end event
eventData
Object
src/reporter/reporter/FileReporter.js:39-47
Handler for scenario:end of type 'failing'
-
eventData
ObjecteventData.minified
eventData.scenario
eventData.errors
src/reporter/reporter/FileReporter.js:55-73
Logs scenario to file
src/reporter/reporter/FileReporter.js:81-95
Generates scenario name from current date
extension
string? This string will be added to the end of the name (optional, default''
)
Returns string
src/reporter/reporter/FileReporter.js:101-103
Checks if provided scenario is already reported
scenario
Returns boolean
src/reporter/reporter/Reporter.js:9-94
Extends EventEmitter
Base Reporter distributing events to all defined reporters
config
Object
src/reporter/reporter/Reporter.js:24-52
Initializes all reporters defined in config
src/reporter/reporter/Reporter.js:60-68
Emits an event with data and propagets it to all reporters
src/reporter/reporter/Reporter.js:74-79
Initializes a reporter from string
reporter
string
src/reporter/reporter/Reporter.js:85-93
Initializes a reporter from a class constructor
Reporter
Class
src/reporter/reporter/SpinnerReporter.js:10-58
Extends EventEmitter
Default reporter
src/reporter/reporter/SpinnerReporter.js:38-48
Handler for events which should cause a spin
src/scriptwriter/index.js:11-27
src/scriptwriter/index.js:11-27
Initializes a scriptwriter worker. It handles scenarios distribution to the testers.
config
Object
src/scriptwriter/scenarios/ScenariosHandler.js:8-131
Handles scenarios execution order
config
Object
src/scriptwriter/scenarios/ScenariosHandler.js:26-31
Initializes default values and loads defined scenarios
src/tester/scenarios/ScenariosHandler.js:33-40
Initializes all dependencies
Returns ScenariosHandler
src/scriptwriter/scenarios/ScenariosHandler.js:40-63
Returns available scenario with highest priority
- FailingScenario
- DefinedScenario
- RandomScenario (if allowed by config)
Returns Object
src/scriptwriter/scenarios/ScenariosHandler.js:73-83
Checks if new random scenarios are allowed based on configuration
Returns boolean
src/scriptwriter/scenarios/ScenariosHandler.js:88-101
Loads all user defined scenarios specified in config
src/scriptwriter/scenarios/ScenariosHandler.js:108-116
Loads a scenario from specified scenarioPath
scenarioPath
string
Returns Object scenario
src/scriptwriter/scenarios/ScenariosHandler.js:122-130
Loads a start url for scenario from specified url paths
Returns string start url
src/tester/scenarios/ScenariosHandler.js:10-53
Handles scenarios execution and initializes necessary dependencies
config
ObjectactionsHandler
ActionsHandler
src/scriptwriter/scenarios/ScenariosHandler.js:26-31
Initializes default values and loads defined scenarios
src/tester/scenarios/ScenariosHandler.js:33-40
Initializes all dependencies
Returns ScenariosHandler
src/scriptwriter/scenarios/ScenariosHandler.js:40-63
Returns available scenario with highest priority
- FailingScenario
- DefinedScenario
- RandomScenario (if allowed by config)
Returns Object
src/scriptwriter/scenarios/ScenariosHandler.js:73-83
Checks if new random scenarios are allowed based on configuration
Returns boolean
src/scriptwriter/scenarios/ScenariosHandler.js:88-101
Loads all user defined scenarios specified in config
src/scriptwriter/scenarios/ScenariosHandler.js:108-116
Loads a scenario from specified scenarioPath
scenarioPath
string
Returns Object scenario
src/scriptwriter/scenarios/ScenariosHandler.js:122-130
Loads a start url for scenario from specified url paths
Returns string start url
src/shared/config/Config.js:8-67
Class that can parse configuration with default values.
src/shared/config/Config.js:13-31
Loads configuration with default values
userConfig
Object? Overrides for default config
src/shared/config/Config.js:43-53
If url is configured with url path (https://www.example.com/index.html),
then this method splits the configuration into url
and urlPaths
.
config
Object
Following config
`{ url: 'https://www.example.com/index.html' }`
would be transformed into the following config
`{ url: 'https://www.example.com', urlPaths: ['/index.html'] }`
src/shared/config/Config.js:59-66
Overrides preview mode configurations
config
Object
Gets a random element from the array
array
Array
Returns any Element from the array
Formats number to specified number of digits
Returns string Number prefixed with ${digits} of zeros
src/tester/actions/AbstractAction.js:8-257
Abstract action class which should be extended with specific action classes. Each class has to have static getter id and method action.
config
ObjectactionsHelper
ActionsHelperactionConfig
Object (optional, default{}
)
src/tester/actions/AbstractAction.js:49-51
Overridable method returning a promise, that should resolve when action was successfull and reject when not.
src/tester/actions/AbstractAction.js:58-60
Override if you need to update action config, or message
results
Object Current results without your updates
Returns Promise<Object> Updated results with your overrides
src/tester/actions/AbstractAction.js:68-91
Prepares action error handler and executes action lifecycle
element
puppeteer.ElementHandleinstance
Object Browser instance
Returns Object results
src/tester/actions/AbstractAction.js:97-99
Override with specific action method, which is executed during AbstractAction.execute()
src/tester/actions/AbstractAction.js:111-127
Executes action lifecycle:
- Executes before action scripts (AbstractAction._beforeActionExecute)
- Executes the action and emits 'action:error' event for any error it throws
- Evaluates the action success
- Executes after action scripts (AbstractAction._afterActionExecute)
element
puppeteer.ElementHandleinstance
Browser
Returns Promise Resolves when lifecycle is finished
src/tester/actions/AbstractAction.js:133-139
Distributes action execution error
-
error
Errorerror.stack
src/tester/actions/AbstractAction.js:154-175
Executes after action scripts
- Executes config.beforeActionScript
- Clears all tabs and windows except for the original one
- If the current url is not part of the tested website, then page.goBack() is called
- Waits for time specified in config.afterActionWaitTime so all scripts are evaluated
and no more errors will occure before next action
- Saves afterLocation to results, which is url after the action was executed
- Reports event 'action:end'
element
puppeteer.ElementHandleinstance
Browser
Returns Promise Resolves when after action is done
src/tester/actions/AbstractAction.js:185-195
Executes before action scripts
- Saves beforeLocation to results, which is url before the action was executed
- Executes config.beforeActionScript
- Reports event 'action:start'
instance
Browser
Returns Promise Resolves when before action is done
src/tester/actions/AbstractAction.js:201-206
Adds the error to action results
error
string
src/tester/actions/AbstractAction.js:213-218
Clears all browser tabs except for the tab at index 0
browser
puppeteer.Browser
Returns Promise Resolves when the tabs are closed
src/tester/actions/AbstractAction.js:226-230
Adds an event listener and registers it to
target
EventListener Event listener instanceevent
string Name of the eventfn
Function Function evaluated on event call
src/tester/actions/AbstractAction.js:235-241
Clears all registered event listeners
src/tester/actions/AbstractAction.js:248-256
Adds action info to the results
element
puppeteer.ElementHandle
Returns Promise Resolves when action info is saved
src/tester/actions/AbstractAction.js:12-14
Override with action identifier
src/tester/actions/AbstractAction.js:19-23
Override with method returning true, when the action should be available for the specified element
src/tester/actions/ActionsHandler.js:9-152
Actions handler which can work with specific actions.
config
Object
src/tester/actions/ActionsHandler.js:25-30
Initializes actions handler dependencies
Returns ActionsHandler this
src/tester/actions/ActionsHandler.js:39-57
Executes specific, or random action
Returns Promise<Object> Resolves with action results
src/tester/actions/ActionsHandler.js:66-87
Gets random or specific action
Returns Object { Action, element }
src/tester/actions/ActionsHandler.js:92-94
Initializes actions helper
src/tester/actions/ActionsHandler.js:99-124
Loads all defined actions
src/tester/actions/ActionsHandler.js:132-151
Returns Promise<Array<Object>> Returns array of objects with keys Action and element, which are all available page actions
src/tester/actions/ActionsHelper.js:4-134
Useful helpers that can be used by any action
config
Object
src/tester/actions/ActionsHelper.js:21-41
Resolves when page readyState equals to one of specified states. If the states are not equal after specified timeout, error is thrown.
-
page
puppeteer.Page -
options
Object?
src/tester/actions/ActionsHelper.js:48-68
Searches for all visible elements in DOM
page
puppeteer.Page
Returns Promise<Array<puppeteer.ElementHandle>> Array of elements
src/tester/actions/ActionsHelper.js:76-78
Searches for an element based on action configuration
page
puppeteer.PageactionConfig
Object (optional, default{}
)
Returns Promise<puppeteer.ElementHandle> element
src/tester/actions/ActionsHelper.js:85-89
Creates a selector for the element
element
puppeteer.ElementHandle
Returns Promise<string> selector
src/tester/actions/ActionsHelper.js:96-114
Highlights the element in the dom by adding some styles
element
puppeteer.ElementHandle
Returns Promise Resolves when element highlight is started
src/tester/actions/ActionsHelper.js:120-124
element
puppeteer.ElementHandle
Returns Promise<string> element.outerHTML
src/tester/actions/ActionsHelper.js:131-133
Checks if an element is visible
element
puppeteer.ElementHandle
Returns Promise<boolean> true if an element is visible
src/tester/actions/BackAction.js:9-51
Extends AbstractAction
Back action, which will click on random or specific (if actionConfig is passed) page element
src/tester/actions/BackAction.js:33-39
Performs the back action on document
element
puppeteer.ElementHandlepage
puppeteer.Page
Returns Promise Resolves when back event is done
src/tester/actions/BackAction.js:46-50
Adds clicked element info to the action results
results
Object
Returns Object
src/tester/actions/BackAction.js:13-15
Returns string 'back'
src/tester/actions/BackAction.js:21-25
Back action should be always possible
element
page
Returns boolean true
src/tester/actions/ClickAction.js:8-55
Extends AbstractAction
Click action, which will click on random or specific (if actionConfig is passed) page element
src/tester/actions/ClickAction.js:34-43
Performs the click action with following wrappers:
- Hover over the element
(So that in preview mode, you will see the element before click)
- Signal click on the element (Only in headfull mode)
- Click on the element
element
puppeteer.ElementHandlepage
puppeteer.Page
Returns Promise Resolves when click is done
src/tester/actions/ClickAction.js:50-54
Adds clicked element info to the action results
results
Object
Returns Object
src/tester/actions/ClickAction.js:12-14
Returns string 'click'
src/tester/actions/ClickAction.js:20-22
Click action should be always possible
Returns boolean true
src/tester/actions/TypeAction.js:11-88
Extends AbstractAction
Type action, which will type a random text into a random input element. Or a specific text into a specific element, when actionsConfig is specified.
src/tester/actions/TypeAction.js:52-63
Performs the type action with following wrappers:
- Hover over the element
(So that in preview mode, you will see the element before typing)
- Highlight the element (Only in headfull mode)
- Type the configured or random text into the element
element
puppeteer.ElementHandlepage
puppeteer.Page
Returns Promise Resolves when typing is done
src/tester/actions/TypeAction.js:69-75
Returns string Text from action config, or random string the list of available texts
src/tester/actions/TypeAction.js:82-87
Adds info to the action results
results
Object
Returns Object
src/tester/actions/TypeAction.js:15-17
Returns string 'type'
src/tester/actions/TypeAction.js:24-40
Checks if an elements is a typable input or textarea
element
puppeteer.ElementHandle
Returns boolean
src/tester/browser/Browser.js:8-10
These errors will not cause test run to exit as failrue
src/tester/browser/Browser.js:15-168
Browser instance
config
Object
src/tester/browser/Browser.js:34-36
Returns puppeteer.Browser
src/tester/browser/Browser.js:41-43
Returns puppeteer.Page
src/tester/browser/Browser.js:53-55
Page error handler recieves 'page-error' event whenever an error occures on the page. Action should add listener to this handler and listen to the 'page-error' event to see if the action caused an error on the page.
Returns Function
src/tester/browser/Browser.js:60-62
Test run with execution error will fail only when unknown execution error occured
src/tester/browser/Browser.js:68-77
Initializes browser instance
src/tester/browser/Browser.js:83-87
Clears browser instance
Returns Promise Resolves when the instance is cleared
src/tester/browser/Browser.js:96-110
Gets browser instance from puppeteer. If there is a config.browserWebSocketEndpoint set, it will connect to remote chrome instance, otherwise it will create new instance locally
Returns Promise<puppeteer.Browser>
src/tester/browser/Browser.js:118-134
Whenever a page error occures, there is a strong possibility, that QApe tester is in inconsistent state. So it will try to clear the instance and wait for the new test run.
src/tester/browser/Browser.js:140-146
Sets unknown execution error indicator
error
Object
src/tester/browser/Browser.js:153-160
Initializes pageErrorHandler, exposes it to the page instance and loads config.pageErrorHandler
Returns Promise Resolves when handler is initialized
src/tester/browser/Browser.js:165-167
Returns EventEmitter
Initializes a tester worker. It handles the test execution.
config
Object
Returns Runner
Sends a message to the reporter
eventName
stringeventData
any
Requests a scenario from the scripwriter
Returns Promise<Object> Resolves with scenario, or an empty object
Sends a failing scenario to the scripwriter
scenario
Object
QApe runner class which sets up the whole test run.
config
Object
Initializes all dependencies and starts all parallel instances.
Returns Promise Resolves for successful run, rejects for failure
Starts single test instance with all dependencies
Returns Promise
Initializes browser instance
Returns Browser instance
Initializes all runner dependencies
Initializes ActionsHandler instance
Initializes ScenariosHandler instance
src/tester/scenarios/DefinedScenarios.js:8-55
Defined scenarios are saved scenarios from previous runs, or manually created. They are executed with higher priority, than random scenarios.
config
ObjectscenariosHelper
ScenariosHelper
src/tester/scenarios/DefinedScenarios.js:23-25
Specifies scenario type name
Returns string 'defined'
src/tester/scenarios/DefinedScenarios.js:33-54
Runs a scenario defined by the user.
Returns Promise
src/tester/scenarios/FailingScenarios.js:8-112
FailingScenarios is initialized, when page error occured. It tries to reproduce the error and tell you the exact steps, how to do that.
config
ObjectscenariosHelper
ScenariosHelper
src/tester/scenarios/FailingScenarios.js:23-25
Specifies scenario type name
Returns string 'failing'
src/tester/scenarios/FailingScenarios.js:35-74
Runs a scenario, which tries to reproduce an error from the random/defined scenario with minimal number of steps.
Returns Promise
src/tester/scenarios/FailingScenarios.js:81-87
scenarioLength
number
Returns number Allowed number of actions from history to reproduce the error based on scenario length and config.
src/tester/scenarios/FailingScenarios.js:96-111
Removes scenario actions, that are not necessary to reproduce the error
Returns Object Minified scenario reproducing the error
src/tester/scenarios/RandomScenarios.js:8-104
Random scenarios are default types of scenarios executed whenever there is nothing else to execute. They randomly click on the website and search for errors.
config
ObjectactionsHandler
ActionsHandlerreporter
Reporter
src/tester/scenarios/RandomScenarios.js:26-28
Specifies scenario type name
Returns string 'random'
src/tester/scenarios/RandomScenarios.js:38-61
Executes a random scenario performing actions on random page elements and trying to produce some page errors.
Returns Promise<Object> results
src/tester/scenarios/RandomScenarios.js:68-103
Performs random actions on the instance
instance
Browser
Returns Promise<Object> results
src/tester/scenarios/ScenariosHelper.js:4-68
Scenarios helpers
config
ObjectactionsHandler
ActionsHandler
src/tester/scenarios/ScenariosHelper.js:21-67
Executes specified scenario