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
92 changes: 40 additions & 52 deletions .github/workflows/app-smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
required: false
default: 'master'
schedule:
# run daily at midnight
# Run daily at midnight UTC
- cron: '15 0 * * *'

jobs:
Expand All @@ -17,27 +17,36 @@ jobs:
strategy:
max-parallel: 1
matrix:
node-version: [18.x, 20.x]
node-version: [20.x, 22.x, 24.x]
os: [ubuntu-latest]

steps:
- name: Checkout e2e-tests repo (for scripts)
uses: actions/checkout@v3
with:
path: e2e-tests

- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Setup CLI
uses: actions/checkout@v3
with:
repository: adobe/aio-cli-plugin-app
ref: ${{ github.event.inputs.branch-name }}
path: aio-cli-plugin-app

- name: Update package.json oclif.plugins
uses: jossef/action-set-json-field@v2.1
with:
file: package.json
file: aio-cli-plugin-app/package.json
field: oclif.plugins
value: "[\"@adobe/aio-cli-plugin-app-templates\"]"
parse_json: true

- name: Auth
uses: adobe/aio-apps-action@3.3.0
uses: adobe/aio-apps-action@3.3.1
with:
os: ${{ matrix.os }}
command: oauth_sts
Expand All @@ -49,69 +58,48 @@ jobs:
# see https://github.com/adobe/aio-lib-ims-oauth/issues/114
TECHNICALACCOUNTID: dummy_id
TECHNICALACCOUNTEMAIL: dummy_email
- id: create
name: create app with no extensions
run: |
npm i @adobe/aio-cli-plugin-app-templates
npm i
mkdir ffapp
cd ffapp

../bin/run app:init . -y --no-login --standalone-app > consoleoutput.txt
grep "App initialization finished" consoleoutput.txt

echo AIO_RUNTIME_AUTH=${{secrets.RUNTIME_AUTH}} > .env
echo AIO_RUNTIME_NAMESPACE=${{secrets.RUNTIME_NAMESPACE}} >> .env
- id: create
name: Create app with no extensions
working-directory: aio-cli-plugin-app
run: node ../e2e-tests/smoke-tests/create-app.js
env:
AIO_RUNTIME_AUTH: ${{ secrets.RUNTIME_AUTH }}
AIO_RUNTIME_NAMESPACE: ${{ secrets.RUNTIME_NAMESPACE }}

../bin/run app:deploy >> consoleoutput.txt
grep "Your deployed actions:" consoleoutput.txt
grep "api/v1/web/ffapp/generic" consoleoutput.txt
grep "/api/v1/web/ffapp/publish-events" consoleoutput.txt
grep ".adobeio-static.net/index.html" consoleoutput.txt
grep "Successful deployment" consoleoutput.txt
- id: app_pack
name: pack an app (uses previous created app)
run: |
cd ffapp
name: Pack an app (uses previous created app)
working-directory: aio-cli-plugin-app
run: node ../e2e-tests/smoke-tests/pack.js

../bin/run app:pack &> consoleoutput.txt
grep "Packaging done." consoleoutput.txt
- id: app_install
name: install an app (uses previous packed app)
run: |
cd ffapp
name: Install an app (uses previous packed app)
working-directory: aio-cli-plugin-app
run: node ../e2e-tests/smoke-tests/install.js

../bin/run app:install dist/app.zip --output install-folder &> consoleoutput.txt
grep "Install done." consoleoutput.txt
- id: createext
name: create app with extension
run: |
rm -rf ffapp
mkdir ffapp
cd ffapp

../bin/run app:init . -y --no-login --extension dx/excshell/1 > consoleoutput.txt
grep "App initialization finished" consoleoutput.txt

echo AIO_RUNTIME_AUTH=${{secrets.RUNTIME_AUTH}} > .env
echo AIO_RUNTIME_NAMESPACE=${{secrets.RUNTIME_NAMESPACE}} >> .env

../bin/run app:deploy --no-publish >> consoleoutput.txt
grep "Your deployed actions:" consoleoutput.txt
grep "api/v1/web/dx-excshell-1/generic" consoleoutput.txt
grep ".adobeio-static.net/index.html" consoleoutput.txt
grep "Successful deployment" consoleoutput.txt
name: Create app with extension
working-directory: aio-cli-plugin-app
run: node ../e2e-tests/smoke-tests/create-app-extension.js
env:
AIO_RUNTIME_AUTH: ${{ secrets.RUNTIME_AUTH }}
AIO_RUNTIME_NAMESPACE: ${{ secrets.RUNTIME_NAMESPACE }}

- id: output
name: Write the output to console for debugging
if: ${{ failure() }}
working-directory: aio-cli-plugin-app
run: |
if [ -d "ffapp" ]; then cd ffapp; fi
cat consoleoutput.txt
if [ -d "ffapp" ]; then
echo "=== Console output from ffapp/consoleoutput.txt ==="
cat ffapp/consoleoutput.txt
else
echo "ffapp directory not found"
fi

- id: slacknotification
name: Slack Notification
if: ${{ failure() }}
if: ${{ failure() && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/app-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [18]
node-version: [20.x, 22.x, 24.x]
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm i --package-lock --package-lock-only
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
run: |
git config user.name adobe-bot
git config user.email grp-opensourceoffice@adobe.com
echo "- $(date) Node ${{ matrix.node-version }} ${{ job.status == 'success' && '🎉 success' || job.status }}" >> logs/run.md
echo "- $(date) Node ${{ matrix.node-version }} ${{ job.status == 'success' && 'success' || job.status }}" >> logs/run.md
git add logs/run.md
git commit -m "generated"
git push
Expand Down
30 changes: 20 additions & 10 deletions .github/workflows/asset-compute-smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Asset Compute smoke test (init, build and deploy)

on:
workflow_dispatch:
pull_request:
schedule:
# run daily at midnight
- cron: '15 0 * * *'
Expand All @@ -12,36 +13,45 @@ jobs:
strategy:
max-parallel: 1
matrix:
node-version: [18.x, 20.x]
node-version: [20.x, 22.x, 24.x]
os: [ubuntu-latest]

steps:
- name: Checkout e2e-tests repo (for scripts)
uses: actions/checkout@v3
with:
path: e2e-tests

- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Setup Asset Compute
uses: actions/checkout@master
with:
repository: adobe/asset-compute-integration-tests
path: asset-compute-tests

- id: create-asset-compute
name: asset compute smoke integration test
run: |
npm i
./node_modules/mocha/bin/mocha test/index.test.js > consoleoutput.txt

grep "App initialization finished!" consoleoutput.txt
grep -e "Running tests in .*/test/asset-compute/worker" consoleoutput.txt
grep "All tests were successful." consoleoutput.txt
working-directory: asset-compute-tests
run: node ../e2e-tests/smoke-tests/asset-compute.js

- id: output
name: Write the output to console for debugging
if: ${{ failure() }}
working-directory: asset-compute-tests
run: |
cat consoleoutput.txt
if [ -f "consoleoutput.txt" ]; then
echo "=== Console output from consoleoutput.txt ==="
cat consoleoutput.txt
else
echo "consoleoutput.txt not found"
fi

- id: slacknotification
name: Slack Notification
if: ${{ failure() }}
if: ${{ failure() && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
Expand Down
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,30 @@ E2e tests for Adobe I/O SDKs and tools.
Each tested repository has its own requirements, mostly environment variables to be set.
Tests are run against [an internal Adobe Console Project](https://developer.adobe.com/console/projects/53444/4566206088344607082).

## Run
## Running Tests

`npm run all`
### Full E2E Test Suite

Run all e2e tests for all libraries:
```bash
npm run all
```

This executes `src/index.js` which runs e2e tests for all configured repositories.

### Individual Smoke Tests (GitHub Actions)

The smoke tests for `aio-cli-plugin-app` are run via GitHub Actions workflows using JavaScript scripts:

- **App Plugin Smoke Test**: `.github/workflows/app-smoke-test.yml`
- Uses scripts from `.github/scripts/smoke-test.js`
- Tests: create app, pack, install, create with extension

- **Asset Compute Smoke Test**: `.github/workflows/asset-compute-smoke-test.yml`
- Uses scripts from `.github/scripts/smoke-test.js`
- Tests: Asset Compute integration

These workflows can also be run locally (see `.github/scripts/README.md` for details).

## Tests

Expand Down
51 changes: 51 additions & 0 deletions smoke-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Smoke Tests

Individual test scripts for AIO workflows, replacing inline shell code in GitHub Actions.

## Test Scripts

Each script is standalone and can be run directly:

- `create-app.js` - Create and deploy app with no extensions
- `create-app-extension.js` - Create and deploy app with extension
- `pack.js` - Package app into a zip file
- `install.js` - Install app from zip file
- `asset-compute.js` - Run Asset Compute integration tests

## Usage

### In GitHub Actions Workflows

```yaml
- name: Create app with no extensions
working-directory: aio-cli-plugin-app
run: node ../e2e-tests/smoke-tests/create-app.js
env:
AIO_RUNTIME_AUTH: ${{ secrets.RUNTIME_AUTH }}
AIO_RUNTIME_NAMESPACE: ${{ secrets.RUNTIME_NAMESPACE }}
```

### Local Testing

```bash
# Test with mocks (no credentials required)
cd smoke-tests
node test-harness.js

# Test with actual CLI (requires credentials)
export AIO_RUNTIME_AUTH="your-auth"
export AIO_RUNTIME_NAMESPACE="your-namespace"
node create-app.js
```

## Files

- `utils.js` - Shared utilities (runCommand, verifyOutput, createAndDeployApp, etc.)
- `test-harness.js` - Local testing with mocks (no credentials needed)
- `tests/fixtures/` - Mock output files for test-harness.js

## Workflows

These scripts are used by:
- `.github/workflows/app-smoke-test.yml`
- `.github/workflows/asset-compute-smoke-test.yml`
29 changes: 29 additions & 0 deletions smoke-tests/asset-compute.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env node

/**
* Asset Compute smoke test
*/

const { runCommand, verifyOutput } = require('./utils');

const outputFile = 'consoleoutput.txt';

try {
console.log('=== Step 1: Install dependencies ===');
runCommand('npm i');

console.log('\n=== Step 2: Run Asset Compute tests ===');
runCommand('./node_modules/mocha/bin/mocha test/index.test.js > consoleoutput.txt');

console.log('\n=== Step 3: Verify test results ===');
verifyOutput(outputFile, [
'App initialization finished!',
'/test/asset-compute/worker',
'All tests were successful.'
]);

console.log('\nAsset Compute smoke test passed!');
} catch (error) {
console.error('\nScript failed:', error.message);
throw error;
}
21 changes: 21 additions & 0 deletions smoke-tests/create-app-extension.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env node

/**
* Create and deploy app with extension
*/

const { createAndDeployApp } = require('./utils');

createAndDeployApp({
installDeps: false,
cleanFirst: true,
initCommand: 'app:init . -y --no-login --extension dx/excshell/1',
deployCommand: 'app:deploy --no-publish',
verifyStrings: [
'Your deployed actions:',
'api/v1/web/dx-excshell-1/generic',
'.adobeio-static.net/index.html',
'Successful deployment'
],
successMessage: 'App with extension creation and deployment successful!'
});
22 changes: 22 additions & 0 deletions smoke-tests/create-app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env node

/**
* Create and deploy app with no extensions
*/

const { createAndDeployApp } = require('./utils');

createAndDeployApp({
installDeps: true,
cleanFirst: false,
initCommand: 'app:init . -y --no-login --standalone-app',
deployCommand: 'app:deploy',
verifyStrings: [
'Your deployed actions:',
'api/v1/web/ffapp/generic',
'/api/v1/web/ffapp/publish-events',
'.adobeio-static.net/index.html',
'Successful deployment'
],
successMessage: 'App creation and deployment successful!'
});
Loading