-
Notifications
You must be signed in to change notification settings - Fork 0
E2E: add activation smoke tests + license activation test #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
88fd1bd
488d3c0
c799b1f
2103899
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,29 +9,116 @@ anchors: | |||||||||||||||||||||||||||||||||
| machine: | ||||||||||||||||||||||||||||||||||
| image: default | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| test_job_config: &test_job_config | ||||||||||||||||||||||||||||||||||
| <<: *context | ||||||||||||||||||||||||||||||||||
| requires: | ||||||||||||||||||||||||||||||||||
| - prepare_test_and_build_environment | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||
| build_package_release: | ||||||||||||||||||||||||||||||||||
| prepare_test_and_build_environment: | ||||||||||||||||||||||||||||||||||
| <<: *default_job_config | ||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||
| - checkout | ||||||||||||||||||||||||||||||||||
| - run: date +%F > .date | ||||||||||||||||||||||||||||||||||
| - run: | ||||||||||||||||||||||||||||||||||
| name: Getting GK test/build tools | ||||||||||||||||||||||||||||||||||
| command: | | ||||||||||||||||||||||||||||||||||
| git clone git@github.com:GravityKit/Tooling.git /home/circleci/tooling | ||||||||||||||||||||||||||||||||||
| - run: | ||||||||||||||||||||||||||||||||||
| name: Create .npmrc | ||||||||||||||||||||||||||||||||||
| command: | | ||||||||||||||||||||||||||||||||||
| echo "//npm.pkg.github.com/:_authToken=${GH_AUTH_TOKEN}" >> ~/.npmrc | ||||||||||||||||||||||||||||||||||
| echo "@gravitykit:registry=https://npm.pkg.github.com" >> ~/.npmrc | ||||||||||||||||||||||||||||||||||
| - restore_cache: | ||||||||||||||||||||||||||||||||||
| key: node-dependencies-{{ checksum "package-lock.json" }} | ||||||||||||||||||||||||||||||||||
| keys: | ||||||||||||||||||||||||||||||||||
| - node-dependencies-{{ .Environment.CACHE_VERSION }}-{{ checksum "package-lock.json" }} | ||||||||||||||||||||||||||||||||||
| - restore_cache: | ||||||||||||||||||||||||||||||||||
| keys: | ||||||||||||||||||||||||||||||||||
| - composer-dependencies-{{ .Environment.CACHE_VERSION }}-{{ checksum "composer.lock" }} | ||||||||||||||||||||||||||||||||||
| - run: | ||||||||||||||||||||||||||||||||||
| name: Installing dependencies | ||||||||||||||||||||||||||||||||||
| command: | | ||||||||||||||||||||||||||||||||||
| /home/circleci/tooling/build-tools/build_tools.sh npm -o install | ||||||||||||||||||||||||||||||||||
| /home/circleci/tooling/build-tools/build_tools.sh composer -o "install --no-dev" | ||||||||||||||||||||||||||||||||||
| /home/circleci/tooling/build-tools/build_tools.sh composer -o install | ||||||||||||||||||||||||||||||||||
| - run: | ||||||||||||||||||||||||||||||||||
| name: Configure E2E environment | ||||||||||||||||||||||||||||||||||
| command: | | ||||||||||||||||||||||||||||||||||
| # GravityForms — required by every GK plugin | ||||||||||||||||||||||||||||||||||
| /home/circleci/tooling/build-tools/build_tools.sh gh -o 'release download -R gravityforms/gravityforms --clobber --pattern "*.zip" --dir .tmp' | ||||||||||||||||||||||||||||||||||
| unzip .tmp/gravityforms*.zip -d .tmp | ||||||||||||||||||||||||||||||||||
| # GravityView — Dashboard Views hooks into `gravityview/loaded` to register Foundation, | ||||||||||||||||||||||||||||||||||
| # so without GravityView active the GK licenses admin page is never registered and the | ||||||||||||||||||||||||||||||||||
| # license activation smoke test cannot find the product card. | ||||||||||||||||||||||||||||||||||
| /home/circleci/tooling/build-tools/build_tools.sh gh -o 'release download -R GravityKit/GravityView --clobber --pattern "gravityview-*.zip" --dir .tmp' | ||||||||||||||||||||||||||||||||||
| unzip .tmp/gravityview-*.zip -d .tmp | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+47
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, let's look at the .circleci/config.yml file and the specific lines mentioned
cat -n .circleci/config.yml | sed -n '40,60p'Repository: GravityKit/Dashboard-Views Length of output: 1701 🏁 Script executed: # Also check the broader context around those lines
cat -n .circleci/config.yml | sed -n '1,70p'Repository: GravityKit/Dashboard-Views Length of output: 3497 🌐 Web query:
💡 Result: With Examples:
gh release download --pattern '*.deb'This works because omitting
gh release download --archive=zip[1]
tag="$(gh release view --json tagName --jq .tagName)"
gh release download "$tag"
Sources: 🏁 Script executed: # Search for GRAVITYFORMS_RELEASE and GRAVITYVIEW_RELEASE in the config
rg 'GRAVITYFORMS_RELEASE|GRAVITYVIEW_RELEASE' .circleci/config.ymlRepository: GravityKit/Dashboard-Views Length of output: 52 🏁 Script executed: # Check if there are any environment variable definitions in the config
grep -n "env:" .circleci/config.yml | head -20Repository: GravityKit/Dashboard-Views Length of output: 52 🏁 Script executed: # Look for any variables section or environment setup
cat -n .circleci/config.yml | grep -A 5 -B 5 "variables:\|environment:"Repository: GravityKit/Dashboard-Views Length of output: 1258 🏁 Script executed: # Search the entire repo for GRAVITYFORMS_RELEASE or GRAVITYVIEW_RELEASE
rg 'GRAVITYFORMS_RELEASE|GRAVITYVIEW_RELEASE' --type yml --type yaml --type mdRepository: GravityKit/Dashboard-Views Length of output: 97 🏁 Script executed: # Check the README or any documentation for E2E setup
find . -maxdepth 2 -name "README*" -o -name "*.md" | head -10Repository: GravityKit/Dashboard-Views Length of output: 81 🏁 Script executed: # Search more broadly for these variables
rg 'GRAVITYFORMS_RELEASE|GRAVITYVIEW_RELEASE'Repository: GravityKit/Dashboard-Views Length of output: 52 🏁 Script executed: # Check the README for E2E setup instructions
cat readme.md | grep -A 10 -B 5 -i "gravityforms\|gravityview\|e2e\|release"Repository: GravityKit/Dashboard-Views Length of output: 1106 🏁 Script executed: # Check if there's a .env.sample mentioned in config
cat -n .env.sample 2>/dev/null | head -30Repository: GravityKit/Dashboard-Views Length of output: 677 🏁 Script executed: # Check CircleCI documentation/scripts to see if there's any release pinning mechanism
find . -name "*.sh" -o -name "*circleci*" | head -20Repository: GravityKit/Dashboard-Views Length of output: 81 🏁 Script executed: # Look for any other CircleCI configuration files that might define variables
find . -path "./.circleci*" -type fRepository: GravityKit/Dashboard-Views Length of output: 92 🌐 Web query:
💡 Result:
# Download all assets from tag v1.2.3
gh release download v1.2.3# Download only matching assets from the latest release
gh release download --pattern '*.deb'# Multiple patterns
gh release download -p '*.deb' -p '*.rpm'# Filter assets from a specific tag
gh release download v1.2.3 --pattern '*linux*amd64*.tar.gz'[1] Pin the upstream plugin releases used by E2E.
Suggested change+ : "${GRAVITYFORMS_RELEASE:?Missing GRAVITYFORMS_RELEASE}"
+ : "${GRAVITYVIEW_RELEASE:?Missing GRAVITYVIEW_RELEASE}"
- /home/circleci/tooling/build-tools/build_tools.sh gh -o 'release download -R gravityforms/gravityforms --clobber --pattern "*.zip" --dir .tmp'
+ /home/circleci/tooling/build-tools/build_tools.sh gh -o "release download ${GRAVITYFORMS_RELEASE} -R gravityforms/gravityforms --clobber --pattern '*.zip' --dir .tmp"
unzip .tmp/gravityforms*.zip -d .tmp
- /home/circleci/tooling/build-tools/build_tools.sh gh -o 'release download -R GravityKit/GravityView --clobber --pattern "gravityview-*.zip" --dir .tmp'
+ /home/circleci/tooling/build-tools/build_tools.sh gh -o "release download ${GRAVITYVIEW_RELEASE} -R GravityKit/GravityView --clobber --pattern 'gravityview-*.zip' --dir .tmp"
unzip .tmp/gravityview-*.zip -d .tmp📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
| cp .env.sample .env | ||||||||||||||||||||||||||||||||||
| sed -i "s|WP_ENV_PLUGINS=.*|WP_ENV_PLUGINS=${PWD}/.tmp/gravityforms,${PWD}/.tmp/gravityview|" .env | ||||||||||||||||||||||||||||||||||
| sed -i "s|GRAVITY_FORMS_LICENSE_KEY=.*|GRAVITY_FORMS_LICENSE_KEY=${GRAVITYFORMS_KEY}|" .env | ||||||||||||||||||||||||||||||||||
| sed -i "s|GRAVITYKIT_LICENSE_KEY=.*|GRAVITYKIT_LICENSE_KEY=${GRAVITYVIEW_KEY}|" .env | ||||||||||||||||||||||||||||||||||
| - save_cache: | ||||||||||||||||||||||||||||||||||
| key: node-dependencies-{{ checksum "package-lock.json" }} | ||||||||||||||||||||||||||||||||||
| key: node-dependencies-{{ .Environment.CACHE_VERSION }}-{{ checksum "package-lock.json" }} | ||||||||||||||||||||||||||||||||||
| paths: | ||||||||||||||||||||||||||||||||||
| - node_modules | ||||||||||||||||||||||||||||||||||
| - save_cache: | ||||||||||||||||||||||||||||||||||
| key: composer-dependencies-{{ .Environment.CACHE_VERSION }}-{{ checksum "composer.lock" }} | ||||||||||||||||||||||||||||||||||
| paths: | ||||||||||||||||||||||||||||||||||
| - vendor | ||||||||||||||||||||||||||||||||||
| - vendor_prefixed | ||||||||||||||||||||||||||||||||||
| - persist_to_workspace: | ||||||||||||||||||||||||||||||||||
| root: /home/circleci | ||||||||||||||||||||||||||||||||||
| paths: | ||||||||||||||||||||||||||||||||||
| - . | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| run_e2e_tests: | ||||||||||||||||||||||||||||||||||
| <<: *default_job_config | ||||||||||||||||||||||||||||||||||
| parallelism: 1 | ||||||||||||||||||||||||||||||||||
| resource_class: xlarge | ||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||
| - attach_workspace: | ||||||||||||||||||||||||||||||||||
| at: /home/circleci | ||||||||||||||||||||||||||||||||||
| - run: | ||||||||||||||||||||||||||||||||||
| name: Run E2E tests | ||||||||||||||||||||||||||||||||||
| command: | | ||||||||||||||||||||||||||||||||||
| attempt=0 | ||||||||||||||||||||||||||||||||||
| max_attempts=3 | ||||||||||||||||||||||||||||||||||
| sleep_time=5 | ||||||||||||||||||||||||||||||||||
| while [ $attempt -lt $max_attempts ]; do | ||||||||||||||||||||||||||||||||||
| npm run tests:e2e:setup && break | ||||||||||||||||||||||||||||||||||
| attempt=$(( attempt + 1 )) | ||||||||||||||||||||||||||||||||||
| rm -rf /home/circleci/.wp-env | ||||||||||||||||||||||||||||||||||
| echo "Retrying WP-ENV setup in $sleep_time seconds… (attempt $attempt/$max_attempts)" | ||||||||||||||||||||||||||||||||||
| sleep $sleep_time | ||||||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||||||
| if [ $attempt -eq $max_attempts ]; then | ||||||||||||||||||||||||||||||||||
| echo "WP-ENV setup failed." | ||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||
| TESTFILES=$(circleci tests glob "tests/E2E/tests/**/*.spec.js") | ||||||||||||||||||||||||||||||||||
| echo "$TESTFILES" | circleci tests run --command="xargs npx playwright test --config=tests/E2E/setup/playwright.config.js" --verbose | ||||||||||||||||||||||||||||||||||
| - store_artifacts: | ||||||||||||||||||||||||||||||||||
| path: tests/E2E/results | ||||||||||||||||||||||||||||||||||
| - store_artifacts: | ||||||||||||||||||||||||||||||||||
| path: tests/E2E/report | ||||||||||||||||||||||||||||||||||
| - store_test_results: | ||||||||||||||||||||||||||||||||||
| path: tests/E2E/results/junit.xml | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+102
to
+103
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
CircleCI's Proposed fix - store_test_results:
- path: tests/E2E/results/junit.xml
+ path: tests/E2E/results🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| build_package_release: | ||||||||||||||||||||||||||||||||||
| <<: *default_job_config | ||||||||||||||||||||||||||||||||||
| environment: | ||||||||||||||||||||||||||||||||||
| # Disable husky pre-commit hooks during CI. `package_build` makes a | ||||||||||||||||||||||||||||||||||
| # git commit, which fires .husky/pre-commit → lint-staged → | ||||||||||||||||||||||||||||||||||
| # `vendor/bin/phpcs`. Since `composer install --no-dev` strips phpcs | ||||||||||||||||||||||||||||||||||
| # (it is a dev dependency), the hook fails with ENOENT and CI dies. | ||||||||||||||||||||||||||||||||||
| # This bug has existed on develop since CI was first configured — | ||||||||||||||||||||||||||||||||||
| # see GravityKit/Dashboard-Views#29 for the full root-cause analysis. | ||||||||||||||||||||||||||||||||||
| HUSKY: "0" | ||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||
| - attach_workspace: | ||||||||||||||||||||||||||||||||||
| at: /home/circleci | ||||||||||||||||||||||||||||||||||
| - run: | ||||||||||||||||||||||||||||||||||
| name: Building | ||||||||||||||||||||||||||||||||||
| command: | | ||||||||||||||||||||||||||||||||||
| /home/circleci/tooling/build-tools/build_tools.sh composer -o "install --no-dev" | ||||||||||||||||||||||||||||||||||
| /home/circleci/tooling/build-tools/build_tools.sh grunt | ||||||||||||||||||||||||||||||||||
| - run: | ||||||||||||||||||||||||||||||||||
| name: Trigger translation pipeline | ||||||||||||||||||||||||||||||||||
|
|
@@ -77,5 +164,11 @@ workflows: | |||||||||||||||||||||||||||||||||
| version: 2 | ||||||||||||||||||||||||||||||||||
| test_and_package: | ||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||
| - prepare_test_and_build_environment: | ||||||||||||||||||||||||||||||||||
| <<: *context | ||||||||||||||||||||||||||||||||||
| - run_e2e_tests: | ||||||||||||||||||||||||||||||||||
| <<: *test_job_config | ||||||||||||||||||||||||||||||||||
| - build_package_release: | ||||||||||||||||||||||||||||||||||
| <<: *context | ||||||||||||||||||||||||||||||||||
| requires: | ||||||||||||||||||||||||||||||||||
| - run_e2e_tests | ||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Comma-separated absolute paths to extra plugins to mount into the wp-env test environment. | ||
| # Example: WP_ENV_PLUGINS=/path/to/gravityforms | ||
| WP_ENV_PLUGINS= | ||
|
|
||
| # License keys injected into the test environment. | ||
| GRAVITY_FORMS_LICENSE_KEY= | ||
| GRAVITYKIT_LICENSE_KEY= | ||
|
|
||
| # Optional tunables | ||
| # E2E_KEEP_DATA=0 Skip cleanup of test data between runs. | ||
| # USE_LOCAL_BROWSER=0 Use local Chromium instead of the Docker Playwright container. | ||
| # SLOW_MO=0 Slow down Playwright actions by N milliseconds (useful for debugging). |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,14 @@ | ||
| .DS_Store | ||
| node_modules | ||
| vendor | ||
| vendor_prefixed | ||
| .sass-cache | ||
| build | ||
| .env | ||
|
|
||
| # E2E Testing | ||
| tests/E2E/setup/.wp-env.json | ||
| tests/E2E/setup/.state.json | ||
| tests/E2E/setup/.e2e-ports.json | ||
| tests/E2E/results/ | ||
| tests/E2E/report/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: GravityKit/Dashboard-Views
Length of output: 90
🏁 Script executed:
cat -n .circleci/config.yml | head -100Repository: GravityKit/Dashboard-Views
Length of output: 4772
🌐 Web query:
CircleCI persist_to_workspace paths root configuration documentation💡 Result:
In CircleCI config,
persist_to_workspacehas two required keys:root: a directory on the container that becomes the workspace root for this step. It can be an absolute path or relative toworking_directory. [1]paths: a list of files/globs or directories to upload, interpreted relative toroot(the workspace root). It must not be the workspace root itself (sopaths: ['.']is invalid ifrootis.). Patterns use Go’sfilepath.Matchglobbing rules. [1]Minimal example (persist one file created under
workspace/):A downstream job then downloads the entire workspace and copies it into the directory you choose via
attach_workspace:So the file above becomes available at
/tmp/workspace/echo-output. [2]Sources: CircleCI configuration reference (
persist_to_workspace,attach_workspace) [1]; CircleCI “Using workspaces to share data between jobs” guide (end-to-end example) [2].🏁 Script executed:
cat -n .circleci/config.yml | tail -50Repository: GravityKit/Dashboard-Views
Length of output: 2668
🏁 Script executed:
Repository: GravityKit/Dashboard-Views
Length of output: 3975
Remove
paths: - .frompersist_to_workspaceas it violates CircleCI's documented constraint.CircleCI's configuration reference explicitly states that
persist_to_workspace.pathsmust not reference the workspace root itself. Withroot: /home/circleciandpaths: - ., the configuration attempts to persist the root directory, which is unsupported and will fail.Beyond the constraint violation, this persists unintended files: the
.npmrcfile containing the auth token, the.envfile with license keys, temporary.tmpartifacts, and other temporary state. Persist only the directories needed downstream (pluginandtooling), and generate the E2E-specific.envinsiderun_e2e_testsinstead.Suggested change
- persist_to_workspace: root: /home/circleci paths: - - . + - plugin + - toolingAlso applies to: 54-57 (move
.envcreation torun_e2e_tests), 67-70 (workspace paths)🤖 Prompt for AI Agents