title: Vue Testing (JEST): button.trigger('click') not working
body: <p>Been reading up a lot of stackoverflow and github discussions, about vue jest having trouble with button.trigger('click'). I've been struggling over this issue for a few hours today, have to say I'm quite frustrated, and surprised how a simple function such as trigger('click') can cause so much problems.</p>
  <p>In short, my code has a b-button, which @click fires off fetchData function, from vuex. This works perfectly well in browser, but in testing mode, the fetchData does not get executed.</p>
  <p>Vue Component Code</p>
  <pre class="lang-js prettyprint-override"><code>&lt;template&gt;
    &lt;b-button id=&quot;loadButton&quot; variant=&quot;outline-primary&quot; @click=&quot;fetchData&quot;&gt;Load Data&lt;/b-button&gt;
  &lt;/template&gt;
  
  &lt;script&gt;
  import { mapActions } from 'vuex';
  export default {
      name: &quot;LoadAndSave&quot;,
      methods: { ...mapActions(['fetchData']) }
  }
  &lt;/script&gt;
  </code></pre>
  <p>Testing Code</p>
  <pre class="lang-js prettyprint-override"><code>import { shallowMount, createLocalVue } from '@vue/test-utils'
  import Vuex from 'vuex'
  import { BootstrapVue } from 'bootstrap-vue'
  import LoadAndSave from '../../resources/components/LoadAndSave'
  
  const localVue = createLocalVue()
  localVue.use(BootstrapVue)
  localVue.use(Vuex)
  
  describe('LoadAndSave.vue', () =&gt; {
    let actions
    let getters
    let store
  
    beforeEach(() =&gt; {
      actions = {
        fetchData: jest.fn()
      }
      store = new Vuex.Store({
        actions
      })
    })
    it('LoadAndSave: onClick executes fetchData', async () =&gt; {
      const wrapper = shallowMount(LoadAndSave, { localVue, store })
      const button = wrapper.find(&quot;#loadButton&quot;)
      await button.trigger('click')
      expect(actions.fetchData).toHaveBeenCalled()
    })
  })
  </code></pre>
  <p>Result of testing</p>
  <pre class="lang-js prettyprint-override"><code>expect(jest.fn()).toHaveBeenCalled()
  
  Expected number of calls: &gt;= 1
  Received number of calls:    0
  </code></pre>
  <p>This is not my first day coding, I am no where near an expert in coding either, but just the idea of not being able to get a button click to trigger really sends chills down my spine, not to mention the frustration accompanied.</p>
  <p>If anyone could give any suggestion that'd be appreciated, thank you.</p>
  <p>Codey</p>