headspinio / appium-altunity-plugin

An Appium 2.x plugin for AltUnity Tester. https://headspin.io
Apache License 2.0
30 stars 5 forks source link

Make AltUnityClient connect maxTries dynamic #11

Open bylihar opened 10 months ago

bylihar commented 10 months ago

Actually, the number of retries is hardcoded (equal to 15):

async connect() {
        let numTries = 0
        const maxTries = 15
        await retryInterval(maxTries, 1000, async () => {
            numTries++
            this.log.info(`Attempting to connect to AltUnity server. This is attempt ${numTries}/${maxTries}`)
            try {
                await this.conn.connect()
            } catch (err: any) {
                throw new Error(`Could not connect to the AltUnity server. Original error was: ${err.message}`)
            }
        })
        this.log.info(`Connection to AltUnity server established`)
    }

It might be very helpful to have it dynamic and pass using capability.