Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] middleware tests #2014

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 2 additions & 0 deletions .ibm/pipelines/value_files/values_showcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ upstream:
value: 'true'
- name: NODE_OPTIONS
value: '--no-node-snapshot'
- name: ENABLE_CORE_ROOTHTTPROUTER_OVERRIDE
value: 'true'
extraAppConfig:
- configMapRef: app-config-rhdh
filename: app-config-rhdh.yaml
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default defineConfig({
timeout: 20000,
testDir: "./playwright",
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
forbidOnly: false,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
Expand Down
14 changes: 14 additions & 0 deletions e2e-tests/playwright/e2e/plugins/middleware.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// https://github.com/gashcrumb/dynamic-plugins-root-http-middleware/tree/main/plugins/middleware-header-example

import test, { expect, request } from "@playwright/test";
import playwrightConfig from "../../../playwright.config";

test.only("Check the middleware is working", async () => {
const endpoint = playwrightConfig.use.baseURL + "/api/simple-chat";
console.log(`middleware endpoint full url: ${endpoint}`);
const context = await request.newContext({
baseURL: endpoint,
});
const r = await context.get("");
expect(r.headers["X-PROXY-TEST-HEADER"]);
});
Loading