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

feat: fully support Multi-window switch recording, etc... #1569

Merged
merged 4 commits into from
Dec 26, 2022

Conversation

smildlzj
Copy link
Contributor

@smildlzj smildlzj commented Dec 23, 2022

Thanks for contributing to the Selenium IDE!
A PR well described will help maintainers to quickly review and merge it

Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.

Description

feat: tell renderer, navigator.webdriver = true

same behavior as other tese tools. tell the page is in test mode.

feat: fully support Multi-window switch recording

auto add selectWindow command when multi-window switch recording.

How to do that?
  • all windows has winHandleId identity which get from main process.
  • winHandleId generate by command list
  • the entry window name root

support play options delay

image

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@smildlzj
Copy link
Contributor Author

Question: this part of code is mean anying?

const windows = BrowserWindow.getAllWindows();
const newWindowIDs = windows.map((window) => window.id);
const opensWindow = this.windowIDs.length < newWindowIDs.length;
if (opensWindow) {
mainCommand.opensWindow = true
mainCommand.windowHandleName = `win${randomInt(1, 9999)}`
}
this.windowIDs = windows.map((window) => window.id);

@smildlzj smildlzj changed the title feat: fully support Multi-window switch recording feat: fully support Multi-window switch recording, etc... Dec 23, 2022
@toddtarsi
Copy link
Contributor

@smildlzj - Woah! This is very impressive. I was not expecting this today. You have really dug into the codebase it seems like, wow!

@toddtarsi
Copy link
Contributor

Question: this part of code is mean anying?

const windows = BrowserWindow.getAllWindows();
const newWindowIDs = windows.map((window) => window.id);
const opensWindow = this.windowIDs.length < newWindowIDs.length;
if (opensWindow) {
mainCommand.opensWindow = true
mainCommand.windowHandleName = `win${randomInt(1, 9999)}`
}
this.windowIDs = windows.map((window) => window.id);

@smildlzj - Sorry I didn't respond to this sooner. Yes, this part learns of new windows during recording steps. Basically, after every recorded step, we check if a new window was added. If so, the last command gets updated with the opensWindow and handle id flags. More specifically, the handle id flag is just a random-ish string which I think gets set as a variable name to the window handle or something like that.

Copy link
Contributor

@toddtarsi toddtarsi left a comment

Choose a reason for hiding this comment

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

LGTM 👍 @smildlzj - I see nothing here to critique. This code looks very well researched and tested. If you tell me its okay to merge, I will. 😄 Nice job!!!

@smildlzj
Copy link
Contributor Author

LGTM 👍 @smildlzj - I see nothing here to critique. This code looks very well researched and tested. If you tell me its okay to merge, I will. 😄 Nice job!!!

Yes, it had test by myself. it work

@smildlzj
Copy link
Contributor Author

Question: this part of code is mean anying?

const windows = BrowserWindow.getAllWindows();
const newWindowIDs = windows.map((window) => window.id);
const opensWindow = this.windowIDs.length < newWindowIDs.length;
if (opensWindow) {
mainCommand.opensWindow = true
mainCommand.windowHandleName = `win${randomInt(1, 9999)}`
}
this.windowIDs = windows.map((window) => window.id);

@smildlzj - Sorry I didn't respond to this sooner. Yes, this part learns of new windows during recording steps. Basically, after every recorded step, we check if a new window was added. If so, the last command gets updated with the opensWindow and handle id flags. More specifically, the handle id flag is just a random-ish string which I think gets set as a variable name to the window handle or something like that.

is this scene?

  • click to play
  • click any link to open new win
  • start to record on new win

@toddtarsi toddtarsi merged commit 88e8bab into SeleniumHQ:trunk Dec 26, 2022
@toddtarsi
Copy link
Contributor

@smildlzj - You're merged! Also, yeah that seems good. Unless clicking play is also causing record. In which case, I will need to fix.

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

Successfully merging this pull request may close these issues.

2 participants