Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

Conversation

seanpoulter
Copy link
Contributor

Context

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

Proposed Changes

  • Add a failing test that shows:
    TypeError: object is not iterable (cannot read property Symbol(Symbol.iterator)
            at EditorGroup.getOpenTabs
    
  • Change the implementation to workaround the issue. this.tabs$$.map works but (await this.tabs$$).map doesn't. 🤷

Notes

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

Copy link
Contributor

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for raising the PR.

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

@seanpoulter
Copy link
Contributor Author

Will do.

@seanpoulter
Copy link
Contributor Author

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
Copy link
Contributor

Want me to try to review the PR Sunday night?

Which PR are you referring to?

@seanpoulter
Copy link
Contributor Author

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

Copy link
Contributor

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@seanpoulter
Copy link
Contributor Author

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
Copy link
Contributor

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
Copy link
Contributor Author

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

That's fixed and rebased.

Copy link
Contributor

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@christian-bromann christian-bromann merged commit 5fd38b8 into webdriverio-community:main Feb 7, 2024
0 of 9 checks passed
@christian-bromann
Copy link
Contributor

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

@seanpoulter seanpoulter deleted the issue-100 branch February 11, 2024 03:24
@wdio-bot
Copy link
Collaborator

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 [email protected] 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 🤖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants