Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests (tax, shipping, payment, catalog mode, reverse withdrawal , wholesale customer) (test automation) #2338

Merged
merged 61 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
6d48c81
Update feature map
shashwatahalder01 Jul 15, 2024
8d921b9
Merge branch 'develop' into featuremap
shashwatahalder01 Aug 2, 2024
d3ffe34
Add tax, shipping, payment tests and refactor some methods, locators
shashwatahalder01 Aug 2, 2024
cc3b6e3
Fix order again test
shashwatahalder01 Aug 3, 2024
2dc28ca
Add updateDokanSettings method and helper methods
shashwatahalder01 Aug 3, 2024
b34bef6
Add product catalog mode tests and dbuitls methos
shashwatahalder01 Aug 3, 2024
a43da05
Add reverse withdrawal tests
shashwatahalder01 Aug 4, 2024
9067fba
Update package and fix locator issue
shashwatahalder01 Aug 4, 2024
39d1dbd
Fix a locator and lint issue
shashwatahalder01 Aug 4, 2024
4c07b71
Refactor taxpage and skipped failed test
shashwatahalder01 Aug 4, 2024
e75934c
Refactor admin test
shashwatahalder01 Aug 4, 2024
67bbaf6
Revert a locator change
shashwatahalder01 Aug 4, 2024
1581a3f
Add Fixtures
shashwatahalder01 Aug 4, 2024
2f65af4
Resove pr reviews
shashwatahalder01 Aug 5, 2024
23519c4
Fix wholesale customer tests
shashwatahalder01 Aug 5, 2024
3c9ff60
Fix lint issue and a locator
shashwatahalder01 Aug 5, 2024
de71c94
Fix prettier issue
shashwatahalder01 Aug 5, 2024
61a064c
Fix booking tests
shashwatahalder01 Aug 6, 2024
1d38dbe
Merge branch 'develop' into featuremap
shashwatahalder01 Aug 10, 2024
bec5264
Merge branch 'develop' into featuremap
shashwatahalder01 Aug 11, 2024
f670c2e
Refactor some method names
shashwatahalder01 Aug 11, 2024
54264d9
Add tslib package
shashwatahalder01 Aug 11, 2024
6fec2cb
Refactor apiutils methods
shashwatahalder01 Aug 11, 2024
776b718
Refactor shortcode method tests
shashwatahalder01 Aug 11, 2024
cabdf3a
Update some methos, locators & data
shashwatahalder01 Aug 11, 2024
67c89a3
Update lint issues
shashwatahalder01 Aug 11, 2024
1a17752
Add a test
shashwatahalder01 Aug 12, 2024
cd88985
Refactor several methods
shashwatahalder01 Aug 12, 2024
237e498
Refactor setup tests
shashwatahalder01 Aug 12, 2024
7919911
Fix DB query issue
shashwatahalder01 Aug 12, 2024
94af618
Fix serializeData issue
shashwatahalder01 Aug 12, 2024
6db871b
Update plugin name
shashwatahalder01 Aug 12, 2024
d2f35c9
Fix auth issue
shashwatahalder01 Aug 12, 2024
1364839
Fix serialize issue
shashwatahalder01 Aug 12, 2024
b204056
Update dbutils methos for query contains single quotes and HTML enti…
shashwatahalder01 Aug 12, 2024
afe0e3b
Fix auth issue
shashwatahalder01 Aug 12, 2024
9e9d0b4
Fix hover issue & update query parameter
shashwatahalder01 Aug 12, 2024
862d52f
Add local site setup tests & update some metods
shashwatahalder01 Aug 12, 2024
5389ade
Add remove previously cloned repo
shashwatahalder01 Aug 13, 2024
143feea
Resolve some todos and add a test
shashwatahalder01 Aug 13, 2024
d7ce916
Sync e2e and api project
shashwatahalder01 Aug 13, 2024
b2b053c
Fix fail tests
shashwatahalder01 Aug 13, 2024
8d7e52c
Fix rfq afterall issue
shashwatahalder01 Aug 13, 2024
4d38220
Remove unused code
shashwatahalder01 Aug 13, 2024
61bc9c1
Update suite config, dbdata
shashwatahalder01 Aug 14, 2024
dd00349
Add grep& grep invert forboth test suite
shashwatahalder01 Aug 14, 2024
aafe3df
Update package & script commands
shashwatahalder01 Aug 15, 2024
e78f6ec
Merge branch 'develop' into featuremap
shashwatahalder01 Aug 15, 2024
d1df7fd
Add a php value to htaccess
shashwatahalder01 Aug 15, 2024
d368898
Disable showing PHP error
shashwatahalder01 Aug 15, 2024
3dbbced
Add subscription product methods in dbUtils & update config
shashwatahalder01 Aug 16, 2024
2b68e5e
Remove .only
shashwatahalder01 Aug 16, 2024
e6502f6
Merge branch 'develop' into featuremap
shashwatahalder01 Aug 16, 2024
134b43c
Update project config
shashwatahalder01 Aug 16, 2024
e2ddfc9
Fix a fail test
shashwatahalder01 Aug 16, 2024
eea41ed
Update test tag
shashwatahalder01 Aug 16, 2024
e2aead1
Update yml
shashwatahalder01 Aug 16, 2024
6ae8fb3
Remove .only
shashwatahalder01 Aug 16, 2024
8053bce
Fix couple of flaky tests
shashwatahalder01 Aug 16, 2024
1f193a0
Fix lint issues
shashwatahalder01 Aug 17, 2024
41acceb
Fix type issues
shashwatahalder01 Aug 17, 2024
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
8 changes: 4 additions & 4 deletions .github/workflows/e2e_api_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,14 @@ jobs:
timeout-minutes: 40
working-directory: tests/pw
run: |
npm run test:e2e:lite
npm run test:e2e

# Run e2e coverage
- name: 🧪 Running e2e coverage
if: always() && (steps.e2e-test.outcome == 'success' || steps.e2e-test.outcome == 'failure')
working-directory: tests/pw
run: |
npm run e2e_coverage
npm run test:e2e:coverage

# Run API tests
- name: 🧪 Running the api tests
Expand All @@ -193,7 +193,7 @@ jobs:
timeout-minutes: 5
working-directory: tests/pw
run: |
npm run test:api:lite
npm run test:api

# Prepare test summary
- name: Prepare test summary
Expand Down Expand Up @@ -230,8 +230,8 @@ jobs:
# Backup Database
- name: Backup Database
if: always() && steps.db-port.outcome == 'success'
working-directory: tests/pw
run: |
cd tests/pw
npm run wp-env run tests-cli wp db export wp-data/db.sql

# Upload artifacts
Expand Down
1 change: 1 addition & 0 deletions tests/pw/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ CI=true [CI/CD environment indicator]
SLOWMO=10 [Slow down test execution by provided seconds] [optional]
NO_SETUP=true [Whether not to run setup tests before actual tests] [optional]
LOCAL=true [Local testing indicator] [optional]
NON_HEADLESS=true [browser mode indicator] [optional]
SITE_PATH=/users/rk/sites/dokan [Path of the local test site][only for local testing]

# Database Configuration
Expand Down
2 changes: 2 additions & 0 deletions tests/pw/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ php_value max_input_vars 10000
php_value memory_limit 1G
php_value post_max_size 1G
php_value upload_max_filesize 1G
php_flag display_errors Off
php_flag log_errors On
<IfModule mod_php7.c>
php_flag opcache.enable Off
</IfModule>
Expand Down
2 changes: 1 addition & 1 deletion tests/pw/.wp-env.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"WP_DEBUG": "true",
"SCRIPT_DEBUG": "true",
"WP_DEBUG_LOG": "true",
"WP_DEBUG_DISPLAY": "false"
"WP_DEBUG_DISPLAY": "true"
},
"mappings": {
".htaccess": ".htaccess",
Expand Down
1 change: 1 addition & 0 deletions tests/pw/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ CI=true [CI/CD environment indicator]
SLOWMO=10 [Slow down test execution by provided seconds] [optional]
NO_SETUP=true [Whether not to run setup tests before actual tests] [optional]
LOCAL=true [Local testing indicator] [optional]
NON_HEADLESS=true [browser mode indicator] [optional]
SITE_PATH=/users/rk/sites/dokan [Path of the local test site][only for local testing]

# Database Configuration
Expand Down
49 changes: 32 additions & 17 deletions tests/pw/api.config.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
import { defineConfig, expect } from '@playwright/test';
import { customExpect } from '@utils/pwMatchers';
import 'dotenv/config';
const { CI, BASE_URL, NO_SETUP, ADMIN, ADMIN_PASSWORD } = process.env;
const { CI, BASE_URL, NO_SETUP, ADMIN, ADMIN_PASSWORD, DOKAN_PRO } = process.env;

export default defineConfig({
/* test directory */
testDir: './tests/api',
/* Include tests based on the pattern */
grep: [/@lite/, /@pro/],
/* Exclude tests based on the pattern */
grepInvert: DOKAN_PRO ? [] : [/@pro/],
/* Folder for test artifacts such as screenshots, videos, traces, etc. */
outputDir: 'playwright/api/test-artifacts/',
/* Path to the global setup file. This file will be required and run before all the tests. */
globalSetup: './global-setup',
// globalSetup: './global-setup',
/* Path to the global teardown file. This file will be required and run after all the tests. */
// globalTeardown: './global-teardown',
/* Maximum time in milliseconds the whole test suite can run */
globalTimeout: CI ? 20 * (60 * 1000) : 20 * (60 * 1000),
/* The maximum number of test failures for the whole test suite run. After reaching this number, testing will stop and exit with an error. */
maxFailures: CI ? 30 : 30,
/* Maximum time one test can run for. */
timeout: CI ? 15 * 1000 : 30 * 1000,
timeout: CI ? 15 * 1000 : 20 * 1000,
/* Configuration for the expect assertion library */
expect: {
/* Maximum time expect() should wait for the condition to be met. For example in `await expect(locator).toHaveText();`*/
Expand All @@ -30,7 +34,7 @@ export default defineConfig({
/* Fail the build on CI if you accidentally left test.only in the source code. */
// forbidOnly : !!CI,
/* The number of times to repeat each test, useful for debugging flaky tests. */
repeatEach: CI ? 1 : 0,
repeatEach: CI ? 0 : 0,
/* The maximum number of retry attempts given to failed tests. */
retries: CI ? 1 : 0,
/* Opt out of parallel tests on CI. */
Expand All @@ -55,7 +59,7 @@ export default defineConfig({

use: {
/* Base URL */
baseURL: BASE_URL ? BASE_URL : 'http://localhost:9999',
baseURL: BASE_URL ?? 'http://localhost:9999',
/* Whether to ignore HTTPS errors during navigation. */
ignoreHTTPSErrors: true,
/* api request headers */
Expand All @@ -68,17 +72,28 @@ export default defineConfig({
projects: [
// Api project

// global_setup
// {
// name: 'global_setup',
// testMatch: /global\.setup\.ts/,
// },
// site_setup
{
name: 'site_setup',
testMatch: ['_site.setup.ts'],
},

// auth_setup
{
name: 'auth_setup',
testMatch: ['_auth.setup.ts'],
dependencies: NO_SETUP ? [] : ['site_setup'],
// fullyParallel: true,
retries: 1,
},

// api_setup
{
name: 'api_setup',
testMatch: /.*\.setup\.ts/,
// testMatch: /.*\.setup\.spec\.ts/,
testMatch: ['_env.setup.ts'],
dependencies: NO_SETUP ? [] : ['auth_setup'],
fullyParallel: true,
retries: 1,
},

// api_tests
Expand All @@ -95,14 +110,14 @@ export default defineConfig({
// coverage_report
{
name: 'coverage_report',
testMatch: '_coverage.teardown.ts',
testMatch: ['_coverage.teardown.ts'],
},

// global_teardown
// {
// name: 'global_teardown',
// testMatch: /global\.teardown\.ts/,
// },
{
name: 'global_teardown',
testMatch: ['global-teardown.ts'],
},
],
});

Expand Down
47 changes: 29 additions & 18 deletions tests/pw/e2e.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { defineConfig, devices, expect } from '@playwright/test';
import { customExpect } from '@utils/pwMatchers';
import 'dotenv/config';
const { CI, LOCAL, BASE_URL, SLOWMO, NO_SETUP } = process.env;
const { CI, NON_HEADLESS, BASE_URL, SLOWMO, NO_SETUP, DOKAN_PRO } = process.env;

export default defineConfig({
/* test directory */
testDir: './tests/e2e',
/* Include tests based on the pattern */
grep: [/@lite/, /@liteOnly/, /@pro/],
/* Exclude tests based on the pattern */
grepInvert: DOKAN_PRO ? [/@liteOnly/, /@serial/] : [/@pro/, /@serial/],
/* Folder for test artifacts such as screenshots, videos, traces, etc. */
outputDir: 'playwright/e2e/test-artifacts/',
/* Path to the global setup file. This file will be required and run before all the tests. */
Expand All @@ -17,7 +21,7 @@ export default defineConfig({
/* The maximum number of test failures for the whole test suite run. After reaching this number, testing will stop and exit with an error. */
maxFailures: CI ? 40 : 40,
/* Maximum time one test can run for. */
timeout: CI ? 45 * 1000 : 45 * 1000,
timeout: CI ? 40 * 1000 : 40 * 1000,
shashwatahalder01 marked this conversation as resolved.
Show resolved Hide resolved
/* Configuration for the expect assertion library */
expect: {
/* Maximum time expect() should wait for the condition to be met. For example in `await expect(locator).toHaveText();`*/
Expand Down Expand Up @@ -77,7 +81,7 @@ export default defineConfig({
/* Emulates 'prefers-colors-scheme' media feature, supported values are 'light', 'dark', 'no-preference' */
// colorScheme: 'dark' ,
/* Whether to run tests on headless or non-headless mode */
headless: CI ? true : false,
headless: !NON_HEADLESS,
/* Whether to ignore HTTPS errors during navigation. */
ignoreHTTPSErrors: true,
/* Record trace only when retrying a test for the first time. */
Expand All @@ -103,51 +107,58 @@ export default defineConfig({
},

projects: [
// E2e project
// plugin_setup
// E2E project

// local_site_setup
{
name: 'plugin_setup',
testMatch: '_plugin.setup.ts',
name: 'local_site_setup',
testMatch: ['_localSite.setup.ts'],
},

// site_setup
{
name: 'site_setup',
testMatch: ['_site.setup.ts'],
},

// auth_setup
{
name: 'auth_setup',
testMatch: '_auth.setup.ts',
dependencies: LOCAL ? ['plugin_setup'] : [],
testMatch: ['_auth.setup.ts'],
dependencies: NO_SETUP ? [] : ['site_setup'],
// fullyParallel: true,
retries: 1,
},

// e2e_setup
{
name: 'e2e_setup',
// testMatch: /.*\.setup\.ts/,
testMatch: '_env.setup.ts',
/* whether not to run setup tests before running actual tests */
testMatch: ['_env.setup.ts'],
dependencies: NO_SETUP ? [] : ['auth_setup'],
fullyParallel: true,
retries: 1,
},

// e2e_tests
{
name: 'e2e_tests',
testMatch: /.*\.spec\.ts/,
testIgnore: /.*\.teardown\.spec\.ts/,
/* whether not to run setup tests before running actual tests */
dependencies: NO_SETUP ? [] : ['e2e_setup'],
/* whether not to run teardown tests after running actual tests */
// teardown: NO_SETUP ? undefined : 'coverage_report',
// teardown: 'global_teardown',
},

// coverage_report
{
name: 'coverage_report',
testMatch: '_coverage.teardown.ts',
testMatch: ['_coverage.teardown.ts'],
},

// local site setup project
// global_teardown
{
name: 'site_setup',
testMatch: /.*\.install\.ts/,
name: 'global_teardown',
testMatch: ['global-teardown.ts'],
},
],
});
Expand Down
Loading
Loading