title: Got "Error: expect(received).not.toBeNull()" when trying to click an element
body: <p>Can somebody help me in my error? I couldn't figure out why i am getting this error expect(received).not.toBeNull() even i used the id locator. It seems it can't read the locator that i am using.
  <a href="https://i.stack.imgur.com/qvJ4Q.png" rel="nofollow noreferrer">error image</a></p>
  <p><strong>Here's the code:</strong>
  This is for clicking the Centre and Stores</p>
  <pre><code>async selectResultByTxt(expected, section) {
      await common.waitForSpinner()
      const results = await $$(
    `${section} ${selectors.clickCentre} ${selectors.clickStore}`
      )
      let text = null
      for (let i = 0; i &lt; results.length; i++) {
        let result = results[i]
        if (
          await (await result.getText())
            .toLowerCase()
            .includes(await expected.toLowerCase())
        ) {
          text = await result.getText()
          await result.click()
          break
        }
      }
      expect(text).not.toBeNull()
      return text
    }
  </code></pre>
  <p>And this is for the <strong>Store step definition:</strong></p>
  <pre><code>When(
    /^I select &quot;([^&quot;]*)&quot; from (Products|Stores|Centres) search results$/,
    async function (searchTerm, section) {
      await this.setTestData(
        'searchTerm',
        await universalHeader.selectResultByTxt(searchTerm, section)
      )
    }
  )
  </code></pre>
  <p>And this is for the <strong>step definition file:</strong></p>
  <pre><code>When(/^I select a Centre from search results$/, async function () {
    const centre = await this.getTestData('westfieldCentre')
    await this.setTestData(
      'westfieldCentre',
      await universalHeader.selectResultByTxt(centre, 'Centres')
    )
  })
  </code></pre>
  <p>And these are the locators that i am using that was stored to a variable:</p>
  <pre><code>clickCentre: '[data-test-id=&quot;search-row-centre&quot;]',
    clickProducts: '[data-test-id=&quot;product-card&quot;]',
    clickStore: '[data-test-id=&quot;search-row-retailer&quot;]'
  </code></pre>