diff --git a/.gitea/workflows/e2e-diagnostic.yml b/.gitea/workflows/e2e-diagnostic.yml new file mode 100644 index 0000000..0dfcd87 --- /dev/null +++ b/.gitea/workflows/e2e-diagnostic.yml @@ -0,0 +1,90 @@ +name: Targeted Frontend Diagnostic + +on: + workflow_dispatch: + +env: + CARGO_BUILD_JOBS: "2" + CARGO_INCREMENTAL: "0" + CARGO_PROFILE_DEV_DEBUG: "0" + TESTCONTAINERS_RYUK_DISABLED: "true" + +jobs: + duplicate-submit: + name: Duplicate Submit Diagnostic + runs-on: ubuntu-latest + timeout-minutes: 30 + services: + crank-e2e-postgres: + image: postgres:16-alpine + env: + POSTGRES_DB: crank + POSTGRES_USER: crank + POSTGRES_PASSWORD: crank + options: >- + --health-cmd "pg_isready -U crank -d crank" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + env: + CRANK_E2E_USE_EXTERNAL_POSTGRES: "1" + CRANK_E2E_POSTGRES_HOST: crank-e2e-postgres + CRANK_E2E_POSTGRES_PORT: "5432" + CRANK_E2E_POSTGRES_DB: crank + CRANK_E2E_POSTGRES_USER: crank + CRANK_E2E_POSTGRES_PASSWORD: crank + steps: + - name: Checkout + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + fetch-depth: 0 + - name: Install Rust toolchain + run: | + set -eu + toolchain="$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml | head -n1)" + if [ -z "$toolchain" ]; then + echo "Unable to read Rust toolchain channel from rust-toolchain.toml" >&2 + exit 1 + fi + if ! rustup run "$toolchain" rustc --version >/dev/null 2>&1 || \ + ! rustup run "$toolchain" cargo --version >/dev/null 2>&1 || \ + ! rustup run "$toolchain" rustfmt --version >/dev/null 2>&1 || \ + ! rustup run "$toolchain" cargo-clippy --version >/dev/null 2>&1; then + rustup toolchain install "$toolchain" --profile minimal --component clippy --component rustfmt + fi + host="$(rustup run "$toolchain" rustc -vV | sed -n 's/^host: //p')" + toolchain_dir="${RUSTUP_HOME:-$HOME/.rustup}/toolchains/${toolchain}-${host}" + toolchain_bin="$toolchain_dir/bin" + if [ ! -x "$toolchain_bin/rustc" ] || [ ! -x "$toolchain_bin/cargo" ]; then + echo "Rust $toolchain was not installed at $toolchain_dir." >&2 + exit 1 + fi + printf '%s\n' "$toolchain_bin" >> "$GITHUB_PATH" + "$toolchain_bin/rustc" --version + "$toolchain_bin/cargo" --version + "$toolchain_bin/rustfmt" --version + "$toolchain_bin/cargo-clippy" --version + - name: Verify runner tools + run: | + rustc --version + cargo --version + node --version + npm --version + docker --version + - name: Install UI dependencies + working-directory: apps/ui + run: npm ci + - name: Install Chromium + working-directory: apps/ui + run: npx playwright install --with-deps chromium + - name: Prebuild E2E services + run: cargo build -p admin-api -p mcp-server --jobs "$CARGO_BUILD_JOBS" + - name: Run only the duplicate-submit test + working-directory: apps/ui + env: + CI: "1" + run: >- + npx playwright test tests/e2e/secrets.spec.js + --grep "secret modal clears sensitive values and locks duplicate submit while saving" + --workers=1 + --retries=0 diff --git a/apps/ui/tests/e2e/secrets.spec.js b/apps/ui/tests/e2e/secrets.spec.js index ee22471..b79c2c3 100644 --- a/apps/ui/tests/e2e/secrets.spec.js +++ b/apps/ui/tests/e2e/secrets.spec.js @@ -130,6 +130,33 @@ test('secret modal clears sensitive values and locks duplicate submit while savi await page.locator('[data-testid="secret-value-input"]').fill('ui-secret-canary-submit'); const submit = page.locator('[data-testid="secret-submit-button"]'); await submit.click(); + const immediate = await page.evaluate(() => { + const button = document.querySelector('[data-testid="secret-submit-button"]'); + const modal = document.querySelector('[data-testid="secret-create-modal"] .modal'); + return { + buttonPresent: Boolean(button), + disabled: Boolean(button && button.disabled), + labelChanged: Boolean(button && button.textContent.trim() !== 'Create secret'), + modalOpen: Boolean(modal && modal.classList.contains('open')), + documentReady: document.readyState === 'complete', + }; + }); + await page.waitForTimeout(250); + const afterDelay = await page.evaluate(() => { + const button = document.querySelector('[data-testid="secret-submit-button"]'); + const modal = document.querySelector('[data-testid="secret-create-modal"] .modal'); + return { + buttonPresent: Boolean(button), + disabled: Boolean(button && button.disabled), + labelChanged: Boolean(button && button.textContent.trim() !== 'Create secret'), + modalOpen: Boolean(modal && modal.classList.contains('open')), + }; + }); + process.stdout.write('[secrets-submit-diagnostic] ' + JSON.stringify({ + immediate, + afterDelay, + interceptedCreatePosts: createPosts, + }) + '\n'); await expect(submit).toBeDisabled(); await submit.click({ force: true }); expect(createPosts).toBe(1);