mercredi 24 avril 2019

Chain Multiple UI interactions using moxios

I have to test a scenario where I click on a selection in dropdown verify dom content then click on second selection in dropdown verify dom content and then click on first selection again and verify dom content

  • I have been looking at moxios documentation and I have tried to wrap moxios.wait inside each other no luck
  • I tried using "then" but since I am calling UI components which in turn call url I do not have a response to work with.
      let selectedValue = '2'
      wrapper.vm._countryChanged(selectionDropDown['data'], selectedValue)
      moxios.wait(() => {
        expect(wrapper.vm.errorCheck.chartNotLoaded).to.eq(true)
        done()
      })

      let selectedValue = '3'
      wrapper.vm._countryChanged(selectionDropDown['data'], selectedValue)
      moxios.wait(() => {
        const data = wrapper.vm.$refs.rangeChart.columnRangeData
        expect(data).to.eq(successJSON.content.data)
        expect(wrapper.vm.errorCheck.chartNotLoaded).to.eq(false)
        done()
      })

      let selectedValue = '2'
      wrapper.vm._countryChanged(selectionDropDown['data'], selectedValue)
      moxios.wait(() => {
        expect(wrapper.vm.errorCheck.chartNotLoaded).to.eq(true)
        done()
      })

The above code works if I comment the other two parts but all of them do not work together in that particular order.

Aucun commentaire:

Enregistrer un commentaire