|
|
@@ -45,8 +45,8 @@ async function main() {
|
|
|
assert(Object.values(ids).includes(country), 'Expected a country string ID')
|
|
|
const currency = country === ids.ae ? 'AED' : 'NGN'
|
|
|
if (api.endsWith('no-login-reconsume')) data = { list: ['Calmag', 'Elken Spirulina', 'C-Joie Flex'].map((name, i) => ({ ID: 'P' + i, GOODS_NAME: name, GOODS_NO: 'SKU' + i, COVER: 'guest-fixture.png', CONTENT: 'Sample product for isolated verification.', SELL_PRICE: 100, MARKET_PRICE: 120, PRICE_PV: 20, DISCOUNT: 80, STORE_NUMS: 5, TAX_RATE: 7.5, COIN: currency, LOCAL_CURRENCY_ID: country === ids.ae ? '148' : '104' })), totalCount: 60 }
|
|
|
- // 故意返回相反币种,验证商品 COIN 不被结算配置覆盖。
|
|
|
- else if (api.endsWith('no-login-show-cart')) data = { sellType: [{ id: 1, sell_type: [{ label: 'pay_stack', name: 'Paystack' }] }], freight: 10, freeShipping: 500, coin: currency === 'NGN' ? 'AED' : 'NGN' }
|
|
|
+ // UAE 商品为 AED,结算返回 NGN,弹窗单独使用结算币种。
|
|
|
+ else if (api.endsWith('no-login-show-cart')) data = { sellType: [{ id: 1, sell_type: [{ label: 'pay_stack', name: 'Paystack' }] }], freight: 10, freeShipping: 500, coin: 'NGN' }
|
|
|
else data = [{ value: 'R1', label: country === ids.ae ? 'Dubai' : 'Lagos' }]
|
|
|
} else if (api === '/v1/user/guest-dec' && request.method() === 'GET') {
|
|
|
data = {
|
|
|
@@ -61,7 +61,7 @@ async function main() {
|
|
|
detailRequests.push(sn)
|
|
|
if (detailMode === 'error') return route.fulfill({ contentType: 'application/json', body: JSON.stringify({ success: false, message: 'Sample query failure' }) })
|
|
|
data = {
|
|
|
- order: { SN: sn, STATUS: 'Unpaid', CURRENCY: 'NGN', CREATED_AT: 1792000000, PAY_AT: 0, ORDER_AMOUNT: '120.00', PAY_AMOUNT: '130.00', PAY_FREIGHT: '10.00', PAY_PV: '20.00', CONSIGNEE: 'Sample recipient', MOBILE: '+234123456789', FULL_ADDRESS: 'Sample street, Lagos', COUNTRY: 'Nigeria', PAY_TYPE: 'Paystack', USER_NAME: 'PRIVATE-MEMBER', REAL_NAME: 'Sample member', SHOW_BV: detailMode === 'member' },
|
|
|
+ order: { SN: sn, STATUS: 'Unpaid', CURRENCY: 'NGN', CREATED_AT: 1792000000, PAY_AT: 0, ORDER_AMOUNT: '120.00', PAY_AMOUNT: '130.00', PAY_FREIGHT: '10.00', PAY_PV: '20.00', CONSIGNEE: 'Sample recipient', MOBILE: '+234123456789', FULL_ADDRESS: 'Sample street, Lagos', EXPRESS_TYPE: detailMode === 'member' ? '1' : 0, COUNTRY: 'Nigeria', PAY_TYPE: 'Paystack', USER_NAME: 'PRIVATE-MEMBER', REAL_NAME: 'Sample member', SHOW_BV: detailMode === 'member' },
|
|
|
goods: [{ GOODS_TITLE: 'Sample ordered product', SKU_CODE: 'SAMPLE-SKU', COVER: 'guest-fixture.png', REAL_PRICE: '120.00', REAL_PV: '20.00', BUY_NUMS: 1, TAX_RATE: 7.5 }]
|
|
|
}
|
|
|
if (detailMode === 'empty') {
|
|
|
@@ -174,7 +174,7 @@ async function main() {
|
|
|
await layouts(market + '-checkout')
|
|
|
await page.getByRole('button', { name: 'Place order', exact: true }).click()
|
|
|
assert.equal(await page.locator('.ng-paystack-payment-dialog input').count(), 0)
|
|
|
- assert((await page.locator('.ng-paystack-payment-amount strong').textContent()).includes(currency + ' 130'))
|
|
|
+ assert.equal(await page.locator('.ng-paystack-payment-amount strong').textContent(), 'NGN 130')
|
|
|
await layouts(market + '-payment', true)
|
|
|
await page.getByRole('button', { name: 'Continue to Paystack', exact: true }).focus()
|
|
|
await page.keyboard.press('Enter')
|
|
|
@@ -188,6 +188,7 @@ async function main() {
|
|
|
assert.equal(payment.currency, 'NGN')
|
|
|
assert.equal(payment.cart, 'SAMPLE-ORDER-' + orders.length)
|
|
|
assert.equal(payment.email, 'buyer-' + market + '@example.test')
|
|
|
+ assert.equal(await page.locator('.ng-paystack-payment-amount strong').textContent(), market === 'ae' ? 'NGN 10' : 'NGN 130')
|
|
|
assert.equal(await page.locator('.ng-guest-pending').count(), 0)
|
|
|
assert(!(await page.locator('.ng-guest-shop').textContent()).includes('Your unpaid order is saved for this visit.'))
|
|
|
const before = orders.length
|
|
|
@@ -202,6 +203,7 @@ async function main() {
|
|
|
const orderText = await page.locator('.ng-guest-order').textContent()
|
|
|
assert(orderText.includes('NGN 130.00') && orderText.includes('Unpaid'), 'SDK success must not replace server payment status')
|
|
|
assert(!orderText.includes('PRIVATE-MEMBER') && !orderText.includes('BV'))
|
|
|
+ assert(await page.getByRole('heading', { name: 'Delivery', exact: true }).isVisible())
|
|
|
assert.equal(await page.locator('.ng-public-header').count(), 0)
|
|
|
await layouts(market + '-order')
|
|
|
const detailCount = detailRequests.length
|
|
|
@@ -224,13 +226,13 @@ async function main() {
|
|
|
detailMode = 'member'
|
|
|
await page.goto(origin + '/#/guest-order?order=SAMPLE-ORDER-MEMBER')
|
|
|
await page.locator('.ng-guest-order-member').waitFor()
|
|
|
- assert((await page.locator('.ng-guest-order-member').textContent()).includes('PRIVATE-MEMBER'))
|
|
|
- assert((await page.locator('.ng-guest-order-member').textContent()).includes('Sample member'))
|
|
|
- assert((await page.locator('.ng-guest-order-item-bv').textContent()).includes('20 BV each'))
|
|
|
- assert.equal((await page.locator('.ng-guest-order-bv-total dd').textContent()).trim(), '+20 BV')
|
|
|
+ assert(!(await page.locator('.ng-guest-order-member').textContent()).includes('PRIVATE-MEMBER'))
|
|
|
+ assert(!(await page.locator('.ng-guest-order-member').textContent()).includes('Sample member'))
|
|
|
+ assert.equal(await page.locator('.ng-guest-order-item-bv').count(), 0)
|
|
|
+ assert.equal(await page.locator('.ng-guest-order-bv-total').count(), 0)
|
|
|
+ assert(await page.getByRole('heading', { name: 'Self Pick-up', exact: true }).isVisible())
|
|
|
assert.equal((await page.locator('.ng-guest-order-grand-total strong').textContent()).trim(), 'NGN 130.00')
|
|
|
- await layouts('member-order')
|
|
|
- await page.locator('.ng-guest-order-member').screenshot({ path: path.join(output, 'member-card.png'), animations: 'disabled' })
|
|
|
+ await layouts('anonymous-order-with-bv-flag')
|
|
|
detailMode = 'empty'
|
|
|
await page.goto(origin + '/#/guest-order?order=SAMPLE-ORDER-EMPTY')
|
|
|
await page.getByText('Item details are unavailable.', { exact: true }).waitFor()
|
|
|
@@ -282,7 +284,12 @@ async function main() {
|
|
|
await page.goto(origin + '/#/guest-order?order=SAMPLE-ORDER-SIGNED-IN')
|
|
|
await page.getByText('Sample ordered product', { exact: true }).waitFor()
|
|
|
assert.equal(await page.locator('.ng-public-header').count(), 1, 'Signed-in order details must retain the header')
|
|
|
+ assert((await page.locator('.ng-guest-order-member').textContent()).includes('PRIVATE-MEMBER'))
|
|
|
+ assert((await page.locator('.ng-guest-order-item-bv').textContent()).includes('20 BV each'))
|
|
|
+ assert.equal((await page.locator('.ng-guest-order-bv-total dd').textContent()).trim(), '+20 BV')
|
|
|
+ assert(await page.getByRole('heading', { name: 'Delivery', exact: true }).isVisible())
|
|
|
await layouts('signed-in-order')
|
|
|
+ await page.locator('.ng-guest-order-member').screenshot({ path: path.join(output, 'member-card.png'), animations: 'disabled' })
|
|
|
receiptUnauthorized = false
|
|
|
const memberReceipt = page.waitForEvent('download')
|
|
|
await page.getByRole('button', { name: 'Download receipt', exact: true }).click()
|
|
|
@@ -294,6 +301,8 @@ async function main() {
|
|
|
await page.reload()
|
|
|
await page.getByText('Sample ordered product', { exact: true }).waitFor()
|
|
|
assert.equal(await page.locator('.ng-public-header').count(), 0, 'Anonymous order details must keep the header hidden')
|
|
|
+ assert.equal(await page.locator('.ng-guest-order-item-bv').count(), 0)
|
|
|
+ assert.equal(await page.locator('.ng-guest-order-bv-total').count(), 0)
|
|
|
assert.deepEqual(unknown, [])
|
|
|
assert.deepEqual(errors, [])
|
|
|
fs.writeFileSync(path.join(output, 'results.json'), JSON.stringify({ checks, orders: orders.length, errors, unknown }, null, 2))
|