If using Chrome, then chromedriver must be installed. Otherwise, the browser’s driver of your choice must be installed.
Currently only Chrome and Edge are supported, but adding an additional browser is trivial. The following code adds the Edge browser. Any Edge-specific options can be configured here such as arguments to be passed to the driver.
export class Edge extends Browser {
public constructor(options?: BrowserOptions) {
super('edge', options);
}
}
npm i --save-dev automark
cd automark && npm install
- You can find a sample project that uses the framework here.
- The following is an example of how to design a test. It’s using Mocha and Chai, but you can use any testing frameworks you want.
import {should} from "chai";
import {Browser} from "../../src/lib/utils/browsers/browser";
import {Chrome} from "../../src/lib/utils/browsers/chrome";
import {config} from "../../main";
import {FacebookLoginPage} from "../../src/pages/FacebookLoginPage";
describe("Browser Tests", function () {
let browser: Browser;
this.timeout(config.timeout);
before(async function () {
browser = new Chrome();
should();
});
it.only("Facebook", async function () {
const loginPage: FacebookLoginPage = new FacebookLoginPage(browser);
await browser.navigate(FacebookLoginPage.URL);
await browser.waitUntilPageHasLoaded(FacebookLoginPage);
await loginPage.login("username", "pw");
});
after(async () => {
await browser.quit();
});
});