Codeception - Functional Tests: how to access variables inside a view

In the functional test below I want to access the variable $current_page but get an "unknown variable error". How can I access variables inside views with codeception?

I have a volt template with this inside

            <form action="/listlab/{{ current_page }}" accept-charset="utf-8" method="post">
                {% if pagination is defined %}
                  {% for row in pagination.items %}
                      <td>{{ row.key }}</td>
                      <td>{{ }}</td>
                      <td>{{ row.description }}</td>
                      <td class="actions">
                        <a href="/showlab//{{ row.label_id }}" class="button small">View</a>
                  {% endfor %}
                {% endif %}

And this in my functional test

$I = new FunctionalTester($scenario);
$I->wantTo("Test Label Overview");
$I->see("List labels");
$I->seeElement('a', ['name' => 'listLabels']);
$I->click('a', ['name' => 'listLabels']);
$I->see("List Labels");
$I->seeElement("table"); /tables of object (labels)
// works until here

// does not work:
// gives the error

The error when the last line of the test is included

Functional Tests (2)
E LabelOverviewCept: Test Label overview (0.06s)

Time: 12 ms, Memory: 14.00MB

There was 1 error:

1) LabelOverviewCept: Test Label overview
 Test  tests/functional/LabelOverviewCept.php

  [PHPUnit\Framework\Exception] Undefined variable: current_page  
edited Jun '18

Afaik, codeception operates on rendered html, so you will never be able to access runtime php variables on the output html.

You would have to mock the controller instance, and test the view variables from there.

Or you could use grabTextFrom and do simply assert if you know what expected value should be?