Actually print message on incorrect email/password

This commit is contained in:
Andrew Ferrazzutti 2021-03-26 02:48:11 -04:00
parent 884d0d32fe
commit 04c09cea1f
1 changed files with 2 additions and 9 deletions

View File

@ -58,14 +58,6 @@ export default class MessagesPuppeteer {
console.error(`[Puppeteer/${this.id}]`, ...text)
}
/**
* Get the inner text of an element.
* To be called in browser context.
*/
_getInnerText(element) {
return element?.innerText
}
/**
* Start the browser and open the messages for web page.
* This must be called before doing anything else.
@ -213,11 +205,12 @@ export default class MessagesPuppeteer {
return value
}),
() => this.page.waitForSelector("#login_incorrect", {visible: true, timeout: 2000})
.then(value => this.page.evaluate(_getInnerText, value)),
.then(value => this.page.evaluate(element => element?.innerText, value)),
() => this._waitForLoginCancel(),
].map(promiseFn => cancelableResolve(promiseFn)))
this.log("Removing observers")
// TODO __mautrixController is undefined when cancelling, why?
await this.page.evaluate(ownID => window.__mautrixController.setOwnID(ownID), this.id)
await this.page.evaluate(() => window.__mautrixController.removeQRChangeObserver())
await this.page.evaluate(() => window.__mautrixController.removeQRAppearObserver())