diff --git a/.github/workflows/smoke-test-daily.yml b/.github/workflows/smoke-test-daily.yml index daee6f18afc..3e881bbced6 100644 --- a/.github/workflows/smoke-test-daily.yml +++ b/.github/workflows/smoke-test-daily.yml @@ -85,6 +85,45 @@ jobs: ${{ env.API_TEST_REPORT_DIR }}/allure-report retention-days: 5 + - name: Update performance test site with E2E test + if: always() + working-directory: plugins/woocommerce + env: + SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_PERF_URL }}/ + SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_PERF_ADMIN_USER }} + SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_PERF_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_RETRY_TIMES: 0 + 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 tests/e2e/specs/smoke-tests/update-woocommerce.js + continue-on-error: true + + - name: Install k6 + if: always() + run: | + curl https://github.com/grafana/k6/releases/download/v0.33.0/k6-v0.33.0-linux-amd64.tar.gz -L | tar xvz --strip-components 1 + + - name: Run k6 smoke tests + if: always() + env: + URL: ${{ secrets.SMOKE_TEST_PERF_URL }} + HOST: ${{ secrets.SMOKE_TEST_PERF_HOST }} + A_USER: ${{ secrets.SMOKE_TEST_PERF_ADMIN_USER }} + A_PW: ${{ secrets.SMOKE_TEST_PERF_ADMIN_PASSWORD }} + C_USER: ${{ secrets.SMOKE_TEST_PERF_ADMIN_USER }} + C_PW: ${{ secrets.SMOKE_TEST_PERF_ADMIN_PASSWORD }} + P_ID: 274 + run: | + ./k6 run plugins/woocommerce/tests/performance/tests/gh-action-daily-ext-requests.js + build: name: Build zip for PR runs-on: ubuntu-20.04 diff --git a/plugins/woocommerce/changelog/daily smoke add k6 b/plugins/woocommerce/changelog/daily smoke add k6 new file mode 100644 index 00000000000..0ac96950bfe --- /dev/null +++ b/plugins/woocommerce/changelog/daily smoke add k6 @@ -0,0 +1,5 @@ +Significance: patch +Type: update +Comment: test related, not included in release + + diff --git a/plugins/woocommerce/tests/performance/tests/gh-action-daily-ext-requests.js b/plugins/woocommerce/tests/performance/tests/gh-action-daily-ext-requests.js new file mode 100644 index 00000000000..a96335c71ea --- /dev/null +++ b/plugins/woocommerce/tests/performance/tests/gh-action-daily-ext-requests.js @@ -0,0 +1,135 @@ +/** + * Internal dependencies + */ +import { homePage } from '../requests/shopper/home.js'; +import { shopPage } from '../requests/shopper/shop-page.js'; +import { searchProduct } from '../requests/shopper/search-product.js'; +import { singleProduct } from '../requests/shopper/single-product.js'; +import { cart } from '../requests/shopper/cart.js'; +import { cartRemoveItem } from '../requests/shopper/cart-remove-item.js'; +import { checkoutGuest } from '../requests/shopper/checkout-guest.js'; +import { checkoutCustomerLogin } from '../requests/shopper/checkout-customer-login.js'; +import { coupons } from '../requests/merchant/coupons.js'; +import { myAccount } from '../requests/shopper/my-account.js'; +import { categoryPage } from '../requests/shopper/category-page.js'; +import { myAccountMerchantLogin } from '../requests/merchant/my-account-merchant.js'; +import { products } from '../requests/merchant/products.js'; +import { addProduct } from '../requests/merchant/add-product.js'; +import { orders } from '../requests/merchant/orders.js'; +import { ordersSearch } from '../requests/merchant/orders-search.js'; +import { homeWCAdmin } from '../requests/merchant/home-wc-admin.js'; + +export const options = { + scenarios: { + homePageSmoke: { + executor: 'per-vu-iterations', + vus: 1, + iterations: 3, + maxDuration: '60s', + exec: 'homePageFlow', + }, + shopPageSmoke: { + executor: 'per-vu-iterations', + vus: 1, + iterations: 3, + maxDuration: '60s', + startTime: '5s', + exec: 'shopPageFlow', + }, + searchProductSmoke: { + executor: 'per-vu-iterations', + vus: 1, + iterations: 3, + maxDuration: '60s', + startTime: '10s', + exec: 'searchProductFlow', + }, + singleProductSmoke: { + executor: 'per-vu-iterations', + vus: 1, + iterations: 3, + maxDuration: '60s', + startTime: '15s', + exec: 'singleProductFlow', + }, + myAccountSmoke: { + executor: 'per-vu-iterations', + vus: 1, + iterations: 3, + maxDuration: '60s', + startTime: '20s', + exec: 'myAccountFlow', + }, + cartSmoke: { + executor: 'per-vu-iterations', + vus: 1, + iterations: 3, + maxDuration: '60s', + startTime: '25s', + exec: 'cartFlow', + }, + checkoutGuestSmoke: { + executor: 'per-vu-iterations', + vus: 1, + iterations: 3, + maxDuration: '120s', + startTime: '30s', + exec: 'checkoutGuestFlow', + }, + checkoutCustomerLoginSmoke: { + executor: 'per-vu-iterations', + vus: 1, + iterations: 3, + maxDuration: '120s', + startTime: '40s', + exec: 'checkoutCustomerLoginFlow', + }, + allMerchantSmoke: { + executor: 'per-vu-iterations', + vus: 1, + iterations: 3, + maxDuration: '360s', + exec: 'allMerchantFlow', + }, + }, + thresholds: { + checks: [ 'rate==1' ], + }, +}; + +export function homePageFlow() { + homePage(); +} +export function shopPageFlow() { + shopPage(); +} +export function searchProductFlow() { + searchProduct(); +} +export function singleProductFlow() { + singleProduct(); + categoryPage(); +} +export function checkoutGuestFlow() { + cart(); + checkoutGuest(); +} +export function checkoutCustomerLoginFlow() { + cart(); + checkoutCustomerLogin(); +} +export function myAccountFlow() { + myAccount(); +} +export function cartFlow() { + cartRemoveItem(); +} +export function allMerchantFlow() { + myAccountMerchantLogin(); + homeWCAdmin(); + orders(); + ordersSearch(); + products(); + addProduct(); + coupons(); +}