getMeta
Overview
Use the getMeta
command to retrieve metadata about the test.
If a key is specified, the command returns the value for that specific key. If the key is not specified, the command will return an object with all the metadata for the test.
To set values in the metadata, use the setMeta command.
info
This command is implemented within Testplane and is not available in the API WebDriverIO.
Usage
await browser.getMeta();
or
await browser.getMeta(key);
Command Parameters
Name | Type | Description |
key | String | Optional parameter. The key whose value needs to be retrieved from the test metadata. |
Usage Examples
it("should get meta info of test", async ({ browser }) => {
await browser.setMeta("foo", "bar");
await browser.url("/foo/bar?baz=qux");
const val = await browser.getMeta("foo");
console.log(val); // outputs: bar
const url = await browser.getMeta("url");
console.log(url); // outputs: /foo/bar?baz=qux
const meta = await browser.getMeta();
console.log(meta); // outputs: {foo: 'bar', url: '/foo/bar?baz=qux'}
});