Putting it all together
Now that we’ve got all the custom-made parts, let’s put together our superpowered method. These methods will return a success value of true
or false
. We ensure that we have a valid element from the earlier chapter. We will replace tags such as the date with a future or past offset. We will detect whether the field is a password and mask our value output accordingly:
export async function setValueAdv( inputField: WebdriverIO.Element, text: string ) { let success: boolean = false; inputField = await getValidElement(inputField, "field"); const SELECTOR = await inputField.selector; let newValue: string = replaceTags(text); let scrubbedValue: string = newValue let fieldName: string = await getFieldName(inputField) //Mask Passwords in output if (fieldName.includes("ssword") ){ scrubbedValue...