Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Change `rad web` command when httpd port changes
Sebastian Martinez committed 2 years ago
commit 910c103a9b66ee1187b1ee17c2190aae31b25c55
parent adc0660e87ca801af4ec20fad469a2966a8e7f7c
2 files changed +32 -4
modified src/App/Header/Connect.svelte
@@ -14,11 +14,12 @@
  import Link from "@app/components/Link.svelte";
  import PortInput from "@app/App/Header/Connect/PortInput.svelte";

+
  $: customUrl = `${httpd.api.baseUrl.scheme}://${httpd.api.baseUrl.hostname}:${customPort}`;
  $: command = import.meta.env.PROD
-
    ? `rad web --backend ${httpd.api.url}`
-
    : `rad web --frontend ${new URL(import.meta.url).origin} --backend ${
-
        httpd.api.url
-
      }`;
+
    ? `rad web --backend ${customUrl}`
+
    : `rad web --frontend ${
+
        new URL(import.meta.url).origin
+
      } --backend ${customUrl}`;

  let customPort = httpd.api.port;
  const buttonTitle: Record<HttpdState["state"], string> = {
added tests/e2e/httpd.spec.ts
@@ -0,0 +1,27 @@
+
import { expect, test } from "@tests/support/fixtures.js";
+

+
test("rad web command reacts to port change", async ({ page, peerManager }) => {
+
  const peer = await peerManager.startPeer({
+
    name: "port-test",
+
  });
+
  await peer.startHttpd(8090);
+

+
  await page.goto("/");
+
  await page.getByRole("button", { name: "radicle.local" }).click();
+

+
  await expect(
+
    page.getByText(
+
      "rad web --frontend http://localhost:3001 --backend http://127.0.0.1:8081",
+
    ),
+
  ).toBeVisible();
+
  await page.locator('input[name="port"]').fill("8090");
+
  await page.locator('input[name="port"]').press("Enter");
+

+
  await expect(
+
    page.getByText(
+
      "rad web --frontend http://localhost:3001 --backend http://127.0.0.1:8090",
+
    ),
+
  ).toBeVisible();
+

+
  await peer.stopHttpd();
+
});