title: how to I store element text from cypress chain into a variable in typescript?
body: <p>I would like to have some testcase to compare tolPage text value is the same as curPage text value like following. but it does not work, how should i pass element text from cypress chain to local variable</p>
  
  <pre><code>class Menu{
    tolPage() {
      return cy
        .get(selectors.pagination.totalPageCount)
        .invoke('text')
        .then((text) =&gt; {
          return text.toString();
        });
    }
    curPage() {
      return cy
        .get(selectors.pagination.currentPageCount)
        .invoke('text')
        .then((text) =&gt; {
          return text.toString();
        });
    }
  }
  describe('check two function should be eq') {
    const menu = new Menu();
      it('Verified "', () =&gt; {
        let text = menu.curPage();
        # menu.tolPage().should('be.eq', text));
        # menu.tolPage().should('be.eq', menu.curPage());
    });
  }
  </code></pre>