automark
v1.3.0
Published
An end-to-end testing library using selenium and a Page Object Model (POM) design pattern.
Downloads
6
Readme
Dependencies If using Chrome, then [[https://chromedriver.chromium.org/][chromedriver]] must be installed. Otherwise, the browser's driver of your choice must be installed.
Browser Support 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.
#+begin_src typescript export class Edge extends Browser { public constructor(options?: BrowserOptions) { super('edge', options); } } #+end_src
Usage #+BEGIN_SRC bash npm i --save-dev automark cd automark && npm install #+END_SRC
Examples
You can find [[https://github.com/markrepedersen/skyscraper][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.
#+BEGIN_SRC typescript 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(); }); }); #+END_SRC