← Back to Discord Forum

Unable to POST using Axios in OnTestEnd() in custom reporter


wanted to post the results of my test run via api call using axios but it doesnt work in OnTestEnd() and OnEnd() but I am able to get it to work in OnTestBegin() and OnBegin() and in the constructor. I am fairly new to javascript too so it could be something I'm not fully familiar with. Does anyone have any suggestions?

This thread is trying to answer question "Why is the user unable to POST using Axios in OnTestEnd() in a custom reporter and how can this be resolved?"

2 replies

In what way does it 'not work'? What are the symptoms? I would expect it to only work reliable in onEnd and in onExit, since those hooks are the only ones that get awaited by Playwright. https://playwright.dev/docs/api/class-reporter

Recently I (think I) solved a problem related to unreliable uploads of artifacts by starting the upload in the onTestEnd but awaiting the promises of those uploads in the onEnd.


storing them in promises and awaiting them in onEnd worked. Thank you.

Related Discord Threads

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.