codeceptjs / codeceptjs/CodeceptJS

AutoLogin Check() operation is failing

未關閉
#2,811 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
JavaScript
星號
4.2k
分支
757
平均合併
2 天 9 小時
30 天內合併 PR
16

描述

#### What are you trying to achieve?
I am trying to use the AutoLogin feature to run multiple tests.

#### What do you get instead?

On the Second test it's failing to preform the check() operation and throwing connection issue as shown below-

Test 2
» [Window Size] [object Object]
[1] Starting session
I am on page "/"
I set cookie [{"domain":".github.com","expiry":1645006954,"httpOnly":true,"name":"dotcom_user","path":"/","sameSite":"Lax","secure":true,"value":"KKTestUser"},{"domain":"github.com","httpOnly":true,"name":"_gh_sess","path":"/","s...
[1] < check login > Error | unknown error: java.net.ConnectException: Connection refused: connect
[1] < check login > Error | unknown error: java.net.ConnectException: Connection refused: connect
» Failed auto login for TestFeature due to unknown error: java.net.ConnectException: Connection refused: connect
» Logging in again
[1] < check login > Starting session
I: login
I am on page "/login"
[1] < auto login > Error | unknown error: java.net.ConnectException: Connection refused: connect
[1] < auto login > Error | unknown error: java.net.ConnectException: Connection refused: connect
[1] < auto login > Error | unknown error: java.net.ConnectException: Connection refused: connect
[1] < auto login > Error | unknown error: java.net.ConnectException: Connection refused: connect
[1] < auto login > Error | unknown error: java.net.ConnectException: Connection refused: connect
[1] < auto login > Error | unknown error: java.net.ConnectException: Connection refused: connect
[1] < auto login > Finalize session
[1] Finalize < check login > session
[1] Starting < teardown > session
[1] < teardown > Finalize < check login > session
» < screenshotOnFail > Test failed, try to save a screenshot
» Screenshot has been saved to C:\.\.\.\.\output\TestFeature_be_1613470980.failed.png
» < unknown error: java.net.ConnectException: Connection refused: connect >
× FAILED in 20129ms

I see element "#dashboard-repos-filter-left"
[1] Retrying... Attempt #2
[1] Retrying... Attempt #3
[1] Retrying... Attempt #4
[1] Retrying... Attempt #5
[1] Retrying... Attempt #6
[1] Error | unknown error: java.net.ConnectException: Connection refused: connect
[1] Error | unknown error: java.net.ConnectException: Connection refused: connect
[1] Error | unknown error: java.net.ConnectException: Connection refused: connect
[1] Starting < teardown > session
[1] < teardown > Stopping recording promises
» < screenshotOnFail > Test failed, try to save a screenshot
» Screenshot has been saved to C:\.\.\.\.\output\Validate_C_1613471041.failed.png
» < unknown error: java.net.ConnectException: Connection refused: connect >
× FAILED in 69085ms

[2] Starting recording promises
[2] Error | invalid session id: No active session with ID 391b802f8b59b3085111b0ff6fb98ba7
invalid session id: No active session with ID 391b802f8b59b3085111b0ff6fb98ba7

-- FAILURES:

1) TestFeature
"before each" hook: Before in "TestFeature":
done() called multiple times in hook of file C:\.\.\.\.\TestFeature_test.js; in addition, done() received error: unknown error: java.net.ConnectException: Connection refused: connect
at Object.getErrorFromResponseBody (C:\.\.\.\.\node_modules\webdriver\build\utils.js:189:12)
at WebDriverRequest._request (C:\.\.\.\.\node_modules\webdriver\build\request.js:168:31)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Browser.wrapCommandFn (C:\.\.\.\.\node_modules\@wdio\utils\build\shim.js:79:29)
at async Browser.wrapCommandFn (C:\.\.\.\.\node_modules\@wdio\utils\build\shim.js:79:29)
at async loginAndSave (C:\.\.\.\.\node_modules\codeceptjs\lib\plugin\autoLogin.js:255:23)
Error: done() called multiple times in hook of file C:\.\.\.\.\TestFeature_test.js; in addition, done() received error: unknown error: java.net.ConnectException: Connection refused: connect
at Object.getErrorFromResponseBody (node_modules\webdriver\build\utils.js:189:12)
at WebDriverRequest._request (node_modules\webdriver\build\request.js:168:31)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Browser.wrapCommandFn (node_modules\@wdio\utils\build\shim.js:79:29)
at async Browser.wrapCommandFn (node_modules\@wdio\utils\build\shim.js:79:29)
at async loginAndSave (node_modules\codeceptjs\lib\plugin\autoLogin.js:255:23)
at C:\.\.\.\.\node_modules\codeceptjs\lib\scenario.js:117:26
at processTicksAndRejections (internal/process/task_queues.js:93:5)

2) TestFeature
Test 2:
java.net.ConnectException: Connection refused: connect
at Object.getErrorFromResponseBody (node_modules\webdriver\build\utils.js:189:12)
at WebDriverRequest._request (node_modules\webdriver\build\request.js:168:31)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Browser.wrapCommandFn (node_modules\@wdio\utils\build\shim.js:79:29)
at async Browser.$$ (node_modules\webdriverio\build\commands\browser\$$.js:53:17)
at async Browser.wrapCommandFn (node_modules\@wdio\utils\build\shim.js:79:29)
at async WebDriver._locate (node_modules\codeceptjs\lib\helper\WebDriver.js:758:19)
at async WebDriver.seeElement (node_modules\codeceptjs\lib\helper\WebDriver.js:1314:17)

### Details

* CodeceptJS version: 3.0.5
* NodeJS Version: 14.15.0
* Operating System: Windows 10
* webdriverio 7.0.1

貢獻指南

開啟貢獻指南

研究方向

閱讀 node_modules/codeceptjs/lib/plugin/autoLogin.js 中 loginAndSave 附近的程式碼以及失敗的 TestFeature_test.js hook;使用列出的 CodeceptJS、Node.js 和 webdriverio 版本重現第二個測試的 AutoLogin 執行。完成標準是,重複的 check() 路徑不再產生 connection-refused 或 invalid-session 失敗,且測試在沒有重複呼叫 done() 的情況下完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
javascript, nodejs
領域
testing-qa
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
25/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。