Skip to content

Commit

Permalink
Migrate onboarding Cypress tests to Scout (elastic#205482)
Browse files Browse the repository at this point in the history
This change converts Cypress tests for the custom logs flow into
Playwright using [the Scout
wrapper](https://github.com/elastic/kibana/tree/main/packages/kbn-scout).

> [!NOTE]
> As Scout package is still being developed, the PR pipeline configured
to runs Playwright tests only when code in certain plugins have been
changed and not on every PR.

### How to run tests locally

Start the Scout server
```bash
node scripts/scout.js start-server --stateful
```

In a separate terminal run the tests
```bash
npx playwright test --config x-pack/solutions/observability/plugins/observability_onboarding/ui_tests/playwright.config.ts
```

Playwright runs browsers in a headless mode by default, user `--headed`
option if needed
  • Loading branch information
mykolaharmash authored Jan 10, 2025
1 parent 41a4255 commit 6ed214a
Show file tree
Hide file tree
Showing 33 changed files with 1,285 additions and 1,475 deletions.
4 changes: 2 additions & 2 deletions .buildkite/pipelines/pull_request/scout_ui_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ steps:
- command: .buildkite/scripts/steps/functional/scout_ui_tests.sh
label: 'Scout UI Tests'
agents:
machineType: n2-standard-4
machineType: n2-standard-8
preemptible: true
depends_on:
- build
Expand All @@ -11,7 +11,7 @@ steps:
- linting
- linting_with_types
- check_types
timeout_in_minutes: 30
timeout_in_minutes: 60
retry:
automatic:
- exit_status: '-1'
Expand Down
13 changes: 1 addition & 12 deletions .buildkite/scripts/pipelines/pull_request/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,6 @@ const getPipeline = (filename: string, removeSteps = true) => {
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/inventory_cypress.yml'));
}

if (
(await doAnyChangesMatch([
/^x-pack\/solutions\/observability\/plugins\/observability_onboarding/,
/^x-pack\/platform\/plugins\/shared\/fleet/,
])) ||
GITHUB_PR_LABELS.includes('ci:all-cypress-suites')
) {
pipeline.push(
getPipeline('.buildkite/pipelines/pull_request/observability_onboarding_cypress.yml')
);
}

if (
(await doAnyChangesMatch([/^x-pack\/solutions\/observability\/plugins\/profiling/])) ||
GITHUB_PR_LABELS.includes('ci:all-cypress-suites')
Expand Down Expand Up @@ -405,6 +393,7 @@ const getPipeline = (filename: string, removeSteps = true) => {
if (
(await doAnyChangesMatch([
/^x-pack\/platform\/plugins\/private\/discover_enhanced\/ui_tests/,
/^x-pack\/solutions\/observability\/plugins\/observability_onboarding/,
/^packages\/kbn-scout/,
])) ||
GITHUB_PR_LABELS.includes('ci:scout-ui-tests')
Expand Down
38 changes: 21 additions & 17 deletions .buildkite/scripts/steps/functional/scout_ui_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,33 @@ source .buildkite/scripts/steps/functional/common.sh

export JOB=kibana-scout-ui-tests

TEST_CONFIG="x-pack/platform/plugins/private/discover_enhanced/ui_tests/playwright.config.ts"
KIBANA_DIR="$KIBANA_BUILD_LOCATION"

declare -A TESTS=(
["Stateful"]="--stateful"
["Serverless Elasticsearch"]="--serverless=es"
["Serverless Observability"]="--serverless=oblt"
["Serverless Security"]="--serverless=security"
)
run_tests() {
local suit_name=$1
local config_path=$2
local run_mode=$3

ORDER=("Stateful" "Serverless Elasticsearch" "Serverless Observability" "Serverless Security")

EXIT_CODE=0

for TEST_NAME in "${ORDER[@]}"; do
RUN_MODE="${TESTS[$TEST_NAME]}"
echo "--- $TEST_NAME: 'discover_enhanced' plugin UI Tests"
if ! node scripts/scout run-tests "$RUN_MODE" --config "$TEST_CONFIG" --kibana-install-dir "$KIBANA_DIR"; then
echo "$TEST_NAME: failed"
echo "--- $suit_name ($run_mode) UI Tests"
if ! node scripts/scout run-tests "$run_mode" --config "$config_path" --kibana-install-dir "$KIBANA_DIR"; then
echo "$suit_name: failed"
EXIT_CODE=1
else
echo "$TEST_NAME: passed"
echo "$suit_name: passed"
fi
}

EXIT_CODE=0

# Discovery Enhanced
for run_mode in "--stateful" "--serverless=es" "--serverless=oblt" "--serverless=security"; do
run_tests "Discovery Enhanced" "x-pack/platform/plugins/private/discover_enhanced/ui_tests/playwright.config.ts" "$run_mode"
done

# Observability Onboarding
for run_mode in "--stateful" "--serverless=oblt"; do
run_tests "Observability Onboarding" "x-pack/solutions/observability/plugins/observability_onboarding/ui_tests/playwright.config.ts" "$run_mode"
done


exit $EXIT_CODE
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,6 @@ x-pack/solutions/observability/plugins/observability_ai_assistant_app @elastic/o
x-pack/solutions/observability/plugins/observability_ai_assistant_management @elastic/obs-ai-assistant
x-pack/solutions/observability/plugins/observability_logs_explorer @elastic/obs-ux-logs-team
x-pack/solutions/observability/plugins/observability_onboarding @elastic/obs-ux-logs-team
x-pack/solutions/observability/plugins/observability_onboarding/e2e @elastic/obs-ux-logs-team
x-pack/solutions/observability/plugins/observability_shared @elastic/observability-ui
x-pack/solutions/observability/plugins/observability_solution/entities_data_access @elastic/obs-entities
x-pack/solutions/observability/plugins/observability_solution/entity_manager_app @elastic/obs-entities
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1474,7 +1474,6 @@
"@kbn/manifest": "link:packages/kbn-manifest",
"@kbn/mock-idp-plugin": "link:packages/kbn-mock-idp-plugin",
"@kbn/mock-idp-utils": "link:packages/kbn-mock-idp-utils",
"@kbn/observability-onboarding-e2e": "link:x-pack/solutions/observability/plugins/observability_onboarding/e2e",
"@kbn/openapi-bundler": "link:packages/kbn-openapi-bundler",
"@kbn/openapi-generator": "link:packages/kbn-openapi-generator",
"@kbn/optimizer": "link:packages/kbn-optimizer",
Expand Down
2 changes: 0 additions & 2 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -1336,8 +1336,6 @@
"@kbn/observability-logs-explorer-plugin/*": ["x-pack/solutions/observability/plugins/observability_logs_explorer/*"],
"@kbn/observability-logs-overview": ["x-pack/platform/packages/shared/observability/logs_overview"],
"@kbn/observability-logs-overview/*": ["x-pack/platform/packages/shared/observability/logs_overview/*"],
"@kbn/observability-onboarding-e2e": ["x-pack/solutions/observability/plugins/observability_onboarding/e2e"],
"@kbn/observability-onboarding-e2e/*": ["x-pack/solutions/observability/plugins/observability_onboarding/e2e/*"],
"@kbn/observability-onboarding-plugin": ["x-pack/solutions/observability/plugins/observability_onboarding"],
"@kbn/observability-onboarding-plugin/*": ["x-pack/solutions/observability/plugins/observability_onboarding/*"],
"@kbn/observability-plugin": ["x-pack/solutions/observability/plugins/observability"],
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 6ed214a

Please sign in to comment.