Merge pull request #1542 from Computroniks/jsdoc-for-tests

JSDoc for test/*
This commit is contained in:
Louis Lam 2022-04-27 14:48:46 +08:00 committed by GitHub
commit 245b13d3c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<any>}
*/
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,