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.
- Loading branch information
1 parent
68e54c7
commit 0420dd8
Showing
5 changed files
with
82 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,56 @@ | ||
import { test, Page } from '@playwright/test'; | ||
import { test, request, Page } from '@playwright/test'; | ||
import { ProductAddonsPage } from '@pages/productAddonsPage'; | ||
import { ApiUtils } from '@utils/apiUtils'; | ||
import { data } from '@utils/testData'; | ||
import { payloads } from '@utils/payloads'; | ||
import { dbUtils } from '@utils/dbUtils'; | ||
|
||
const { VENDOR_ID } = process.env; | ||
|
||
test.describe('Product addon functionality test', () => { | ||
let vendor: ProductAddonsPage; | ||
let vPage: Page; | ||
let addonId: string; | ||
let addonName: string; | ||
let addonFieldTitle: string; | ||
let apiUtils: ApiUtils; | ||
|
||
async function createVendorProductAddon(): Promise<[string, string, string]> { | ||
const [, addonId, addonName, addonFieldTitle] = await apiUtils.createProductAddon(payloads.createProductAddons(), payloads.adminAuth); | ||
await dbUtils.updateCell(addonId, VENDOR_ID); | ||
console.log(addonId, addonName, addonFieldTitle); | ||
return [addonId, addonName, addonFieldTitle]; | ||
} | ||
|
||
test.beforeAll(async ({ browser }) => { | ||
const vendorContext = await browser.newContext(data.auth.vendorAuth); | ||
vPage = await vendorContext.newPage(); | ||
vendor = new ProductAddonsPage(vPage); | ||
|
||
addonName = data.vendor.addon.randomName(); | ||
addonFieldTitle = data.vendor.addon.randomTitle(); | ||
await vendor.addAddon({ ...data.vendor.addon, name: addonName, titleRequired: addonFieldTitle }); | ||
apiUtils = new ApiUtils(await request.newContext()); | ||
[addonId, addonName, addonFieldTitle] = await createVendorProductAddon(); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await apiUtils.deleteAllProductAddons(payloads.adminAuth); | ||
await vPage.close(); | ||
await apiUtils.dispose(); | ||
}); | ||
|
||
test('vendor product addons menu page is rendering properly @pro @explo', async () => { | ||
test('vendor product addons menu page is rendering properly @pro @exp @v', async () => { | ||
await vendor.vendorProductAddonsSettingsRenderProperly(); | ||
}); | ||
|
||
test('vendor can add addons @pro', async () => { | ||
test('vendor can add addons @pro @v', async () => { | ||
await vendor.addAddon({ ...data.vendor.addon, name: data.vendor.addon.randomName() }); | ||
}); | ||
|
||
test('vendor can edit addon @pro', async () => { | ||
test('vendor can edit addon @pro @v', async () => { | ||
await vendor.editAddon({ ...data.vendor.addon, name: addonName, titleRequired: addonFieldTitle }); | ||
}); | ||
|
||
test('vendor can delete addon @pro', async () => { | ||
test('vendor can delete addon @pro @v', async () => { | ||
const [, addonName] = await createVendorProductAddon(); | ||
await vendor.deleteAddon({ ...data.vendor.addon, name: addonName }); | ||
}); | ||
}); |
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
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