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
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
WP_BASE_URL=http://localhost:8889
WP_AUTH_STORAGE=wp-auth.json
WP_USERNAME=admin
WP_PASSWORD=password
INTERACTIONS_SLUG=Interactions/interactions
ELEMENTOR_SLUG=elementor/elementor
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@ node_modules/
vendor/
build/
dist/
e2e/
tools/
playwright-report/
playwright-interact/
test-results/
*.min.js
src/editor/animejs/index.js
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ module.exports = {
root: true,
extends: [
'plugin:@wordpress/eslint-plugin/recommended-with-formatting',
'plugin:jest/recommended',
'plugin:compat/recommended',
],
env: {
Expand Down
144 changes: 144 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: Playwright Tests
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]
permissions:
contents: read
actions: write
Comment on lines +7 to +9

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the workflow file around the relevant lines
cat -n .github/workflows/playwright.yml | sed -n '1,220p'

# Find artifact-related usage and permissions in the repository
rg -n "upload-artifact|download-artifact|artifact-metadata|permissions:" .github/workflows . -g '!**/node_modules/**' -g '!**/dist/**' -g '!**/build/**'

Repository: gambitph/Interactions

Length of output: 6443


🏁 Script executed:

#!/bin/bash
set -euo pipefail

cat -n .github/workflows/playwright.yml | sed -n '1,220p'

Repository: gambitph/Interactions

Length of output: 6167


🌐 Web query:

GitHub Actions upload-artifact permissions actions: write artifact-metadata write workflow permissions docs

💡 Result:

As of July 15, 2026, the artifact-metadata: write permission is a fine-grained GitHub Actions permission specifically required for interacting with artifact metadata APIs, such as creating artifact metadata storage records [1]. Key points regarding this permission: 1. Function: The artifact-metadata: write permission allows a workflow to create and manage artifact-related metadata [1]. It replaced the broader contents: write permission for these specific API operations as of early 2026 [1]. 2. Usage: It is primarily used by actions that generate or persist metadata for build artifacts, such as the actions/attest-build-provenance action when creating storage records [2][3][4]. 3. Requirements: If you are using an action that requires this capability (e.g., to create storage records for linked artifacts), you must explicitly define the permission in your workflow job configuration [2][3]: permissions: artifact-metadata: write # Other necessary permissions (e.g., id-token: write, attestations: write) 4. Context: Note that the standard actions/upload-artifact action does not require the artifact-metadata: write permission to upload artifacts themselves [5][6][7]. The artifact-metadata permission is specifically for advanced metadata operations accessed via the REST API [1][8]. If you encounter errors like Failed to create storage record, ensure the permission is correctly scoped within your workflow job permissions block [9].

Citations:


Remove the workflow-wide actions: write permission .github/workflows/playwright.yml:7-9
actions/upload-artifact and actions/download-artifact don’t need it, so this can stay at contents: read unless another step actually needs the Actions API.

🧰 Tools
🪛 zizmor (1.26.1)

[error] 9-9: overly broad permissions (excessive-permissions): actions: write is overly broad at the workflow level

(excessive-permissions)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/playwright.yml around lines 7 - 9, Remove the
workflow-wide actions: write entry from the permissions block in the Playwright
workflow, retaining contents: read. Do not add replacement Actions permissions
unless an existing step explicitly requires the Actions API.

Source: Linters/SAST tools

jobs:
build:
runs-on: ubuntu-latest
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
steps:
- uses: actions/checkout@v4
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
with:
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
check-latest: true
cache: npm
cache-dependency-path: package-lock.json
- name: Build Interactions Free Plugin
run: |
npm ci --legacy-peer-deps
npm run build:e2e
- name: Archive plugin build
run: tar --exclude=./node_modules --exclude=./.git -czf /tmp/interactions-playwright-build.tar.gz .
- uses: actions/upload-artifact@v4
with:
name: interactions-playwright-build
path: /tmp/interactions-playwright-build.tar.gz
retention-days: 1

test:
needs: build
timeout-minutes: 60
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# interactions-playwright-matrix-start
- php_version: '8.5'
wp_version: '7.0.1'
- php_version: '8.0'
wp_version: '7.0.1'
- php_version: '8.0'
wp_version: '6.8.5'
- php_version: '8.0'
wp_version: '6.9.4'
# interactions-playwright-matrix-end
name: PHP ${{ matrix.php_version }} and WP ${{ matrix.wp_version || 'latest' }}
steps:
- name: Restore plugin build
uses: actions/download-artifact@v4
with:
name: interactions-playwright-build
- name: Extract plugin build
run: tar -xzf interactions-playwright-build.tar.gz
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
check-latest: true
cache: npm
cache-dependency-path: package-lock.json
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Set the version suffix for the output
run: echo VERSION_SUFFIX=${GITHUB_REF_NAME//\//-} >> $GITHUB_ENV
- name: Set WP Version and create .wp-env.json
run: |
WP_VERSION="${{ matrix.wp_version }}"
core='"Wordpress/Wordpress#'${{ matrix.wp_version }}'"'

if [[ -z "$WP_VERSION" || "$WP_VERSION" == "null" ]]; then
WP_VERSION="latest"
core=null
fi

echo "WP_VERSION=$WP_VERSION" >> $GITHUB_ENV

echo '{
"core": '$core',
"phpVersion": "${{ matrix.php_version }}",
"plugins": [ ".", "https://downloads.wordpress.org/plugin/elementor.zip" ],
"config": {
"SCRIPT_DEBUG": false
}
}' > .wp-env.json

cat .wp-env.json
- name: Cache Playwright Browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-playwright-
- name: Install Playwright Browsers
timeout-minutes: 15
run: |
for attempt in 1 2 3; do
npx playwright install chromium --with-deps && exit 0
echo "Playwright install failed on attempt $attempt"
sleep $((attempt * 30))
done
exit 1
- name: Start wp-env
run: npx @wordpress/env start
- name: Print current WP version
run: npx @wordpress/env run tests-cli wp core version
- name: Run playwright tests
id: run-playwright-tests
env:
WP_BASE_URL: http://localhost:8889
WP_AUTH_STORAGE: wp-auth.json
WP_USERNAME: admin
WP_PASSWORD: password
INTERACTIONS_SLUG: Interactions/interactions
ELEMENTOR_SLUG: elementor/elementor
run: npm run test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() && steps.run-playwright-tests.outcome == 'failure' }}
id: artifact-upload-step
with:
name: playwright-report-php_${{ matrix.php_version }}-wp_${{ env.WP_VERSION }}-${{ env.VERSION_SUFFIX }}
path: playwright-report/
overwrite: true
retention-days: 30
- uses: markpatterson27/markdown-to-output@v1
id: mto
if: ${{ !cancelled() && steps.run-playwright-tests.outcome == 'failure' }}
with:
filepath: ./playwright-interact/errors.md
- name: Add test results to summary
if: ${{ !cancelled() && steps.run-playwright-tests.outcome == 'failure' }}
env:
SUMMARY_BODY: ${{ steps.mto.outputs.body }}
REPORT_NAME: playwright-report-php_${{ matrix.php_version }}-wp_${{ env.WP_VERSION }}-${{ env.VERSION_SUFFIX }}
ARTIFACT_ID: ${{ steps.artifact-upload-step.outputs.artifact-id }}
Comment on lines +138 to +141

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

file=".github/workflows/playwright.yml"
rg -n 'GITHUB_ENV|env\.(WP_VERSION|VERSION_SUFFIX)|name: playwright-report' "$file"

# Confirm artifact names include both matrix dimensions.
rg -n 'matrix\.(php_version|wp_version)' "$file"

Repository: gambitph/Interactions

Length of output: 1030


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file=".github/workflows/playwright.yml"
nl -ba "$file" | sed -n '60,150p'

Repository: gambitph/Interactions

Length of output: 199


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file=".github/workflows/playwright.yml"
awk 'NR>=60 && NR<=150 { printf "%4d  %s\n", NR, $0 }' "$file"

Repository: gambitph/Interactions

Length of output: 4055


🌐 Web query:

GitHub Actions env context GITHUB_ENV values available in expressions upload-artifact with name step outputs

💡 Result:

In GitHub Actions, there are distinct mechanisms for managing data within a workflow, depending on whether you are using the env context, the GITHUB_ENV environment file, or step outputs [1][2][3]. The env context is used for variables defined in the workflow file (at the workflow, job, or step level) [4][5]. It is processed before the job is sent to the runner, meaning it is suitable for expressions in conditional statements [2][6]. GITHUB_ENV is a file on the runner used to persist environment variables for subsequent steps within the same job [5][3]. When you append a variable to this file (e.g., echo "VAR_NAME=value" >> $GITHUB_ENV), that variable becomes available to all following steps in that job as an environment variable [5][3]. Crucially, the step that writes to GITHUB_ENV does not have access to that new variable; only subsequent steps do [5][3]. Regarding the upload-artifact action (commonly used as actions/upload-artifact), it does not use environment variables to communicate its results back to the workflow [7][8]. Instead, it provides step outputs [7][8]. You can access these outputs by assigning an id to the step and referencing it via the steps context [7][9]. For example, if you want to use the artifact-id produced by an upload-artifact step: 1. Assign an id to the upload step: - uses: actions/upload-artifact@v7 id: my-artifact-upload with: name: my-artifact path: path/to/files 2. Reference the output in a subsequent step: - name: Use artifact ID run: echo "The artifact ID is ${{ steps.my-artifact-upload.outputs.artifact-id }}" The outputs provided by actions/upload-artifact include artifact-id, artifact-url, and artifact-digest [7][9][8]. These outputs are available to all subsequent steps in the same job [7][9]. To use them in a different job, you must explicitly define them in the job outputs section and use the needs context [7][9].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file=".github/workflows/playwright.yml"
awk 'NR>=1 && NR<=70 { printf "%4d  %s\n", NR, $0 }' "$file"

Repository: gambitph/Interactions

Length of output: 2600


Use step outputs for the artifact name. WP_VERSION and VERSION_SUFFIX are only written via $GITHUB_ENV, so ${{ env.WP_VERSION }} / ${{ env.VERSION_SUFFIX }} stay empty in the later actions/upload-artifact@v4 and summary expressions. That makes the matrix artifact names collide; emit the normalized values via $GITHUB_OUTPUT and read them as steps.<id>.outputs.* instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/playwright.yml around lines 139 - 142, Update the workflow
step that normalizes WP_VERSION and VERSION_SUFFIX to also emit both values via
GITHUB_OUTPUT, then change REPORT_NAME in the artifact upload and
summary-related expressions to read those values through the step’s outputs
instead of env.WP_VERSION and env.VERSION_SUFFIX. Preserve the existing
normalized values and PHP matrix naming.

run: |
echo "$SUMMARY_BODY" >> $GITHUB_STEP_SUMMARY
echo "Report: [${REPORT_NAME}.zip](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/${ARTIFACT_ID})" >> $GITHUB_STEP_SUMMARY
11 changes: 10 additions & 1 deletion .github/workflows/plugin-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,16 @@ jobs:

steps:
- name: Check out
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
persist-credentials: false

- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
check-latest: true
cache: npm
cache-dependency-path: package-lock.json

- name: Set the version suffix for the output
run: echo VERSION_SUFFIX=${GITHUB_REF_NAME//\//-} >> $GITHUB_ENV
Expand Down
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@ build-plugin/
.DS_Store
*.log
*.map
pro__premium_only/
pro__premium_only/
.env
wp-auth.json
playwright-report/
playwright-interact/
test-results/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22
11 changes: 11 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"core": null,
"phpVersion": "8.0",
"plugins": [
".",
"https://downloads.wordpress.org/plugin/elementor.zip"
],
"config": {
"SCRIPT_DEBUG": false
}
}
35 changes: 35 additions & 0 deletions e2e/config/global-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { request } from '@playwright/test'

import { ExtendedRequestUtils } from 'e2e/test-utils'

async function globalSetup() {
const requestContext = await request.newContext( {
baseURL: process.env.WP_BASE_URL,
ignoreHTTPSErrors: true,
} )
const requestUtils = new ExtendedRequestUtils( requestContext, {
storageStatePath: process.env.WP_AUTH_STORAGE,
user: {
username: process.env.WP_USERNAME,
password: process.env.WP_PASSWORD,
},
} )

await requestUtils.setupRest()

const plugins = await requestUtils.getActivePlugins()

for ( const slug of Object.keys( plugins ) ) {
await requestUtils.deactivatePlugin( slug )
}

await requestUtils.activatePlugin( process.env.INTERACTIONS_SLUG )

if ( process.env.ELEMENTOR_SLUG ) {
await requestUtils.activatePlugin( process.env.ELEMENTOR_SLUG )
}

await requestContext.dispose()
}

export default globalSetup
129 changes: 129 additions & 0 deletions e2e/config/reporter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
/* eslint-disable no-console */
import type {
FullConfig, TestResult,
Reporter, Suite, TestCase,
} from '@playwright/test/reporter'

import { ms } from 'e2e/test-utils'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Import ansiRegex to strip color codes.

Playwright's error.message and error.snippet include ANSI escape codes for terminal coloring. If these aren't stripped, they will pollute the resulting Markdown report (e.g., showing up as [31mExpected[39m) and render poorly in GitHub step summaries.

You can utilize the ansiRegex that was exported in e2e/test-utils/format.ts but left unused.

🐛 Proposed fix to sanitize error outputs
-import { ms } from 'e2e/test-utils'
+import { ms, ansiRegex } from 'e2e/test-utils'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { ms } from 'e2e/test-utils'
import { ms, ansiRegex } from 'e2e/test-utils'
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e/config/reporter.ts` at line 7, Import and use the exported ansiRegex in
the reporter’s error formatting flow to remove ANSI escape sequences from
Playwright error.message and error.snippet before generating Markdown or GitHub
step-summary output. Preserve the existing report content apart from this
sanitization, and reuse the ansiRegex export from e2e/test-utils/format.ts
rather than adding a new pattern.


import fs from 'fs'
import path from 'path'

class InteractReporter implements Reporter {
outputFolder: string;
failedTestErrors: Array<string>;
totalTestCount: number;
suite: Suite;

constructor( options: { outputFolder?: string } = {} ) {
this.outputFolder = options.outputFolder || 'playwright-interact'
this.cleanupFolder()

this.totalTestCount = 0
this.failedTestErrors = []
}

cleanupFolder() {
const folderPath = path.resolve( this.outputFolder )

if ( fs.existsSync( folderPath ) ) {
const files = fs.readdirSync( folderPath )
for ( const file of files ) {
const filePath = path.join( folderPath, file )
if ( fs.lstatSync( filePath ).isFile() ) {
fs.unlinkSync( filePath )
}
}
console.log( `All files removed from: ${ folderPath }` )
} else {
fs.mkdirSync( folderPath, { recursive: true } )
}
}

onBegin( config: FullConfig, suite: Suite ): void {
this.totalTestCount = suite.allTests().length
this.suite = suite
console.log( `Running ${ this.totalTestCount } tests:` )
}

onTestEnd( test: TestCase, result: TestResult ) {
const resultMark = test.ok() ? '✓' : '✘'
const titlePath = test.titlePath().filter( t => t !== '' ).join( ' › ' )
const retryLabel = test.results.length > 1 ? `(retry #${ test.results.length - 1 }) ` : ''
const duration = `[${ ms( result.duration ) }]`
console.log( `${ resultMark } ${ titlePath } ${ retryLabel }${ duration }` )

if ( result.status !== test.expectedStatus ) {
let testResult = `${ titlePath } ${ retryLabel }${ duration }` + '\n\n'
if ( result.errors.length >= 1 ) {
result.errors.forEach( error => {
if ( error.message ) {
testResult += `${ error.message }` + '\n\n'
}

if ( error.snippet ) {
testResult += `${ error.snippet }` + `\n\n`
}
} )
Comment on lines +58 to +67

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Strip ANSI codes from error messages and snippets.

Applying the imported ansiRegex will sanitize the error details before they are written to the Markdown report.

♻️ Proposed refactor
 			if ( result.errors.length >= 1 ) {
 				result.errors.forEach( error => {
 					if ( error.message ) {
-						testResult += `${ error.message }` + '\n\n'
+						testResult += `${ error.message.replace( ansiRegex, '' ) }` + '\n\n'
 					}
 
 					if ( error.snippet ) {
-						testResult += `${ error.snippet }` + `\n\n`
+						testResult += `${ error.snippet.replace( ansiRegex, '' ) }` + `\n\n`
 					}
 				} )
 			}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if ( result.errors.length >= 1 ) {
result.errors.forEach( error => {
if ( error.message ) {
testResult += `${ error.message }` + '\n\n'
}
if ( error.snippet ) {
testResult += `${ error.snippet }` + `\n\n`
}
} )
if ( result.errors.length >= 1 ) {
result.errors.forEach( error => {
if ( error.message ) {
testResult += `${ error.message.replace( ansiRegex, '' ) }` + '\n\n'
}
if ( error.snippet ) {
testResult += `${ error.snippet.replace( ansiRegex, '' ) }` + `\n\n`
}
} )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e/config/reporter.ts` around lines 58 - 67, Update the error-reporting loop
in reporter handling to apply the imported ansiRegex when appending each
error.message and error.snippet, ensuring ANSI escape codes are removed before
writing the Markdown testResult while preserving the existing formatting and
conditional checks.

}

this.failedTestErrors.push( testResult )
}
}

getSummary() {
let skipped = 0
let expected = 0
let unexpected = 0
let flaky = 0

const unexpectedTestTitles : Array<string> = []

this.suite.allTests().forEach( test => {
switch ( test.outcome() ) {
case 'skipped': skipped++; break
case 'expected': expected++; break
case 'unexpected':
unexpected++
unexpectedTestTitles.push( '- ' + test.titlePath().filter( t => t !== '' ).join( ' › ' ) )
break
case 'flaky': flaky++; break
}
} )

if ( unexpected ) {
console.log( '\nSummary:' )
console.log( `${ expected } passed` )
console.log( `${ flaky } flaky` )
console.log( `${ skipped } skipped` )
console.log( `${ unexpected } failed` )
console.log( `---\n\nFailed Tests:` )
console.log( this.failedTestErrors.join( '' ) )

const md = `
| PASSED | FLAKY | SKIPPED | FAILED |
| ------ | ----- | ------- | ------ |
| ${ expected } | ${ flaky } | ${ skipped } | ${ unexpected } |

Failed Tests:
${ unexpectedTestTitles.join( '\n' ) }

`

const folderPath = path.resolve( this.outputFolder )
if ( ! fs.existsSync( folderPath ) ) {
fs.mkdirSync( folderPath, { recursive: true } )
}

const reportPath = path.join( folderPath, 'errors.md' )
fs.writeFileSync( reportPath, md )
}
}

async onEnd() {
process.stdout.write( '\n' )
this.getSummary()
}
}

export default InteractReporter
Loading
Loading