Merge branch 'trunk' into add/low-stock-threshold

This commit is contained in:
jamelreid 2021-12-23 10:21:08 -05:00
commit ef00eaa70e
10 changed files with 249 additions and 9 deletions

View File

@ -25,6 +25,7 @@ jobs:
- name: Install prerequisites.
working-directory: package/woocommerce/plugins/woocommerce
id: installation
run: |
npm install -g pnpm
pnpm install
@ -34,6 +35,7 @@ jobs:
- name: Run smoke test.
working-directory: package/woocommerce/plugins/woocommerce
if: steps.installation.outcome == 'success'
env:
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
@ -49,8 +51,50 @@ jobs:
DEFAULT_TIMEOUT_OVERRIDE: 120000
run: |
pnpx wc-e2e test:e2e plugins/woocommerce/tests/e2e/specs/smoke-tests/update-woocommerce.js
- name: Post Smoke tests results comment on PR
if: always()
uses: actions/github-script@v5
env:
TITLE: 'Smoke Test Results'
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const script = require( './package/woocommerce/packages/js/e2e-environment/bin/post-results-to-github-pr.js' )
await script({github, context})
- name: Run E2E tests.
working-directory: package/woocommerce/plugins/woocommerce
if: steps.installation.outcome == 'success'
env:
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }}
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
WC_E2E_SCREENSHOTS: 1
E2E_RETEST: 1
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }}
UPDATE_WC: 1
DEFAULT_TIMEOUT_OVERRIDE: 120000
run: |
pnpx wc-e2e test:e2e
- name: Post E2E tests results comment on PR
if: always()
uses: actions/github-script@v5
env:
TITLE: 'E2E Test Results'
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const script = require( './package/woocommerce/packages/js/e2e-environment/bin/post-results-to-github-pr.js' )
await script({github, context})
- name: Remove label from pull request.
if: "${{ contains(github.event.pull_request.labels.*.name, 'run: smoke tests') }}"
uses: actions-ecosystem/action-remove-labels@v1

3
.gitignore vendored
View File

@ -70,3 +70,6 @@ yarn.lock
# Editors
nbproject/private/
# Test Results
test-results.json

View File

@ -2,6 +2,11 @@
## Added
- Added `post-results-to-github-pr.js` to post smoke test results to a GitHub PR.
- Added jest flags to generate a json test report
## Added
- Added `await` for every call to `shopper.logout`
- Updated `getLatestReleaseZipUrl()` to allow passing in an authorization token and simplified arguments to just the repository name
- Added `upload.ini` which increases the limits for uploading files (such as for plugins) in the Docker environment

View File

@ -79,6 +79,8 @@ const jestArgs = [
'--maxWorkers=1',
'--rootDir=./',
'--verbose',
'--json',
'--outputFile=test-results.json',
...program.args,
];

View File

@ -0,0 +1,38 @@
const fs = require( 'fs' );
const path = require( 'path' );
const resultsFile = path.resolve( __dirname, '../test-results.json' );
const buildOutput = ( results ) => {
const { TITLE, SMOKE_TEST_URL } = process.env;
let output = `## ${ TITLE }:\n\n`;
output += `**Test URL:** ${ SMOKE_TEST_URL }\n`;
output += `**Total Number of Passed Tests:** ${ results.numTotalTests }\n`;
output += `**Total Number of Failed Tests:** ${ results.numFailedTests }\n`;
output += `**Total Number of Test Suites:** ${ results.numTotalTestSuites }\n`;
output += `**Total Number of Passed Test Suites:** ${ results.numPassedTestSuites }\n`;
output += `**Total Number of Failed Test Suites:** ${ results.numFailedTestSuites }\n`;
return output;
};
module.exports = async ( { github, context } ) => {
let output = '';
if ( fs.existsSync( resultsFile ) ) {
const data = fs.readFileSync( resultsFile );
const results = JSON.parse( data );
output = buildOutput( results );
} else {
output = `## Test Results Not Found!`;
}
await github.rest.issues.createComment( {
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output,
} );
};

View File

@ -40,8 +40,15 @@
"devDependencies": {
"@babel/cli": "7.12.8",
"@babel/core": "7.12.9",
"@babel/plugin-proposal-async-generator-functions": "^7.16.4",
"@babel/plugin-proposal-object-rest-spread": "^7.16.0",
"@babel/plugin-transform-react-jsx": "^7.16.0",
"@babel/plugin-transform-runtime": "^7.16.4",
"@babel/polyfill": "7.12.1",
"@babel/preset-env": "7.12.7",
"@wordpress/babel-plugin-import-jsx-pragma": "1.1.3",
"@wordpress/babel-preset-default": "3.0.2",
"@wordpress/browserslist-config": "^4.1.0",
"@wordpress/eslint-plugin": "7.3.0",
"eslint": "^8.1.0",
"jest-circus": "25.1.0",

View File

@ -19,8 +19,19 @@
"fishery": "^1.2.0"
},
"devDependencies": {
"@babel/cli": "7.12.8",
"@babel/core": "7.12.9",
"@babel/plugin-proposal-async-generator-functions": "^7.16.4",
"@babel/plugin-proposal-object-rest-spread": "^7.16.0",
"@babel/plugin-transform-react-jsx": "^7.16.0",
"@babel/plugin-transform-runtime": "^7.16.4",
"@babel/polyfill": "7.12.1",
"@babel/preset-env": "7.12.7",
"@typescript-eslint/eslint-plugin": "^5.3.0",
"@typescript-eslint/parser": "^5.3.0",
"@wordpress/babel-plugin-import-jsx-pragma": "1.1.3",
"@wordpress/babel-preset-default": "3.0.2",
"@wordpress/browserslist-config": "^4.1.0",
"eslint": "^8.1.0"
},
"peerDependencies": {

View File

@ -22,7 +22,7 @@
"psr/container": "1.0.0",
"woocommerce/action-scheduler": "3.4.0",
"woocommerce/woocommerce-admin": "3.0.0-rc.1",
"woocommerce/woocommerce-blocks": "6.5.0"
"woocommerce/woocommerce-blocks": "6.5.1"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4",

View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "97d29d724f0342a99e7bf3f9d1d3c262",
"content-hash": "ecce1670d22ae2df07e552adce1cfc29",
"packages": [
{
"name": "automattic/jetpack-autoloader",
@ -614,16 +614,16 @@
},
{
"name": "woocommerce/woocommerce-blocks",
"version": "v6.5.0",
"version": "v6.5.1",
"source": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce-gutenberg-products-block.git",
"reference": "655a9c1de46262304cc8ac187ca8fcc0abf23b6d"
"reference": "260dddfe93e30d09d34dd0cf3b662ac1d6191aef"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/655a9c1de46262304cc8ac187ca8fcc0abf23b6d",
"reference": "655a9c1de46262304cc8ac187ca8fcc0abf23b6d",
"url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/260dddfe93e30d09d34dd0cf3b662ac1d6191aef",
"reference": "260dddfe93e30d09d34dd0cf3b662ac1d6191aef",
"shasum": ""
},
"require": {
@ -662,9 +662,9 @@
],
"support": {
"issues": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues",
"source": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/tree/v6.5.0"
"source": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/tree/v6.5.1"
},
"time": "2021-12-07T11:28:05+00:00"
"time": "2021-12-22T11:40:29+00:00"
}
],
"packages-dev": [

View File

@ -115,11 +115,18 @@ importers:
'@automattic/puppeteer-utils': github:Automattic/puppeteer-utils#0f3ec50
'@babel/cli': 7.12.8
'@babel/core': 7.12.9
'@babel/plugin-proposal-async-generator-functions': ^7.16.4
'@babel/plugin-proposal-object-rest-spread': ^7.16.0
'@babel/plugin-transform-react-jsx': ^7.16.0
'@babel/plugin-transform-runtime': ^7.16.4
'@babel/polyfill': 7.12.1
'@babel/preset-env': 7.12.7
'@jest/test-sequencer': ^25.5.4
'@slack/web-api': ^6.1.0
'@woocommerce/api': ^0.2.0
'@wordpress/babel-plugin-import-jsx-pragma': 1.1.3
'@wordpress/babel-preset-default': 3.0.2
'@wordpress/browserslist-config': ^4.1.0
'@wordpress/e2e-test-utils': ^4.16.1
'@wordpress/eslint-plugin': 7.3.0
'@wordpress/jest-preset-default': ^7.1.3
@ -155,8 +162,15 @@ importers:
devDependencies:
'@babel/cli': 7.12.8_@babel+core@7.12.9
'@babel/core': 7.12.9
'@babel/plugin-proposal-async-generator-functions': 7.16.4_@babel+core@7.12.9
'@babel/plugin-proposal-object-rest-spread': 7.16.0_@babel+core@7.12.9
'@babel/plugin-transform-react-jsx': 7.16.0_@babel+core@7.12.9
'@babel/plugin-transform-runtime': 7.16.4_@babel+core@7.12.9
'@babel/polyfill': 7.12.1
'@babel/preset-env': 7.12.7_@babel+core@7.12.9
'@wordpress/babel-plugin-import-jsx-pragma': 1.1.3_@babel+core@7.12.9
'@wordpress/babel-preset-default': 3.0.2
'@wordpress/browserslist-config': 4.1.0
'@wordpress/eslint-plugin': 7.3.0_eslint@8.2.0+typescript@4.2.4
eslint: 8.2.0
jest-circus: 25.1.0
@ -166,8 +180,19 @@ importers:
packages/js/e2e-utils:
specifiers:
'@automattic/puppeteer-utils': github:Automattic/puppeteer-utils#0f3ec50
'@babel/cli': 7.12.8
'@babel/core': 7.12.9
'@babel/plugin-proposal-async-generator-functions': ^7.16.4
'@babel/plugin-proposal-object-rest-spread': ^7.16.0
'@babel/plugin-transform-react-jsx': ^7.16.0
'@babel/plugin-transform-runtime': ^7.16.4
'@babel/polyfill': 7.12.1
'@babel/preset-env': 7.12.7
'@typescript-eslint/eslint-plugin': ^5.3.0
'@typescript-eslint/parser': ^5.3.0
'@wordpress/babel-plugin-import-jsx-pragma': 1.1.3
'@wordpress/babel-preset-default': 3.0.2
'@wordpress/browserslist-config': ^4.1.0
'@wordpress/deprecated': ^3.2.3
'@wordpress/e2e-test-utils': ^4.16.1
config: 3.3.3
@ -182,8 +207,19 @@ importers:
faker: 5.5.3
fishery: 1.4.0
devDependencies:
'@babel/cli': 7.12.8_@babel+core@7.12.9
'@babel/core': 7.12.9
'@babel/plugin-proposal-async-generator-functions': 7.16.4_@babel+core@7.12.9
'@babel/plugin-proposal-object-rest-spread': 7.16.0_@babel+core@7.12.9
'@babel/plugin-transform-react-jsx': 7.16.0_@babel+core@7.12.9
'@babel/plugin-transform-runtime': 7.16.4_@babel+core@7.12.9
'@babel/polyfill': 7.12.1
'@babel/preset-env': 7.12.7_@babel+core@7.12.9
'@typescript-eslint/eslint-plugin': 5.3.0_ef742ec0d85d332d26b421951e243e75
'@typescript-eslint/parser': 5.3.0_eslint@8.1.0+typescript@4.2.4
'@wordpress/babel-plugin-import-jsx-pragma': 1.1.3_@babel+core@7.12.9
'@wordpress/babel-preset-default': 3.0.2
'@wordpress/browserslist-config': 4.1.0
eslint: 8.1.0
plugins/woocommerce:
@ -561,6 +597,24 @@ packages:
'@babel/helper-annotate-as-pure': 7.16.0
regexpu-core: 4.8.0
/@babel/helper-define-polyfill-provider/0.3.0_@babel+core@7.12.9:
resolution: {integrity: sha512-7hfT8lUljl/tM3h+izTX/pO3W3frz2ok6Pk+gzys8iJqDfZrZy2pXjRTZAvG2YmfHun1X4q8/UZRLatMfqc5Tg==}
peerDependencies:
'@babel/core': ^7.4.0-0
dependencies:
'@babel/core': 7.12.9
'@babel/helper-compilation-targets': 7.16.3_@babel+core@7.12.9
'@babel/helper-module-imports': 7.16.0
'@babel/helper-plugin-utils': 7.14.5
'@babel/traverse': 7.16.3
debug: 4.3.2
lodash.debounce: 4.0.8
resolve: 1.20.0
semver: 6.3.0
transitivePeerDependencies:
- supports-color
dev: true
/@babel/helper-define-polyfill-provider/0.3.0_@babel+core@7.16.0:
resolution: {integrity: sha512-7hfT8lUljl/tM3h+izTX/pO3W3frz2ok6Pk+gzys8iJqDfZrZy2pXjRTZAvG2YmfHun1X4q8/UZRLatMfqc5Tg==}
peerDependencies:
@ -1297,6 +1351,16 @@ packages:
'@babel/core': 7.16.0
'@babel/helper-plugin-utils': 7.14.5
/@babel/plugin-syntax-jsx/7.16.0_@babel+core@7.12.9:
resolution: {integrity: sha512-8zv2+xiPHwly31RK4RmnEYY5zziuF3O7W2kIDW+07ewWDh6Oi0dRq8kwvulRkFgt6DB97RlKs5c1y068iPlCUg==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.12.9
'@babel/helper-plugin-utils': 7.14.5
dev: true
/@babel/plugin-syntax-jsx/7.16.0_@babel+core@7.16.0:
resolution: {integrity: sha512-8zv2+xiPHwly31RK4RmnEYY5zziuF3O7W2kIDW+07ewWDh6Oi0dRq8kwvulRkFgt6DB97RlKs5c1y068iPlCUg==}
engines: {node: '>=6.9.0'}
@ -1995,6 +2059,20 @@ packages:
'@babel/core': 7.16.0
'@babel/helper-plugin-utils': 7.14.5
/@babel/plugin-transform-react-jsx/7.16.0_@babel+core@7.12.9:
resolution: {integrity: sha512-rqDgIbukZ44pqq7NIRPGPGNklshPkvlmvqjdx3OZcGPk4zGIenYkxDTvl3LsSL8gqcc3ZzGmXPE6hR/u/voNOw==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.12.9
'@babel/helper-annotate-as-pure': 7.16.0
'@babel/helper-module-imports': 7.16.0
'@babel/helper-plugin-utils': 7.14.5
'@babel/plugin-syntax-jsx': 7.16.0_@babel+core@7.12.9
'@babel/types': 7.16.0
dev: true
/@babel/plugin-transform-react-jsx/7.16.0_@babel+core@7.16.0:
resolution: {integrity: sha512-rqDgIbukZ44pqq7NIRPGPGNklshPkvlmvqjdx3OZcGPk4zGIenYkxDTvl3LsSL8gqcc3ZzGmXPE6hR/u/voNOw==}
engines: {node: '>=6.9.0'}
@ -2046,6 +2124,23 @@ packages:
'@babel/core': 7.16.0
'@babel/helper-plugin-utils': 7.14.5
/@babel/plugin-transform-runtime/7.16.4_@babel+core@7.12.9:
resolution: {integrity: sha512-pru6+yHANMTukMtEZGC4fs7XPwg35v8sj5CIEmE+gEkFljFiVJxEWxx/7ZDkTK+iZRYo1bFXBtfIN95+K3cJ5A==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.12.9
'@babel/helper-module-imports': 7.16.0
'@babel/helper-plugin-utils': 7.14.5
babel-plugin-polyfill-corejs2: 0.3.0_@babel+core@7.12.9
babel-plugin-polyfill-corejs3: 0.4.0_@babel+core@7.12.9
babel-plugin-polyfill-regenerator: 0.3.0_@babel+core@7.12.9
semver: 6.3.0
transitivePeerDependencies:
- supports-color
dev: true
/@babel/plugin-transform-runtime/7.16.4_@babel+core@7.16.0:
resolution: {integrity: sha512-pru6+yHANMTukMtEZGC4fs7XPwg35v8sj5CIEmE+gEkFljFiVJxEWxx/7ZDkTK+iZRYo1bFXBtfIN95+K3cJ5A==}
engines: {node: '>=6.9.0'}
@ -5199,7 +5294,6 @@ packages:
/@wordpress/browserslist-config/4.1.0:
resolution: {integrity: sha512-RSJhgY2xmz6yAdDNhz/NvAO6JS+91vv9cVL7VDG2CftbyjTXBef05vWt3FzZhfeF0xUrYdpZL1PVpxmJiKvbEg==}
engines: {node: '>=12'}
dev: false
/@wordpress/deprecated/3.2.3:
resolution: {integrity: sha512-YoJos/hW216PIlxbtNyb24kPR3TUFTSsfeVT23SxudW4jhmwM12vkl3KY1RDbhD/qi89OE4k+8xsBo5cM3lCSw==}
@ -6294,6 +6388,19 @@ packages:
resolve: 1.20.0
dev: true
/babel-plugin-polyfill-corejs2/0.3.0_@babel+core@7.12.9:
resolution: {integrity: sha512-wMDoBJ6uG4u4PNFh72Ty6t3EgfA91puCuAwKIazbQlci+ENb/UU9A3xG5lutjUIiXCIn1CY5L15r9LimiJyrSA==}
peerDependencies:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/compat-data': 7.16.4
'@babel/core': 7.12.9
'@babel/helper-define-polyfill-provider': 0.3.0_@babel+core@7.12.9
semver: 6.3.0
transitivePeerDependencies:
- supports-color
dev: true
/babel-plugin-polyfill-corejs2/0.3.0_@babel+core@7.16.0:
resolution: {integrity: sha512-wMDoBJ6uG4u4PNFh72Ty6t3EgfA91puCuAwKIazbQlci+ENb/UU9A3xG5lutjUIiXCIn1CY5L15r9LimiJyrSA==}
peerDependencies:
@ -6306,6 +6413,18 @@ packages:
transitivePeerDependencies:
- supports-color
/babel-plugin-polyfill-corejs3/0.4.0_@babel+core@7.12.9:
resolution: {integrity: sha512-YxFreYwUfglYKdLUGvIF2nJEsGwj+RhWSX/ije3D2vQPOXuyMLMtg/cCGMDpOA7Nd+MwlNdnGODbd2EwUZPlsw==}
peerDependencies:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.12.9
'@babel/helper-define-polyfill-provider': 0.3.0_@babel+core@7.12.9
core-js-compat: 3.19.1
transitivePeerDependencies:
- supports-color
dev: true
/babel-plugin-polyfill-corejs3/0.4.0_@babel+core@7.16.0:
resolution: {integrity: sha512-YxFreYwUfglYKdLUGvIF2nJEsGwj+RhWSX/ije3D2vQPOXuyMLMtg/cCGMDpOA7Nd+MwlNdnGODbd2EwUZPlsw==}
peerDependencies:
@ -6317,6 +6436,17 @@ packages:
transitivePeerDependencies:
- supports-color
/babel-plugin-polyfill-regenerator/0.3.0_@babel+core@7.12.9:
resolution: {integrity: sha512-dhAPTDLGoMW5/84wkgwiLRwMnio2i1fUe53EuvtKMv0pn2p3S8OCoV1xAzfJPl0KOX7IB89s2ib85vbYiea3jg==}
peerDependencies:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.12.9
'@babel/helper-define-polyfill-provider': 0.3.0_@babel+core@7.12.9
transitivePeerDependencies:
- supports-color
dev: true
/babel-plugin-polyfill-regenerator/0.3.0_@babel+core@7.16.0:
resolution: {integrity: sha512-dhAPTDLGoMW5/84wkgwiLRwMnio2i1fUe53EuvtKMv0pn2p3S8OCoV1xAzfJPl0KOX7IB89s2ib85vbYiea3jg==}
peerDependencies: