Skip to content

Commit

Permalink
✨ Swap http-server for a custom server with express (front-end integr…
Browse files Browse the repository at this point in the history
…ation tests)
  • Loading branch information
belen-albeza committed Apr 25, 2024
1 parent 4780442 commit 2aaaa3b
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 251 deletions.
4 changes: 2 additions & 2 deletions frontend/package.json
Expand Up @@ -30,7 +30,7 @@
"translations:find-unused": "node ./scripts/find-unused-translations.js",
"compile": "node ./scripts/compile.js",
"watch": "node ./scripts/watch.js",
"e2e:server": "NODE_NO_WARNINGS=1 http-server ./resources/public -p 3500 -a 0.0.0.0",
"e2e:server": "node ./scripts/e2e-server.js",
"e2e:test": "playwright test",
"storybook:compile": "gulp template:storybook && clojure -M:dev:shadow-cljs compile storybook",
"storybook:watch": "npm run storybook:compile && concurrently \"clojure -M:dev:shadow-cljs watch storybook\" \"storybook dev -p 6006\"",
Expand All @@ -51,6 +51,7 @@
"autoprefixer": "^10.4.17",
"concurrently": "^8.2.2",
"draft-js": "git+https://github.com/penpot/draft-js.git",
"express": "^4.19.2",
"fancy-log": "^2.0.0",
"gettext-parser": "^8.0.0",
"gulp": "4.0.2",
Expand All @@ -62,7 +63,6 @@
"gulp-sass": "^5.1.0",
"gulp-sourcemaps": "^3.0.0",
"gulp-svg-sprite": "^2.0.3",
"http-server": "^14.1.1",
"jsdom": "^24.0.0",
"map-stream": "0.0.7",
"marked": "^12.0.0",
Expand Down
15 changes: 15 additions & 0 deletions frontend/playwright/workspace.spec.js
@@ -0,0 +1,15 @@
import { expect } from "@playwright/test";
import { interceptRPC, testWithWebSocket } from "./helpers";

const anyFileId = "c7ce0794-0992-8105-8004-38e630f7920b/c7ce0794-0992-8105-8004-38f280443849";

const setupWorkspace = async (page) => {
await interceptRPC(page, "get-profile", "logged-in-user/get-profile-logged-in.json");
};

testWithWebSocket.skip("Empty file is displayed correctly", async ({ page, navigate }) => {
await setupWorkspace(page);
await navigate(`/#/workspace/${anyFileId}`);

expect(page.getByTestId("sitemap-toolbox").getByText(/page 1/i)).toBeVisible();
});
13 changes: 13 additions & 0 deletions frontend/scripts/e2e-server.js
@@ -0,0 +1,13 @@
import express from "express";
import { fileURLToPath } from "url";
import path from "path";

const app = express();
const port = 3500;

const staticPath = path.join(fileURLToPath(import.meta.url), "../../resources/public");
app.use(express.static(staticPath));

app.listen(port, () => {
console.log(`Listening at 0.0.0.0:${port}`);
});

0 comments on commit 2aaaa3b

Please sign in to comment.