Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/test-smokes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ jobs:
with:
node-version: 20

- name: Cache multiplex server node_modules
if: ${{ runner.os != 'Windows' || github.event_name == 'schedule' }}
uses: actions/cache@v4
with:
path: tests/integration/playwright/multiplex-server/node_modules
key: ${{ runner.os }}-multiplex-server-${{ hashFiles('tests/integration/playwright/multiplex-server/package.json') }}
restore-keys: |
${{ runner.os }}-multiplex-server-
- name: Install node dependencies
if: ${{ runner.os != 'Windows' || github.event_name == 'schedule' }}
run: yarn
Expand Down
1 change: 1 addition & 0 deletions news/changelog-1.9.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ All changes included in 1.9:

- ([#13396](https://github.com/quarto-dev/quarto-cli/issues/13396)): Fix `quarto publish connect` regression.
- ([#13441](https://github.com/quarto-dev/quarto-cli/pull/13441)): Catch `undefined` exceptions in Pandoc failure to avoid spurious error message.
- ([#13046](https://github.com/quarto-dev/quarto-cli/issues/13046)): Use new url for multiplex socket.io server <https://multiplex.up.railway.app/> as default for `format: revealjs` and `revealjs.multiplex: true`.

## Dependencies

Expand Down
2 changes: 1 addition & 1 deletion src/format/reveal/format-reveal-multiplex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ interface RevealMultiplexToken {
url: string;
}

const kDefaultMultiplexUrl = "https://reveal-multiplex.glitch.me/";
const kDefaultMultiplexUrl = "https://multiplex.up.railway.app/";

async function revealMultiplexToken(
format: Format,
Expand Down
8 changes: 4 additions & 4 deletions src/resources/editor/tools/vs-code.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19276,7 +19276,7 @@ var require_yaml_intelligence_resources = __commonJS({
properties: {
url: {
string: {
default: "https://reveal-multiplex.glitch.me/",
default: "https://multiplex.up.railway.app/",
description: "Multiplex token server (defaults to Reveal-hosted server)\n"
}
},
Expand Down Expand Up @@ -24933,12 +24933,12 @@ var require_yaml_intelligence_resources = __commonJS({
mermaid: "%%"
},
"handlers/mermaid/schema.yml": {
_internalId: 197474,
_internalId: 197471,
type: "object",
description: "be an object",
properties: {
"mermaid-format": {
_internalId: 197466,
_internalId: 197463,
type: "enum",
enum: [
"png",
Expand All @@ -24954,7 +24954,7 @@ var require_yaml_intelligence_resources = __commonJS({
exhaustiveCompletions: true
},
theme: {
_internalId: 197473,
_internalId: 197470,
type: "anyOf",
anyOf: [
{
Expand Down

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/resources/editor/tools/yaml/web-worker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -12248,7 +12248,7 @@
"properties": {
"url": {
"string": {
"default": "https://reveal-multiplex.glitch.me/",
"default": "https://multiplex.up.railway.app/",
"description": "Multiplex token server (defaults to Reveal-hosted server)\n"
}
},
Expand Down Expand Up @@ -17905,12 +17905,12 @@
"mermaid": "%%"
},
"handlers/mermaid/schema.yml": {
"_internalId": 197474,
"_internalId": 197471,
"type": "object",
"description": "be an object",
"properties": {
"mermaid-format": {
"_internalId": 197466,
"_internalId": 197463,
"type": "enum",
"enum": [
"png",
Expand All @@ -17926,7 +17926,7 @@
"exhaustiveCompletions": true
},
"theme": {
"_internalId": 197473,
"_internalId": 197470,
"type": "anyOf",
"anyOf": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ config:
multiplex:
secret: null
id: null
url: "https://reveal-multiplex.glitch.me/"
url: "https://multiplex.up.railway.app/"
2 changes: 1 addition & 1 deletion src/resources/schema/document-reveal-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
properties:
url:
string:
default: https://reveal-multiplex.glitch.me/
default: https://multiplex.up.railway.app/
description: |
Multiplex token server (defaults to Reveal-hosted server)
id:
Expand Down
34 changes: 34 additions & 0 deletions tests/docs/playwright/revealjs/multiplex.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: "Multiplex Test Presentation"
format:
revealjs:
multiplex:
url: "http://127.0.0.1:1948/"
# setting secret and id is required to avoid having multiplex server running at render time
secret: "c04998070a4ec17940ab3c52101daefd"
id: "52d3aedefbff55dbe54e1fa5229df99b849a33951c7c09afb6bcf7e6f33233c7"
---

## Slide 1 {#slide-1}

This is the first slide.

## Slide 2 {#slide-2}

This is the second slide with some content.

## Slide 3 {#slide-3}

### Fragment Test

::: {.fragment}
Fragment 1
:::

::: {.fragment}
Fragment 2
:::

## Slide 4 {#slide-4}

Final slide with more content.
17 changes: 16 additions & 1 deletion tests/integration/playwright-tests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { execProcess } from "../../src/core/process.ts";
import { quartoDevCmd } from "../utils.ts";
import { fail } from "testing/asserts";
import { isWindows } from "../../src/deno_ral/platform.ts";
import { join } from "../../src/deno_ral/path.ts";
import { existsSync } from "../../src/deno_ral/fs.ts";

async function fullInit() {
await initYamlIntelligenceResourcesFromFilesystem();
Expand All @@ -30,6 +32,19 @@ const globOutput = Deno.args.length
setInitializer(fullInit);
await initState();

// Install multiplex server dependencies if needed
const multiplexServerPath = "integration/playwright/multiplex-server";
const multiplexNodeModules = join(multiplexServerPath, "node_modules");
if (!existsSync(multiplexNodeModules)) {
console.log("Installing multiplex server dependencies...");
await execProcess({
cmd: isWindows ? "npm.cmd" : "npm",
args: ["install", "--loglevel=error"],
cwd: multiplexServerPath,
});
console.log("Multiplex server dependencies installed.");
}

// const promises = [];
const fileNames: string[] = [];
const extraOpts = [
Expand All @@ -52,7 +67,7 @@ for (const { path: fileName } of globOutput) {
// mediabag inspection if we don't wait all renders
// individually. This is very slow..
await execProcess({
cmd: quartoDevCmd(),
cmd: quartoDevCmd(),
args: ["render", input, ...options],
});
fileNames.push(fileName);
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/playwright/multiplex-server/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
package-lock.json
34 changes: 34 additions & 0 deletions tests/integration/playwright/multiplex-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# RevealJS Multiplex Server (Local Test Instance)

This is a local instance of the [reveal/multiplex](https://github.com/reveal/multiplex) server used for testing Quarto's RevealJS multiplex feature.

## Purpose

This server enables testing of the multiplex presentation feature without relying on external services. It:

- Generates tokens (secret/socketId pairs)
- Manages socket.io connections between master and client presentations
- Broadcasts presentation state changes from master to clients

## Usage

The server is automatically started by Playwright's `webServer` configuration when running tests. It listens on `http://localhost:1948` by default.

## Installation

Dependencies are automatically installed by `tests/integration/playwright-tests.test.ts` before running Playwright tests.

Manual installation:
```bash
npm install
```

## Running Manually

```bash
npm start
```

## Attribution

Server code is from the [reveal/multiplex](https://github.com/reveal/multiplex) repository.
76 changes: 76 additions & 0 deletions tests/integration/playwright/multiplex-server/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
let http = require("http");
let express = require("express");
let cors = require("cors");
let fs = require("fs");
let io = require("socket.io");
let crypto = require("crypto");

let app = express();
let staticDir = express.static;

app.use(cors()); // enable cors for all origins

let server = http.createServer(app);

let socketsIO = io(server, {
cors: {
origin: "*",
methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
},
});

let opts = {
port: process.env.PORT || 1948,
baseDir: process.cwd(),
};

socketsIO.on("connection", (socket) => {
console.debug("Connection opened");
socket.on("multiplex-statechanged", (data) => {
if (
typeof data.secret == "undefined" ||
data.secret == null ||
data.secret === ""
)
return;
if (createHash(data.secret) === data.socketId) {
console.debug("Broadcasting state change");
data.secret = null;
socket.broadcast.emit(data.socketId, data);
} else {
console.warn("Secret and socketId do not match");
}
});
});

app.use(express.static(opts.baseDir));

app.get("/", (req, res) => {
res.writeHead(200, { "Content-Type": "text/html" });

let stream = fs.createReadStream(opts.baseDir + "/index.html");
stream.on("error", (error) => {
res.write(
'<style>body{font-family: sans-serif;}</style><h2>reveal.js multiplex server.</h2><a href="/token">Generate token</a>'
);
res.end();
});
stream.on("open", () => {
stream.pipe(res);
});
});

app.get("/token", (req, res) => {
let secret = crypto.randomBytes(16).toString("hex");
res.send({ secret: secret, socketId: createHash(secret) });
});

let createHash = (secret) => {
let hash = crypto.createHash("sha256").update(secret);
return hash.digest("hex");
};

// Open the listening port
server.listen(opts.port || null);

console.log(`reveal.js: Multiplex running on port: ${opts.port}`);
19 changes: 19 additions & 0 deletions tests/integration/playwright/multiplex-server/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "reveal-multiplex",
"version": "0.1.0",
"description": "reveal.js multiplex plugin - local test server",
"homepage": "https://revealjs.com",
"scripts": {
"start": "node index.js"
},
"engines": {
"node": ">=18.0.0"
},
"dependencies": {
"cors": "^2.8.5",
"express": "~4.17.1",
"mustache": "~4.0.0",
"socket.io": "^2.5.0"
},
"license": "MIT"
}
23 changes: 17 additions & 6 deletions tests/integration/playwright/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,21 @@ export default defineConfig({

/* Run your local dev server before starting the tests */
/* We use python for this but we could also try using another tool */
webServer: {
command: 'uv run python -m http.server 8080',
url: 'http://127.0.0.1:8080',
reuseExistingServer: !isCI,
cwd: '../../docs/playwright',
},
webServer: [
{
// HTTP server for rendered HTML files
command: 'uv run python -m http.server 8080',
url: 'http://127.0.0.1:8080',
reuseExistingServer: !isCI,
cwd: '../../docs/playwright',
},
{
// Socket.IO multiplex server for RevealJS
command: 'npm start',
url: 'http://127.0.0.1:1948',
reuseExistingServer: !isCI,
cwd: './multiplex-server',
timeout: 10000,
}
],
});
Loading
Loading