Codeception / Codeception/module-webdriver

Example of `executeAsyncJs()`

Open
#130 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
39
Forks
25
PR merge metrics
No merged PRs in 30d

Description

I have a case in which I request a API call via fetch/XHR (in execute async js method) grab its response and want to check that its response contains specific string.

Example:

```php
$response = $I->executeAsyncJS(<<assertContains('needle', $response);
```

I have made several attempts but unable to achieve the desired result. Sometimes I get errors or sometime empty array `[]`

It would be glad if such example is provided.

Note that there is also a [unanswered question on Stack Overflow](https://stackoverflow.com/questions/60108844/get-a-response-from-codeception-i-executeasyncjs)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the executeAsyncJS() entry point and the linked Stack Overflow question to understand the expected asynchronous return value. Add a documentation example showing a fetch, XHR, or API response returned to PHP and checked with assertContains(); the example should avoid errors and empty-array results.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php
Domain
documentation, testing
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.