forked from microsoft/dotnet-podcasts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
26342db
commit 078fd0e
Showing
12 changed files
with
331 additions
and
5 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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "dotnet-podcasts", | ||
"version": "1.0.0", | ||
"description": "---\r page_type: sample\r description: \".NET 6 reference application shown at .NET Conf 2021 featuring ASP.NET Core, Blazor, .NET MAUI, Microservices, and more!\"\r languages:\r - csharp\r products:\r - dotnet-core\r - ef-core\r - blazor\r - dotnet-maui\r - azure-sql-database\r - azure-storage\r - azure-container-apps\r - azure-container-registry\r - azure-app-service-web\r ---", | ||
"main": "index.js", | ||
"directories": { | ||
"doc": "docs" | ||
}, | ||
"scripts": {}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Microsoft/dotnet-podcasts.git" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/Microsoft/dotnet-podcasts/issues" | ||
}, | ||
"homepage": "https://github.com/Microsoft/dotnet-podcasts#readme", | ||
"devDependencies": { | ||
"@playwright/test": "^1.25.2" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import type { PlaywrightTestConfig } from '@playwright/test'; | ||
import { devices } from '@playwright/test'; | ||
|
||
const config: PlaywrightTestConfig = { | ||
testDir: './tests', | ||
/* Maximum time one test can run for. */ | ||
timeout: 30 * 1000, | ||
expect: { | ||
/** | ||
* Maximum time expect() should wait for the condition to be met. | ||
* For example in `await expect(locator).toHaveText();` | ||
*/ | ||
timeout: 5000 | ||
}, | ||
/* Run tests in files in parallel */ | ||
fullyParallel: true, | ||
/* Fail the build on CI if you accidentally left test.only in the source code. */ | ||
forbidOnly: !!process.env.CI, | ||
/* Retry on CI only */ | ||
retries: process.env.CI ? 2 : 0, | ||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ | ||
reporter: [ | ||
['html'], | ||
['junit', { outputFile: './test-results/junit.xml' }], | ||
], | ||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ | ||
use: { | ||
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ | ||
actionTimeout: 0, | ||
/* Base URL to use in actions like `await page.goto('/')`. */ | ||
baseURL: process.env.BASEURL, | ||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ | ||
trace: 'on', | ||
video: 'on', | ||
}, | ||
|
||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { | ||
...devices['Desktop Chrome'], | ||
}, | ||
}, | ||
{ | ||
name: 'firefox', | ||
use: { | ||
...devices['Desktop Firefox'], | ||
}, | ||
}, | ||
{ | ||
name: 'webkit', | ||
use: { | ||
...devices['Desktop Safari'], | ||
}, | ||
}, | ||
], | ||
}; | ||
|
||
export default config; |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { test, expect, Page } from '@playwright/test'; | ||
|
||
test.describe.configure({ mode: 'parallel' }); | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await page.goto('/discover'); | ||
}); | ||
|
||
test.describe('Discover', () => { | ||
test('should allow me to browse categories', async ({ page }) => { | ||
// Loop through each category | ||
for (const category of ['Microsoft', 'Mobile', 'Community', 'M365']) { | ||
// click on the category | ||
await page.locator('.tags-item >> text=' + category).click(); | ||
// assert category is selected | ||
await expect(page.locator('.titlePage')).toHaveText(category); | ||
// navigate back to discover page | ||
await page.locator('button:has-text("Back")').click(); | ||
} | ||
}); | ||
|
||
test('should allow me to search', async ({ page }) => { | ||
// use search bar | ||
await page.locator('[placeholder="Search here"]').click(); | ||
// search for a podcast | ||
await page.locator('[placeholder="Search here"]').fill('.NET'); | ||
await page.locator('[placeholder="Search here"]').press('Enter'); | ||
// assert no results page isn't shown | ||
expect(page.locator('.main')).not.toContain('no results'); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { test, expect, Page } from '@playwright/test'; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await page.goto('/discover'); | ||
}); | ||
|
||
test.describe('Listen Later', () => { | ||
test('should allow me to listen to podcast later', async ({ page }) => { | ||
// click first podcast in list | ||
await page.locator('.item-primary-action').first().click(); | ||
// click first listen later button | ||
await page.locator('button.buttonIcon.episode-actions-later').first().click(); | ||
// view listen later tab | ||
await page.locator('.navbarApp-item >> text=ListenLater').click(); | ||
await expect(page).toHaveURL('/listen-later'); | ||
// assert no results page isn't shown | ||
expect(page.locator('.main')).not.toContain('no results'); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { test, expect, Page } from '@playwright/test'; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await page.goto('/discover'); | ||
}); | ||
|
||
test.describe('Listen Together', () => { | ||
test('should allow me to listen together', async ({ page }) => { | ||
// click first podcast in list | ||
await page.locator('.item-primary-action').first().click(); | ||
// click play | ||
await page.locator('.icon-play').first().click(); | ||
// click go to listen together page | ||
await page.locator('text=ListenTogether').click(); | ||
await expect(page).toHaveURL('/listen-together'); | ||
// assert Create new room button isn't disabled | ||
expect(page.locator('.buttonApp.primary >> text=Create new room')).toBeEnabled | ||
// create new room | ||
await page.locator('.buttonApp.primary >> text=Create new room').click(); | ||
await page.locator('[placeholder="Your name"]').fill('test'); | ||
// open room | ||
await page.locator('button:has-text("Open room")').click(); | ||
// leave the room | ||
await page.locator('text=Leave the room').click(); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { test, expect, Page } from '@playwright/test'; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await page.goto(''); | ||
}); | ||
|
||
test.describe('Login', () => { | ||
test('should allow me to login', async ({ page }) => { | ||
// click sign in | ||
await page.locator('text=Sign In').click(); | ||
// assert discover page is shown | ||
await expect(page).toHaveURL('/discover'); | ||
expect(page).toHaveTitle('.NET Podcasts') | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { test, expect, Page } from '@playwright/test'; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await page.goto('/settings'); | ||
}); | ||
|
||
test.describe('Settings', () => { | ||
test('should allow me to toggle settings', async ({ page }) => { | ||
// loop through each setting | ||
for (const setting of ['autodownload', 'deleteplayed', 'systemtheme', 'darktheme']) { | ||
// toggle setting | ||
await page.locator('input[name="' + setting + '"]').check(); | ||
await page.locator('input[name="' + setting + '"]').uncheck(); | ||
} | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { test, expect, Page } from '@playwright/test'; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await page.goto('/discover'); | ||
}); | ||
|
||
test.describe('Subscriptions', () => { | ||
test('should allow me to subscribe', async ({ page }) => { | ||
// click first podcast in list | ||
await page.locator('.item-primary-action').first().click(); | ||
// click subscribe | ||
await page.locator('button:has-text("Subscribe")').click(); | ||
// view subscriptions | ||
await page.locator('.navbarApp-item >> text=subscriptions').click(); | ||
await expect(page).toHaveURL('/subscriptions'); | ||
// assert subscriptions are shown | ||
expect(page.locator('.main')).not.toContain('You haven’t subscribed to any channel yet.'); | ||
}); | ||
}); |