From 91dea939a6710c6725055e5e4584be51defb4eb8 Mon Sep 17 00:00:00 2001 From: toddtarsi Date: Fri, 22 Mar 2024 00:40:06 -0500 Subject: [PATCH] i think we are ready to go --- packages/selenium-ide/scripts/ide-runner.js | 23 +++++++++++----- .../windows/ProjectEditor/renderer.tsx | 4 +-- .../tabs/Project/ProjectSettings.tsx | 19 ++++++++++++- .../controllers/ResizablePanels/index.ts | 27 +++++++++++-------- .../main/session/controllers/State/index.ts | 2 +- .../main/session/controllers/Windows/index.ts | 16 +++-------- 6 files changed, 57 insertions(+), 34 deletions(-) diff --git a/packages/selenium-ide/scripts/ide-runner.js b/packages/selenium-ide/scripts/ide-runner.js index 94d1edb3e..005d8cb9d 100644 --- a/packages/selenium-ide/scripts/ide-runner.js +++ b/packages/selenium-ide/scripts/ide-runner.js @@ -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 diff --git a/packages/selenium-ide/src/browser/windows/ProjectEditor/renderer.tsx b/packages/selenium-ide/src/browser/windows/ProjectEditor/renderer.tsx index 6e41a06fe..0f0374b52 100644 --- a/packages/selenium-ide/src/browser/windows/ProjectEditor/renderer.tsx +++ b/packages/selenium-ide/src/browser/windows/ProjectEditor/renderer.tsx @@ -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(TESTS_TAB) + const [tab, setTab] = React.useState(PROJECT_TAB) return ( diff --git a/packages/selenium-ide/src/browser/windows/ProjectEditor/tabs/Project/ProjectSettings.tsx b/packages/selenium-ide/src/browser/windows/ProjectEditor/tabs/Project/ProjectSettings.tsx index 5cc9a1ff0..5c84cf09a 100644 --- a/packages/selenium-ide/src/browser/windows/ProjectEditor/tabs/Project/ProjectSettings.tsx +++ b/packages/selenium-ide/src/browser/windows/ProjectEditor/tabs/Project/ProjectSettings.tsx @@ -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 ( <> @@ -39,6 +42,20 @@ const ProjectSettings: FC = () => { value={name} /> + + { + update({ + url: e.target.value, + }) + }} + size="small" + value={url} + /> + { playbackWindow.setPosition(...panelDims.position) }) diff --git a/packages/selenium-ide/src/main/session/controllers/State/index.ts b/packages/selenium-ide/src/main/session/controllers/State/index.ts index 2d9d60871..ea06afa0f 100644 --- a/packages/selenium-ide/src/main/session/controllers/State/index.ts +++ b/packages/selenium-ide/src/main/session/controllers/State/index.ts @@ -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() }) } } diff --git a/packages/selenium-ide/src/main/session/controllers/Windows/index.ts b/packages/selenium-ide/src/main/session/controllers/Windows/index.ts index d02e2110d..16dd5a07d 100644 --- a/packages/selenium-ide/src/main/session/controllers/Windows/index.ts +++ b/packages/selenium-ide/src/main/session/controllers/Windows/index.ts @@ -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, @@ -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) { @@ -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,