vendredi 8 novembre 2019

if loop not performing even the condition is met

Help I`m writing a test in nightwatch.js.

Everything is working besides one loop. got something like this

  if ( max_przesuniecie >= 0) {
                browser
                .perform(function() {
                  console.log('max_przesuniecie = ' + max_przesuniecie)
                })
                  .setValue('#state_form > div.x_panel1 > table > tbody:nth-child(2) > tr:nth-child(1) > td:nth-child(4) > input', chance.floating({
                    min: 0,
                    max: [max_przesuniecie],
                    fixed: 2
                  }))
                console.log('max_przesuniecie = ' + max_przesuniecie)
                browser
                  .pause(3000)
                  .useXpath() // every selector now must be XPath
                  .click("//*[contains(text(),'Zapisz')]")
                  .useCss()
                  .pause(4000)}
          else {
            browser
            .perform(function() {
              console.log('BŁAD!!!!!!!!!!!!')
            })

            browser.saveScreenshot('./Screeny/error.png')
            browser.end()
          }

Variable max_przesuniecie equals 1.21 (float)

(max_przesuniecie >= 0) is true but loop goes to the else fragment don`t know why...

Aucun commentaire:

Enregistrer un commentaire