diff --git a/tests/elementor/google-photos.spec.js b/tests/elementor/google-photos.spec.js new file mode 100644 index 0000000..1f6300e --- /dev/null +++ b/tests/elementor/google-photos.spec.js @@ -0,0 +1,44 @@ +const { test, expect } = require('@playwright/test'); + +let slug = 'playwright-elementor/elementor-google-photos'; + + +test.describe("Google Photos", () => { + test.beforeEach(async ({ page }) => { + await page.goto(slug); + }); + + test('Google Photos Carousel', async ({ page }) => { + await expect(page.getByRole('heading', { name: 'Google Photos Carousel' })).toBeVisible(); + await expect(page.locator('#ep-elements-id-f3716c7 iframe').contentFrame().getByTitle('Open in new window.').getByRole('img')).toBeVisible(); + }); + + test('Pro - Google Photos Gallery Player', async ({ page }) => { + await page.getByRole('heading', { name: 'Pro - Google Photos Gallery Player', exact: true }).click(); + await expect(page.locator('#ep-elements-id-dba371e iframe').contentFrame().locator('.jx-imageset').first()).toBeVisible(); + await expect(page.locator('#ep-elements-id-dba371e iframe').contentFrame().locator('div:nth-child(3) > div > div:nth-child(2) > svg')).toBeVisible(); + await expect(page.locator('#ep-elements-id-dba371e iframe').contentFrame().locator('div:nth-child(5) > div:nth-child(2) > div > div:nth-child(2) > svg')).toBeVisible(); + await page.locator('#ep-elements-id-dba371e iframe').contentFrame().locator('div:nth-child(7) > .jx-svg-image > svg').click(); + await page.locator('#ep-elements-id-dba371e iframe').contentFrame().locator('.jx-carousel-arrow > .jx-svg-image > svg').first().click(); + await page.locator('#ep-elements-id-dba371e iframe').contentFrame().locator('div:nth-child(2) > svg').first().click(); + }); + + test('Pro - Google Photos Gallery Player - Auto Play & Repeat On', async ({ page }) => { + await expect(page.getByRole('heading', { name: 'Pro - Google Photos Gallery Player - Auto Play & Repeat On' })).toBeVisible(); + await expect(page.locator('#ep-elements-id-117fe6c iframe').contentFrame().locator('.jx-imageset').first()).toBeVisible(); + await expect(page.locator('#ep-elements-id-117fe6c iframe').contentFrame().locator('div:nth-child(8) > .jx-svg-image > svg')).toBeVisible(); + await expect(page.locator('#ep-elements-id-117fe6c iframe').contentFrame().locator('img:nth-child(2)').first()).toBeVisible(); + await expect(page.locator('#ep-elements-id-117fe6c iframe').contentFrame().locator('div:nth-child(2) > .jx-imageset > div > img:nth-child(2)')).toBeVisible(); + await expect(page.locator('#ep-elements-id-117fe6c iframe').contentFrame().locator('div:nth-child(3) > .jx-imageset > div > img:nth-child(2)')).toBeVisible(); + await expect(page.locator('#ep-elements-id-117fe6c iframe').contentFrame().locator('div:nth-child(4) > .jx-imageset > div > img:nth-child(2)')).toBeVisible(); + await expect(page.locator('#ep-elements-id-117fe6c iframe').contentFrame().locator('img:nth-child(2)').first()).toBeVisible(); + }); + + test('Single Photo - With Color', async ({ page }) => { + await expect(page.getByRole('heading', { + name: 'Single Photo - With Color' + })).toBeVisible(); + await expect(page.locator('#ep-elements-id-f0593d4 iframe').contentFrame().locator('.jx-imageset')).toBeVisible(); + await expect(page.locator('#ep-elements-id-f0593d4 iframe').contentFrame().getByRole('link', { name: 'New item by Md. Nahid Hasan' })).toBeVisible(); + }); +}); \ No newline at end of file diff --git a/tests/gutenberg/google-photos.spec.js b/tests/gutenberg/google-photos.spec.js new file mode 100644 index 0000000..0caa4ad --- /dev/null +++ b/tests/gutenberg/google-photos.spec.js @@ -0,0 +1,48 @@ +const { test, expect } = require('@playwright/test'); + +let slug = 'playwright-elementor/gutenberg-google-photos'; + + +test.describe("Google Photos", () => { + test.beforeEach(async ({ page }) => { + await page.goto(slug); + }); + + test('Google Photos Carousel', async ({ page }) => { + await expect(page.getByText('Google Photos Carousel')).toBeVisible(); + await expect(page.locator('iframe').first().contentFrame().locator('.jx-imageset').first()).toBeVisible(); + }); + + test('Pro - Google Photos Gallery Player', async ({ page }) => { + await expect(page.getByRole('heading', { name: 'Pro – Google Photos Gallery Player', exact: true })).toBeVisible(); + await expect(page.locator('iframe').nth(1).contentFrame().locator('.jx-imageset').first()).toBeVisible(); + await expect(page.locator('iframe').nth(1).contentFrame().locator('div:nth-child(8) > .jx-svg-image > svg')).toBeVisible(); + await page.locator('iframe').nth(1).contentFrame().locator('div:nth-child(7) > .jx-svg-image > svg').click(); + await expect(page.locator('iframe').nth(1).contentFrame().locator('div:nth-child(2) > .jx-imageset > div > img:nth-child(2)')).toBeVisible(); + await expect(page.locator('iframe').nth(1).contentFrame().locator('div:nth-child(7)')).toBeVisible(); + await expect(page.locator('iframe').nth(1).contentFrame().locator('.jx-carousel-arrow > .jx-svg-image > svg').first()).toBeVisible(); + await page.locator('iframe').nth(1).contentFrame().locator('.jx-carousel-arrow > .jx-svg-image > svg').first().click(); + await expect(page.locator('iframe').nth(1).contentFrame().locator('.jx-imageset').first()).toBeVisible(); + }); + + test('Pro - Google Photos Gallery Player - Auto Play & Repeat On', async ({ page }) => { + await expect(page.getByRole('heading', { name: 'Pro – Google Photos Gallery Player – Auto Play & Repeat On' })).toBeVisible(); + await expect(page.locator('iframe').nth(2).contentFrame().locator('div:nth-child(4) > .jx-imageset')).toBeVisible(); + await expect(page.locator('iframe').nth(2).contentFrame().locator('div:nth-child(2) > .jx-imageset > div > img:nth-child(2)')).toBeVisible(); + await expect(page.locator('iframe').nth(2).contentFrame().locator('div:nth-child(3) > .jx-imageset > div > img:nth-child(2)')).toBeVisible(); + await expect(page.locator('iframe').nth(2).contentFrame().locator('div:nth-child(4) > .jx-imageset > div > img:nth-child(2)')).toBeVisible(); + await expect(page.locator('iframe').nth(2).contentFrame().locator('img:nth-child(2)').first()).toBeVisible(); + await expect(page.locator('iframe').nth(2).contentFrame().locator('div:nth-child(8) > .jx-svg-image > svg')).toBeVisible(); + }); + + test('Single Photo - With Color', async ({ page }) => { + await expect(page.getByRole('heading', { name: 'Single Photo – With Color' })).toBeVisible(); + await page.locator('iframe').nth(3).contentFrame().getByRole('img').nth(1).click(); + await expect(page.locator('iframe').nth(3).contentFrame().getByRole('link', { name: 'New item by Md. Nahid Hasan' })).toBeVisible(); + await page.locator('iframe').nth(3).contentFrame().locator('div:nth-child(7)').click(); + }); + + + +}); +