Skip to content

Commit

Permalink
Merge branch 'testlite' into e2e-pw
Browse files Browse the repository at this point in the history
  • Loading branch information
shashwatahalder01 committed Feb 14, 2024
2 parents d7f86dc + 49cde25 commit b0ac5d6
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,39 @@ import { AdminPage } from '@pages/adminPage';
import { selector } from '@pages/selectors';
import { data } from '@utils/testData';

export class ProPromoPage extends AdminPage {
export class NoticeAndPromotionPage extends AdminPage {
constructor(page: Page) {
super(page);
}

// dokan pro promo
async dokanProPromo() {
// dokan notice & promotion

// dokan notice
async dokanNoticeRenderProperly() {
await this.goto(data.subUrls.backend.dokan.dokan);

// dokan notice elements are visible
const isPromotionVisible = await this.isVisible(selector.admin.dokan.promotion.promotion);
isPromotionVisible ? await this.notToHaveCount(selector.admin.dokan.notice.noticeDiv1, 0) : await this.notToHaveCount(selector.admin.dokan.notice.noticeDiv, 0);
await this.notToHaveCount(selector.admin.dokan.notice.slider, 0);
await this.notToHaveCount(selector.admin.dokan.notice.sliderPrev, 0);
await this.notToHaveCount(selector.admin.dokan.notice.sliderNext, 0);
}

// dokan promotion
async dokanPromotionRenderProperly() {
await this.goto(data.subUrls.backend.dokan.dokan);
// dokan promotion elements are visible
const isPromotionVisible = await this.isVisible(selector.admin.dokan.promotion.promotion);
if (isPromotionVisible) {
await this.multipleElementVisible(selector.admin.dokan.promotion);
} else {
console.log('No promotion is ongoing');
}
}

// dokan pro promotion
async dokanProPromotionRenderProperly() {
// dokan promo banner
await this.goIfNotThere(data.subUrls.backend.dokan.dokan);

Expand Down
30 changes: 30 additions & 0 deletions tests/pw/tests/e2e/noticeAndPromotion.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { test, Page } from '@playwright/test';
import { NoticeAndPromotionPage } from '@pages/noticeAndPromotionPage';
import { data } from '@utils/testData';

test.describe('Dokan pro feature promo test', () => {
let admin: NoticeAndPromotionPage;
let aPage: Page;

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

test.afterAll(async () => {
await aPage.close();
});

test('dokan notice is rendering properly @lite @exp @a', async () => {
await admin.dokanNoticeRenderProperly();
});

test('dokan promotion is rendering properly @lite @exp @a', async () => {
await admin.dokanPromotionRenderProperly();
});

test('dokan pro features promotions are rendering properly @liteOnly @exp @a', async () => {
await admin.dokanProPromotionRenderProperly();
});
});
30 changes: 0 additions & 30 deletions tests/pw/tests/e2e/proPromo.spec.ts

This file was deleted.

0 comments on commit b0ac5d6

Please sign in to comment.