-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #205 from Xpirix/improve-playwright-ci-test
Improve playwright ci test
- Loading branch information
Showing
28 changed files
with
2,942 additions
and
805 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,44 +1,55 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { test as base, expect } from "@playwright/test"; | ||
import { Sidebar } from "./fixtures/sidebar"; | ||
import { DownloadPage } from "./fixtures/download-page"; | ||
import { HomePage } from "./fixtures/home-page"; | ||
|
||
let url = '/'; | ||
type DownloadPageFixtures = { | ||
homePage: HomePage; | ||
sidebar: Sidebar; | ||
downloadPage: DownloadPage; | ||
}; | ||
|
||
test('download page', async ({ page }) => { | ||
await page.goto(url); | ||
await page.locator('section').filter({ hasText: 'Free and open source Spatial' }).getByRole('link').click(); | ||
await expect(page.getByText('Before download starts ¶ QGIS')).toBeVisible(); | ||
// the following options are one-time payments and are hidden by default | ||
await expect(page.getByText('$ 10.00').first()).toBeHidden(); | ||
await expect(page.getByText('$ 20.00').first()).toBeHidden(); | ||
await expect(page.getByText('$ 50.00').first()).toBeHidden(); | ||
await expect(page.getByText('$ 100.00').first()).toBeHidden(); | ||
await expect(page.getByText('$ 250.00').first()).toBeHidden(); | ||
await expect(page.locator('#submit-button')).toBeVisible(); | ||
await expect(page.getByRole('link', { name: 'Other methods, more info' })).toBeVisible(); | ||
await expect(page.locator('#currency')).toBeVisible(); | ||
await expect(page.getByRole('button', { name: 'Skip it and go to download' })).toBeVisible(); | ||
await expect(page.locator('#sidebar').getByRole('link', { name: 'Product' })).toBeVisible(); | ||
await expect(page.locator('#sidebar div').filter({ hasText: 'Product' }).locator('span')).toBeVisible(); | ||
await page.locator('#sidebar div').filter({ hasText: 'Product' }).locator('span').click(); | ||
await expect(page.locator('#sidebar').getByRole('link', { name: 'Overview' })).toBeVisible(); | ||
await expect(page.locator('#sidebar').getByRole('link', { name: 'Case studies' })).toBeVisible(); | ||
await expect(page.locator('#sidebar').getByRole('link', { name: 'Plugins' })).toBeVisible(); | ||
await expect(page.locator('#sidebar').getByRole('link', { name: 'Visual Changelogs' })).toBeVisible(); | ||
await expect(page.locator('#sidebar').getByRole('link', { name: 'Community' })).toBeVisible(); | ||
await expect(page.locator('#sidebar div').filter({ hasText: 'Community' }).locator('span')).toBeVisible(); | ||
await page.locator('#sidebar div').filter({ hasText: 'Community' }).locator('span').click(); | ||
await expect(page.locator('#sidebar').getByRole('link', { name: 'Get involved' })).toBeVisible(); | ||
await expect(page.locator('#sidebar').getByRole('link', { name: 'Become a certified member' })).toBeVisible(); | ||
await expect(page.locator('#sidebar').getByRole('link', { name: 'QGIS Foundation' })).toBeVisible(); | ||
await expect(page.locator('#sidebar').getByRole('link', { name: 'Project Organisation' })).toBeVisible(); | ||
await expect(page.locator('#sidebar').getByRole('link', { name: 'Members Blogs' })).toBeVisible(); | ||
await expect(page.locator('#sidebar').getByRole('link', { name: 'Funding' })).toBeVisible(); | ||
await expect(page.locator('#sidebar').getByRole('link', { name: 'Download' })).toBeVisible(); | ||
await expect(page.locator('#sidebar').getByRole('link', { name: 'Resources', exact: true })).toBeVisible(); | ||
await expect(page.locator('#sidebar div').filter({ hasText: 'Resources' }).locator('span')).toBeVisible(); | ||
await page.locator('#sidebar div').filter({ hasText: 'Resources' }).locator('span').click(); | ||
await expect(page.locator('#sidebar').getByRole('link', { name: 'QGIS resources' })).toBeVisible(); | ||
await page.getByRole('button', { name: 'Skip it and go to download' }).click(); | ||
await expect(page.getByRole('heading', { name: 'Download QGIS for your' })).toBeVisible(); | ||
await page.getByRole('heading', { name: 'Other platforms' }).click(); | ||
await expect(page.getByRole('heading', { name: 'Other platforms' })).toBeVisible(); | ||
const test = base.extend<DownloadPageFixtures>({ | ||
homePage: async ({ page }, use) => { | ||
const homePage = new HomePage(page); | ||
await use(homePage); | ||
}, | ||
sidebar: async ({ page }, use) => { | ||
const sidebar = new Sidebar(page); | ||
await use(sidebar); | ||
}, | ||
downloadPage: async ({ page }, use) => { | ||
const downloadPage = new DownloadPage(page); | ||
await use(downloadPage); | ||
}, | ||
}); | ||
|
||
test("Download page", async ({ homePage, sidebar, downloadPage }) => { | ||
await homePage.goto(); | ||
await homePage.downloadLink.click(); | ||
await expect(downloadPage.beforeDownloadText).toBeVisible(); | ||
// TODO: Add tests for monthly and one-time tabs | ||
await expect(downloadPage.submitButton).toBeVisible(); | ||
await expect(downloadPage.otherMethodsLink).toBeVisible(); | ||
await expect(downloadPage.currencyInput).toBeVisible(); | ||
await expect(downloadPage.skipDownloadButton).toBeVisible(); | ||
await expect(sidebar.productLink).toBeVisible(); | ||
await expect(sidebar.overviewLink).toBeVisible(); | ||
await expect(sidebar.caseStudiesLink).toBeVisible(); | ||
await expect(sidebar.pluginsLink).toBeVisible(); | ||
await expect(sidebar.visualChangelogsLink).toBeVisible(); | ||
await expect(sidebar.communityLink).toBeVisible(); | ||
await expect(sidebar.getInvolvedLink).toBeVisible(); | ||
await expect(sidebar.becomeCertifiedMemberLink).toBeVisible(); | ||
await expect(sidebar.qgisFoundationLink).toBeVisible(); | ||
await expect(sidebar.projectOrganisationLink).toBeVisible(); | ||
await expect(sidebar.membersBlogsLink).toBeVisible(); | ||
await expect(sidebar.fundingLink).toBeVisible(); | ||
await expect(sidebar.downloadLink).toBeVisible(); | ||
await expect(sidebar.resourcesLink).toBeVisible(); | ||
await expect(sidebar.qgisResourcesLink).toBeVisible(); | ||
await downloadPage.skipDownloadButton.click(); | ||
await expect(downloadPage.beforeDownloadHeading).toBeVisible(); | ||
await downloadPage.otherPlatformsHeading.click(); | ||
await expect(downloadPage.otherPlatformsHeading).toBeVisible(); | ||
}); |
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,53 +1,72 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
let url = '/'; | ||
|
||
test('product page', async ({ page }) => { | ||
await page.goto(url); | ||
await page.locator('section').filter({ hasText: 'Free and open source Spatial' }).getByRole('link').click(); | ||
await page.locator('#sidebar').getByRole('link', { name: 'Product' }).click(); | ||
await expect(page.getByText('Free and open source')).toBeVisible(); | ||
await expect(page.getByRole('heading', { name: 'QGIS overview' })).toBeVisible(); | ||
await expect(page.getByText('Giving the power of spatial')).toBeVisible(); | ||
await expect(page.locator('section').filter({ hasText: 'Free and open source QGIS' }).getByRole('link')).toBeVisible(); | ||
await expect(page.getByText('Available on Windows, Mac,')).toBeVisible(); | ||
await expect(page.getByText('Key features ¶ Create map')).toBeVisible(); | ||
await expect(page.getByText('Create map')).toBeVisible(); | ||
await expect(page.getByText('Edit layers')).toBeVisible(); | ||
await expect(page.getByText('Process and analyze')).toBeVisible(); | ||
await expect(page.getByText('Share maps')).toBeVisible(); | ||
await expect(page.locator('#content-tab-1').getByRole('img', { name: 'Create map' })).toBeVisible(); | ||
await expect(page.getByText('Class-leading cartography ¶ Experience QGIS’ extensive set of design options to')).toBeVisible(); | ||
await expect(page.getByRole('img', { name: 'Create map' }).nth(1)).toBeVisible(); | ||
await expect(page.getByText('Enhance the functionality of')).toBeVisible(); | ||
await expect(page.getByRole('link', { name: 'Go to plugins' })).toBeVisible(); | ||
await expect(page.getByRole('img', { name: 'International conference' })).toBeVisible(); | ||
await expect(page.getByText('Connect with professionals,')).toBeVisible(); | ||
await expect(page.getByRole('link', { name: 'Community meetings' })).toBeVisible(); | ||
await expect(page.getByRole('img', { name: 'Local user groups' })).toBeVisible(); | ||
await expect(page.getByRole('heading', { name: 'Local user groups and support' })).toBeVisible(); | ||
await expect(page.getByText('Join a community of like-')).toBeVisible(); | ||
await expect(page.getByRole('link', { name: 'Local groups list' })).toBeVisible(); | ||
await expect(page.getByRole('link', { name: 'Join the community' })).toBeVisible(); | ||
await expect(page.getByText('QGIS Server ¶ Publish your')).toBeVisible(); | ||
await expect(page.getByText('QGIS Desktop ¶ Create, edit,')).toBeVisible(); | ||
await expect(page.getByText('QGIS Web Client ¶ Publish')).toBeVisible(); | ||
await expect(page.getByText('QGIS on mobiles and tablets ¶ The QGIS experience does not stop on the desktop')).toBeVisible(); | ||
await expect(page.getByText('Case Studies ¶ We gather')).toBeVisible(); | ||
await expect(page.getByRole('link', { name: 'Amurum forest reserve habitat' })).toBeVisible(); | ||
await expect(page.getByText('Maps showcase ¶ QGIS users')).toBeVisible(); | ||
await expect(page.getByText('Application screenshots ¶ Below are some screenshots from QGIS itself and a')).toBeVisible(); | ||
await page.getByRole('link', { name: 'Maps', exact: true }).click(); | ||
await expect(page.getByText('QGIS Maps ¶ Amazing maps')).toBeVisible(); | ||
await expect(page.getByText('Amazing maps created using')).toBeVisible(); | ||
await expect(page.getByRole('link', { name: 'Screenshots' })).toBeVisible(); | ||
await page.getByRole('link', { name: 'Screenshots' }).click(); | ||
await expect(page.getByText('QGIS Screenshots ¶ Screenshots of QGIS in action')).toBeVisible(); | ||
await expect(page.getByText('Screenshots of QGIS in action')).toBeVisible(); | ||
await page.locator('#sidebar').getByRole('link', { name: 'Case studies' }).click(); | ||
await expect(page.getByText('Case Studies ¶ Amurum forest')).toBeVisible(); | ||
await expect(page.getByRole('link', { name: 'Amurum forest reserve habitat' })).toBeVisible(); | ||
await expect(page.locator('#sidebar').getByRole('link', { name: 'Plugins' })).toBeVisible(); | ||
await page.locator('#sidebar').getByRole('link', { name: 'Visual Changelogs' }).click(); | ||
await expect(page.getByText('Visual Changelogs ¶ Below you')).toBeVisible(); | ||
}); | ||
import { test as base, expect } from "@playwright/test"; | ||
import { HomePage } from "./fixtures/home-page"; | ||
import { Sidebar } from "./fixtures/sidebar"; | ||
import { ProductPage } from "./fixtures/product-page"; | ||
|
||
type ProductPageFixtures = { | ||
homePage: HomePage; | ||
sidebar: Sidebar; | ||
productPage: ProductPage; | ||
}; | ||
|
||
const test = base.extend<ProductPageFixtures>({ | ||
homePage: async ({ page }, use) => { | ||
const homePage = new HomePage(page); | ||
await use(homePage); | ||
}, | ||
sidebar: async ({ page }, use) => { | ||
const sidebar = new Sidebar(page); | ||
await use(sidebar); | ||
}, | ||
productPage: async ({ page }, use) => { | ||
const productPage = new ProductPage(page); | ||
await use(productPage); | ||
}, | ||
}); | ||
|
||
test("Product page", async ({ homePage, sidebar, productPage }) => { | ||
await homePage.goto(); | ||
await homePage.downloadLink.click(); | ||
await sidebar.productLink.click(); | ||
await expect(productPage.fosQGISLink).toBeVisible(); | ||
await expect(productPage.qgisOverview).toBeVisible(); | ||
await expect(productPage.contentTab1Img).toBeVisible(); | ||
await expect(productPage.createMapImg).toBeVisible(); | ||
await expect(productPage.goToPluginsLink).toBeVisible(); | ||
await expect(productPage.internationalConferenceImg).toBeVisible(); | ||
await expect(productPage.communityMeetingsLink).toBeVisible(); | ||
await expect(productPage.localUserGroupsImg).toBeVisible(); | ||
await expect(productPage.localUserGroupsHeading).toBeVisible(); | ||
await expect(productPage.localGroupsListLink).toBeVisible(); | ||
await expect(productPage.joinTheCommunityLink).toBeVisible(); | ||
await expect(productPage.amurumForestLink).toBeVisible(); | ||
|
||
for (const text of productPage.productTextList) { | ||
await expect(productPage.pageBody).toContainText(text); | ||
} | ||
|
||
await productPage.mapsLink.click(); | ||
for (const text of productPage.mapsTextList) { | ||
await expect(productPage.pageBody).toContainText(text); | ||
} | ||
|
||
await expect(productPage.screenshotsLink).toBeVisible(); | ||
await productPage.screenshotsLink.click(); | ||
|
||
for (const text of productPage.screenshotsTextList) { | ||
await expect(productPage.pageBody).toContainText(text); | ||
} | ||
await sidebar.caseStudiesLink.click(); | ||
|
||
for (const text of productPage.caseStudiesTextList) { | ||
await expect(productPage.pageBody).toContainText(text); | ||
} | ||
|
||
await expect(productPage.amurumForestLink).toBeVisible(); | ||
await expect(sidebar.pluginsLink).toBeVisible(); | ||
await sidebar.visualChangelogsLink.click(); | ||
|
||
for (const text of productPage.visualChangelogsTextList) { | ||
await expect(productPage.pageBody).toContainText(text); | ||
} | ||
}); |
Oops, something went wrong.