From b641c8a8785d06a80bb702dae4e7ac4c11dd7f06 Mon Sep 17 00:00:00 2001 From: Matthew Nickson Date: Fri, 22 Apr 2022 23:24:14 +0100 Subject: [PATCH 2/2] Add JSDoc to test/* Signed-off-by: Matthew Nickson --- test/e2e.spec.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/e2e.spec.js b/test/e2e.spec.js index 5535f57d..8de8ceb1 100644 --- a/test/e2e.spec.js +++ b/test/e2e.spec.js @@ -284,6 +284,11 @@ describe("Init", () => { }); }); +/** + * Test login + * @param {string} username + * @param {string} password + */ async function login(username, password) { await input(page, "#floatingInput", username); await input(page, "#floatingPassword", password); @@ -291,6 +296,13 @@ async function login(username, password) { await sleep(5000); } +/** + * Click on an element on the page + * @param {Page} page Puppeteer page instance + * @param {string} selector + * @param {number} elementIndex + * @returns {Promise} + */ async function click(page, selector, elementIndex = 0) { await page.waitForSelector(selector, { timeout: 5000, @@ -300,6 +312,12 @@ async function click(page, selector, elementIndex = 0) { }, selector, elementIndex); } +/** + * Input text into selected field + * @param {Page} page Puppeteer page instance + * @param {string} selector + * @param {string} text Text to input + */ async function input(page, selector, text) { await page.waitForSelector(selector, { timeout: 5000,