-
Notifications
You must be signed in to change notification settings - Fork 3
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
Issue 1375: rework generation flow #1390
Merged
Merged
Changes from 9 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
67bf716
rework locators geneartion logic
MariiaNebesnova ace42f2
rework locators generation flow
MariiaNebesnova 78b2288
rework generation flow
MariiaNebesnova 93d1bf2
minor
MariiaNebesnova 14aac8b
Merge branch 'master' into issue_1375
MariiaNebesnova bb209f7
fix tests
MariiaNebesnova c23293c
minors
MariiaNebesnova f380fa7
codestyle
MariiaNebesnova c7038ef
codestyle
MariiaNebesnova 0ecf647
minors
MariiaNebesnova 04a13dc
minors
MariiaNebesnova d9473cb
minor
MariiaNebesnova 5dbbea8
fix pending update
MariiaNebesnova d79b39c
Merge branch 'master' into issue_1375
MariiaNebesnova 8f39074
Merge branch 'master' into issue_1375
MariiaNebesnova 1a913f4
ver up
MariiaNebesnova File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,37 @@ | ||
export const accumulateAndDenounce = (fn: (arg: any[]) => any) => { | ||
let accumulatedArgs: any[] = []; | ||
let interval: NodeJS.Timer | null = null; | ||
let cancelTimeout: NodeJS.Timeout | null = null; | ||
class Debouncer { | ||
accumulatedArgs: any[] = []; | ||
interval: NodeJS.Timer | null = null; | ||
cancelTimeout: NodeJS.Timeout | null = null; | ||
|
||
const debouncedFn = (args: any[]) => { | ||
accumulatedArgs.push(...args); | ||
}; | ||
constructor() { | ||
this.accumulateAndDebounce = this.accumulateAndDebounce.bind(this); | ||
} | ||
|
||
const throttledFn = () => { | ||
if (accumulatedArgs.length > 0) { | ||
cancelTimeout && clearTimeout(cancelTimeout); | ||
fn(accumulatedArgs); | ||
accumulatedArgs = []; | ||
} else { | ||
if (cancelTimeout) return; | ||
cancelTimeout = setTimeout(() => interval && clearInterval(interval), 30000); | ||
} | ||
}; | ||
accumulateAndDebounce(fn: (arg: any[]) => any) { | ||
const debouncedFn = (args: any[]) => { | ||
this.accumulatedArgs.push(...args); | ||
}; | ||
|
||
interval = setInterval(throttledFn, 500); | ||
const throttledFn = () => { | ||
if (this.accumulatedArgs.length > 0) { | ||
this.cancelTimeout && clearTimeout(this.cancelTimeout); | ||
fn(this.accumulatedArgs); | ||
this.accumulatedArgs = []; | ||
} else { | ||
if (this.cancelTimeout) return; | ||
this.cancelTimeout = setTimeout(() => { | ||
this.interval && clearInterval(this.interval); | ||
this.interval = null; | ||
}, 30000); | ||
} | ||
}; | ||
|
||
return (args: any) => { | ||
debouncedFn(args); | ||
}; | ||
}; | ||
if (!this.interval) this.interval = setInterval(throttledFn, 500); | ||
|
||
return (args: any) => { | ||
debouncedFn(args); | ||
}; | ||
} | ||
} | ||
|
||
export const debouncer = new Debouncer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import connector from "../../pageServices/connector"; | ||
|
||
export const getDocument = async () => { | ||
const documentResult = await connector.attachContentScript(() => JSON.stringify(document.documentElement.innerHTML)); | ||
return await documentResult[0].result; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest also type
xpathConfig: MainState["xpathConfig"]
like in src/features/locators/utils/locatorGenerationController.tsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, thank you!