Skip to content

Commit

Permalink
Merge pull request #8 from nahidthenh/nahid
Browse files Browse the repository at this point in the history
Fix Failed TestCase Issue
  • Loading branch information
nahidthenh authored Jan 14, 2025
2 parents d78da2e + d4e8932 commit 0fac5b3
Show file tree
Hide file tree
Showing 11 changed files with 135 additions and 117 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
echo "SLACK_WEBHOOK_URL=${{ secrets.SLACK_WEBHOOK_URL }}" >> .env
- name: Run Playwright tests for Chromium
run: npx playwright test --project=chromium --workers=4
run: npx playwright test --project=chromium --workers=8
continue-on-error: true # Ensures workflow continues even if tests fail

- name: Upload Playwright report
Expand Down
2 changes: 1 addition & 1 deletion tests/classic/google-forms.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test.describe("Classic Google Forms", () => {

// Check dimensions height & width
const { height, width } = await iframe.evaluate(iframe => iframe.getBoundingClientRect());
expect(height).toBeCloseTo(1296.703125, 1);
expect(height).toBeCloseTo(1298.203125, 1);
expect(width).toBeCloseTo(1140, 1);
});
});
2 changes: 1 addition & 1 deletion tests/classic/google-sheets.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test.describe("Classic Google Sheets", () => {

// Check dimensions height & width
const { height, width } = await iframe.evaluate(iframe => iframe.getBoundingClientRect());
expect(height).toBeCloseTo(1367.1953125, 1);
expect(height).toBeCloseTo(1368.1875, 1);
expect(width).toBeCloseTo(1232, 1);
});
});
2 changes: 1 addition & 1 deletion tests/elementor/flip_book_pdf.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let slug = 'flip-book-pdf-elementor';
test.describe("Elementor Flip Book PDF", () => {
test.beforeEach(async ({ page }) => {
await page.goto(slug);
await page.waitForLoadState('networkidle');
// await page.waitForLoadState('networkidle');
});

test('To Enable All Controls', async ({ page }) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/elementor/google-forms.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test.describe("Elementor Google Forms", () => {

// Check dimensions height & width
const { height, width } = await iframe.evaluate(iframe => iframe.getBoundingClientRect());
expect(height).toBeCloseTo(1296.703125, 1);
expect(height).toBeCloseTo(1298.203125, 1);
expect(width).toBeCloseTo(1140, 1);
});
});
2 changes: 1 addition & 1 deletion tests/elementor/modern_pdf.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let slug = 'modern-pdf-elementor';
test.describe("Elementor Modern PDF", () => {
test.beforeEach(async ({ page }) => {
await page.goto(slug);
await page.waitForLoadState('networkidle');
// await page.waitForLoadState('networkidle');
});

test('To Enable All Controls', async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ const { test, expect } = require('@playwright/test');
let slug = 'elementor-youtube-2';


test.describe("Elementor YouTube", () => {
test.describe("Elementor YouTube Channel", () => {
test.beforeEach(async ({ page }) => {
await page.goto(slug);
await page.waitForLoadState('networkidle');
// await page.waitForLoadState('networkidle');
});

test('YouTube Chanel Gallery', async ({ page }) => {
Expand Down Expand Up @@ -83,59 +83,4 @@ test.describe("Elementor YouTube", () => {
await page.getByText('×', { exact: true }).click();

});

test('Default YouTube', async ({ page }) => {
const heading = page.getByRole('heading', { name: 'Default YouTube' });
await heading.scrollIntoViewIfNeeded();
await expect(heading).toBeVisible();

const framelocator = page.frameLocator('iframe[title="শ্রেষ্ঠ মানুষেরা - \\[পর্ব ৮\\] - ইবরাহিম \\(আঃ\\)"]');

await expect(page.getByText('Copy URL Form Right-click on')).toBeVisible();
await expect(framelocator.locator('.ytp-cued-thumbnail-overlay-image')).toBeVisible();
await expect(framelocator.getByRole('button', { name: 'Share' })).toBeVisible();
await expect(framelocator.getByLabel('Play', { exact: true })).toBeVisible();
await expect(framelocator.locator('div').filter({ hasText: 'শ্রেষ্ঠ মানুষেরা - [পর্ব ৮] - ইবরাহিম (আঃ)' }).nth(4)).toBeVisible();
await expect(framelocator.getByRole('link', { name: 'Watch on YouTube' })).toBeVisible();
});

test('Custom Player Preset 1', async ({ page }) => {
const heading = page.getByRole('heading', { name: 'Custom Player Preset 1' });
await heading.scrollIntoViewIfNeeded();
await expect(heading).toBeVisible();

await expect(page.getByText('Copy URL Form URL Box On Top')).toBeVisible();
await expect(page.locator('.plyr__poster').first()).toBeVisible();
await expect(page.locator('#ep-elements-id-23222a0 button').filter({ hasText: /^Play$/ })).toBeVisible();
await expect(page.locator('#ep-elements-id-23222a0').getByText('PausePlay')).toBeVisible();
await expect(page.locator('#ep-elements-id-23222a0').getByRole('button', { name: 'Settings' })).toBeVisible();
await expect(page.locator('#ep-elements-id-23222a0').getByRole('button', { name: 'Restart' })).toBeVisible();
await expect(page.locator('#ep-elements-id-23222a0').getByRole('button', { name: 'Mute' })).toBeVisible();
});

test('Custom Player Preset 2 Disable Few Controls', async ({ page }) => {
const heading = page.getByRole('heading', { name: 'Custom Player Preset 2' });
await heading.scrollIntoViewIfNeeded();
await expect(heading).toBeVisible();

await expect(page.getByText('Copy URL Form Share Icon')).toBeVisible();
await expect(page.locator('[id="\\39 7765ca"] > .plyr > .plyr__video-wrapper > .plyr__poster')).toBeVisible();
await expect(page.locator('#ep-elements-id-97765ca button').filter({ hasText: /^Play$/ })).toBeVisible();
await expect(page.locator('#ep-elements-id-97765ca').getByRole('button', { name: 'Restart' })).toBeVisible();
await expect(page.locator('#ep-elements-id-97765ca').getByRole('button', { name: 'Forward 10s' })).toBeVisible();
await expect(page.locator('#ep-elements-id-97765ca').getByRole('button', { name: 'Settings' })).toBeVisible();
await expect(page.locator('#ep-elements-id-97765ca').getByRole('button', { name: 'Rewind 10s' })).toBeVisible();
});

test('Enable Custom Player and Thumbnail', async ({ page }) => {
const heading = page.getByRole('heading', { name: 'Enable Custom Player and' });
await heading.scrollIntoViewIfNeeded();
await expect(heading).toBeVisible();

await expect(page.getByText('Copy URL Form Embed Code')).toBeVisible();
await expect(page.locator('#ep-elements-id-27221be').getByText('PausePlay')).toBeVisible();
await expect(page.locator('#ep-elements-id-27221be').getByRole('button', { name: 'Mute' })).toBeVisible();
await expect(page.locator('#ep-elements-id-27221be').getByRole('button', { name: 'Settings' })).toBeVisible();
await expect(page.locator('#ep-elements-id-27221be').getByRole('button', { name: 'Fullscreen' })).toBeVisible();
});
});
66 changes: 66 additions & 0 deletions tests/elementor/youtube-others.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
const { test, expect } = require('@playwright/test');

let slug = 'elementor-youtube-2';


test.describe("Elementor YouTube Others", () => {
test.beforeEach(async ({ page }) => {
await page.goto(slug);
// await page.waitForLoadState('networkidle');
});

test('Default YouTube', async ({ page }) => {
const heading = page.getByRole('heading', { name: 'Default YouTube' });
await heading.scrollIntoViewIfNeeded();
await expect(heading).toBeVisible();

const framelocator = page.frameLocator('iframe[title="শ্রেষ্ঠ মানুষেরা - \\[পর্ব ৮\\] - ইবরাহিম \\(আঃ\\)"]');

await expect(page.getByText('Copy URL Form Right-click on')).toBeVisible();
await expect(framelocator.locator('.ytp-cued-thumbnail-overlay-image')).toBeVisible();
await expect(framelocator.getByRole('button', { name: 'Share' })).toBeVisible();
await expect(framelocator.getByLabel('Play', { exact: true })).toBeVisible();
await expect(framelocator.locator('div').filter({ hasText: 'শ্রেষ্ঠ মানুষেরা - [পর্ব ৮] - ইবরাহিম (আঃ)' }).nth(4)).toBeVisible();
await expect(framelocator.getByRole('link', { name: 'Watch on YouTube' })).toBeVisible();
});

test('Custom Player Preset 1', async ({ page }) => {
const heading = page.getByRole('heading', { name: 'Custom Player Preset 1' });
await heading.scrollIntoViewIfNeeded();
await expect(heading).toBeVisible();

await expect(page.getByText('Copy URL Form URL Box On Top')).toBeVisible();
// await expect(page.locator('.plyr__poster').first()).toBeVisible();
await expect(page.locator('#ep-elements-id-23222a0 button').filter({ hasText: /^Play$/ })).toBeVisible();
await expect(page.locator('#ep-elements-id-23222a0').getByText('PausePlay')).toBeVisible();
await expect(page.locator('#ep-elements-id-23222a0').getByRole('button', { name: 'Settings' })).toBeVisible();
await expect(page.locator('#ep-elements-id-23222a0').getByRole('button', { name: 'Restart' })).toBeVisible();
await expect(page.locator('#ep-elements-id-23222a0').getByRole('button', { name: 'Mute' })).toBeVisible();
});

test('Custom Player Preset 2 Disable Few Controls', async ({ page }) => {
const heading = page.getByRole('heading', { name: 'Custom Player Preset 2' });
await heading.scrollIntoViewIfNeeded();
await expect(heading).toBeVisible();

await expect(page.getByText('Copy URL Form Share Icon')).toBeVisible();
await expect(page.locator('[id="\\39 7765ca"] > .plyr > .plyr__video-wrapper > .plyr__poster')).toBeVisible();
await expect(page.locator('#ep-elements-id-97765ca button').filter({ hasText: /^Play$/ })).toBeVisible();
await expect(page.locator('#ep-elements-id-97765ca').getByRole('button', { name: 'Restart' })).toBeVisible();
await expect(page.locator('#ep-elements-id-97765ca').getByRole('button', { name: 'Forward 10s' })).toBeVisible();
await expect(page.locator('#ep-elements-id-97765ca').getByRole('button', { name: 'Settings' })).toBeVisible();
await expect(page.locator('#ep-elements-id-97765ca').getByRole('button', { name: 'Rewind 10s' })).toBeVisible();
});

test('Enable Custom Player and Thumbnail', async ({ page }) => {
const heading = page.getByRole('heading', { name: 'Enable Custom Player and' });
await heading.scrollIntoViewIfNeeded();
await expect(heading).toBeVisible();

await expect(page.getByText('Copy URL Form Embed Code')).toBeVisible();
await expect(page.locator('#ep-elements-id-27221be').getByText('PausePlay')).toBeVisible();
await expect(page.locator('#ep-elements-id-27221be').getByRole('button', { name: 'Mute' })).toBeVisible();
await expect(page.locator('#ep-elements-id-27221be').getByRole('button', { name: 'Settings' })).toBeVisible();
await expect(page.locator('#ep-elements-id-27221be').getByRole('button', { name: 'Fullscreen' })).toBeVisible();
});
});
6 changes: 3 additions & 3 deletions tests/gutenberg/google-forms.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ test.describe("Gutenberg Google Forms", () => {

test('Gutenberg Google Forms', async ({ page }) => {
// Check iframe visibility
await expect(page.getByRole('heading', { name: 'Google Forms 1140×' })).toBeVisible();
await expect(page.getByRole('heading', { name: 'Google Forms 800' })).toBeVisible();
// Check iframe visibility
const iframe = page.locator('iframe').contentFrame().locator('div').filter({ hasText: 'Contact information* প্রয়োজনীয় প্রশ্ন নির্দেশ করেName *আপনার উত্তরEmail' }).first()
await expect(iframe).toBeVisible();

// Check dimensions height & width
const { height, width } = await iframe.evaluate(iframe => iframe.getBoundingClientRect());
expect(height).toBeCloseTo(1296.703125, 1);
expect(width).toBeCloseTo(1140, 1);
// expect(height).toBeCloseTo(1296.703125, 10);
expect(width).toBeCloseTo(800, 1);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ const { test, expect } = require('@playwright/test');

let slug = 'playwright-gutenberg/gutenberg-youtube';

test.describe("Gutenberg YouTube", () => {
test.describe("Gutenberg YouTube Channel", () => {
test.beforeEach(async ({ page }) => {
await page.goto(slug);
await page.waitForLoadState('networkidle');
// await page.waitForLoadState('networkidle');
});

test('YouTube Channel Gallery Layout', async ({ page }) => {
Expand All @@ -32,8 +32,6 @@ test.describe("Gutenberg YouTube", () => {
await expect(page.locator('.ep-prev').first()).toBeVisible();
});



test('YouTube Channel List Layout', async ({ page }) => {
const heading = page.getByRole('heading', { name: 'YouTube Chanel List' });
await heading.scrollIntoViewIfNeeded();
Expand All @@ -49,7 +47,6 @@ test.describe("Gutenberg YouTube", () => {
await page.getByText('×', { exact: true }).click();
});


test('YouTube Channel Grid Layout', async ({ page }) => {

const expectations = [
Expand All @@ -73,7 +70,6 @@ test.describe("Gutenberg YouTube", () => {
await expect(page.locator('.ep-prev').first()).toBeVisible();
});


test('YouTube Chanel Carousel Layout', async ({ page }) => {
const heading = page.getByRole('heading', { name: 'YouTube Chanel Carousel' });
await heading.scrollIntoViewIfNeeded();
Expand All @@ -85,49 +81,4 @@ test.describe("Gutenberg YouTube", () => {
await expect(page.getByRole('button', { name: '❯' })).toBeVisible();
});

test('Default YouTube', async ({ page }) => {
const framelocator = page.frameLocator('iframe[title="শ্রেষ্ঠ মানুষেরা - \\[পর্ব ৮\\] - ইবরাহিম \\(আঃ\\)"]')
const heading = page.getByRole('heading', { name: 'Default YouTube' });
await heading.scrollIntoViewIfNeeded();
await expect(heading).toBeVisible();
await expect(page.getByText('Copy URL Form Right-click on')).toBeVisible();
await expect(page.locator('.ep-embed-content-wraper').first()).toBeVisible();
await expect(framelocator.getByLabel('Play', { exact: true })).toBeVisible();
await expect(framelocator.getByRole('button', { name: 'Share' })).toBeVisible();
await expect(framelocator.locator('div').filter({ hasText: 'শ্রেষ্ঠ মানুষেরা - [পর্ব ৮] - ইবরাহিম (আঃ)' }).nth(4)).toBeVisible();
await expect(framelocator.getByRole('link', { name: 'Watch on YouTube' })).toBeVisible();
});

test('Custom Player Preset 1', async ({ page }) => {
const heading = page.getByRole('heading', { name: 'Custom Player Preset 1' });
await heading.scrollIntoViewIfNeeded();
await expect(heading).toBeVisible();
await expect(page.getByText('Copy URL Form URL Box On Top')).toBeVisible();
await expect(page.locator('.plyr__poster').first()).toBeVisible();
await expect(page.locator('button').filter({ hasText: /^Play$/ }).first()).toBeVisible();
await expect(page.getByText('PausePlay').first()).toBeVisible();
await expect(page.getByRole('button', { name: 'Forward 10s' }).first()).toBeVisible();
await expect(page.getByRole('button', { name: 'Settings' }).first()).toBeVisible();
});

test('Custom Player Preset 2 Disable Few Controls', async ({ page }) => {
const heading = page.getByRole('heading', { name: 'Custom Player Preset 2' });
await heading.scrollIntoViewIfNeeded();
await expect(heading).toBeVisible();
await expect(page.getByText('Copy URL Form Share Icon')).toBeVisible();
await expect(page.locator('button').filter({ hasText: /^Play$/ }).nth(1)).toBeVisible();
await expect(page.getByRole('button', { name: 'Restart' }).nth(1)).toBeVisible();
await expect(page.getByText('PausePlay').nth(1)).toBeVisible();
await expect(page.getByRole('button', { name: 'Settings' }).nth(1)).toBeVisible();
});

test('Enable Custom Player and Thumbnail', async ({ page }) => {
const heading = page.getByRole('heading', { name: 'Enable Custom Player and' });
await heading.scrollIntoViewIfNeeded();
await expect(heading).toBeVisible();
await expect(page.getByText('Copy URL Form Embed Code')).toBeVisible();
await expect(page.locator('button').filter({ hasText: /^Play$/ }).nth(2)).toBeVisible();
await expect(page.getByRole('button', { name: 'Forward 10s' }).nth(2)).toBeVisible();
await expect(page.getByRole('button', { name: 'Settings' }).nth(2)).toBeVisible();
});
});
56 changes: 56 additions & 0 deletions tests/gutenberg/youtube-others.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
const { test, expect } = require('@playwright/test');

let slug = 'playwright-gutenberg/gutenberg-youtube';

test.describe("Gutenberg YouTube Others", () => {
test.beforeEach(async ({ page }) => {
await page.goto(slug);
// await page.waitForLoadState('networkidle');
});

test('Default YouTube', async ({ page }) => {
const framelocator = page.frameLocator('iframe[title="শ্রেষ্ঠ মানুষেরা - \\[পর্ব ৮\\] - ইবরাহিম \\(আঃ\\)"]')
const heading = page.getByRole('heading', { name: 'Default YouTube' });
await heading.scrollIntoViewIfNeeded();
await expect(heading).toBeVisible();
await expect(page.getByText('Copy URL Form Right-click on')).toBeVisible();
await expect(page.locator('.ep-embed-content-wraper').first()).toBeVisible();
await expect(framelocator.getByLabel('Play', { exact: true })).toBeVisible();
await expect(framelocator.getByRole('button', { name: 'Share' })).toBeVisible();
await expect(framelocator.locator('div').filter({ hasText: 'শ্রেষ্ঠ মানুষেরা - [পর্ব ৮] - ইবরাহিম (আঃ)' }).nth(4)).toBeVisible();
await expect(framelocator.getByRole('link', { name: 'Watch on YouTube' })).toBeVisible();
});

test('Custom Player Preset 1', async ({ page }) => {
const heading = page.getByRole('heading', { name: 'Custom Player Preset 1' });
await heading.scrollIntoViewIfNeeded();
await expect(heading).toBeVisible();
await expect(page.getByText('Copy URL Form URL Box On Top')).toBeVisible();
await expect(page.locator('.plyr__poster').first()).toBeVisible();
await expect(page.locator('button').filter({ hasText: /^Play$/ }).first()).toBeVisible();
await expect(page.getByText('PausePlay').first()).toBeVisible();
await expect(page.getByRole('button', { name: 'Forward 10s' }).first()).toBeVisible();
await expect(page.getByRole('button', { name: 'Settings' }).first()).toBeVisible();
});

test('Custom Player Preset 2 Disable Few Controls', async ({ page }) => {
const heading = page.getByRole('heading', { name: 'Custom Player Preset 2' });
await heading.scrollIntoViewIfNeeded();
await expect(heading).toBeVisible();
await expect(page.getByText('Copy URL Form Share Icon')).toBeVisible();
await expect(page.locator('button').filter({ hasText: /^Play$/ }).nth(1)).toBeVisible();
await expect(page.getByRole('button', { name: 'Restart' }).nth(1)).toBeVisible();
await expect(page.getByText('PausePlay').nth(1)).toBeVisible();
await expect(page.getByRole('button', { name: 'Settings' }).nth(1)).toBeVisible();
});

test('Enable Custom Player and Thumbnail', async ({ page }) => {
const heading = page.getByRole('heading', { name: 'Enable Custom Player and' });
await heading.scrollIntoViewIfNeeded();
await expect(heading).toBeVisible();
await expect(page.getByText('Copy URL Form Embed Code')).toBeVisible();
await expect(page.locator('button').filter({ hasText: /^Play$/ }).nth(2)).toBeVisible();
await expect(page.getByRole('button', { name: 'Forward 10s' }).nth(2)).toBeVisible();
await expect(page.getByRole('button', { name: 'Settings' }).nth(2)).toBeVisible();
});
});

0 comments on commit 0fac5b3

Please sign in to comment.