From 3046524ff6243dbcccb43985cf11970ac02b76f6 Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Wed, 8 May 2024 20:36:05 +0300 Subject: [PATCH] chore: fix all tests feat: add lockConnect to QS options for alt connection screen UI --- README.MD | 9 +++++---- cypress/e2e/index.spec.ts | 4 ++-- src/react/{AddServer.tsx => AddServerOrConnect.tsx} | 6 +++--- src/react/ServersList.stories.tsx | 4 ++-- src/react/ServersListProvider.tsx | 6 +++--- 5 files changed, 15 insertions(+), 14 deletions(-) rename src/react/{AddServer.tsx => AddServerOrConnect.tsx} (96%) diff --git a/README.MD b/README.MD index 1b8b84ac..bc39fb98 100644 --- a/README.MD +++ b/README.MD @@ -103,10 +103,11 @@ world chunks have a *yellow* border, hostile mobs have a *red* outline, passive Press `Y` to set query parameters to url of your current game state. -- `?server=` - Display connect screen to the server on load -- `?username=` - Set the username on load -- `?proxy=` - Set the proxy server address on load -- `?version=` - Set the version on load +- `?ip=` - Display connect screen to the server on load +- `?username=` - Set the username for server +- `?proxy=` - Set the proxy server address to use for server +- `?version=` - Set the version for server +- `?lockConnect=true` - Disable cancel / save buttons, useful for integrates iframes - `?reconnect=true` - Reconnect to the server on page reloads. Available in **dev mode only** and very useful on server testing. - `?loadSave=` - Load the save on load with the specified folder name (not title) diff --git a/cypress/e2e/index.spec.ts b/cypress/e2e/index.spec.ts index 35399393..455b1283 100644 --- a/cypress/e2e/index.spec.ts +++ b/cypress/e2e/index.spec.ts @@ -38,7 +38,7 @@ const setOptions = (options: Partial) => { } it('Loads & renders singleplayer', () => { - cleanVisit('/?singleplayer=1') + visit('/?singleplayer=1') setOptions({ localServerOptions: { generation: { @@ -52,7 +52,7 @@ it('Loads & renders singleplayer', () => { testWorldLoad() }) -it.only('Joins to server', () => { +it('Joins to server', () => { visit('/?ip=localhost&version=1.16.1') window.localStorage.version = '' // todo replace with data-test diff --git a/src/react/AddServer.tsx b/src/react/AddServerOrConnect.tsx similarity index 96% rename from src/react/AddServer.tsx rename to src/react/AddServerOrConnect.tsx index bae39ac9..54f04af1 100644 --- a/src/react/AddServer.tsx +++ b/src/react/AddServerOrConnect.tsx @@ -38,6 +38,7 @@ export default ({ onBack, onConfirm, title = 'Add a Server', initialData, parseQ const [usernameOverride, setUsernameOverride] = React.useState(initialData?.usernameOverride ?? qsParams?.get('username') ?? '') const [passwordOverride, setPasswordOverride] = React.useState(initialData?.passwordOverride ?? qsParams?.get('password') ?? '') const smallWidth = useIsSmallWidth() + const lockConnect = qsParams?.get('lockConnect') === 'true' return
setProxyOverride(value)} placeholder={defaults?.proxyOverride} /> setUsernameOverride(value)} placeholder={defaults?.usernameOverride} /> setPasswordOverride(value)} /* placeholder='For advanced usage only' */ /> - - + } }>Cancel} {qsParams?.get('ip') &&