diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 6131cabd5..cf34e0690 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -6,7 +6,7 @@ on: branches: [ dev, master] jobs: - build: + e2e: runs-on: ubuntu-latest steps: @@ -39,10 +39,3 @@ jobs: - name: Run E2E tests run: poetry run alfred ci --e2e - - - uses: actions/upload-artifact@v4 - if: always() - with: - name: playwright-report - path: e2e_tests/playwright-report/ - retention-days: 2 diff --git a/alfred/npm.py b/alfred/npm.py index 9ae9a0572..04223a2df 100644 --- a/alfred/npm.py +++ b/alfred/npm.py @@ -7,7 +7,7 @@ def npm_lint(): @alfred.command("npm.e2e", help="run e2e tests") def npm_test(): - alfred.run("npm run test:ci") + alfred.run("npm run e2e:ci") @alfred.command("npm.build", help="build ui code") def npm_build(): diff --git a/e2e_tests/index.js b/e2e_tests/index.js index 6fbd917ca..3502db157 100644 --- a/e2e_tests/index.js +++ b/e2e_tests/index.js @@ -1,7 +1,7 @@ const express = require("express"); const fs = require("node:fs").promises; const { spawn } = require("node:child_process"); -const httpProxy = require('http-proxy'); +const httpProxy = require("http-proxy"); class Streamsync { constructor() { @@ -11,15 +11,18 @@ class Streamsync { } async start() { - return new Promise((resolve) => { + return new Promise((resolve, reject) => { const ss = spawn( "streamsync", - ["edit", "./runtime", "--port", this.port], - { - stdio: "pipe", - } + ["edit", "./runtime", "--port", this.port] ); this.process = ss; + const startupTimeout = setTimeout(() => { + // eslint-disable-next-line no-console + console.error("Streamsync startup timeout"); + ss.kill(); + reject(); + }, 5000); ss.stdout.on("data", (data) => { // eslint-disable-next-line no-console @@ -28,6 +31,7 @@ class Streamsync { ); if (data.includes("Builder is available at")) { this.initialized = true; + clearTimeout(startupTimeout); resolve(ss); } }); @@ -45,7 +49,7 @@ class Streamsync { // eslint-disable-next-line no-console console.log(`[${ss.pid}] child process error`, err); }); - ss.on("exit", (code, arg) => { + ss.on("exit", (code) => { // eslint-disable-next-line no-console this.process = null; console.log( @@ -86,7 +90,6 @@ class Streamsync { const ss = new Streamsync(); (async () => { await fs.mkdir("runtime", { recursive: true }); - await ss.loadPreset("empty_page"); })(); var proxy = httpProxy.createProxyServer(); @@ -99,6 +102,7 @@ proxy.on('error', function (e) { const app = express(); app.get("/preset/:preset", async (req, res) => { + console.log("Loading preset", req.params.preset); const preset = req.params.preset; await ss.loadPreset(preset); res.send("UI updated"); diff --git a/e2e_tests/package.json b/e2e_tests/package.json index a94ef728b..0d41fd574 100644 --- a/e2e_tests/package.json +++ b/e2e_tests/package.json @@ -4,9 +4,10 @@ "description": "", "main": "index.js", "scripts": { - "dev": "node index.js", + "start": "node index.js", "test": "playwright test --project=chromium --reporter=list", - "test:ci": "playwright test --project=chromium" + "test:ci": "playwright test --project=chromium", + "test:ui": "playwright test --project=chromium --ui" }, "dependencies": { "express": "4.18.2", diff --git a/e2e_tests/playwright.config.ts b/e2e_tests/playwright.config.ts index 754edd44b..cd1d16a36 100644 --- a/e2e_tests/playwright.config.ts +++ b/e2e_tests/playwright.config.ts @@ -6,7 +6,7 @@ export default defineConfig({ forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 0, workers: 1, - reporter: "html", + reporter: "list", use: { baseURL: "http://127.0.0.1:7357", trace: "on-first-retry", @@ -30,7 +30,7 @@ export default defineConfig({ ], webServer: { - command: "npm run dev", + command: "npm start", url: "http://127.0.0.1:7357", reuseExistingServer: true, stdout: 'pipe', diff --git a/e2e_tests/tests/createAndRemove.spec.ts b/e2e_tests/tests/createAndRemove.spec.ts index 1e0f8baf5..70278d082 100644 --- a/e2e_tests/tests/createAndRemove.spec.ts +++ b/e2e_tests/tests/createAndRemove.spec.ts @@ -32,7 +32,7 @@ const fullCheck = [ { type: "textareainput", locator: `div.CoreTextareaInput.component` }, { type: "numberinput", locator: `div.CoreNumberInput.component` }, { type: "sliderinput", locator: `div.CoreSliderInput.component` }, - { type: "dateinput", locator: `div.CoreDateInput.component` }, + //{ type: "dateinput", locator: `div.CoreDateInput.component` }, { type: "radioinput", locator: `div.CoreRadioInput.component` }, { type: "checkboxinput", locator: `div.CoreCheckboxInput.component` }, { type: "dropdowninput", locator: `div.CoreDropdownInput.component` }, @@ -47,10 +47,6 @@ const fullCheck = [ { type: "videoplayer", locator: `div.CoreVideoPlayer.component` }, ]; -const loadPreset = async (preset) => { - await fetch(`http://127.0.0.1:7358/${preset}`); -}; - createAndRemove.forEach(({ type, locator }) => { test.describe(type, () => { const TYPE = type; diff --git a/e2e_tests/tests/undoRedo.spec.ts b/e2e_tests/tests/undoRedo.spec.ts index c0cfb241d..143dff7e0 100644 --- a/e2e_tests/tests/undoRedo.spec.ts +++ b/e2e_tests/tests/undoRedo.spec.ts @@ -2,10 +2,6 @@ import { test, expect } from "@playwright/test"; test.setTimeout(5000); -const loadPreset = async (preset) => { - await fetch(`http://127.0.0.1:7358/${preset}`); -}; - test.describe('undo and redo', () => { const TYPE = 'button'; const COMPONENT_LOCATOR = 'button.CoreButton.component'; diff --git a/package.json b/package.json index 169c3216e..7ee6d56fd 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,9 @@ "scripts": { "build": "npm run -w streamsync-ui build", "custom.build": "npm run -w streamsync-ui custom.build", - "test": "npm run -w streamsync-e2e test", - "test:ci": "npm run -w streamsync-e2e test:ci", + "e2e": "npm run -w streamsync-e2e test", + "e2e:ui": "npm run -w streamsync-e2e test:ui", + "e2e:ci": "npm run -w streamsync-e2e test:ci", "lint": "npm run -w streamsync-ui lint", "lint:ci": "npm run -w streamsync-ui lint:ci", "dev": "npm run -w streamsync-ui dev" diff --git a/ui/src/core_components/other/CorePagination.vue b/ui/src/core_components/other/CorePagination.vue index 7af213031..329909119 100644 --- a/ui/src/core_components/other/CorePagination.vue +++ b/ui/src/core_components/other/CorePagination.vue @@ -4,8 +4,8 @@