setBatch method

Class: EyesPlatform: PlaywrightLanguage: JavaScript SDK:

Use this method to set the batch information for this test.

In the Test Manager, all the results of tests that were executed as a single batch are displayed together and can be managed and operated on as a group. See How to organize your tests with batches and How to group tests into batches using the SDK for details and an example.

Syntax

eyes.setBatch(batch);
eyes.setBatch(name, id, startedAt_date);
eyes.setBatch(name, id);
eyes.setBatch(name);
eyes.setBatch(name, id, startedAt_str);

Parameters

batch
Type:BatchInfoPlain
An object of the class BatchInfo that describes the batch.
name
Type:string
The batch name. It may be any string.
id
Type:string [Optional ]
If the first parameter is a batch name string (and not a BatchInfo object), then the value passed for this parameter will be used as the id of the created object. All tests that have the same batch ID will appear in the Test results in the same batch. If the value is a falsy value or is not passed and the environment variable APPLITOOLS_BATCH_ID is defined, then the value of the environment variable will be used as the ID. Otherwise, an internal id will be generated.
startedAt_date
Type:Date [Optional ]

If the value is a falsey value or is not passed, then the current date and time will be used.

The start date/time as a JavaScript Date object

startedAt_str
Type:string [Optional ]

If the value is a falsey value or is not passed, then the current date and time will be used.

The value passed must be a string that represents the date/time in the same format as Date().toUTCString().

Return value

Type: void

Remarks

Call this method once before the calls to the open method for all tests that are supposed to be part of this batch.