Skip to content
Open
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
75 changes: 0 additions & 75 deletions .claude/commands/cypress/cypress-setup.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: cypress-run
name: run
description: Display Cypress test commands - choose execution mode (headless recommended)
parameters:
- name: execution-mode
Expand All @@ -11,8 +11,8 @@ parameters:
# Cypress Test Commands

**Prerequisites**:
1. Run `/cypress-setup` first to configure your environment.
2. Ensure the "Cypress Tests" terminal window is open (created by `/cypress-setup`)
1. Run `/cypress:setup` first to configure your environment.
2. Ensure the "Cypress Tests" terminal window is open (created by `/cypress:setup`)

**Note**: All commands are executed in the "Cypress Tests" terminal window using the helper scripts.

Expand Down Expand Up @@ -340,7 +340,7 @@ Use these tags with `--env grepTags`:

## Related Commands

- **`/cypress-setup`** - Configure testing environment and open Cypress Tests terminal
- **`/cypress:setup`** - Configure testing environment and open Cypress Tests terminal

---

Expand Down
92 changes: 92 additions & 0 deletions .claude/commands/cypress/setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
name: setup
description: Automated Cypress environment setup with direct configuration
parameters: []
---

# Cypress Environment Setup

This command sets up the Cypress testing environment by checking prerequisites, installing dependencies, and configuring environment variables.

## Instructions for Claude

Follow these steps in order:

### Step 1: Check Prerequisites

1. **Check Node.js version** - Required: >= 18
- Run `node --version` and verify it's >= 18
- If not, inform the user they need to install Node.js 18 or higher

### Step 2: Navigate and Install Dependencies

1. **Navigate to the cypress directory**:
```bash
cd web/cypress
```
Comment thread
coderabbitai[bot] marked this conversation as resolved.

2. **Install npm dependencies**:
```bash
npm install
```

### Step 3: Create or Update Environment Configuration

**Important**: Do NOT run the interactive `configure-env.sh` script. Instead, create `export-env.sh` directly (in the `web/cypress/` directory from Step 2).

1. Check if `export-env.sh` already exists
2. If it exists, read it and show the current values to the user. Ask if they want to keep or update them.
3. Look for cluster credentials in the following order:
- **Conversation context**: Check if the user already provided a console URL and kubeadmin password earlier in the conversation
- **Existing export-env.sh**: Reuse values from an existing file if the user confirms they're current
- **Ask the user directly**: If no credentials are found, ask the user to provide:
- Console URL (e.g., `https://console-openshift-console.apps.ci-ln-xxxxx.aws-4.ci.openshift.org`)
- Kubeadmin password
- **Do NOT proceed without credentials** — the file cannot be created with placeholder values
4. Write the file directly:

```bash
cat > export-env.sh << 'ENVEOF'
# shellcheck shell=bash
export CYPRESS_BASE_URL='<console-url>'
export CYPRESS_LOGIN_IDP='kube:admin'
export CYPRESS_LOGIN_USERS='kubeadmin:<password>'
Comment thread
DavidRajnoha marked this conversation as resolved.
export CYPRESS_KUBECONFIG_PATH='/tmp/kubeconfig'
export CYPRESS_SKIP_ALL_INSTALL='false'
export CYPRESS_SKIP_COO_INSTALL='false'
export CYPRESS_COO_UI_INSTALL='true'
export CYPRESS_SKIP_KBV_INSTALL='true'
export CYPRESS_KBV_UI_INSTALL='false'
export CYPRESS_TIMEZONE='UTC'
export CYPRESS_MOCK_NEW_METRICS='false'
export CYPRESS_SESSION='true'
export CYPRESS_DEBUG='false'
ENVEOF
```

5. Set restrictive permissions (the file contains credentials):
```bash
chmod 600 export-env.sh
```

Notes on the values:
- `CYPRESS_BASE_URL`: The OpenShift console URL from the cluster provisioning output
- `CYPRESS_LOGIN_USERS`: Format is `kubeadmin:<password>` using the password from cluster provisioning
- `CYPRESS_KUBECONFIG_PATH`: Use `/tmp/kubeconfig` when running in a Docker sandbox, or the actual path to kubeconfig on the host
- `CYPRESS_SKIP_ALL_INSTALL='false'`: Ensures operators get installed on first run
- `CYPRESS_COO_UI_INSTALL='true'`: Installs the Cluster Observability Operator UI plugin

### Step 4: Verify the setup

Source the file and confirm the variables are set:

```bash
source export-env.sh
echo "Base URL: $CYPRESS_BASE_URL"
```

### Step 5: Inform the user

Let the user know the environment is configured and they can run tests using `/cypress:run`.

---
Loading