Skip to content

Commit 61fc30c

Browse files
committed
cleaning stuff uppp
1 parent 3c8f9e9 commit 61fc30c

File tree

15 files changed

+133
-55
lines changed

15 files changed

+133
-55
lines changed

packages/selenium-ide/src/browser/components/AppBar/index.tsx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
1+
import MenuIcon from '@mui/icons-material/Menu'
2+
import MenuOpenIcon from '@mui/icons-material/MenuOpen'
13
import React from 'react'
24
import TabPanel from '../Tab/Panel'
3-
import SuiteControls from '../../windows/ProjectEditor/tabs/Suites/Controls'
4-
import TestControls from '../../windows/ProjectEditor/tabs/Tests/Controls'
5-
import { SUITES_TAB, TESTS_TAB } from '../../enums/tab'
5+
import SuiteControls from 'browser/windows/ProjectEditor/tabs/Suites/Controls'
6+
import TestControls from 'browser/windows/ProjectEditor/tabs/Tests/Controls'
7+
import { SUITES_TAB, TESTS_TAB } from 'browser/enums/tab'
68
import { SIDEMainProps } from '../types'
79
import AppBarTabs from './AppBarTabs'
8-
import { Paper } from '@mui/material'
10+
import IconButton from '@mui/material/IconButton'
11+
import Paper from '@mui/material/Paper'
912
import { getActiveTest } from '@seleniumhq/side-api'
1013

11-
const SIDEAppBar: React.FC<Pick<SIDEMainProps, 'session' | 'setTab' | 'tab'>> = ({
14+
type SIDEAppBarProps = Pick<SIDEMainProps, 'session' | 'setTab' | 'tab'>
15+
16+
const SIDEAppBar: React.FC<SIDEAppBarProps> = ({
1217
session,
1318
setTab,
1419
tab,
1520
}) => {
21+
const showDrawer = session.state.editor.showDrawer
1622
return (
1723
<Paper className="flex flex-row width-100 z-3" elevation={1} square>
24+
<IconButton
25+
aria-label={showDrawer ? 'Close drawer' : 'Open drawer'}
26+
onClick={() => window.sideAPI.state.set('editor.showDrawer', !showDrawer)}
27+
>
28+
{showDrawer ? <MenuOpenIcon /> : <MenuIcon />}
29+
</IconButton>
1830
<AppBarTabs setTab={setTab} tab={tab} />
1931
<div className="flex flex-1" />
2032
<TabPanel index={TESTS_TAB} value={tab}>

packages/selenium-ide/src/browser/components/ProjectEditor/index.tsx

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import SIDEAppBar from '../AppBar'
1313
const ProjectEditor: React.FC<
1414
Pick<SIDEMainProps, 'session' | 'setTab' | 'tab'>
1515
> = ({ session, setTab, tab }) => {
16+
const showDrawer = session.state.editor.showDrawer
1617
if (session.project.id === loadingID) {
1718
return <div id="loading" />
1819
}
@@ -23,21 +24,28 @@ const ProjectEditor: React.FC<
2324
<SIDEAppBar session={session} setTab={setTab} tab={tab} />
2425
</div>
2526
<div className="flex-1">
26-
<PanelGroup
27-
direction="horizontal"
28-
id="drawer-editor"
29-
{...usePanelGroup('drawer-editor')}
30-
>
31-
<Panel collapsible id="editor-drawer" order={1}>
32-
<SIDEDrawer session={session} tab={tab} />
33-
</Panel>
34-
<PanelResizeHandle className="resize-bar" id="h-resize-1" />
35-
<Panel id="editor-panel" order={2}>
36-
<Box className="fill flex flex-col">
37-
<Main session={session} setTab={setTab} tab={tab} />
38-
</Box>
39-
</Panel>
40-
</PanelGroup>
27+
{showDrawer && (
28+
<PanelGroup
29+
direction="horizontal"
30+
id="drawer-editor"
31+
{...usePanelGroup('drawer-editor')}
32+
>
33+
<Panel collapsible id="editor-drawer" order={1}>
34+
<SIDEDrawer session={session} tab={tab} />
35+
</Panel>
36+
<PanelResizeHandle className="resize-bar" id="h-resize-1" />
37+
<Panel id="editor-panel" order={2}>
38+
<Box className="fill flex flex-col">
39+
<Main session={session} setTab={setTab} tab={tab} />
40+
</Box>
41+
</Panel>
42+
</PanelGroup>
43+
)}
44+
{!showDrawer && (
45+
<Box className="fill flex flex-col">
46+
<Main session={session} setTab={setTab} tab={tab} />
47+
</Box>
48+
)}
4149
</div>
4250
</div>
4351
</DndProvider>

packages/selenium-ide/src/browser/helpers/preload.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ export default async (api: NestedPartial<Api>, ...cbs: (() => void)[]) => {
6969
...api,
7070
mutators: getApiSubset(mutators, api),
7171
} as ApiWithMutators
72-
console.log(api, mutators, getApiSubset(mutators, api))
7372
if (cbs?.length) {
7473
for (const cb of cbs) {
7574
await cb()

packages/selenium-ide/src/browser/windows/ProjectEditor/tabs/Suites/Editor/index.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
import Box from '@mui/material/Box'
2+
import Typography from '@mui/material/Typography'
13
import Paper from '@mui/material/Paper'
4+
import { loadingID } from '@seleniumhq/side-api/dist/constants/loadingID'
25
import { getActiveSuite } from '@seleniumhq/side-api/dist/helpers/getActiveData'
6+
import { TestShape } from '@seleniumhq/side-model'
7+
import { SIDEMainProps } from 'browser/components/types'
38
import React from 'react'
49
import SuiteEditor from './SuiteEditor'
510
import AvailableSuiteTestList from './AvailableSuiteTestList'
6-
import { TestShape } from '@seleniumhq/side-model'
711
import CurrentSuiteTestList from './CurrentSuiteTestList'
8-
import { SIDEMainProps } from 'browser/components/types'
9-
import { Box } from '@mui/material'
1012

1113
const SuiteCustomizer: React.FC<Pick<SIDEMainProps, 'session'>> = ({
1214
session,
@@ -19,7 +21,13 @@ const SuiteCustomizer: React.FC<Pick<SIDEMainProps, 'session'>> = ({
1921
project: { tests },
2022
state: { activeSuiteID, editor },
2123
} = session
22-
24+
if (activeSuite.id === loadingID) {
25+
return (
26+
<Box className="flex-1 width-100" textAlign="center">
27+
<Typography className="p-4">No Suite Selected</Typography>
28+
</Box>
29+
)
30+
}
2331
return (
2432
<>
2533
<Box className="flex-1 flex-row no-overflow-y">
@@ -28,17 +36,9 @@ const SuiteCustomizer: React.FC<Pick<SIDEMainProps, 'session'>> = ({
2836
selectedIndexes={editor.selectedTestIndexes}
2937
tests={activeTests}
3038
/>
31-
<AvailableSuiteTestList
32-
activeSuite={activeSuiteID}
33-
allTests={tests}
34-
/>
39+
<AvailableSuiteTestList activeSuite={activeSuiteID} allTests={tests} />
3540
</Box>
36-
<Paper
37-
className="flex-initial"
38-
elevation={1}
39-
id="suite-editor"
40-
square
41-
>
41+
<Paper className="flex-initial" elevation={1} id="suite-editor" square>
4242
<SuiteEditor suite={activeSuite} />
4343
</Paper>
4444
</>

packages/selenium-ide/src/browser/windows/ProjectEditor/tabs/Suites/SuiteSelector.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ const SuiteSelector: React.FC<Pick<SIDEMainProps, 'session'>> = ({
1818
const [disabled /*, setDisabled*/] = React.useState(false)
1919
const [confirmDelete, setConfirmDelete] = React.useState(false)
2020
const [confirmCreate, setConfirmCreate] = React.useState(false)
21-
const activeSuiteName = suites.find((t) => t.id === activeSuiteID)?.name ?? ''
21+
const matchingSuite = suites.find((t) => t.id === activeSuiteID)
22+
const activeSuiteName = matchingSuite?.name ?? ''
2223
return (
2324
<>
2425
<EditorToolbar
@@ -31,7 +32,7 @@ const SuiteSelector: React.FC<Pick<SIDEMainProps, 'session'>> = ({
3132
? async () => window.sideAPI.state.toggleSuiteMode('editor')
3233
: undefined
3334
}
34-
editText='Edit Suite'
35+
editText="Edit Suite"
3536
onRemove={
3637
activeSuiteID ? async () => setConfirmDelete(true) : undefined
3738
}
@@ -41,10 +42,12 @@ const SuiteSelector: React.FC<Pick<SIDEMainProps, 'session'>> = ({
4142
? async () => window.sideAPI.state.toggleSuiteMode('viewer')
4243
: undefined
4344
}
44-
viewText='View Suite Playback'
45+
viewText="View Suite Playback"
4546
>
4647
<FormControl className="flex flex-1">
47-
<InputLabel id="suite-select-label">Selected Suite</InputLabel>
48+
<InputLabel id="suite-select-label" margin="dense" size='small'>
49+
Selected Suite
50+
</InputLabel>
4851
<Select
4952
label="suite-select-label"
5053
onChange={async (event) => {
@@ -56,7 +59,7 @@ const SuiteSelector: React.FC<Pick<SIDEMainProps, 'session'>> = ({
5659
margin="dense"
5760
placeholder={suites.length ? 'Select a suite' : 'No suites found'}
5861
size="small"
59-
value={activeSuiteID}
62+
value={matchingSuite?.id ?? ''}
6063
>
6164
{suites.map((t) => (
6265
<MenuItem key={t.id} value={t.id}>

packages/selenium-ide/src/browser/windows/ProjectEditor/tabs/Suites/Viewer/index.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
import Box from '@mui/material/Box'
12
import List from '@mui/material/List'
3+
import Typography from '@mui/material/Typography'
24
import { CoreSessionData, getActiveSuite, hasID } from '@seleniumhq/side-api'
35
import { TestShape } from '@seleniumhq/side-model'
46
import React from 'react'
57
import SuiteViewerEntry from './Entry'
68
import { SIDEMainProps } from 'browser/components/types'
9+
import { loadingID } from '@seleniumhq/side-api/src/constants/loadingID'
710

811
export interface CurrentSuiteTestListProps {
912
session: CoreSessionData
@@ -13,6 +16,13 @@ const SuiteViewer: React.FC<Pick<SIDEMainProps, 'session'>> = ({ session }) => {
1316
const tests = session.project.tests
1417
const testResults = session.state.playback.testResults
1518
const activeSuite = getActiveSuite(session)
19+
if (activeSuite.id === loadingID) {
20+
return (
21+
<Box className="flex-1 width-100" textAlign="center">
22+
<Typography className="p-4">No Suite Selected</Typography>
23+
</Box>
24+
)
25+
}
1626
return (
1727
<>
1828
<List className="overflow-y pt-0" dense>

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,23 @@ const CommandEditor: FC<CommandEditorProps> = ({
3535
...command,
3636
command: isDisabled ? command.command.slice(2) : command.command,
3737
}
38+
if (selectedCommandIndexes.length > 1) {
39+
return (
40+
<Stack className="p-4" spacing={1}>
41+
<Typography className="centered py-4" variant="body2">
42+
{selectedCommandIndexes.length} commands selected
43+
</Typography>
44+
</Stack>
45+
)
46+
}
3847
if (
39-
selectedCommandIndexes.length !== 1 ||
40-
!commands[correctedCommand.command]
48+
!commands[correctedCommand.command] ||
49+
selectedCommandIndexes.length === 0
4150
) {
4251
return (
43-
<Stack className="p-4" spacing={1} style={{ height: 240 }}>
52+
<Stack className="p-4" spacing={1}>
4453
<Typography className="centered py-4" variant="body2">
45-
{selectedCommandIndexes.length === 0
46-
? 'No commands selected'
47-
: `${selectedCommandIndexes.length} commands selected`}
54+
No commands selected
4855
</Typography>
4956
</Stack>
5057
)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const CommandList: FC<CommandListProps> = ({
5858
</EditorToolbar>
5959
<ReorderableList
6060
classes={{
61-
root: 'overflow-y pt-0',
61+
root: 'flex-1 flex-col overflow-y pt-0',
6262
}}
6363
dense
6464
aria-disabled={disabled}

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,20 @@ const {
1616
} = window.sideAPI
1717

1818
const commandTextFormat = { color: 'primary.main', typography: 'body2' }
19+
const commentTextFormat = {
20+
color: 'info.main',
21+
ml: 2,
22+
typography: 'subtitle2',
23+
}
1924
const argTextFormat = {
2025
color: 'secondary.main',
21-
typography: 'subtitle2',
2226
ml: 2,
27+
typography: 'subtitle2',
2328
}
2429
const errorTextFormat = {
2530
color: 'error.main',
26-
typography: 'caption',
2731
ml: 2,
32+
typography: 'caption',
2833
}
2934

3035
interface CommandRowProps {
@@ -54,7 +59,7 @@ export const defaultCommandState =
5459
const CommandRow: React.FC<CommandRowProps> = ({
5560
activeTest,
5661
commandState = defaultCommandState,
57-
command: { command, id, isBreakpoint, opensWindow, target, value },
62+
command: { command, comment, id, isBreakpoint, opensWindow, target, value },
5863
disabled = false,
5964
index,
6065
reorderPreview,
@@ -75,6 +80,7 @@ const CommandRow: React.FC<CommandRowProps> = ({
7580
className={mainClass}
7681
divider
7782
data-command-id={id}
83+
data-command={commandText}
7884
dragType="COMMAND"
7985
id={id}
8086
index={index}
@@ -117,6 +123,10 @@ const CommandRow: React.FC<CommandRowProps> = ({
117123
}
118124
secondary={
119125
<>
126+
<Box sx={errorTextFormat}>{commandState.message}</Box>
127+
{comment && (
128+
<Box sx={commentTextFormat}>// {comment}</Box>
129+
)}
120130
<Box sx={argTextFormat}>{target}</Box>
121131
<Box sx={argTextFormat}>{value}</Box>
122132
<Box sx={errorTextFormat}>{commandState.message}</Box>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const CommandList: FC<CommandListProps> = ({
6464
<ReorderableList
6565
aria-disabled={disabled}
6666
classes={{
67-
root: 'overflow-y pt-0',
67+
root: 'flex-1 flex-col overflow-y pt-0',
6868
}}
6969
dense
7070
>

0 commit comments

Comments
 (0)