fix: restore full test suite
Separate the internal API and nginx ports, align browser BDD fixtures with tenant and Go Loose requirements, and correct the invitation outcome interaction order. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
0de20d20f5
commit
660d5291ec
8 changed files with 44 additions and 8 deletions
|
|
@ -40,7 +40,7 @@ COPY docker/entrypoint.sh /usr/local/bin/go-guess-entrypoint
|
|||
|
||||
USER app
|
||||
EXPOSE 8080
|
||||
ENV ADDRESS=:8080 \
|
||||
ENV ADDRESS=:8081 \
|
||||
APP_ENV=production \
|
||||
FRONTEND_URL=http://localhost:8080
|
||||
|
||||
|
|
|
|||
1
bdd/init.sql
Normal file
1
bdd/init.sql
Normal file
|
|
@ -0,0 +1 @@
|
|||
CREATE SCHEMA ypto AUTHORIZATION go_guess;
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
"version": "0.1.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "cucumber-js --config cucumber.mjs"
|
||||
"test": "node run-tests.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cucumber/cucumber": "13.2.1",
|
||||
|
|
|
|||
29
bdd/run-tests.js
Normal file
29
bdd/run-tests.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { spawn } from "node:child_process";
|
||||
import http from "node:http";
|
||||
|
||||
const authorizationServer = http.createServer((request, response) => {
|
||||
response.setHeader("Content-Type", "application/json");
|
||||
response.end(
|
||||
JSON.stringify({
|
||||
allowed: true,
|
||||
tenant_slug: "ypto",
|
||||
application_slug: "guess",
|
||||
api_key_name: "bdd",
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
authorizationServer.listen(18081, "127.0.0.1", () => {
|
||||
const cucumber = spawn("cucumber-js", ["--config", "cucumber.mjs"], {
|
||||
stdio: "inherit",
|
||||
});
|
||||
cucumber.on("exit", (code, signal) => {
|
||||
authorizationServer.close(() => {
|
||||
if (signal) {
|
||||
process.kill(process.pid, signal);
|
||||
} else {
|
||||
process.exit(code ?? 1);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -6,6 +6,7 @@ setDefaultTimeout(Number(process.env.BDD_STEP_TIMEOUT_MS ?? 15000));
|
|||
Before(async function () {
|
||||
this.browser = await chromium.launch({
|
||||
headless: process.env.BDD_HEADLESS !== "false",
|
||||
args: ["--host-resolver-rules=MAP ypto.guess.local 127.0.0.1"],
|
||||
});
|
||||
this.context = await this.browser.newContext();
|
||||
this.page = await this.context.newPage();
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ services:
|
|||
POSTGRES_DB: go_guess
|
||||
POSTGRES_USER: go_guess
|
||||
POSTGRES_PASSWORD: go_guess
|
||||
volumes:
|
||||
- ./bdd/init.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U go_guess -d go_guess"]
|
||||
interval: 2s
|
||||
|
|
@ -23,10 +25,13 @@ services:
|
|||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
VITE_GO_LOOSE_API_KEY: gl_bdd_key_that_is_long_enough_for_client
|
||||
environment:
|
||||
DATABASE_URL: postgres://go_guess:go_guess@db:5432/go_guess?sslmode=disable
|
||||
DATABASE_URL: postgres://go_guess:go_guess@db:5432/go_guess?sslmode=disable&search_path=ypto
|
||||
JWT_SECRET: bdd-test-secret-that-is-at-least-32-characters
|
||||
FRONTEND_URL: http://app:8080
|
||||
FRONTEND_URL: http://ypto.guess.local:8080
|
||||
GO_LOOSE_BASE_URL: http://127.0.0.1:18081
|
||||
RABBITMQ_URL: amqp://guest:guest@rabbitmq:5672/
|
||||
APP_ENV: test
|
||||
ports:
|
||||
|
|
@ -47,7 +52,7 @@ services:
|
|||
context: bdd
|
||||
dockerfile: Dockerfile
|
||||
environment:
|
||||
BDD_BASE_URL: http://127.0.0.1:8080
|
||||
BDD_BASE_URL: http://ypto.guess.local:8080
|
||||
BDD_HEADLESS: "true"
|
||||
BDD_STEP_TIMEOUT_MS: "15000"
|
||||
network_mode: service:app
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ http {
|
|||
index index.html;
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://127.0.0.1:8080;
|
||||
proxy_pass http://127.0.0.1:8081;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
|
|
|||
|
|
@ -749,8 +749,8 @@ describe('Go Guess frontend', () => {
|
|||
renderApp('/jobs/7')
|
||||
await user.click(await screen.findByRole('tab', { name: /invitations/i }))
|
||||
await user.click(screen.getByRole('button', { name: 'Review answers' }))
|
||||
await user.click(await screen.findByRole('button', { name: 'Pass candidate' }))
|
||||
await user.click(screen.getByRole('button', { name: 'Fail candidate' }))
|
||||
await user.click(await screen.findByRole('button', { name: 'Fail candidate' }))
|
||||
await user.click(screen.getByRole('button', { name: 'Pass candidate' }))
|
||||
|
||||
expect(fetch).toHaveBeenCalledWith(
|
||||
'/api/jobs/7/invitations/44/outcome',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue