npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sgapps.io-testing-platform

v1.1.17

Published

Testing Platform based on puppeteer and puppeteer-firefox. Offers possibility to define a scenario and run it under both browsers.

Downloads

12

Readme

🐙 SGApps.IO Testing Platform

Easy way to build testing scenarios

🐙 SGApps.IO Testing Platform

easy and intuitive functional testing based on puppeteer

Emulation mode

Testing Platform based on puppeteer and puppeteer-firefox it uses these modules for emulation part.

Offers possibility to define a scenario, if you want you may fork testing scenario and build another one

In single row you may run same testing scenario under different Browsers and environments.

  • 📳 Available emulation for 71 devices
  • You may run using Chrome 🌐 or Firefox Browsers 🦊
  • 🍽 You can fork a testing Scenario and make other with chages
  • Easily to use Expect and Assert functionalities.
  • You can easily create functionality groups and subgroups in your test
  • Support for working with file Inputs
  • 🆒 IntelliSense Support

Why to use, describing concept

Reason for creating this library was to build a very friendly environment for functional testing, that can be easily installed without additional configurations.

Concept is based building easy to read intuitive scenarios that can be understood by anyone.

When You have 2 Testing Scenarios that are the same under specific step, you can fork them on any step, and the fork represents a clone a scenario until that step.

Example

let Scenario = new TestScenario();

Scenario
	.isHeadLess(true)
	.isVerbose(false) // enable to view detailed step logs
	.getPage()
	.goto('http://google.com', { waitUntil: "domcontentloaded" })
	.wait(1000)
	.describe('Functionality Group')
		.goto('http://yahoo.com', { waitUntil: "domcontentloaded" })
		.wait(1000)
		.it(async (done, evaluate, assert, expect) => {
			let title = await evaluate('document.title');

			expect(title).to().be().a("string");

			assert.isNotNull(title);
			done();
		}, "Example of checking block » checking title")
		.goto('http://bing.com', { waitUntil: "domcontentloaded" })
		.wait(1000)
		.goto('http://jsdoc.app', { waitUntil: "domcontentloaded" })

		.describe('Functionality SubGroup')
			.goto('https://sgapps.io', { waitUntil: "domcontentloaded" })
			.wait(1000)
			.goto('https://github.com', { waitUntil: "domcontentloaded" })
			.wait(1000)
			.goto('https://npmjs.com', { waitUntil: "domcontentloaded" })
			.wait(1000)
		.describeClose()
		.wait(1000)
	.describeClose()
	.close();

ScreenShots

Testing multiple devices with same test scenario

Run Same Scenario on multiple devices

Testing in Verbose mode - view all steps

Run Same Scenario on multiple devices

Examples

API

Table of Contents

TestingScenario

Type: function ()


isHeadLess

Indicates if Browser should run in headless mode

Type: function (isHeadLess): TestingScenario

  • isHeadLess Boolean? if parameter is not passed function will return current isHeadLess value

isVerbose

Indicates if tests should run in verbose mode

Type: function (isVerbose, isHeadLess): TestingScenario

  • isVerbose
  • isHeadLess Boolean? if parameter is not passed function will return current isVerbose value

ScenarioName

Specify or get Current Scenario Name

Type: function (name): TestingScenario

  • name String? if parameter is not passed function will return current name

_getPage

Select from instance a page with specific index

Type: function (instance, index, PuppeteerInstance)

  • instance
  • index (Number | "next" | "prev" | String) Page's index or 'next', 'prev', 'last' or 'first' or pages label (optional, default (instance.currentPage._getLabelName||0))
  • PuppeteerInstance

getPage

Select from instance a page with specific index

Type: function (index): TestingScenario

  • index (Number | "next" | "prev" | String) Page's index or 'next', 'prev', 'last' or 'first' or pages label (optional, default (instance.currentPage._getLabelName||0))

setViewport

Applying specific viewport for device

Type: function (options): TestingScenario


goto

Opens an URL

Type: function (url, options): TestingScenario


wait

wait a priod of specified miliseconds

Type: function (timeMs): TestingScenario

  • timeMs Number number of miliseconds

pageEventWait

Wait until a page will reach an event

Type: function (eventName, handler): TestingScenario

  • eventName ("close" | "console" | "dialog" | "domcontentloaded" | "error" | "frameattached" | "framedetached" | "framenavigated" | "load" | "metrics" | "pageerror" | "popup" | "request" | "requestfailed" | "requestfinished" | "response" | "workercreated" | "workerdestroyed")
  • handler function (any): Promise? a function that can execute specific operations with data obtained on event

waitForFileChooser

add a files to input[type="file"] in instance's page

Type: function (files, selector): TestingScenario

  • files Array<String> list of file paths to be added to input
  • selector String CSS Selector used to identify input[type="file"]

waitForFunction

wait until browser will pageFunction will return true value

Type: function (pageFunction, options): TestingScenario


waitForNavigation

wait specific navigation state

Type: function (options): TestingScenario


waitForSelector

Wait for the selector to appear in page. If at the moment of calling the method the selector already exists, the method will return immediately. If the selector doesn't appear after the timeout milliseconds of waiting, the function will throw.

Type: function (selector, options): TestingScenario


waitForXPath

Wait for the xpath to appear in page. If at the moment of calling the method the xpath already exists, the method will return immediately. If the xpath doesn't appear after the timeout milliseconds of waiting, the function will throw.

Type: function (xpath, options): TestingScenario


userAgent

Handle User agent of instance

Type: function (handler): TestingScenario

  • handler function (userAgent): Promise if parameter is present will handle UserAgent value

clearPermissionOverrides

Clears all permission overrides for the browser context.

Type: function (): TestingScenario


overridePermissions

Override permissions for the browser context.

Type: function (origin, permissions): TestingScenario


pageClose

Close a page from instance

Type: function (options, index): TestingScenario


pageSetLabel

Set page label, for easier selecting using .getPage(label)

Type: function (label): TestingScenario

  • label String label that will be set on current page

pageReload

Close a page from instance

Type: function (index, options): TestingScenario


pageContent

Handle User agent of instance

Type: function (handler)

  • handler function (userAgent) if parameter is present will handle UserAgent value

clickOnSelector

This method fetches an element with selector, scrolls it into view if needed, and then uses page.mouse to click in the center of the element. If there's no element matching selector, the method throws an error.

Type: function (selector, options): TestingScenario


typeOnSelector

Sends a keydown, keypress/input, and keyup event for each character in the text.

Type: function (selector, text, options): TestingScenario

  • selector String A selector of an element to type into. If there are multiple elements satisfying the selector, the first will be used.
  • text String A text to type into a focused element.
  • options TestingScenarioTypeOnSelectorOptions Optional parameters

tapOnSelector

This method fetches an element with selector, scrolls it into view if needed, and then uses page.touchscreen to tap in the center of the element. If there's no element matching selector, the method throws an error.

Type: function (selector): TestingScenario

  • selector String A selector to search for element to tap. If there are multiple elements satisfying the selector, the first will be tapped.

focusOnSelector

This method fetches an element with selector and focuses it. If there's no element matching selector, the method throws an error.

Type: function (selector): TestingScenario

  • selector String A selector of an element to focus. If there are multiple elements satisfying the selector, the first will be focused.

hoverOnSelector

This method fetches an element with selector, scrolls it into view if needed, and then uses page.mouse to hover over the center of the element. If there's no element matching selector, the method throws an error.

Type: function (selector): TestingScenario

  • selector String A selector to search for element to hover. If there are multiple elements satisfying the selector, the first will be hovered.

evaluate

If the function passed to the page.evaluate returns a non-Serializable value, then page.evaluate resolves to undefined. DevTools Protocol also supports transferring some additional values that are not serializable by JSON: -0, NaN, Infinity, -Infinity, and bigint literals.

Type: function (pageFunction, handler, variables, meta): TestingScenario

  • pageFunction (function (Object): any | String) Function to be evaluated in the page context
  • handler function (result): Promise? function that receives serializable data from pageFunction
  • variables Object context passed to pageFunction (optional, default {})
  • meta

evaluateOnSelectorAll

If the function passed to the page.evaluate returns a non-Serializable value, then page.evaluate resolves to undefined. DevTools Protocol also supports transferring some additional values that are not serializable by JSON: -0, NaN, Infinity, -Infinity, and bigint literals.

Type: function (selector, pageFunction, handler, value): TestingScenario

  • selector String A selector for an selecting element
  • pageFunction (Function | String) Function to be evaluated in the page context
  • handler function (result): Promise? function that receives serializable data from pageFunction, this parameter can be skipped
  • value any? context passed to pageFunction

Examples:

Example usage of string pageFunction.

test.evaluateOnSelectorAll('a[href]', 'element.click()');

Example usage of string pageFunction with handler

test.evaluateOnSelectorAll('input[type="text"]', 'element.value', function (value) {
    console.log(value);
});

Example usage of string pageFunction and context

test.evaluateOnSelectorAll('input[type="email"]', 'element.value = value', '[email protected]');

Example usage of string pageFunction with handler and context

test.evaluateOnSelectorAll('input[type="checkbox"]', 'element.value = value; element.checked', function (isChecked) {
    console.log('isChecked')
} 'On');

Example usage of pageFunction.

test.evaluateOnSelectorAll('a[href]', function (element) { element.click() });

Example usage of pageFunction with handler

test.evaluateOnSelectorAll(
    'input[type="text"]',
    function (element) {
        return element.value;
    }, function (value) {
        console.log(value);
    }
);

Example usage of pageFunction and context

test.evaluateOnSelectorAll(
    'input[type="email"]',
    function (element, value) {
        element.value = value;
    },
    '[email protected]'
);

Example usage of pageFunction with handler and context

test.evaluateOnSelectorAll(
    'input[type="checkbox"]',
    function (element, value) {
        element.value = value;
        return element.checked;
    },
    function (isChecked) {
        console.log('isChecked');
    },
    'On'
);

evaluateOnSelectorOnlyOne

Similar with evaluateOnSelectorAll but throws an error if detected more than one element

Type: function (selector, pageFunction, handler, value): TestingScenario

  • selector String A selector for an selecting element
  • pageFunction (Function | String) Function to be evaluated in the page context
  • handler function (result): Promise? function that receives serializable data from pageFunction, this parameter can be skipped
  • value any? context passed to pageFunction

pageEmulate

Emulates specific configuration of device

Type: function (config): TestingScenario


message

Add a specific message to last operation

Type: function (message): TestingScenario


operationLabels

Add labels to operation

Type: function (labels): TestingScenario


operationLabelsRemove

Remove labels from operation

Type: function (labels): TestingScenario


deactivate

activate or deactivate operation by adding or removing operation label "__Deactivated"

Type: function (status): TestingScenario

  • status Boolean if status is true than operation will be deactivated

describe

Describe a section of testing scenario

Type: function (message): TestingScenario

  • message String the message that will describe the Scenario Section

describeClose

Close Describe section of testing scenario

Type: function (message): TestingScenario

  • message String message on succeed

group

Describe a group of testing scenario similar to TestingScenario.describe

Type: function (message): TestingScenario

  • message String the name of group the Scenario Section

groupClose

Close Group section of testing scenario

Type: function (message): TestingScenario

  • message String message on succeed

injectScenario

Inject other testing Scenario on specific step

Type: function (Scenario)


it

Assert some functionality from test

Type: function (handler, message): TestingScenario

Example:

test.goto('http://example.com')
   .describe('Testing Page')
       .describe('Testing Title')
           .it((done, evaluate, assert, expect) => {
               let title = evaluate('document.title');
               expect(title).to().be().eq('Page Title', 'default page title - message shown on error');
               done();
           })
       .describeClose()
       // check if using some browsers api
       .describe('Testing Title')
           .it(async (done, evaluate, assert, expect) => {
               let title = await evaluate(
                   () => {
                       return document.title
                   }
               );
               assert.isNotNull(title);
               done();
           })
       .describeClose()
   .describeClose()

fork

Timestamp The timestamp when the metrics sample was taken. Documents Number of documents in the page. Frames Number of frames in the page. JSEventListeners Number of events in the page. Nodes Number of DOM nodes in the page. LayoutCount Total number of full or partial page layout. RecalcStyleCount Total number of page style recalculations. LayoutDuration Combined durations of all page layouts. RecalcStyleDuration Combined duration of all page style recalculations. ScriptDuration Combined duration of JavaScript execution. TaskDuration Combined duration of all tasks performed by the browser. JSHeapUsedSize Used JavaScript heap size. JSHeapTotalSize Total JavaScript heap size.

Type: function ()


fork

Fork or Clone Testing Scenario

Type: function ()


close

Close device Instance

Type: function ()


run

Run your tests under specific environment

Type: function (device, device2, device3, device4, device5, device6, device7, device8, otherDevices, devices)


TestingScenarioSetViewportOptions

Type: Object

  • width Number? device width in pixels. Default value is 1920
  • height Number? device height in pixels. Default value is 1080
  • deviceScaleFactor Number? Device Scale Factor. Default value is 1
  • hasTouch Boolean? Emulate touch instead of click. Default value is false
  • isLandscape Boolean? is device in landscape mode. Default value is true
  • isMobile isMobile? is mobile device. Default value is false

TestingScenarioGotoOptions

Type: Object

  • waitUntil ("load" | "domcontentloaded" | "networkidle0" | "networkidle2")? When to consider navigation succeeded, defaults to 'load'. Given an array of event strings, navigation is considered to be successful after all events have been fired. Default value is 'domcontentloaded'
  • timeout Number? Maximum navigation time in milliseconds, defaults to 30 seconds, pass 0 to disable timeout. The default value can be changed by using the page.setDefaultNavigationTimeout(timeout) or page.setDefaultTimeout(timeout) methods. Default value is 30
  • referer String? Referer header value. If provided it will take preference over the referer header value set by page.setExtraHTTPHeaders().

TestingScenarioWaitForFunctionOptions

Type: Object

  • polling ("raf" | "polling" | "mutation")? An interval at which the pageFunction is executed, defaults to 'raf'. If polling is a number, then it is treated as an interval in milliseconds at which the function would be executed. If polling is a string, then it can be one of the following values:- raf - to constantly execute pageFunction in requestAnimationFrame callback. This is the tightest polling mode which is suitable to observe styling changes.
    • mutation - to execute pageFunction on every DOM mutation.
  • timeout Number? maximum time to wait for in milliseconds, Defaults to 30000 (30 seconds). Pass 0 to disable timeout.

TestingScenarioWaitForNavigationOptions

Type: Object

  • waitUntil ("load" | "domcontentloaded" | "networkidle0" | "networkidle2")? When to consider navigation succeeded, defaults to 'load'. Given an array of event strings, navigation is considered to be successful after all events have been fired. Events can be either:- load - consider navigation to be finished when the load event is fired.
    • domcontentloaded - consider navigation to be finished when the DOMContentLoaded event is fired.
    • networkidle0 - consider navigation to be finished when there are no more than 0 network connections for at least 500 ms.
    • networkidle2 - consider navigation to be finished when there are no more than 2 network connections for at least 500 ms.
  • timeout Number? maximum time to wait for in milliseconds, Defaults to 30000 (30 seconds). Pass 0 to disable timeout.

TestingScenarioWaitForSelectorOptions

Type: Object

  • visible Boolean? wait for element to be present in DOM and to be visible, i.e. to not have display: none or visibility: hidden CSS properties. Defaults to false.
  • hidden Boolean? wait for element to not be found in the DOM or to be hidden, i.e. have display: none or visibility: hidden CSS properties. Defaults to false.
  • timeout Number? maximum time to wait for in milliseconds, Defaults to 30000 (30 seconds). Pass 0 to disable timeout.

TestingScenarioWaitForXPathOptions

Type: Object

  • visible Boolean? wait for element to be present in DOM and to be visible, i.e. to not have display: none or visibility: hidden CSS properties. Defaults to false.
  • hidden Boolean? wait for element to not be found in the DOM or to be hidden, i.e. have display: none or visibility: hidden CSS properties. Defaults to false.
  • timeout Number? maximum time to wait for in milliseconds, Defaults to 30000 (30 seconds). Pass 0 to disable timeout.

TestingScenarioInstancePermissions

Type: ("geolocation" | "midi" | "midi-sysex" | "notifications" | "push" | "camera" | "microphone" | "background-sync" | "ambient-light-sensor" | "accelerometer" | "gyroscope" | "magnetometer" | "accessibility-events" | "clipboard-read" | "clipboard-write" | "payment-handler")


TestingScenarioPageCloseOptions

Type: Object

  • runBeforeUnload Boolean Defaults to false. Whether to run the before unload page handlers.

TestingScenarioPageReloadOptions

Type: Object

  • timeout Number Maximum navigation time in milliseconds, defaults to 30 seconds, pass 0 to disable timeout.
  • waitUntil (TestingScenarioPageReloadOptionsWaitUntil | Array<TestingScenarioPageReloadOptionsWaitUntil>) When to consider navigation succeeded, defaults to load. Given an array of event strings, navigation is considered to be successful after all events have been fired. Events can be either:- load - consider navigation to be finished when the load event is fired.
    • domcontentloaded - consider navigation to be finished when the DOMContentLoaded event is fired.
    • networkidle0 - consider navigation to be finished when there are no more than 0 network connections for at least 500 ms.
    • networkidle2 - consider navigation to be finished when there are no more than 2 network connections for at least 500 ms.

TestingScenarioPageReloadOptionsWaitUntil

When to consider navigation succeeded, defaults to load. Given an array of event strings, navigation is considered to be successful after all events have been fired. Events can be either:

  • load - consider navigation to be finished when the load event is fired.
  • domcontentloaded - consider navigation to be finished when the DOMContentLoaded event is fired.
  • networkidle0 - consider navigation to be finished when there are no more than 0 network connections for at least 500 ms.
  • networkidle2 - consider navigation to be finished when there are no more than 2 network connections for at least 500 ms.

Type: ("load" | "domcontentloaded" | "networkidle0" | "networkidle2")


TestingScenarioClickOnSelectorOptions

Type: Object

  • button ("left" | "right" | "middle") Defaults to left.
  • clickCount Number defaults to 1.
  • delay Number Time to wait between mousedown and mouseup in milliseconds. Defaults to 0.

TestingScenarioTypeOnSelectorOptions

Type: Object

  • delay Number Time to wait between key presses in milliseconds. Defaults to 0.

TestingScenarioPageEmulateConfigViewport

Type: Object

  • width Number page width in pixels.
  • height Number page height in pixels.
  • deviceScaleFactor Number Specify device scale factor (can be thought of as dpr). Defaults to 1.
  • isMobile Boolean Whether the meta viewport tag is taken into account. Defaults to false.
  • hasTouch Boolean Specifies if viewport supports touch events. Defaults to false
  • isLandscape Boolean Specifies if viewport is in landscape mode. Defaults to false.

TestingScenarioPageEmulateDeviceName

Type: ("Blackberry PlayBook" | "Blackberry PlayBook landscape" | "BlackBerry Z30" | "BlackBerry Z30 landscape" | "Galaxy Note 3" | "Galaxy Note 3 landscape" | "Galaxy Note II" | "Galaxy Note II landscape" | "Galaxy S III" | "Galaxy S III landscape" | "Galaxy S5" | "Galaxy S5 landscape" | "iPad" | "iPad landscape" | "iPad Mini" | "iPad Mini landscape" | "iPad Pro" | "iPad Pro landscape" | "iPhone 4" | "iPhone 4 landscape" | "iPhone 5" | "iPhone 5 landscape" | "iPhone 6" | "iPhone 6 landscape" | "iPhone 6 Plus" | "iPhone 6 Plus landscape" | "iPhone 7" | "iPhone 7 landscape" | "iPhone 7 Plus" | "iPhone 7 Plus landscape" | "iPhone 8" | "iPhone 8 landscape" | "iPhone 8 Plus" | "iPhone 8 Plus landscape" | "iPhone SE" | "iPhone SE landscape" | "iPhone X" | "iPhone X landscape" | "iPhone XR" | "iPhone XR landscape" | "JioPhone 2" | "JioPhone 2 landscape" | "Kindle Fire HDX" | "Kindle Fire HDX landscape" | "LG Optimus L70" | "LG Optimus L70 landscape" | "Microsoft Lumia 550" | "Microsoft Lumia 950" | "Microsoft Lumia 950 landscape" | "Nexus 10" | "Nexus 10 landscape" | "Nexus 4" | "Nexus 4 landscape" | "Nexus 5" | "Nexus 5 landscape" | "Nexus 5X" | "Nexus 5X landscape" | "Nexus 6" | "Nexus 6 landscape" | "Nexus 6P" | "Nexus 6P landscape" | "Nexus 7" | "Nexus 7 landscape" | "Nokia Lumia 520" | "Nokia Lumia 520 landscape" | "Nokia N9" | "Nokia N9 landscape" | "Pixel 2" | "Pixel 2 landscape" | "Pixel 2 XL" | "Pixel 2 XL landscape")


TestingScenarioPageEmulateDeviceConfig

Type: Object


TestingScenarioPageEmulateCallbackResult

Type: Object


TestingScenarioPageEmulateCallback

Type: Function


TestingScenarioPageEmulateDeviceConfigOptions

Type: Object

  • ignoreHTTPSErrors boolean Whether to ignore HTTPS errors during navigation. Defaults to false.
  • headless boolean Whether to run browser in headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). Defaults to true unless the devtools option is true.
  • executablePath string Path to a Chromium or Chrome executable to run instead of the bundled Chromium. If executablePath is a relative path, then it is resolved relative to current working directory.
  • slowMo number Slows down Puppeteer operations by the specified amount of milliseconds. Useful so that you can see what is going on.
  • defaultViewport TestingScenarioSetViewportOptions Sets a consistent viewport for each page. Defaults to an 800x600 viewport. null disables the default viewport.
  • args Array<String> Additional arguments to pass to the browser instance. The list of Chromium flags can be found here.
  • ignoreDefaultArgs (boolean | Array<String>) If true, then do not use puppeteer.defaultArgs(). If an array is given, then filter out the given default arguments. Dangerous option; use with care. Defaults to false.
  • handleSIGINT boolean Close the browser process on Ctrl-C. Defaults to true.
  • handleSIGTERM boolean Close the browser process on SIGTERM. Defaults to true.
  • handleSIGHUP boolean Close the browser process on SIGHUP. Defaults to true.
  • timeout number Maximum time in milliseconds to wait for the browser instance to start. Defaults to 30000 (30 seconds). Pass 0 to disable timeout.
  • dumpio boolean Whether to pipe the browser process stdout and stderr into process.stdout and process.stderr. Defaults to false.
  • userDataDir string Path to a User Data Directory.
  • env Object Specify environment variables that will be visible to the browser. Defaults to process.env.
  • devtools boolean Whether to auto-open a DevTools panel for each tab. If this option is true, the headless option will be set false.
  • pipe boolean Connects to the browser over a pipe instead of a WebSocket. Defaults to false.

TestingScenarioPageEmulateConfig

Type: Object


TestingScenarioItHandlerCallback

Type: Function

  • done Function function that should be executed when check id done
  • evaluate Function function executed in Browser's context that return an result

assert

Type: function (expectValue, value, message, isNegated, comparingFunction)

  • expectValue any
  • value any
  • message String
  • isNegated
  • comparingFunction

expect

Type: function (value)

  • value any

to

Type: function (): expectTo


expectTo

Type: function (value)

  • value

be

Type: function (): expectToBe


expectToBe

Type: function (value)

  • value

ExpectedType

Type: ("string" | "number" | "boolean" | "function" | "object" | "array" | "null" | "NaN" | "NUMBER_FINITE" | "NUMBER_SAFE_INTEGER" | "INFINITY" | "POSITIVE_INFINITY" | "NEGATIVE_INFINITY")


Expect.to.be.a


Expect.to.be.notA


Expect.to.be.instanceOf

  • instanceType (Object | Error | any)
  • message String what to show wen conditions are not meet

expectValueDescribe

Type: function (value)

  • value

TestingScenario

Type: function ()


_getPage

Select from instance a page with specific index

Type: function (instance, index, PuppeteerInstance)

  • instance
  • index (Number | "next" | "prev" | String) Page's index or 'next', 'prev', 'last' or 'first' or pages label (optional, default (instance.currentPage._getLabelName||0))
  • PuppeteerInstance

getPage

Select from instance a page with specific index

Type: function (index): TestingScenario

  • index (Number | "next" | "prev" | String) Page's index or 'next', 'prev', 'last' or 'first' or pages label (optional, default (instance.currentPage._getLabelName||0))

setViewport

Type: function (options)

  • options

  • width Number? device width in pixels

  • height Number? device height in pixels

  • deviceScaleFactor Number? Device Scale Factor

  • hasTouch Boolean? Emulate touch instead of click

  • isLandscape Boolean? is device in landscape mode

  • isMobile isMobile? is mobile device


setViewport

Applying specific viewport for device

Type: function (options): TestingScenario

  • options TestingScenarioSetViewportOptions

goto

Type: function (url, options)

  • url

  • options

  • waitUntil ("load" | "domcontentloaded" | "networkidle0" | "networkidle2")? When to consider navigation succeeded, defaults to 'load'. Given an array of event strings, navigation is considered to be successful after all events have been fired. Events can be either:

  • timeout Number? Maximum navigation time in milliseconds, defaults to 30 seconds, pass 0 to disable timeout. The default value can be changed by using the page.setDefaultNavigationTimeout(timeout) or page.setDefaultTimeout(timeout) methods.

  • referer String? Referer header value. If provided it will take preference over the referer header value set by page.setExtraHTTPHeaders().


goto

Opens an URL

Type: function (url, options): TestingScenario

  • url String URL to navigate page to. The url should include scheme, e.g. https://.
  • options TestingScenarioGotoOptions? Navigation parameters

wait

wait a priod of specified miliseconds

Type: function (timeMs): TestingScenario

  • timeMs Number number of miliseconds

pageEventWait

Wait until a page will reach an event

Type: function (eventName, handler): TestingScenario

  • eventName ("close" | "console" | "dialog" | "domcontentloaded" | "error" | "frameattached" | "framedetached" | "framenavigated" | "load" | "metrics" | "pageerror" | "popup" | "request" | "requestfailed" | "requestfinished" | "response" | "workercreated" | "workerdestroyed")
  • handler function (any): Promise? a function that can execute specific operations with data obtained on event

waitForFileChooser

add a files to input[type="file"] in instance's page

Type: function (files, selector): TestingScenario

  • files Array<String> list of file paths to be added to input
  • selector String CSS Selector used to identify input[type="file"]

[waitForFunction](https://labs.sgapps.io/open-source/sgapps.io-testing-platform/blob/70c60bbbc