Skip to content

Commit 9ce76d1

Browse files
committed
scroll commands into view
1 parent a5e0f5f commit 9ce76d1

File tree

5 files changed

+20
-14
lines changed

5 files changed

+20
-14
lines changed

packages/selenium-ide/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "selenium-ide",
3-
"version": "4.0.1-alpha.78",
3+
"version": "4.0.1-alpha.79",
44
"private": false,
55
"description": "Selenium IDE electron app",
66
"author": "Todd <[email protected]>",

packages/selenium-ide/src/browser/windows/ProjectEditor/tabs/Tests/TestCommandListItem.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ const CommandRow: React.FC<CommandRowProps> = ({
7474
<ReorderableListItem
7575
className={mainClass}
7676
divider
77+
data-command-id={id}
7778
dragType="COMMAND"
7879
id={id}
7980
index={index}

packages/selenium-ide/src/browser/windows/ProjectEditor/tabs/Tests/TestCommandRow.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ const CommandRow: React.FC<CommandRowProps> = ({
115115
},
116116
}}
117117
divider
118+
data-command-id={id}
118119
dragType="COMMAND"
119120
id={id}
120121
index={index}

packages/selenium-ide/src/browser/windows/ProjectEditor/tabs/Tests/TestsTab.tsx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,27 @@ const TestsTab: React.FC<Pick<SIDEMainProps, 'session' | 'setTab' | 'tab'>> = ({
6464
const CommandsComponent = isTableWidth ? CommandTable : CommandList
6565
const activeTest = getActiveTest(session)
6666
const activeCommand = getActiveCommand(session)
67+
React.useEffect(() => {
68+
if (activeCommand) {
69+
setTimeout(() => {
70+
const commandElement = document.querySelector(
71+
`[data-command-id="${activeCommand.id}"]`
72+
)
73+
if (commandElement) {
74+
commandElement.scrollIntoView({
75+
behavior: 'smooth',
76+
block: 'nearest',
77+
inline: 'start',
78+
})
79+
}
80+
}, 100)
81+
}
82+
}, [activeCommand])
6783
const disabled = ['playing', 'recording'].includes(session.state.status)
6884
return (
6985
<Box className="fill flex flex-col">
7086
<Box className="flex-initial">
71-
<AppBar
72-
session={session}
73-
setTab={setTab}
74-
tab={tab}
75-
/>
87+
<AppBar session={session} setTab={setTab} tab={tab} />
7688
</Box>
7789
<Box className="flex-1 flex-col" ref={ref}>
7890
<TestSelector session={session} />

packages/selenium-ide/src/main/session/controllers/Playback/index.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -360,14 +360,6 @@ export default class PlaybackController extends BaseController {
360360
this.playNextTest()
361361
}
362362
}
363-
if (e.state === 'finished') {
364-
await this.session.api.state.updateStepSelection(
365-
0,
366-
false,
367-
false,
368-
true
369-
)
370-
}
371363
}
372364
this.session.api.playback.onPlayUpdate.dispatchEvent(e)
373365
}

0 commit comments

Comments
 (0)