Skip to content

Commit

Permalink
i think we are ready to go
Browse files Browse the repository at this point in the history
  • Loading branch information
toddtarsi committed Mar 22, 2024
1 parent c12e9d2 commit 91dea93
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 34 deletions.
23 changes: 16 additions & 7 deletions packages/selenium-ide/scripts/ide-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,28 @@ async function main() {
} catch (e) {}
}
await driver.switchTo().window(handles[0])

const projectTab = await driver.wait(
webdriver.until.elementLocated(webdriver.By.id('tab-2')),
5000
)
await projectTab.click()

const url = await driver.wait(
webdriver.until.elementLocated(webdriver.By.css('[data-url]')),
webdriver.until.elementLocated(webdriver.By.id('project-url')),
5000
)
await url.click()
while ((await url.getAttribute('value')) !== '') {
await url.sendKeys(webdriver.Key.BACK_SPACE)
}
const host = 'http://localhost:8080'
for (const index in host) {
await url.sendKeys(host[index])
await driver.sleep(10)
}
await url.sendKeys('http://localhost:8080')

const testTab = await driver.wait(
webdriver.until.elementLocated(webdriver.By.id('tab-0')),
5000
)
await testTab.click()

const record = await driver.wait(
webdriver.until.elementLocated(webdriver.By.css('[data-record]')),
1000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import SIDELogger from 'browser/components/Logger'
import PlaybackControls from 'browser/components/PlaybackControls'
import ProjectPlaybackWindow from 'browser/components/PlaybackPanel'
import ProjectEditor from 'browser/components/ProjectEditor'
import { TAB, TESTS_TAB } from 'browser/enums/tab'
import { PROJECT_TAB, TAB } from 'browser/enums/tab'
import { usePanelGroup } from 'browser/hooks/usePanelGroup'
import { SessionContextProviders } from 'browser/contexts/provider'

const ProjectMainWindow = () => {
const [tab, setTab] = React.useState<TAB>(TESTS_TAB)
const [tab, setTab] = React.useState<TAB>(PROJECT_TAB)
return (
<AppWrapper>
<SessionContextProviders>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ const {
} = window.sideAPI
const ProjectSettings: FC = () => {
const {
project: { delay, name, plugins },
project: { delay, name, plugins, url },
} = React.useContext(context)
if (url === 'http://loading') {
return null
}
return (
<>
<Stack className="p-4" spacing={1}>
Expand All @@ -39,6 +42,20 @@ const ProjectSettings: FC = () => {
value={name}
/>
</FormControl>
<FormControl>
<TextField
id="project-url"
label="Project URL"
name="project-url"
onChange={(e: any) => {
update({
url: e.target.value,
})
}}
size="small"
value={url}
/>
</FormControl>
<FormControl>
<TextField
id="delay"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@ export default class ResizablePanelsController extends BaseController {
const panelScreenPosition = await this.getPanelScreenPosition(
'playback-panel'
)
const offset = { x: 0, y: 0 };
const offset = { x: 0, y: 0 }
switch (process.platform) {
case 'win32':
offset.x = 12;
offset.y = 21;
break;
offset.x = 12
offset.y = 21
break
case 'darwin':
offset.x = 0;
offset.y = -29;
break;
offset.x = 0
offset.y = -29
break
default:
offset.x = 0;
offset.y = 0;
offset.x = 0
offset.y = 0
}
this.cachedPlaybackWindowDimensions = {
position: [
Expand All @@ -67,12 +67,17 @@ export default class ResizablePanelsController extends BaseController {
position: [number, number]
size: [number, number]
}
return this.cachedPlaybackWindowDimensions!;
return this.cachedPlaybackWindowDimensions!
}

async recalculatePlaybackWindows() {
this.session.windows.recalculatePlaybackWindows()
const { active, height, width } =
this.session.state.state.editor.overrideWindowSize
if (active) {
return this.session.windows.resizePlaybackWindows(width, height)
}
const panelDims = await this.getPlaybackWindowDimensions()
this.session.windows.resizePlaybackWindows(...panelDims.size)
this.session.windows.playbackWindows.forEach((playbackWindow) => {
playbackWindow.setPosition(...panelDims.position)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class StateController extends BaseController {
set(key: string, _data: any) {
if (key.includes('editor.overrideWindowSize')) {
queue(async () => {
await this.session.windows.recalculatePlaybackWindows()
await this.session.resizablePanels.recalculatePlaybackWindows()
})
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ export default class WindowsController extends BaseController {
)
const window = this.windowLoaders[playbackWindowName]({
...opts,
show: false,
x: playbackPanel.position[0],
y: playbackPanel.position[1],
width: correctedDims.width,
Expand Down Expand Up @@ -414,7 +415,9 @@ export default class WindowsController extends BaseController {
}

async requestPlaybackWindow() {
await this.openPlaybackWindow(null)
const window = await this.openPlaybackWindow(null)
const projectURL = this.session.projects.project.url
window.loadURL(projectURL)
}

async calculateScaleAndZoom(_targetWidth: number, _targetHeight: number) {
Expand Down Expand Up @@ -462,17 +465,6 @@ export default class WindowsController extends BaseController {
window.webContents.setZoomFactor(zoomFactor)
}

async recalculatePlaybackWindows() {
const { active, height, width } =
this.session.state.state.editor.overrideWindowSize
if (active) {
return this.resizePlaybackWindows(width, height)
}
const panelDims =
await this.session.resizablePanels.getPlaybackWindowDimensions()
this.resizePlaybackWindows(...panelDims.size)
}

async resizePlaybackWindows(_targetWidth: number, _targetHeight: number) {
const { width, height, zoomFactor } = await this.calculateScaleAndZoom(
_targetWidth,
Expand Down

0 comments on commit 91dea93

Please sign in to comment.