forked from getdokan/dokan
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add: add product form tests (getdokan#2385) * Add: add vendor payment tests * Update: update feature map * Update: remove test.only
- Loading branch information
1 parent
1697f36
commit 2fb317a
Showing
6 changed files
with
122 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,11 @@ import { PaymentsPage } from '@pages/paymentsPage'; | |
import { ApiUtils } from '@utils/apiUtils'; | ||
import { data } from '@utils/testData'; | ||
import { payloads } from '@utils/payloads'; | ||
import { dbUtils } from '@utils/dbUtils'; | ||
import { dbData } from '@utils/dbData'; | ||
import { helpers } from '@utils/helpers'; | ||
|
||
const { VENDOR_ID } = process.env; | ||
|
||
test.describe('Payments test', () => { | ||
let admin: PaymentsPage; | ||
|
@@ -20,10 +25,13 @@ test.describe('Payments test', () => { | |
vendor = new PaymentsPage(vPage); | ||
|
||
apiUtils = new ApiUtils(await request.newContext()); | ||
// await dbUtils.updateUserMeta(VENDOR_ID, 'dokan_profile_settings', { payment: [] }); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await apiUtils.updateBatchWcSettingsOptions('general', payloads.currency, payloads.adminAuth); | ||
await dbUtils.updateUserMeta(VENDOR_ID, 'dokan_profile_settings', dbData.testData.dokan.paymentSettings); | ||
// await apiUtils.setStoreSettings(payloads.defaultStoreSettings, payloads.vendorAuth); | ||
await aPage.close(); | ||
await vPage.close(); | ||
await apiUtils.dispose(); | ||
|
@@ -71,40 +79,63 @@ test.describe('Payments test', () => { | |
}); | ||
|
||
test('vendor can add paypal payment method', { tag: ['@lite', '@vendor'] }, async () => { | ||
await vendor.setBasicPayment({ ...data.vendor.payment, methodName: 'paypal' }); | ||
// await apiUtils.setStoreSettings({ payment: { paypal: { email: '' } } }, payloads.vendorAuth); | ||
await dbUtils.updateUserMeta(VENDOR_ID, 'dokan_profile_settings', { payment: { paypal: { email: '' } } }); | ||
await vendor.addBasicPayment({ ...data.vendor.payment, methodName: 'paypal' }); | ||
}); | ||
|
||
test('vendor can update paypal payment method', { tag: ['@lite', '@vendor'] }, async () => { | ||
await dbUtils.updateUserMeta(VENDOR_ID, 'dokan_profile_settings', { payment: { paypal: { email: '[email protected]' } } }); | ||
await vendor.addBasicPayment({ ...data.vendor.payment, methodName: 'paypal' }); | ||
}); | ||
|
||
test('vendor can remove paypal payment method', { tag: ['@lite', '@vendor'] }, async () => { | ||
await dbUtils.updateUserMeta(VENDOR_ID, 'dokan_profile_settings', { payment: { paypal: { email: '[email protected]' } } }); | ||
await vendor.removeBasicPayment({ ...data.vendor.payment, methodName: 'paypal' }); | ||
}); | ||
|
||
test('vendor can add bank payment method', { tag: ['@lite', '@vendor'] }, async () => { | ||
await vendor.setBankTransfer(data.vendor.payment); | ||
await dbUtils.updateUserMeta(VENDOR_ID, 'dokan_profile_settings', helpers.emptyObjectValues(dbData.testData.dokan.paymentSettings.bank)); | ||
await vendor.addBankTransfer(data.vendor.payment); | ||
}); | ||
|
||
test('vendor can add Skrill payment method', { tag: ['@pro', '@vendor'] }, async () => { | ||
await vendor.setBasicPayment({ ...data.vendor.payment, methodName: 'skrill' }); | ||
test('vendor can update bank payment method', { tag: ['@lite', '@vendor'] }, async () => { | ||
await dbUtils.updateUserMeta(VENDOR_ID, 'dokan_profile_settings', dbData.testData.dokan.paymentSettings.bank); | ||
await vendor.addBankTransfer(data.vendor.payment); | ||
}); | ||
|
||
test('vendor can add custom payment method', { tag: ['@pro', '@vendor'] }, async () => { | ||
await vendor.setBasicPayment({ ...data.vendor.payment, methodName: 'custom' }); | ||
test('vendor can remove bank payment method', { tag: ['@lite', '@vendor'] }, async () => { | ||
await dbUtils.updateUserMeta(VENDOR_ID, 'dokan_profile_settings', dbData.testData.dokan.paymentSettings.bank); | ||
await vendor.removeBasicPayment({ ...data.vendor.payment, methodName: 'bank' }); | ||
}); | ||
|
||
test('vendor can disconnect paypal payment method', { tag: ['@lite', '@vendor'] }, async () => { | ||
await vendor.disconnectBasicPayment({ ...data.vendor.payment, methodName: 'paypal' }); | ||
//reset | ||
await apiUtils.setStoreSettings(payloads.defaultStoreSettings, payloads.vendorAuth); // todo: need to reset only payment method | ||
test('vendor can add skrill payment method', { tag: ['@pro', '@vendor'] }, async () => { | ||
await dbUtils.updateUserMeta(VENDOR_ID, 'dokan_profile_settings', { payment: { skrill: { email: '' } } }); | ||
await vendor.addBasicPayment({ ...data.vendor.payment, methodName: 'skrill' }); | ||
}); | ||
|
||
test('vendor can disconnect bank payment method', { tag: ['@lite', '@vendor'] }, async () => { | ||
await vendor.disconnectBasicPayment({ ...data.vendor.payment, methodName: 'bank' }); | ||
// reset | ||
await apiUtils.setStoreSettings(payloads.defaultStoreSettings, payloads.vendorAuth); // todo: need to reset only payment method | ||
test('vendor can update skrill payment method', { tag: ['@pro', '@vendor'] }, async () => { | ||
await dbUtils.updateUserMeta(VENDOR_ID, 'dokan_profile_settings', { payment: { skrill: { email: '[email protected]' } } }); | ||
await vendor.addBasicPayment({ ...data.vendor.payment, methodName: 'skrill' }); | ||
}); | ||
|
||
test('vendor can remove skrill payment method', { tag: ['@pro', '@vendor'] }, async () => { | ||
await dbUtils.updateUserMeta(VENDOR_ID, 'dokan_profile_settings', { payment: { skrill: { email: '[email protected]' } } }); | ||
await vendor.removeBasicPayment({ ...data.vendor.payment, methodName: 'skrill' }); | ||
}); | ||
|
||
test('vendor can add custom payment method', { tag: ['@pro', '@vendor'] }, async () => { | ||
await dbUtils.updateUserMeta(VENDOR_ID, 'dokan_profile_settings', { payment: { dokan_custom: { value: '' } } }); | ||
await vendor.addBasicPayment({ ...data.vendor.payment, methodName: 'custom' }); | ||
}); | ||
|
||
test('vendor can disconnect Skrill payment method', { tag: ['@pro', '@vendor'] }, async () => { | ||
// todo: need to add skrill connect via db | ||
await vendor.disconnectBasicPayment({ ...data.vendor.payment, methodName: 'skrill' }); | ||
test('vendor can update custom payment method', { tag: ['@pro', '@vendor'] }, async () => { | ||
await dbUtils.updateUserMeta(VENDOR_ID, 'dokan_profile_settings', { payment: { dokan_custom: { value: '0123456789' } } }); | ||
await vendor.addBasicPayment({ ...data.vendor.payment, methodName: 'custom' }); | ||
}); | ||
|
||
test('vendor can disconnect custom payment method', { tag: ['@pro', '@vendor'] }, async () => { | ||
// todo: need to add skrill connect via db | ||
await vendor.disconnectBasicPayment({ ...data.vendor.payment, methodName: 'custom' }); | ||
test('vendor can remove custom payment method', { tag: ['@pro', '@vendor'] }, async () => { | ||
await dbUtils.updateUserMeta(VENDOR_ID, 'dokan_profile_settings', { payment: { dokan_custom: { value: '0123456789' } } }); | ||
await vendor.removeBasicPayment({ ...data.vendor.payment, methodName: 'custom' }); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1420,6 +1420,30 @@ export const dbData = { | |
length_duration: '', | ||
addon_settings: [], | ||
}, | ||
|
||
// vendor payment settings | ||
paymentSettings: { | ||
paypal: { | ||
email: '[email protected]', | ||
}, | ||
bank: { | ||
ac_name: 'accountName', | ||
ac_number: '0123456789', | ||
bank_name: 'bankName', | ||
ac_type: 'personal', | ||
bank_addr: 'bankAddress', | ||
routing_number: '9876543210', | ||
iban: 'QWERTY12345', | ||
swift: 'AZERTY98765', | ||
declaration: 'on', | ||
}, | ||
dokan_custom: { | ||
value: '0123456789QWERTY', | ||
}, | ||
skrill: { | ||
email: '[email protected]', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters