Merge branch 'master' into fix-1448-discord-service-url

This commit is contained in:
Jordan Bertasso
2022-05-10 22:53:55 +10:00
committed by GitHub
111 changed files with 5494 additions and 1498 deletions

View File

@@ -229,3 +229,25 @@ describe("Test Discord Notification Provider", () => {
);
});
});
describe("The function filterAndJoin", () => {
it("should join and array of strings to one string", () => {
const result = utilServerRewire.filterAndJoin(["one", "two", "three"]);
expect(result).toBe("onetwothree");
});
it("should join strings using a given connector", () => {
const result = utilServerRewire.filterAndJoin(["one", "two", "three"], "-");
expect(result).toBe("one-two-three");
});
it("should filter null, undefined and empty strings before joining", () => {
const result = utilServerRewire.filterAndJoin([undefined, "", "three"], "--");
expect(result).toBe("three");
});
it("should return an empty string if all parts are filtered out", () => {
const result = utilServerRewire.filterAndJoin([undefined, "", ""], "--");
expect(result).toBe("");
});
});

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,