webdriverio-community / wdio-vscode-service

A service to test VSCode extensions from end to end using WebdriverIO
https://webdriverio-community.github.io/wdio-vscode-service/
MIT License
29 stars 23 forks source link

fix: Prevent "TypeError: object is not iterable" #102

Closed seanpoulter closed 5 months ago

seanpoulter commented 5 months ago

Context

This PR is a workaround for the bug described in #100 but doesn't address the root cause. Sorry.

Proposed Changes

Notes

To set expectations, I'm offline until Sunday night. Feel free to change anything you'd like Christian.

seanpoulter commented 5 months ago

Will do.

seanpoulter commented 5 months ago

Let me know how I can help with the latest stable CI breaking too. Want me to try to review the PR Sunday night?

christian-bromann commented 5 months ago

Want me to try to review the PR Sunday night?

Which PR are you referring to?

seanpoulter commented 5 months ago

Mind investigate what console.log(await this.tab$$) returns? It should be an empty array with some extra methods attached to it.

Ah, sorry Christian. I didn't get ChromeDriver set up on Ubuntu on ARM to test it locally. My command to close all the open editor tabs didn't work. The await this.tab$$ had a length of 1.

After actually closing the tabs, we do get an empty array. I don't see where the length is so I confirmed it logging the .length:

[0-0] [
[0-0]   selector: '.tab',
[0-0]   every: [Function: bound every],
[0-0]   everySeries: [Function: bound everySeries] AsyncFunction,
[0-0]   filter: [Function: bound filter],
[0-0]   filterSeries: [Function: bound filterSeries] AsyncFunction,
[0-0]   find: [Function: bound find],
[0-0]   findIndex: [Function: bound findIndex],
[0-0]   findIndexSeries: [Function: bound findIndexSeries] AsyncFunction,
[0-0]   findSeries: [Function: bound findSeries] AsyncFunction,
[0-0]   forEach: [Function: bound forEach] AsyncFunction,
[0-0]   forEachSeries: [Function: bound forEachSeries] AsyncFunction,
[0-0]   map: [Function: bound map] AsyncFunction,
[0-0]   mapSeries: [Function: bound mapSeries] AsyncFunction,
[0-0]   reduce: [Function: bound reduce] AsyncFunction,
[0-0]   some: [Function: bound some],
[0-0]   someSeries: [Function: bound someSeries] AsyncFunction,
[0-0]   parent: Element {
[0-0]     sessionId: 'ebf877e53f69f90d9d473ccdc90e8a0f',
[0-0]     elementId: 'EC65E98773E9E9AD91AD8AD8D2BBA6AC_element_65',
[0-0]     'element-6066-11e4-a52e-4f735466cecf': 'EC65E98773E9E9AD91AD8AD8D2BBA6AC_element_65',
[0-0]     selector: '.editor-group-container',
[0-0]     parent: Element {
[0-0]       sessionId: 'ebf877e53f69f90d9d473ccdc90e8a0f',
[0-0]       elementId: 'EC65E98773E9E9AD91AD8AD8D2BBA6AC_element_18',
[0-0]       'element-6066-11e4-a52e-4f735466cecf': 'EC65E98773E9E9AD91AD8AD8D2BBA6AC_element_18',
[0-0]       selector: 'div[id="workbench.parts.editor"]',
[0-0]       parent: [Browser],
[0-0]       emit: [Function: bound ],
[0-0]       isReactElement: false,
[0-0]       isShadowElement: false,
[0-0]       addCommand: [Function (anonymous)],
[0-0]       overwriteCommand: [Function (anonymous)]
[0-0]     },
[0-0]     index: 0,
[0-0]     emit: [Function: bound bound ],
[0-0]     isReactElement: false,
[0-0]     isShadowElement: false,
[0-0]     addCommand: [Function (anonymous)],
[0-0]     overwriteCommand: [Function (anonymous)]
[0-0]   },
[0-0]   foundWith: '$$',
[0-0]   props: []
[0-0] ]
[0-0] length = 0

Want me to try to review the PR Sunday night?

Which PR are you referring to?

94

seanpoulter commented 5 months ago

To save you from looking, it fails trying to download ChromeDriver 118 from the legacy URL. Could you try rerunning just one of the 1.83 jobs?

christian-bromann commented 5 months ago

Could you try rerunning just one of the 1.83 jobs?

That pipeline seems to fail due to:

[chrome 114.0.5735.289 linux #0-2] Running: chrome (v114.0.5735.289) on linux
[chrome 114.0.5735.289 linux #0-2] Session ID: d184e8fbe965e48cb7b9c536cb864247
[chrome 114.0.5735.289 linux #0-2]
[chrome 114.0.5735.289 linux #0-2] ยป /test/specs/editor.e2e.ts
[chrome 114.0.5735.289 linux #0-2] editor
[chrome 114.0.5735.289 linux #0-2]     getOpenTabs
[chrome 114.0.5735.289 linux #0-2]        โœ– returns an empty array when no tabs are open
[chrome 114.0.5735.289 linux #0-2]
[chrome 114.0.5735.289 linux #0-2] 1 failing (3.4s)
[chrome 114.0.5735.289 linux #0-2]
[chrome 114.0.5735.289 linux #0-2] 1) getOpenTabs returns an empty array when no tabs are open
[chrome 114.0.5735.289 linux #0-2] expect(received).toBe(expected) // Object.is equality

If it should pass with deep equality, replace "toBe" with "toStrictEqual"

Expected: []
Received: serializes to the same string
[chrome 114.0.5735.289 linux #0-2] Error: expect(received).toBe(expected) // Object.is equality
[chrome 114.0.5735.289 linux #0-2]
[chrome 114.0.5735.289 linux #0-2] If it should pass with deep equality, replace "toBe" with "toStrictEqual"
[chrome 114.0.5735.289 linux #0-2]
[chrome 114.0.5735.289 linux #0-2] Expected: []
[chrome 114.0.5735.289 linux #0-2] Received: serializes to the same string
[chrome 114.0.5735.289 linux #0-2]     at Context.<anonymous> (file:///home/runner/work/wdio-vscode-service/wdio-vscode-service/test/specs/editor.e2e.ts?invalidateCache=0.40237443167130205:11:67)
[chrome 114.0.5735.289 linux #0-2]     at processTicksAndRejections (node:internal/process/task_queues:95:5)
seanpoulter commented 5 months ago

Oof. Sorry for the back and forth. I should have caught that much much earlier. :facepalm:

That's fixed and rebased.

christian-bromann commented 5 months ago

Congrats on your first contribution to this plugin. Really appreciated your work!

wdio-bot commented 5 months ago

Hey seanpoulter ๐Ÿ‘‹

Thank you for your contribution to WebdriverIO! Your pull request has been marked as an "Expensable" contribution. We've sent you an email with further instructions on how to claim your expenses from our development fund. Please make sure to check your spam folder as well. If you have any questions, feel free to reach out to us at expense@webdriver.io or in the contributing channel on Discord.

We are looking forward to more contributions from you in the future ๐Ÿ™Œ

Have a nice day, The WebdriverIO Team ๐Ÿค–