Skip to content
Merged
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
52 changes: 38 additions & 14 deletions .claude/memories/ci-e2e-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ test.beforeAll(async ({ }, testInfo) => {
- Basic functionality verification
- Health checks and core features

2. **Showcase Tests** (defined in `playwright.config.ts`)
2. **Showcase Tests** (defined in `e2e-tests/playwright/projects.json`)
- `showcase`: General functionality tests with base deployment using Helm chart
- `showcase-rbac`: General functionality tests with RBAC-enabled deployment using Helm chart
- `showcase-k8s`: Kubernetes integration tests with base deployment
Expand All @@ -81,6 +81,10 @@ test.beforeAll(async ({ }, testInfo) => {
- `showcase-upgrade`: Upgrade scenario tests
- `any-test`: Use for debugging when you need to run a specific tests

**Note**: All project names are defined in `e2e-tests/playwright/projects.json` as the single source of truth. This file is consumed by:
- `playwright.config.ts` via TypeScript import (`e2e-tests/playwright/projects.ts`)
- CI/CD scripts via `.ibm/pipelines/playwright-projects.sh` (exports as `$PW_PROJECT_*` variables)

3. **Authentication Provider Tests** (`showcase-auth-providers`)
- OIDC (Red Hat Backstage Keycloak)
- Microsoft OAuth2
Expand All @@ -106,28 +110,44 @@ test.beforeAll(async ({ }, testInfo) => {
- Audit logging functionality
- Compliance verification

### Test Execution Scripts
### Test Execution

#### CI/CD Pipeline Execution

In the CI/CD pipeline, tests are executed directly using Playwright's `--project` flag via the `run_tests()` function in `.ibm/pipelines/utils.sh`:

```bash
yarn playwright test --project="${playwright_project}"
```

Available yarn scripts in `e2e-tests/package.json`:
The namespace and Playwright project are decoupled, allowing flexible reuse. The `check_and_test()` and `run_tests()` functions accept an explicit `playwright_project` argument:

```bash
# Showcase tests - OpenShift deployments
# Function signatures:
check_and_test "${RELEASE_NAME}" "${NAMESPACE}" "${PLAYWRIGHT_PROJECT}" "${URL}" [max_attempts] [wait_seconds]
run_tests "${RELEASE_NAME}" "${NAMESPACE}" "${PLAYWRIGHT_PROJECT}" "${URL}"
```

#### Local Development Scripts

Available yarn scripts in `e2e-tests/package.json` for local development:

```bash
# Showcase tests - OpenShift deployments (Helm)
yarn showcase # General showcase tests
yarn showcase-ci-nightly # General showcase tests (nightly CI alias)
yarn showcase-rbac # General showcase tests with RBAC
yarn showcase-rbac-nightly # General showcase tests with RBAC (nightly CI alias)

# Showcase tests - Kubernetes deployments
yarn showcase-k8s-ci-nightly # Kubernetes showcase tests
yarn showcase-rbac-k8s-ci-nightly # Kubernetes showcase tests with RBAC
yarn showcase-k8s # Kubernetes showcase tests
yarn showcase-rbac-k8s # Kubernetes showcase tests with RBAC

# Showcase tests - Operator deployments
yarn showcase-operator-nightly # Operator showcase tests
yarn showcase-operator-rbac-nightly # Operator showcase tests with RBAC
yarn showcase-operator # Operator showcase tests
yarn showcase-operator-rbac # Operator showcase tests with RBAC

# Showcase tests - Other scenarios
yarn showcase-runtime # Runtime configuration tests
yarn showcase-upgrade-nightly # Upgrade scenario tests
yarn showcase-upgrade # Upgrade scenario tests

# Authentication provider tests
yarn showcase-auth-providers # Auth provider tests
Expand All @@ -143,6 +163,8 @@ yarn prettier:check # Prettier checking
yarn prettier:fix # Prettier fixing
```

**Note**: The CI pipeline no longer uses yarn script aliases. Instead, it runs Playwright directly with `yarn playwright test --project=<project-name>`. This decouples the namespace from the test project name, enabling more flexible namespace and test project reuse.

### Environment Variables

All the important environment variables are sourced in `.ibm/pipelines/env_variables.sh`
Expand Down Expand Up @@ -283,6 +305,7 @@ For CI/CD pipeline execution, tests run in a containerized environment using the
- **`.ibm/pipelines/utils.sh`**: Utility functions
- **`.ibm/pipelines/reporting.sh`**: Reporting and notifications
- **`.ibm/pipelines/env_variables.sh`**: Environment variable management
- **`.ibm/pipelines/playwright-projects.sh`**: Loads Playwright project names from `projects.json` as `$PW_PROJECT_*` variables

#### CI Infrastructure Package Configuration

Expand Down Expand Up @@ -347,7 +370,7 @@ export ISRUNNINGLOCAL=true
export ISRUNNINGLOCALDEBUG=true

# Run tests locally
npx playwright test --project showcase-auth-providers --workers 1
yarn playwright test --project showcase-auth-providers --workers 1
```

#### CI Debugging
Expand All @@ -357,8 +380,8 @@ npx playwright test --project showcase-auth-providers --workers 1
4. **Test Failures**: Review test reports and screenshots

#### Common Debugging Tools
- **Playwright Inspector**: `npx playwright test --debug`
- **Trace Viewer**: `npx playwright show-trace`
- **Playwright Inspector**: `yarn playwright test --debug`
- **Trace Viewer**: `yarn playwright show-trace`
- **Screenshots**: Automatic on failure
- **Video Recording**: Available for all tests

Expand Down Expand Up @@ -423,6 +446,7 @@ brew install gnu-sed
- [OpenShift CI Pipeline README](.ibm/pipelines/README.md)

### Configuration Files
- [Playwright Project Names (Single Source of Truth)](e2e-tests/playwright/projects.json)
- [Playwright Configuration](e2e-tests/playwright.config.ts)
- [Package Configuration](e2e-tests/package.json)
- [Dynamic Plugins Config](dynamic-plugins/package.json)
Expand Down
4 changes: 2 additions & 2 deletions .claude/memories/playwright-locators.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ class CatalogPage {

```bash
# Generate locators automatically
npx playwright codegen http://localhost:7007
yarn playwright codegen http://localhost:7007

# Debug tests step-by-step
npx playwright test --debug
yarn playwright test --debug

# Or pause in test
await page.pause();
Expand Down
52 changes: 38 additions & 14 deletions .cursor/rules/ci-e2e-testing.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ test.beforeAll(async ({ }, testInfo) => {
- Basic functionality verification
- Health checks and core features

2. **Showcase Tests** (defined in `playwright.config.ts`)
2. **Showcase Tests** (defined in `e2e-tests/playwright/projects.json`)
- `showcase`: General functionality tests with base deployment using Helm chart
- `showcase-rbac`: General functionality tests with RBAC-enabled deployment using Helm chart
- `showcase-k8s`: Kubernetes integration tests with base deployment
Expand All @@ -87,6 +87,10 @@ test.beforeAll(async ({ }, testInfo) => {
- `showcase-upgrade`: Upgrade scenario tests
- `any-test`: Use for debugging when you need to run a specific tests

**Note**: All project names are defined in `e2e-tests/playwright/projects.json` as the single source of truth. This file is consumed by:
- `playwright.config.ts` via TypeScript import (`e2e-tests/playwright/projects.ts`)
- CI/CD scripts via `.ibm/pipelines/playwright-projects.sh` (exports as `$PW_PROJECT_*` variables)

3. **Authentication Provider Tests** (`showcase-auth-providers`)
- OIDC (Red Hat Backstage Keycloak)
- Microsoft OAuth2
Expand All @@ -112,28 +116,44 @@ test.beforeAll(async ({ }, testInfo) => {
- Audit logging functionality
- Compliance verification

### Test Execution Scripts
### Test Execution

#### CI/CD Pipeline Execution

In the CI/CD pipeline, tests are executed directly using Playwright's `--project` flag via the `run_tests()` function in `.ibm/pipelines/utils.sh`:

```bash
yarn playwright test --project="${playwright_project}"
```

Available yarn scripts in `e2e-tests/package.json`:
The namespace and Playwright project are decoupled, allowing flexible reuse. The `check_and_test()` and `run_tests()` functions accept an explicit `playwright_project` argument:

```bash
# Showcase tests - OpenShift deployments
# Function signatures:
check_and_test "${RELEASE_NAME}" "${NAMESPACE}" "${PLAYWRIGHT_PROJECT}" "${URL}" [max_attempts] [wait_seconds]
run_tests "${RELEASE_NAME}" "${NAMESPACE}" "${PLAYWRIGHT_PROJECT}" "${URL}"
```

#### Local Development Scripts

Available yarn scripts in `e2e-tests/package.json` for local development:

```bash
# Showcase tests - OpenShift deployments (Helm)
yarn showcase # General showcase tests
yarn showcase-ci-nightly # General showcase tests (nightly CI alias)
yarn showcase-rbac # General showcase tests with RBAC
yarn showcase-rbac-nightly # General showcase tests with RBAC (nightly CI alias)

# Showcase tests - Kubernetes deployments
yarn showcase-k8s-ci-nightly # Kubernetes showcase tests
yarn showcase-rbac-k8s-ci-nightly # Kubernetes showcase tests with RBAC
yarn showcase-k8s # Kubernetes showcase tests
yarn showcase-rbac-k8s # Kubernetes showcase tests with RBAC

# Showcase tests - Operator deployments
yarn showcase-operator-nightly # Operator showcase tests
yarn showcase-operator-rbac-nightly # Operator showcase tests with RBAC
yarn showcase-operator # Operator showcase tests
yarn showcase-operator-rbac # Operator showcase tests with RBAC

# Showcase tests - Other scenarios
yarn showcase-runtime # Runtime configuration tests
yarn showcase-upgrade-nightly # Upgrade scenario tests
yarn showcase-upgrade # Upgrade scenario tests

# Authentication provider tests
yarn showcase-auth-providers # Auth provider tests
Expand All @@ -149,6 +169,8 @@ yarn prettier:check # Prettier checking
yarn prettier:fix # Prettier fixing
```

**Note**: The CI pipeline no longer uses yarn script aliases. Instead, it runs Playwright directly with `yarn playwright test --project=<project-name>`. This decouples the namespace from the test project name, enabling more flexible namespace and test project reuse.

### Environment Variables

All the important environment variables are sourced in `.ibm/pipelines/env_variables.sh`
Expand Down Expand Up @@ -289,6 +311,7 @@ For CI/CD pipeline execution, tests run in a containerized environment using the
- **`.ibm/pipelines/utils.sh`**: Utility functions
- **`.ibm/pipelines/reporting.sh`**: Reporting and notifications
- **`.ibm/pipelines/env_variables.sh`**: Environment variable management
- **`.ibm/pipelines/playwright-projects.sh`**: Loads Playwright project names from `projects.json` as `$PW_PROJECT_*` variables

#### CI Infrastructure Package Configuration

Expand Down Expand Up @@ -353,7 +376,7 @@ export ISRUNNINGLOCAL=true
export ISRUNNINGLOCALDEBUG=true

# Run tests locally
npx playwright test --project showcase-auth-providers --workers 1
yarn playwright test --project showcase-auth-providers --workers 1
```

#### CI Debugging
Expand All @@ -363,8 +386,8 @@ npx playwright test --project showcase-auth-providers --workers 1
4. **Test Failures**: Review test reports and screenshots

#### Common Debugging Tools
- **Playwright Inspector**: `npx playwright test --debug`
- **Trace Viewer**: `npx playwright show-trace`
- **Playwright Inspector**: `yarn playwright test --debug`
- **Trace Viewer**: `yarn playwright show-trace`
- **Screenshots**: Automatic on failure
- **Video Recording**: Available for all tests

Expand Down Expand Up @@ -429,6 +452,7 @@ brew install gnu-sed
- [OpenShift CI Pipeline README](.ibm/pipelines/README.md)

### Configuration Files
- [Playwright Project Names (Single Source of Truth)](e2e-tests/playwright/projects.json)
- [Playwright Configuration](e2e-tests/playwright.config.ts)
- [Package Configuration](e2e-tests/package.json)
- [Dynamic Plugins Config](dynamic-plugins/package.json)
Expand Down
4 changes: 2 additions & 2 deletions .cursor/rules/playwright-locators.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ class CatalogPage {

```bash
# Generate locators automatically
npx playwright codegen http://localhost:7007
yarn playwright codegen http://localhost:7007

# Debug tests step-by-step
npx playwright test --debug
yarn playwright test --debug

# Or pause in test
await page.pause();
Expand Down
6 changes: 4 additions & 2 deletions .ibm/pipelines/jobs/aks-helm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ source "$DIR"/lib/log.sh
source "$DIR"/utils.sh
# shellcheck source=.ibm/pipelines/cluster/aks/aks-helm-deployment.sh
source "$DIR"/cluster/aks/aks-helm-deployment.sh
# shellcheck source=.ibm/pipelines/playwright-projects.sh
source "$DIR"/playwright-projects.sh

handle_aks_helm() {
log::info "Starting AKS Helm deployment"
Expand All @@ -19,10 +21,10 @@ handle_aks_helm() {
cluster_setup_k8s_helm

initiate_aks_helm_deployment
check_and_test "${RELEASE_NAME}" "${NAME_SPACE}" "https://${K8S_CLUSTER_ROUTER_BASE}" 50 30
check_and_test "${RELEASE_NAME}" "${NAME_SPACE}" "${PW_PROJECT_SHOWCASE_K8S}" "https://${K8S_CLUSTER_ROUTER_BASE}" 50 30
delete_namespace "${NAME_SPACE}"

initiate_rbac_aks_helm_deployment
check_and_test "${RELEASE_NAME_RBAC}" "${NAME_SPACE_RBAC}" "https://${K8S_CLUSTER_ROUTER_BASE}" 50 30
check_and_test "${RELEASE_NAME_RBAC}" "${NAME_SPACE_RBAC}" "${PW_PROJECT_SHOWCASE_RBAC_K8S}" "https://${K8S_CLUSTER_ROUTER_BASE}" 50 30
delete_namespace "${NAME_SPACE_RBAC}"
}
6 changes: 4 additions & 2 deletions .ibm/pipelines/jobs/aks-operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ source "$DIR"/install-methods/operator.sh
source "$DIR"/cluster/aks/aks-operator-deployment.sh
# shellcheck source=.ibm/pipelines/cluster/k8s/k8s-utils.sh
source "$DIR"/cluster/k8s/k8s-utils.sh
# shellcheck source=.ibm/pipelines/playwright-projects.sh
source "$DIR"/playwright-projects.sh

handle_aks_operator() {
log::info "Starting AKS Operator deployment"
Expand All @@ -23,10 +25,10 @@ handle_aks_operator() {
prepare_operator "3"

initiate_aks_operator_deployment "${NAME_SPACE}" "https://${K8S_CLUSTER_ROUTER_BASE}"
check_and_test "${RELEASE_NAME}" "${NAME_SPACE}" "https://${K8S_CLUSTER_ROUTER_BASE}" 50 30
check_and_test "${RELEASE_NAME}" "${NAME_SPACE}" "${PW_PROJECT_SHOWCASE_K8S}" "https://${K8S_CLUSTER_ROUTER_BASE}" 50 30
cleanup_aks_deployment "${NAME_SPACE}"

initiate_rbac_aks_operator_deployment "${NAME_SPACE_RBAC}" "https://${K8S_CLUSTER_ROUTER_BASE}"
check_and_test "${RELEASE_NAME}" "${NAME_SPACE_RBAC}" "https://${K8S_CLUSTER_ROUTER_BASE}" 50 30
check_and_test "${RELEASE_NAME}" "${NAME_SPACE_RBAC}" "${PW_PROJECT_SHOWCASE_RBAC_K8S}" "https://${K8S_CLUSTER_ROUTER_BASE}" 50 30
cleanup_aks_deployment "${NAME_SPACE_RBAC}"
}
4 changes: 3 additions & 1 deletion .ibm/pipelines/jobs/auth-providers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ source "$DIR"/lib/log.sh
source "$DIR"/utils.sh
# shellcheck source=.ibm/pipelines/install-methods/operator.sh
source "$DIR"/install-methods/operator.sh
# shellcheck source=.ibm/pipelines/playwright-projects.sh
source "$DIR"/playwright-projects.sh

handle_auth_providers() {
local retry_operator_installation="${1:-1}"
Expand All @@ -23,5 +25,5 @@ handle_auth_providers() {
export LOGS_FOLDER

log::info "Running tests ${AUTH_PROVIDERS_RELEASE} in ${AUTH_PROVIDERS_NAMESPACE}"
run_tests "${AUTH_PROVIDERS_RELEASE}" "${AUTH_PROVIDERS_NAMESPACE}"
run_tests "${AUTH_PROVIDERS_RELEASE}" "${AUTH_PROVIDERS_NAMESPACE}" "${PW_PROJECT_SHOWCASE_AUTH_PROVIDERS}" "https://${K8S_CLUSTER_ROUTER_BASE}"
}
6 changes: 4 additions & 2 deletions .ibm/pipelines/jobs/eks-helm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ source "$DIR"/cluster/eks/eks-helm-deployment.sh
source "$DIR"/cluster/eks/aws.sh
# shellcheck source=.ibm/pipelines/cluster/k8s/k8s-utils.sh
source "$DIR"/cluster/k8s/k8s-utils.sh
# shellcheck source=.ibm/pipelines/playwright-projects.sh
source "$DIR"/playwright-projects.sh

handle_eks_helm() {
log::info "Starting EKS Helm deployment"
Expand All @@ -33,7 +35,7 @@ handle_eks_helm() {

initiate_eks_helm_deployment
configure_eks_ingress_and_dns "${NAME_SPACE}" "${RELEASE_NAME}-developer-hub"
check_and_test "${RELEASE_NAME}" "${NAME_SPACE}" "https://${K8S_CLUSTER_ROUTER_BASE}" 50 30
check_and_test "${RELEASE_NAME}" "${NAME_SPACE}" "${PW_PROJECT_SHOWCASE_K8S}" "https://${K8S_CLUSTER_ROUTER_BASE}" 50 30
cleanup_eks_dns_record "${EKS_INSTANCE_DOMAIN_NAME}"
delete_namespace "${NAME_SPACE}"

Expand All @@ -44,7 +46,7 @@ handle_eks_helm() {

initiate_rbac_eks_helm_deployment
configure_eks_ingress_and_dns "${NAME_SPACE_RBAC}" "${RELEASE_NAME_RBAC}-developer-hub"
check_and_test "${RELEASE_NAME_RBAC}" "${NAME_SPACE_RBAC}" "https://${K8S_CLUSTER_ROUTER_BASE}" 50 30
check_and_test "${RELEASE_NAME_RBAC}" "${NAME_SPACE_RBAC}" "${PW_PROJECT_SHOWCASE_RBAC_K8S}" "https://${K8S_CLUSTER_ROUTER_BASE}" 50 30
cleanup_eks_dns_record "${EKS_INSTANCE_DOMAIN_NAME}"
delete_namespace "${NAME_SPACE_RBAC}"
}
6 changes: 4 additions & 2 deletions .ibm/pipelines/jobs/eks-operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ source "$DIR"/cluster/eks/eks-operator-deployment.sh
source "$DIR"/cluster/k8s/k8s-utils.sh
# shellcheck source=.ibm/pipelines/cluster/eks/aws.sh
source "$DIR"/cluster/eks/aws.sh
# shellcheck source=.ibm/pipelines/playwright-projects.sh
source "$DIR"/playwright-projects.sh

handle_eks_operator() {
log::info "Starting EKS Operator deployment"
Expand All @@ -34,7 +36,7 @@ handle_eks_operator() {

initiate_eks_operator_deployment "${NAME_SPACE}" "https://${K8S_CLUSTER_ROUTER_BASE}"
configure_eks_ingress_and_dns "${NAME_SPACE}" "dh-ingress"
check_and_test "${RELEASE_NAME}" "${NAME_SPACE}" "https://${K8S_CLUSTER_ROUTER_BASE}" 50 30
check_and_test "${RELEASE_NAME}" "${NAME_SPACE}" "${PW_PROJECT_SHOWCASE_K8S}" "https://${K8S_CLUSTER_ROUTER_BASE}" 50 30
cleanup_eks_dns_record "${EKS_INSTANCE_DOMAIN_NAME}"
cleanup_eks_deployment "${NAME_SPACE}"

Expand All @@ -45,7 +47,7 @@ handle_eks_operator() {

initiate_rbac_eks_operator_deployment "${NAME_SPACE_RBAC}" "https://${K8S_CLUSTER_ROUTER_BASE}"
configure_eks_ingress_and_dns "${NAME_SPACE_RBAC}" "dh-ingress"
check_and_test "${RELEASE_NAME}" "${NAME_SPACE_RBAC}" "https://${K8S_CLUSTER_ROUTER_BASE}" 50 30
check_and_test "${RELEASE_NAME}" "${NAME_SPACE_RBAC}" "${PW_PROJECT_SHOWCASE_RBAC_K8S}" "https://${K8S_CLUSTER_ROUTER_BASE}" 50 30
cleanup_eks_dns_record "${EKS_INSTANCE_DOMAIN_NAME}"
cleanup_eks_deployment "${NAME_SPACE_RBAC}"
}
Loading
Loading