afterAll
Overview
This parameter is a hook. The function specified for this parameter will be automatically called after tests are completed.
The context of the function is the Testplane config. Also function receive config in arguments.
Usage Example
Here is an example of suing this hook for logout.
testplane.config.ts
import { launchBrowser } from "testplane/unstable";
export default {
// ...
browsers: {
chrome: {
headless: true,
desiredCapabilities: {
webSocketUrl: true,
browserName: "chrome",
},
},
firefox: {
headless: true,
desiredCapabilities: {
webSocketUrl: true,
browserName: "firefox",
},
},
},
afterAll: async () => {
// launch a new browser with existing config
const browser = await launchBrowser(this.config.browsers.chrome);
await browser.url("https://example.com");
// login using saved state
await browser.restoreState({
path: "./dump.json",
});
// do logout things (press logout button etc.)
await browser.deleteSession();
},
};