Skip to content

Commit

Permalink
test: e2e-api tests (#1994)
Browse files Browse the repository at this point in the history
* updated apiUtils

* updated apiUtils endpoints nd tests

* fixed  api tests

* fixed some tests

* fixed some tests

* add new api tests

* merged both suites

* merged both suites

* have both suites

* update apiutils & removed query from apiendpoints

* update api tests

* removed query from global setup

* removed query from global setup

* updated global setup: api context. playwright config

* updated playwright config

* updated playwright config

* updated local site setup

* updated local site setup

* updated api suite

* updated api suite

* added composer update

* added composer update dokan pro

* added npm i for project

* added npm i for project

* added npm i for project

* added npm i for project

* q

* fixed refund tests

* fixed refund tests & update apiutils

* updated config, yml

* updated config, yml

* updated config

* updated yml

* updated yml

* q

* updated yml & apiUtils

* deleted packagelock

* added dokan package.lock.json

* update: yaml

* update:test summary (#5)

* update:test summary

* update:added lock file

* update:added files

* added new tests

* added new tests

* added new lite tests

* add db env types

* add new tests

* added new admin tests

* added new admin tests

* newLitetests (#7)

* add new tests dokan lite

* add new tests dokan lite1

* add new tests dokan pro

* add new tests dokan pro

* add new tests dokan pro

* add new tests dokan pro

* add new tests dokan pro

* add new tests dokan pro

* add new tests dokan pro

* add new tests dokan pro

* add seller badge tests

* add seller badge tests

* add tools tests

* add tools tests

* add modules tests

* add verification tests

* add advertising tests

* fix:selector issue

* added new refunds tests

* added new refunds tests

* added new rfq tests

* add tests rfq

* add tests rfq

* add tests reports

* add license tests

* update import style

* added test tag

* added settings page

* added help page

* added wholesale & tools  page

* added modules page

* added advertising  page

* added verifications page

* added reports and refunds  page

* added announcements seller badge req store support store reviews  page

* added abuse reports & reverse withdraws  page

* added  withdraws page

* added admin dashboard page

* added propromo  localsetup  page

* removed skip from describe

* add wholesale customerse

* add wholesale customerse

* add wholesale customerse

* add wholesale customerse

* fix some testse

* fix some tests

* Nt (#8)

* fix some tests

* fix some tests

* fix some tests

* fix some tests

* fixed some issues

* fix some tests

* fix some tests

* fix some tests

* fix some more tests

* update some  tests store support

* update some tests store support

* update seller badge tests

* update tests

* update qpiUtils

* update seller Badge tests

* update product advertising  tests

* update suite  tests

* update rfq tests

* update yml

* update announcements

* update announcements test

* update announcements test

* update announcements test

* update advertising test

* update advertising test

* update wholesale test

* update wholesale test

* update refunds test

* update refunds test

* update reporst test

* update reporst test

* update repors test

* update refunds test

* update reports test

* package.json

* update some tests

* update some tests

* update some tests

* update some tests

* update some tests

* update some tests

* update some tests

* update some tests

* update some tests

* update some tests

* update store categories  tests

* update assertion style

* update some tests

* update some testdata

* update auction test

* update some page

* down some todos

* update suburls and split admin page

* update structure

* add coupon tests

* add interfaces

* add interfaces

* add interfaces to pages

* add interfaces to pages

* add interfaces to pages

* add interfaces to pages

* add interfaces to pages

* complete some todos

* complete some todos

* complete some todos

* fix settings locator issue

* fix settings locator issue

* added global teardown

* added lite only flag

* update yml

* update yml

* update store tests

* update store tests

* update yaml

* update test tag

* added new customer lite tests

* added new customer lite tests

* added new customer lite tests

* added new customer lite tests

* added new store list tests

* added my order tests

* added my order tests

* added my order tests seperately

* added multiple tests imp

* updated multiple tests imp

* upddate review

* upddate storelisting

* fix issues

* update store listing tests

* update shop page tests

* update my order tests

* update my order tests

* update single product tests

* update single product and abuse report tests

* update product enquiry  tests

* update single product tests

* update single product tests

* update single product tests

* update single product tests

* added vendor dashboard tests

* added vendor staff  tests

* added vendor followers  tests

* added fix some tests

* added fix some tests

* added fix some tests

* remove test.only

* update yaml

* update yaml

* update yaml

* update yaml

* added product and order tests

* fix tests

* fixing tests

* fixing tests

* fixing tests

* fixing tests

* fixing tests

* add coupons test

* remove test. only

* fix some tests

* added order tests

* added order tests

* added payment tests

* fix coupons and order  tests

* fix order tests

* fix product tests

* fix product tests

* fix support ticket tests

* fix support ticket tests

* fix some flaky tests

* fix some flaky tests

* fix & updated some flaky tests

* fix withdraw and some flaky tests

* fix withdraw and some flaky tests

* fix coupons test

* fix product store map  test

* update context based on roles

* update some flaky test and replace waitForNavigation

* remove test.only

* remove --auth.spec.ts

* updated gitignore

* fixed some todos

* fixed some todos, update afterall, added new tests

* fixed env

* fixed env

* fixed some todos

* remove testonly

* revert docontentloaded to networkidle

* revert docontentloaded to networkidle

* revert afterall

* revert afterall

* update some test

* update some test

* update some test

* update some test

* move todos from tests to todo

* move todos from tests to todo

* move todos from tests to todo

* move todos from tests to todo

* fix some flaky

* fix some flaky

* fix some flaky

* fix some flaky

* fix skipped test

* fix skipped test

* added new tests

* added new tests

* added fixed vendor staff tests

* added fixed vendor staff tests

* added auction tests

* added auction tests

* added booking tests

* added booking resouce tests

* added booking resouce tests

* fixed flaky tests

* fixed flaky tests

* added review tests

* added review tests

* fixed failed  tests

* fixed failed & flaky tests

* resolved: .rowaction locator issue, remove redundant function, split tests into separate group

* fixed a flaky tests

* fixed a flaky tests

* fixed a flaky tests

* fixed a flaky test

* removed test.only

* fixed edit auction test

* Protests (#10)

* added user subscription test

* added rma tests

* added rma tests

* update customer page

* update customer page

* update customer page

* update customer page

* update customer page

* update customer

* fix some todos

* updated test tags

* updated tests

* updated tests

* updated tests

* updated product tests

* updated vendor page, moved tests to new files, added spmv test

* added seo test

* fixed failed tests

* remove testonly

* add some todos

* fix some tests

* fix some tests

* fix some tests

* fix some tests

* skipped falky tests

* skipped falky tests

* fix: permalink issue

* fix: permalink issue

* updated wp-env

* updated wp-env

* updated __auth

* run test on hpos branch

* fixed flaky tests

* update yml

* skipped some test

* resolved conflict

* update tests

* Update e2e-tests.yml

* Update e2e-tests.yml

* Newtests (#12)

* resolved falky test

* resolved falky test

* resolved falky test

* resolved falky test

* resolved falky test

* resolved falky test

* update test data

* update rfq

* qqq

* update refund

* update refund

* update tests

* update tests

* update tests

* update tests

* hpos tests

* added reverse withdraw and some new tests

* added vendor quote request tests

* added customer quote request tests

* added customer quote request tests

* fixed failed tests

* added rfq customer tests

* added new customer tests

* added new storlisting tests

* added new delivery time tests

* added myorder test

* fixed faied & flaky test

* added new tests

* fixed flaky

* add lock file

* fixed failed test

* fixed failed test

* added new tests

* added new tests

* added new support ticket tests

* update support ticket tests

* update support ticket tests

* update subscription tests

* update subscription tests

* update some todos

* update some assertions

* fixed failed tests

* fixed failed tests

* resolved some todos

* resolved some todos

* resolved some todos

* resolved some todos

* add: sellerbadge test

* add: store test

* update suite

* update suite

* update todos

* update verifications tests

* update wholesale tests

* update wholesale tests

* update announcement tests

* update verification tests

* update verification tests

* update verification tests

* add env overrider

* update helpers

* update helpers

* update helpers

* update env

* update yml

* update yml

* update yml

* update yml

* update yml

* update yml

* reverted all unnecessary changes

* added new spmv test

* added new spmv test

* added new spmv test

* update spmv

* added new spmv test e2e & api

* added new settings test

* added new booking tests

* added new booking tests

* added hpos option

* resolved auction todo

* fix email verification

* added payment gateway payloads

* added new booking tests

* update tests

* update package.json

* update rfq tests

* update rfq

* update rfq tests

* update suite

* update lock file

* update suite

* update suite

* update suite

* remove unnecessary lines and files

* update yml and env for lite repo

* update readme

* refactor: setup tests for lite

* refactor: setup tests for lite

* refactor: setup test describe

* refactor: setup test filename

* refactor: setup test filename

* refactor: orders spec for lite

* refactor: orders spec for lite

* refactor: orders spec for lite

* refactor: orders spec for lite

* refactor: orders spec for lite

* refactor: orders spec for lite

* refactor: orders spec for lite

* refactor: orders spec for lite

* refactor: orders spec for lite

* refactor: orders spec for lite

* refactor: orders spec for lite

* refactor: orders spec for lite

* refactor: orders spec for lite

* refactor: orders spec for lite

* refactor: orders spec for lite

* refactor: orders spec for lite

* refactor: orders spec for lite

* refactor: orders spec for lite

* refactor: suite for only lite

* refactor: suite for only lite

* refactor: suite for only lite

* refactor: suite for only lite

* removed unnecessary files

* update yml and removed console log

* update some todos

* update some todos

* update some type def

* update storage state

* update browser context

* update eslint

* update apiutils

* update apiutils

* update apiutils

* update suite: fix linter, delete unnecessary files

* replaced uuid with nanoid

* resolved some failed tests

* updated packages and linters

* fixed some tests

* fix some failded tests

* add annotation for failed tests

* update getSellerId method apiutils

* update prettierrc

* update tests

* update tests

* update tests

* update tests

* update tests

* update tests

* update tests

* add linter

* fix linter

* update import

* update linter

* update linter

* update lockfile

* update lint

* update lint

* update lint

* add new tests

* update yml

* add new api tests

* add one page product tests

* add coverage report, added new api tests  (#14)

* added linter & formatter

* update yml and package.json

* update prettierrc

* update prettierrc

* added path in tsconfig, update package import

* fix linter issue

* fix linter issue

* fix linter issue

* update suite

* fix linter issue

* update linter

* update lint

* update linter

* update lint

* merged e2e

* merged e2e

* update yml

* update yml

* added coverage report & update all api tests

* add new api tests

* update suite

* rm

* update vendorstaff tests

* fix linter issues

* update yml

* update yml

* fix linter issues

* update setup tests

* update yml

* update env.json

* update readme

* update readme

* update spmv test for one page product feature

* coveert setup files to spec

* fix failed tests

* update lite

* update lite

* update tests for new changes

* removed .vscode folder
  • Loading branch information
shashwatahalder01 authored Oct 5, 2023
1 parent 8a7ae9f commit 2cbed69
Show file tree
Hide file tree
Showing 193 changed files with 47,652 additions and 1 deletion.
196 changes: 196 additions & 0 deletions .github/workflows/e2e_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
name: End-to-End Tests Lite

on:
schedule:
- cron: '0 8 * * *'
pull_request:
push:
branches:
- develop
- lite
workflow_dispatch:

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

permissions:
checks: write
contents: read
issues: write
pull-requests: write

env:
ADMIN: admin
ADMIN_PASSWORD: password
VENDOR: vendor1
VENDOR2: vendor2
CUSTOMER: customer1
USER_PASSWORD: 01dokan01
GMAP: ${{secrets.GMAP}}
BASE_URL: http://localhost:9999
CI: true
FORCE_COLOR: 1
DB_HOST_NAME: localhost
DB_USER_NAME: root
DB_USER_PASSWORD: password
DATABASE: tests-wordpress
DB_PREFIX: wp
PR_NUMBER: ${{ github.event.number }}
SHA: ${{ github.event.pull_request.head.sha }}
SYSTEM_INFO: ./tests/pw/systemInfo.json
API_TEST_RESULT: ./tests/pw/playwright-report/api/junit-report/api-results.xml
E2E_TEST_RESULT: ./tests/pw/playwright-report/e2e/junit-report/e2e-results.xml

jobs:
tests:
name: e2e tests
runs-on: ubuntu-latest
# strategy:
# fail-fast: false

steps:
- name: Checkout testing repo
uses: actions/checkout@v3

- name: Use desired version of NodeJS
uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'

# - name: Install latest npm
# run: |
# npm install -g [email protected]

- name: Composer install and build (Dokan-lite)
run: |
composer install --no-dev
composer dump-autoload -o
- name: Npm install and build (Dokan-lite)
run: |
npm ci
npm run build
# Install test dependencies
- name: Install dependencies
run: |
cd tests/pw
npm ci
# Start wordpress environment
- name: Start WordPress Env
run: |
cd tests/pw
npm run start:env
# Grab test db port
- name: Get Test DB PORT
run: |
cd tests/pw
echo "DB_PORT=$(docker ps -f ancestor='mariadb' -f name='tests-mysql' --format='{{.Ports}}' | sed -E 's/.*:(.*)->.*/\1/')" >> $GITHUB_ENV
# db port
- name: DB PORT
run: |
cd tests/pw
echo "The value of test DB_PORT is ${{ env.DB_PORT }}"
# Activate theme
- name: Activate theme:Storefront
run: |
cd tests/pw
npm run wp-env run tests-cli "wp theme activate storefront"
# Set permalink structure
- name: Set Permalink structure
run: |
cd tests/pw
npm run wp-env run tests-cli "wp rewrite structure /%postname%/"
# Get Playwright version
- name: Get installed Playwright version
id: playwright-version
run: |
cd tests/pw
echo "PLAYWRIGHT_VERSION=$(npm ls @playwright/test --json | jq --raw-output '.dependencies["@playwright/test"].version')" >> $GITHUB_ENV
# Cache browser binaries, cache key is based on Playwright version and OS
- name: Cache playwright binaries
uses: actions/cache@v3
id: playwright-cache
with:
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
restore-keys: |
${{ runner.os }}-playwright-
# Install browser binaries & OS dependencies if cache missed
- name: Install Playwright browser binaries & OS dependencies
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: |
cd tests/pw
npm run pw:browser-with-deps
# Run e2e tests
- name: 🧪 Running the e2e tests
if: always()
timeout-minutes: 40
run: |
cd tests/pw
npm run test:e2e:lite
# Run API tests
- name: 🧪 Running the api tests
if: always()
timeout-minutes: 5
run: |
cd tests/pw
npm run test:api:lite
# Prepare test summary
- name: Prepare test summary
id: prepare-test-summary
uses: actions/github-script@v6
if: always()
with:
result-encoding: string
script: |
const script = require("./tests/pw/testSummary.ts" )
return await script({github, context, core})
# Find PR comment
- name: Find PR comment by github-actions[bot]
uses: peter-evans/find-comment@v2
id: find-comment
if: github.event_name == 'pull_request'
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Tests Summary

# Post test summary as PR comment
- name: Create or update PR comment
uses: peter-evans/create-or-update-comment@v2
if: github.event_name == 'pull_request'
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.prepare-test-summary.outputs.result }}
edit-mode: replace

# Upload artifacts
- name: Archive test artifacts (screenshots, HTML snapshots, Reports)
uses: actions/upload-artifact@v3
if: always()
with:
name: test-artifact
path: |
tests/pw/playwright
tests/pw/playwright-report
if-no-files-found: ignore
retention-days: 30
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions tests/pw/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Plugin Configuration
ADMIN=John_Doe [Admin username]
ADMIN_PASSWORD=AdminPass123 [Password for the admin account]
VENDOR=David_Johnson [Vendor username]
VENDOR2=jhonathon_Smith [Vendor username]
CUSTOMER=Michael_Williams [Customer username]
USER_PASSWORD=Passw0rd123 [Password for all other users]
GMAP=ABCD1234EFGH5678 [Google Maps API key]
LICENSE_KEY=ABCD1234EFGH5678 [Dokan License key]
DOKAN_PRO=true [Dokan pro active status]

# Playwright Configuration
BASE_URL=https://example.com [Base URL of the test site]
CI=true [CI/CD environment indicator]
SLOWMO=10 [Slow down test execution by provided seconds] [optional]
SETUP=true [Whether not to run setup tests before actual tests] [optional]

# Database Configuration
DB_HOST_NAME=localhost [Database server hostname or IP address]
DB_USER_NAME=dbuser [Database username]
DB_USER_PASSWORD=dbpassword [Database user password]
DATABASE=mywpdb [Database name]
DB_PORT=3306 [Database connection port]
DB_PREFIX=wp [Prefix for database tables]
23 changes: 23 additions & 0 deletions tests/pw/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Playwright Specific
node_modules/
playwright/
playwright-report
test-results/
summary.json
types/

# IDE - VSCode
.vscode/*

# System Files
.DS_Store
Thumbs.db
{"mode":"full","isActive":false}

# Docs files
*_spec3.json


# Custom files
TODO.ts
TODO.md
37 changes: 37 additions & 0 deletions tests/pw/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended", // recommended, recommended-type-checked, strict, strict-type-checked
// "plugin:@typescript-eslint/recommended-type-checked", // for ts typed check
// "plugin:@typescript-eslint/stylistic", // stylistic, stylistic-type-checked
// "plugin:@typescript-eslint/stylistic-type-checked", // for ts typed check
"plugin:playwright/recommended",
"prettier"
],
"plugins": ["@typescript-eslint"],
"parser": "@typescript-eslint/parser",
// for ts typed check
// "parserOptions": {
// "project": true,
// "tsconfigRootDir": "__dirname"
// },
"root": true,
"rules": {
// eslint rules
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-explicit-any": "off",
// playwright rules
"playwright/expect-expect": "off",
"playwright/no-skipped-test": "off",
"playwright/no-conditional-in-test": "off"
// custom rules
// "no-restricted-syntax": [
// "error",
// {
// "selector": "CallExpression[callee.property.name='only']",
// "message": "test.only is not allowed."
// },
// ],
}
}
Loading

0 comments on commit 2cbed69

Please sign in to comment.