Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User testing, save response and print method #4264

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Mte90
Copy link

@Mte90 Mte90 commented Jan 24, 2025

As per title now the response is saved so it is possible to get more information like the URL where the user is or check the response code.

Also the print function probably isn't the best but let's to print something in the pytest output as it isn't very easy to do that.

I was trying to get the actual URL after the various redirects but response.history with:

async def test_navigate_to(user: User) -> None:
    @ui.page('/')
    def index() -> None:
        ui.navigate.to('/login')

    @ui.page('/login')
    def login() -> None:
        ui.input('Username')

    await user.open('/')
    user.print(user.response.history)
    # await user.should_see('Username')
    user.find('Username').type('admin')

Return an empty list, I think because the redirect happens next the open so at that time there wasn't the reidrect but I am not finding a way to get the actual url where it is the user.

Mte90 added 2 commits January 24, 2025 13:20
As per title now the response is saved so it is possible to get more information like the URL where the user is or check the response code.

Also the `print` function probably isn't the best but let's to print something in the pytest output as it isn't very easy to do that.
@Mte90
Copy link
Author

Mte90 commented Jan 24, 2025

Now there is a method that returns all the routes done in the specific test.

@Mte90
Copy link
Author

Mte90 commented Jan 24, 2025

So my idea to use page_routes return the routes registered not the one the user visited including redirects requires something more advanced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant