Skip to content

Commit

Permalink
Fix failed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shashwatahalder01 committed Dec 11, 2024
1 parent 2c81820 commit 951c54e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
6 changes: 3 additions & 3 deletions tests/pw/fixtures/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { ShortcodePage } from '@pages/shortcodePage';
import { SingleProductPage } from '@pages/singleProductPage';
import { SingleStorePage } from '@pages/singleStorePage';
import { SpmvPage } from '@pages/spmvPage';
import { StoreAppearance } from '@pages/storeAppearance';
import { StoreAppearancePage } from '@pages/storeAppearancePage';
import { StoreCategoriesPage } from '@pages/storeCategoriesPage';
import { StoreListingPage } from '@pages/storeListingPage';
import { StoreReviewsPage } from '@pages/storeReviewsPage';
Expand Down Expand Up @@ -111,7 +111,7 @@ type pages = {
singleProductPage: SingleProductPage;
singleStorePage: SingleStorePage;
spmvPage: SpmvPage;
storeAppearance: StoreAppearance;
storeAppearance: StoreAppearancePage;
storeCategoriesPage: StoreCategoriesPage;
storeListingPage: StoreListingPage;
storeReviewsPage: StoreReviewsPage;
Expand Down Expand Up @@ -308,7 +308,7 @@ export const test = base.extend<pages>({
},

storeAppearance: async ({ page }, use) => {
await use(new StoreAppearance(page));
await use(new StoreAppearancePage(page));
},

storeCategoriesPage: async ({ page }, use) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import { data } from '@utils/testData';
// selectors
const singleStoreCustomer = selector.customer.cSingleStore;

export class StoreAppearance extends BasePage {
export class StoreAppearancePage extends BasePage {
constructor(page: Page) {
super(page);
}

async gotoSingleStore(storeName: string): Promise<void> {
await this.gotoUntilNetworkidle(data.subUrls.frontend.vendorDetails(helpers.slugify(storeName)));
await this.gotoUntilNetworkidle(data.subUrls.frontend.vendorDetails(helpers.slugify(storeName)), { waitUntil: 'networkidle' }, true);
}

// view store map on store sidebar
Expand Down
7 changes: 4 additions & 3 deletions tests/pw/tests/e2e/privacyPolicy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ test.describe('Privacy Policy & Store Contact form test', () => {
customer = new PrivacyPolicyPage(cPage);
apiUtils = new ApiUtils(await request.newContext());

await dbUtils.updateOptionValue(dbData.dokanWidgets.names.storeContactForm, dbData.dokanWidgets.values.storeContactFormWidget);
await dbUtils.updateOptionValue('sidebars_widgets', { 'sidebar-store': [dbData.dokanWidgets.widgets.storeContactForm] });
// await dbUtils.updateOptionValue(dbData.dokanWidgets.names.storeContactForm, dbData.dokanWidgets.values.storeContactFormWidget);
// await dbUtils.updateOptionValue('sidebars_widgets', { 'sidebar-store': [dbData.dokanWidgets.widgets.storeContactForm] });
});

test.afterAll(async () => {
Expand All @@ -41,7 +41,8 @@ test.describe('Privacy Policy & Store Contact form test', () => {
await customer.disablePrivacyPolicy(data.predefined.vendorStores.vendor1);
});

test('admin can disable store contact form from store sidebar', { tag: ['@lite', '@customer'] }, async () => {
// todo: remove below test: duplicate test
test.skip('admin can disable store contact form from store sidebar', { tag: ['@lite', '@customer'] }, async () => {
await dbUtils.updateOptionValue(dbData.dokan.optionName.appearance, { contact_seller: 'off' });
await customer.disableStoreContactForm(data.predefined.vendorStores.vendor1);
});
Expand Down
18 changes: 9 additions & 9 deletions tests/pw/tests/e2e/storeAppearance.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test, Page, request } from '@playwright/test';
import { StoreAppearance } from '@pages/storeAppearance';
import { StoreAppearancePage } from '@pages/storeAppearancePage';
import { ApiUtils } from '@utils/apiUtils';
import { dbUtils } from '@utils/dbUtils';
import { data } from '@utils/testData';
Expand All @@ -9,20 +9,20 @@ import { payloads } from '@utils/payloads';
const { VENDOR_ID } = process.env;

test.describe('Store Appearance test', () => {
let admin: StoreAppearance;
let admin: StoreAppearancePage;
let aPage: Page;
let apiUtils: ApiUtils;

test.beforeAll(async ({ browser }) => {
const adminContext = await browser.newContext(data.auth.adminAuth);
aPage = await adminContext.newPage();
admin = new StoreAppearance(aPage);
admin = new StoreAppearancePage(aPage);

apiUtils = new ApiUtils(await request.newContext());
await dbUtils.updateOptionValue(dbData.dokanWidgets.names.storeLocation, dbData.dokanWidgets.values.storeLocationWidget);
await dbUtils.updateOptionValue(dbData.dokanWidgets.names.storeOpenClose, dbData.dokanWidgets.values.storeOpenCloseWidget);
await dbUtils.updateOptionValue(dbData.dokanWidgets.names.storeContactForm, dbData.dokanWidgets.values.storeContactFormWidget);
await dbUtils.updateOptionValue('sidebars_widgets', { 'sidebar-store': [dbData.dokanWidgets.widgets.storeLocation, dbData.dokanWidgets.widgets.storeOpenClose, dbData.dokanWidgets.widgets.storeContactForm] });
// await dbUtils.updateOptionValue(dbData.dokanWidgets.names.storeLocation, dbData.dokanWidgets.values.storeLocationWidget);
// await dbUtils.updateOptionValue(dbData.dokanWidgets.names.storeOpenClose, dbData.dokanWidgets.values.storeOpenCloseWidget);
// await dbUtils.updateOptionValue(dbData.dokanWidgets.names.storeContactForm, dbData.dokanWidgets.values.storeContactFormWidget);
// await dbUtils.updateOptionValue('sidebars_widgets', { 'sidebar-store': [dbData.dokanWidgets.widgets.storeLocation, dbData.dokanWidgets.widgets.storeOpenClose, dbData.dokanWidgets.widgets.storeContactForm] });
});

test.afterAll(async () => {
Expand All @@ -40,7 +40,7 @@ test.describe('Store Appearance test', () => {
});

['Google Maps', 'Mapbox'].forEach((api: string) => {
test.skip(`admin can set map api source (${api})`, { tag: ['@lite', '@admin'] }, async () => {
test(`admin can set map api source (${api})`, { tag: ['@lite', '@admin'] }, async () => {
await dbUtils.updateOptionValue(dbData.dokan.optionName.appearance, { store_map: 'on', map_api_source: api === 'Google Maps' ? 'google_maps' : 'mapbox' });
await admin.viewMapAPISource(api as 'Google Maps' | 'Mapbox', data.predefined.vendorStores.vendor1);
});
Expand Down Expand Up @@ -87,7 +87,7 @@ test.describe('Store Appearance test', () => {

['enable', 'disable'].forEach((status: string) => {
test(`admin can ${status} vendor info on single store page`, { tag: ['@lite', '@admin'] }, async () => {
// await apiUtils.updateStore(VENDOR_ID, { show_email: 'yes' }, payloads.adminAuth); // todo: apply this after issue fix
// await apiUtils.updateStore(VENDOR_ID, { show_email: 'yes' }, payloads.adminAuth); // todo: apply this after api issue fix
await apiUtils.updateStore(VENDOR_ID, { ...payloads.storeResetFields, show_email: 'yes' }, payloads.adminAuth);
await dbUtils.updateOptionValue(dbData.dokan.optionName.appearance, { hide_vendor_info: status === 'enable' ? { email: '', phone: '', address: '' } : { email: 'email', phone: 'phone', address: 'address' } });
await admin.viewVendorInfoOnSingleStorePage(status as 'enable' | 'disable', data.predefined.vendorStores.vendor1);
Expand Down
2 changes: 1 addition & 1 deletion tests/pw/utils/payloads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2251,7 +2251,7 @@ export const payloads = {
// title : 'dokan',
// description : 'Just another WordPress site',
// url : 'http://dokan.test',
// email : '[email protected]',
email : '[email protected]',
timezone: 'Asia/Dhaka',
date_format: 'F j, Y',
time_format: 'g:i a',
Expand Down

0 comments on commit 951c54e

Please sign in to comment.