webdriverio / webdriverio

Next-gen browser and mobile automation test framework for Node.js
http://webdriver.io
MIT License
9.05k stars 2.5k forks source link

Error in "AfterTest Hook" Error: IllegalState: Eyes not open, while using applitool services. #5744

Closed diptilenka closed 3 years ago

diptilenka commented 4 years ago

[//]: # NOTE: This repository only maintains packages that are listed in the Readme. Please make sure that your issue is directly caused by one of these packages and if not file an issue in the correct 3rd party package repository.

Environment (please complete the following information):

Describe the bug A clear and concise description of what the bug is. I added browser.takeSnapshot('') each time i.e (HomePage.hamburgerMenu as any).waitAndClick(); (HomePage.hamburgerDocumentUpload as any).waitAndClick(); expect(DocumentUploadPage.documentUploadHeaderText).toEqual('Upload') browser.takeSnapshot('workflow'); To Reproduce Steps to reproduce the behavior: Follow the document s like https://webdriver.io/docs/applitools-service.html And also mentioned below lines in tsconfig.json "types": [ "node", "@wdio/sync", "@wdio/jasmine-framework", "@wdio/applitools-service"

and in test it("should navigate from Home Screen to Document Upload Page.", () => { LoginHandler.switchBackAfterLoginContext(); ContextHandler.waitForDocumentFullyLoaded(); (HomePage.hamburgerMenu as any).waitAndClick(); (HomePage.hamburgerDocumentUpload as any).waitAndClick(); expect(DocumentUploadPage.documentUploadHeaderText).toEqual('Upload'); browser.takeSnapshot('test'); });

The above test passed if browser.takeSnapshot() was not added and if added the eyes not open error. [Include code or an example repository that can easily be set up]

Expected behavior A clear and concise description of what you expected to happen. The test cases failed and shows Error: IllegalState: Eyes not open, Log If applicable, add logs to help explain your problem. Create a gist which is a paste of your full Selenium/WebdriverIO logs, and link them here. Do not paste your full Appium logs here, as it will make this issue very long and hard to read! If you are reporting a bug, always include Selenium/WebdriverIO logs!

Additional context Add any other context about the problem here.

i am using a mobile appp to automate, so its not a browser but a hybrid app.

Please use the correct markdown

christian-bromann commented 4 years ago

Please provide logs or/and a reproducible example. Your description doesn't help to identify the problem.

diptilenka commented 4 years ago

Attached the appium log arguments)","args":[]} [debug] [W3C (4ac31947)] Calling AppiumDriver.execute() with args: ["return (() => document.readyState).apply(null, arguments)",[],"4ac31947-077d-401f-a809-f683722dcfb1"] [debug] [XCUITest] Executing command 'execute' [debug] [RemoteDebugger] Executing atom 'execute_script' [debug] [RemoteDebugger] Executing 'execute_script' atom in default context [debug] [RemoteDebugger] Sending javascript command: '(function(){return function(){var f=this; [debug] [RemoteDebugger] funct...' [debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to app 'PID:86751', page '1', target 'page-7' (id: 519): 'Runtime.evaluate' [debug] [RemoteDebugger] Received data response from send (id: 519): '{"status":0,"value":"complete"}' [debug] [RemoteDebugger] Sending to Web Inspector took 3ms [debug] [RemoteDebugger] Received result for atom 'execute_script' execution: "complete" [debug] [W3C (4ac31947)] Responding to client with driver.execute() result: "complete" [HTTP] <-- POST /session/4ac31947-077d-401f-a809-f683722dcfb1/execute/sync 200 6 ms - 20 [HTTP]  [HTTP] --> POST /session/4ac31947-077d-401f-a809-f683722dcfb1/element [HTTP] {"using":"css selector","value":"button.mat-icon-button mat-icon.hyland-icons"} [debug] [W3C (4ac31947)] Calling AppiumDriver.findElement() with args: ["css selector","button.mat-icon-button mat-icon.hyland-icons","4ac31947-077d-401f-a809-f683722dcfb1"] [debug] [XCUITest] Executing command 'findElement' [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id [debug] [BaseDriver] Waiting up to 0 ms for condition [debug] [RemoteDebugger] Executing atom 'find_element' [debug] [RemoteDebugger] Executing 'find_element' atom in default context [debug] [RemoteDebugger] Sending javascript command: '(function(){return function(){var k=this;functi...' [debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to app 'PID:86751', page '1', target 'page-7' (id: 521): 'Runtime.evaluate' [debug] [RemoteDebugger] Received data response from send (id: 521): '"{\"status\":0,\"value\":{\"ELEMENT\":\":wdc:1598293692365\"}}"' [debug] [RemoteDebugger] Sending to Web Inspector took 36ms [debug] [RemoteDebugger] Received result for atom 'find_element' execution: {"ELEMENT":":wdc:1598293692365"} [debug] [W3C (4ac31947)] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"5029","ELEMENT":"5029"} [HTTP] <-- POST /session/4ac31947-077d-401f-a809-f683722dcfb1/element 200 39 ms - 73 [HTTP]  [HTTP] --> GET /session/4ac31947-077d-401f-a809-f683722dcfb1/element/5029/displayed [HTTP] {} [debug] [W3C (4ac31947)] Calling AppiumDriver.elementDisplayed() with args: ["5029","4ac31947-077d-401f-a809-f683722dcfb1"] [debug] [XCUITest] Executing command 'elementDisplayed' [debug] [RemoteDebugger] Executing atom 'is_displayed' [debug] [RemoteDebugger] Executing 'is_displayed' atom in default context [debug] [RemoteDebugger] Sending javascript command: '(function(){return function(){var h,l=this;func...' [debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to app 'PID:86751', page '1', target 'page-7' (id: 523): 'Runtime.evaluate' [debug] [RemoteDebugger] Received data response from send (id: 523): '"{\"status\":0,\"value\":true}"' [debug] [RemoteDebugger] Sending to Web Inspector took 43ms [debug] [RemoteDebugger] Received result for atom 'is_displayed' execution: true [debug] [W3C (4ac31947)] Responding to client with driver.elementDisplayed() result: true [HTTP] <-- GET /session/4ac31947-077d-401f-a809-f683722dcfb1/element/5029/displayed 200 45 ms - 14 [HTTP]  [HTTP] --> POST /session/4ac31947-077d-401f-a809-f683722dcfb1/element/5029/click [HTTP] {} [debug] [W3C (4ac31947)] Calling AppiumDriver.click() with args: ["5029","4ac31947-077d-401f-a809-f683722dcfb1"] [debug] [XCUITest] Executing command 'click' [debug] [RemoteDebugger] Executing atom 'click' [debug] [RemoteDebugger] Executing 'click' atom in default context [debug] [RemoteDebugger] Sending javascript command: '(function(){return function(){var h,aa=this;fun...' [debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to app 'PID:86751', page '1', target 'page-7' (id: 525): 'Runtime.evaluate' [debug] [RemoteDebugger] Received data response from send (id: 525): '"{\"status\":0,\"value\":null}"' [debug] [RemoteDebugger] Sending to Web Inspector took 14ms [debug] [RemoteDebugger] Received result for atom 'click' execution: null [debug] [W3C (4ac31947)] Responding to client with driver.click() result: null [HTTP] <-- POST /session/4ac31947-077d-401f-a809-f683722dcfb1/element/5029/click 200 19 ms - 14 [HTTP]  [HTTP] --> POST /session/4ac31947-077d-401f-a809-f683722dcfb1/element [HTTP] {"using":"xpath","value":"(//span[@class='mat-line'])[4]"} [debug] [W3C (4ac31947)] Calling AppiumDriver.findElement() with args: ["xpath","(//span[@class='mat-line'])[4]","4ac31947-077d-401f-a809-f683722dcfb1"] [debug] [XCUITest] Executing command 'findElement' [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id [debug] [BaseDriver] Waiting up to 0 ms for condition [debug] [RemoteDebugger] Executing atom 'find_element' [debug] [RemoteDebugger] Executing 'find_element' atom in default context [debug] [RemoteDebugger] Sending javascript command: '(function(){return function(){var k=this;functi...' [debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to app 'PID:86751', page '1', target 'page-7' (id: 527): 'Runtime.evaluate' [debug] [RemoteDebugger] Received data response from send (id: 527): '"{\"status\":0,\"value\":{\"ELEMENT\":\":wdc:1598293692370\"}}"' [debug] [RemoteDebugger] Sending to Web Inspector took 33ms [debug] [RemoteDebugger] Received result for atom 'find_element' execution: {"ELEMENT":":wdc:1598293692370"} [debug] [W3C (4ac31947)] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"5030","ELEMENT":"5030"} [HTTP] <-- POST /session/4ac31947-077d-401f-a809-f683722dcfb1/element 200 37 ms - 73 [HTTP]  [HTTP] --> GET /session/4ac31947-077d-401f-a809-f683722dcfb1/element/5030/displayed [HTTP] {} [debug] [W3C (4ac31947)] Calling AppiumDriver.elementDisplayed() with args: ["5030","4ac31947-077d-401f-a809-f683722dcfb1"] [debug] [XCUITest] Executing command 'elementDisplayed' [debug] [RemoteDebugger] Executing atom 'is_displayed' [debug] [RemoteDebugger] Executing 'is_displayed' atom in default context [debug] [RemoteDebugger] Sending javascript command: '(function(){return function(){var h,l=this;func...' [debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to app 'PID:86751', page '1', target 'page-7' (id: 529): 'Runtime.evaluate' [debug] [RemoteDebugger] Received data response from send (id: 529): '"{\"status\":0,\"value\":true}"' [debug] [RemoteDebugger] Sending to Web Inspector took 44ms [debug] [RemoteDebugger] Received result for atom 'is_displayed' execution: true [debug] [W3C (4ac31947)] Responding to client with driver.elementDisplayed() result: true [HTTP] <-- GET /session/4ac31947-077d-401f-a809-f683722dcfb1/element/5030/displayed 200 48 ms - 14 [HTTP]  [HTTP] --> POST /session/4ac31947-077d-401f-a809-f683722dcfb1/element/5030/click [HTTP] {} [debug] [W3C (4ac31947)] Calling AppiumDriver.click() with args: ["5030","4ac31947-077d-401f-a809-f683722dcfb1"] [debug] [XCUITest] Executing command 'click' [debug] [RemoteDebugger] Executing atom 'click' [debug] [RemoteDebugger] Executing 'click' atom in default context [debug] [RemoteDebugger] Sending javascript command: '(function(){return function(){var h,aa=this;fun...' [debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to app 'PID:86751', page '1', target 'page-7' (id: 531): 'Runtime.evaluate' [debug] [RemoteDebugger] Received data response from send (id: 531): '"{\"status\":0,\"value\":null}"' [debug] [RemoteDebugger] Sending to Web Inspector took 95ms [debug] [RemoteDebugger] Received result for atom 'click' execution: null [debug] [W3C (4ac31947)] Responding to client with driver.click() result: null [HTTP] <-- POST /session/4ac31947-077d-401f-a809-f683722dcfb1/element/5030/click 200 98 ms - 14 [HTTP]  [HTTP] --> POST /session/4ac31947-077d-401f-a809-f683722dcfb1/element [HTTP] {"using":"css selector","value":"h1.mat-toolbartitle"} [debug] [W3C (4ac31947)] Calling AppiumDriver.findElement() with args: ["css selector","h1.mat-toolbartitle","4ac31947-077d-401f-a809-f683722dcfb1"] [debug] [XCUITest] Executing command 'findElement' [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id [debug] [BaseDriver] Waiting up to 0 ms for condition [debug] [RemoteDebugger] Executing atom 'find_element' [debug] [RemoteDebugger] Executing 'find_element' atom in default context [debug] [RemoteDebugger] Sending javascript command: '(function(){return function(){var k=this;functi...' [debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to app 'PID:86751', page '1', target 'page-7' (id: 533): 'Runtime.evaluate' [debug] [RemoteDebugger] Received data response from send (id: 533): '"{\"status\":0,\"value\":{\"ELEMENT\":\":wdc:1598293692371\"}}"' [debug] [RemoteDebugger] Sending to Web Inspector took 37ms [debug] [RemoteDebugger] Received result for atom 'find_element' execution: {"ELEMENT":":wdc:1598293692371"} [debug] [W3C (4ac31947)] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"5031","ELEMENT":"5031"} [HTTP] <-- POST /session/4ac31947-077d-401f-a809-f683722dcfb1/element 200 40 ms - 73 [HTTP]  [HTTP] --> GET /session/4ac31947-077d-401f-a809-f683722dcfb1/element/5031/text [HTTP] {} [debug] [W3C (4ac31947)] Calling AppiumDriver.getText() with args: ["5031","4ac31947-077d-401f-a809-f683722dcfb1"] [debug] [XCUITest] Executing command 'getText' [debug] [RemoteDebugger] Executing atom 'get_text' [debug] [RemoteDebugger] Executing 'get_text' atom in default context [debug] [RemoteDebugger] Sending javascript command: '(function(){return function(){var h,l=this;func...' [debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to app 'PID:86751', page '1', target 'page-7' (id: 535): 'Runtime.evaluate' [debug] [RemoteDebugger] Received data response from send (id: 535): '"{\"status\":0,\"value\":\"Upload\"}"' [debug] [RemoteDebugger] Sending to Web Inspector took 40ms [debug] [RemoteDebugger] Received result for atom 'get_text' execution: "Upload" [debug] [W3C (4ac31947)] Responding to client with driver.getText() result: "Upload" [HTTP] <-- GET /session/4ac31947-077d-401f-a809-f683722dcfb1/element/5031/text 200 43 ms - 18 [HTTP]  [HTTP] --> DELETE /session/4ac31947-077d-401f-a809-f683722dcfb1 [HTTP] {} [debug] [W3C (4ac31947)] Calling AppiumDriver.deleteSession() with args: ["4ac31947-077d-401f-a809-f683722dcfb1"] [debug] [BaseDriver] Event 'quitSessionRequested' logged at 1598293701863 (23:58:21 GMT+0530 (India Standard Time)) [Appium] Removing session 4ac31947-077d-401f-a809-f683722dcfb1 from our master session list [debug] [WD Proxy] Matched '/session/4ac31947-077d-401f-a809-f683722dcfb1' to command name 'deleteSession' [debug] [WD Proxy] Proxying [DELETE /session/4ac31947-077d-401f-a809-f683722dcfb1] to [DELETE http://127.0.0.1:8100/session/6CFE7660-2B19-4043-BF0E-5DE42A9E4D89] with no body [debug] [RemoteDebugger] Application 'PID:86751' disconnected. Removing from app dictionary. [debug] [RemoteDebugger] Current app is 'PID:86751' [debug] [RemoteDebugger] No longer have app id. Attempting to find new one. [debug] [RemoteDebugger] Application 'PID:86752' disconnected. Removing from app dictionary. [debug] [RemoteDebugger] Current app is 'undefined' [debug] [RemoteDebugger] Application 'PID:86754' disconnected. Removing from app dictionary. [debug] [RemoteDebugger] Current app is 'undefined' [debug] [WD Proxy] Got response with status 200: { [debug] [WD Proxy] "value" : null, [debug] [WD Proxy] "sessionId" : "2445A739-68B9-4820-9863-4E7480228820" [debug] [WD Proxy] } [DevCon Factory] Releasing connections for C8C99A9C-F800-498C-8C54-10F0BF825DC6 device on any port number [DevCon Factory] Found cached connections to release: ["C8C99A9C-F800-498C-8C54-10F0BF825DC6:8100"] [debug] [DevCon Factory] Cached connections count: 0 [debug] [XCUITest] Not clearing log files. Use clearSystemFiles capability to turn on. [debug] [XCUITest] Found a remote debugger session. Removing... [debug] [RemoteDebugger] Disconnecting from remote debugger [debug] [RemoteDebugger] Cleaning up listeners [debug] [IOSSimulatorLog] Stopping iOS log capture [debug] [BaseDriver] Event 'quitSessionFinished' logged at 1598293702885 (23:58:22 GMT+0530 (India Standard Time)) [debug] [W3C (4ac31947)] Received response: null [debug] [W3C (4ac31947)] But deleting session, so not returning [debug] [W3C (4ac31947)] Responding to client with driver.deleteSession() result: null [debug] [W3C (4ac31947)] Destroying socket connection [HTTP] <-- DELETE /session/4ac31947-077d-401f-a809-f683722dcfb1 200 1023 ms - 14 [HTTP]  [Appium] Received SIGTERM - shutting down [debug] [Appium] There are no active sessions for cleanup @christian-bromann

diptilenka commented 4 years ago

ERROR @wdio/sync: Error: IllegalState: Eyes not open at Object.isValidState (/Users/xxx/Documents/xxx/xxx/node_modules/@applitools/eyes-sdk-core/lib/utils/ArgumentGuard.js:226:11) at Object.close (/Users/xxx/Documents/xxx/xxx//node_modules/@applitools/eyes-sdk-core/lib/sdk/EyesBase.js:1140:21) at Object.close (/Users/xxx/Documents/xxx/xxx//node_modules/@applitools/eyes-sdk-core/lib/sdk/EyesClassic.js:678:8) at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:97:5) at ApplitoolsService.afterTest (//Users/xxx/Documents/xxx/xxx/node_modules/@wdio/applitools-service/build/index.js:99:20) [0-0] Error in "AfterTest Hook" IllegalState: Eyes not open

@christian-bromann

christian-bromann commented 4 years ago

@dipti-code can you provide a reproducible example?

diptilenka commented 4 years ago

To Reproduce Steps to reproduce the behavior: Follow the document s like https://webdriver.io/docs/applitools-service.html And also mentioned below lines in tsconfig.json "types": [ "node", "@wdio/sync", "@wdio/jasmine-framework", "@wdio/applitools-service"

and in test it("should navigate from Home Screen to Document Upload Page.", () => { LoginHandler.switchBackAfterLoginContext(); ContextHandler.waitForDocumentFullyLoaded(); (HomePage.hamburgerMenu as any).waitAndClick(); (HomePage.hamburgerDocumentUpload as any).waitAndClick(); expect(DocumentUploadPage.documentUploadHeaderText).toEqual('Upload'); browser.takeSnapshot('test'); });

@christian-bromann

christian-bromann commented 4 years ago

@dipti-code this isn't reproducible .. can you create an example repository that someone can clone and reproduce the error. No one knows what kind of setup you have and the devil can be in the detail.

diptilenka commented 4 years ago

@christian-bromann Sorry , unable to share the huge code as per the company policy, if any other means like zoom call i can share with you.

christian-bromann commented 4 years ago

unable to share the huge code as per the company policy

I am not asking for your project code, I am asking for a minimal example project that reproduces the problem. If this is a problem within WebdriverIO it should be reproducible in a new fresh simplified project.

diptilenka commented 4 years ago

@christian-bromann you can download the git repo and run the iOS config. https://github.com/dipti-code/applitool_webdriverio.git

christian-bromann commented 4 years ago

This is the Appium boilerplate project, it has no integration with Applitools.

diptilenka commented 4 years ago

I have integrated.Applitool for you. The error is same what am getting for my project also. @christian-bromann

christian-bromann commented 4 years ago

I don't see any Applitools in there, probably not pushed the latest code?

diptilenka commented 4 years ago

@christian-bromann check now. Pull the latest now.

diptilenka commented 4 years ago

@christian-bromann Please help in this regards.

christian-bromann commented 4 years ago

@dipti-code sorry but there are a lot of other items on my plate that need attention. I am not sure if I am the right person to investigate this. Any contributions from outside would be helpful, thanks!

christian-bromann commented 3 years ago

As we have deprecated our Applitools integration this issue is not relevant anymore. We recommend to use @applitools/eyes-webdriverio from now on. Thanks!