forked from Azure-Samples/eShopOnAzure
-
Notifications
You must be signed in to change notification settings - Fork 2
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 Azure-Samples#15 from Azure-Samples/brecon/aprMerge
Merge eshop with aspire preview5
- Loading branch information
Showing
83 changed files
with
1,016 additions
and
579 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
version: 2 | ||
registries: | ||
public-nuget: | ||
type: nuget-feed | ||
url: https://api.nuget.org/v3/index.json | ||
updates: | ||
- package-ecosystem: nuget | ||
directory: "/" | ||
registries: | ||
- public-nuget | ||
schedule: | ||
interval: weekly | ||
open-pull-requests-limit: 15 | ||
|
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,48 @@ | ||
name: Playwright Tests for eShop | ||
on: | ||
push: | ||
branches: [ main ] | ||
paths-ignore: | ||
- '**.md' | ||
- 'src/ClientApp/**' | ||
- 'test/ClientApp.UnitTests/**' | ||
- '.github/workflows/pr-validation-maui.yml' | ||
pull_request: | ||
branches: [ main ] | ||
paths-ignore: | ||
- '**.md' | ||
- 'src/ClientApp/**' | ||
- 'test/ClientApp.UnitTests/**' | ||
- '.github/workflows/pr-validation-maui.yml' | ||
jobs: | ||
test: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-dotnet@v4 | ||
with: | ||
global-json-file: global.json | ||
- name: Install Aspire | ||
run: | | ||
dotnet workload update | ||
dotnet workload install aspire | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Install Playwright Browsers | ||
run: npx playwright install chromium | ||
- name: Run Playwright tests | ||
run: npx playwright test | ||
env: | ||
ESHOP_USE_HTTP_ENDPOINTS: 1 | ||
USERNAME1: bob | ||
PASSWORD: Pass123$ | ||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 |
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,42 @@ | ||
name: eShop Pull Request Validation - .NET MAUI | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- '**' | ||
paths: | ||
- 'src/ClientApp/**' | ||
- 'test/ClientApp.UnitTests/**' | ||
- '.github/workflows/pr-validation-maui.yml' | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'src/ClientApp/**' | ||
- 'test/ClientApp.UnitTests/**' | ||
- '.github/workflows/pr-validation-maui.yml' | ||
|
||
jobs: | ||
test: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup .NET (global.json) | ||
uses: actions/setup-dotnet@v3 | ||
|
||
- name: Update Workloads | ||
run: dotnet workload update | ||
|
||
- name: Install Workloads | ||
shell: pwsh | ||
run: | | ||
dotnet workload install android | ||
dotnet workload install ios | ||
dotnet workload install maccatalyst | ||
dotnet workload install maui | ||
- name: Build | ||
run: dotnet build src/ClientApp/ClientApp.csproj | ||
|
||
- name: Test | ||
run: dotnet test tests/ClientApp.UnitTests/ClientApp.UnitTests.csproj |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('Add item to the cart', async ({ page }) => { | ||
await page.goto('/'); | ||
|
||
await expect(page.getByRole('heading', { name: 'Ready for a new adventure?' })).toBeVisible(); | ||
await page.getByRole('link', { name: 'Adventurer GPS Watch' }).click(); | ||
await page.getByRole('button', { name: 'Add to shopping bag' }).click(); | ||
await page.getByRole('link', { name: 'shopping bag' }).click(); | ||
await page.getByRole('heading', { name: 'Shopping bag' }).click(); | ||
|
||
await page.getByText('Total').nth(1).click(); | ||
await page.getByLabel('product quantity').getByText('1'); | ||
|
||
await expect.poll(() => page.getByLabel('product quantity').count()).toBeGreaterThan(0); | ||
}); |
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,13 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('Browse Items', async ({ page }) => { | ||
await page.goto('/'); | ||
|
||
await expect(page.getByRole('heading', { name: 'Ready for a new adventure?' })).toBeVisible(); | ||
|
||
await page.getByRole('link', { name: 'Adventurer GPS Watch' }).click(); | ||
await page.getByRole('heading', { name: 'Adventurer GPS Watch' }).click(); | ||
|
||
//Expect | ||
await expect(page.getByRole('heading', { name: 'Adventurer GPS Watch' })).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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('Remove item from cart', async ({ page }) => { | ||
await page.goto('/'); | ||
await expect(page.getByRole('heading', { name: 'Ready for a new adventure?' })).toBeVisible(); | ||
|
||
await page.getByRole('link', { name: 'Adventurer GPS Watch' }).click(); | ||
await expect(page.getByRole('heading', { name: 'Adventurer GPS Watch' })).toBeVisible(); | ||
|
||
await page.getByRole('button', { name: 'Add to shopping bag' }).click(); | ||
await page.getByRole('link', { name: 'shopping bag' }).click(); | ||
await expect(page.getByRole('heading', { name: 'Shopping bag' })).toBeVisible(); | ||
|
||
await expect.poll(() => page.getByLabel('product quantity').count()).toBeGreaterThan(0); | ||
|
||
await page.getByLabel('product quantity').fill('0'); | ||
|
||
await page.getByRole('button', { name: 'Update' }).click(); | ||
|
||
await expect(page.getByText('Your shopping bag is empty')).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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { test as setup, expect } from '@playwright/test'; | ||
import { STORAGE_STATE } from '../playwright.config'; | ||
import { assert } from 'console'; | ||
|
||
assert(process.env.USERNAME1, 'USERNAME1 is not set'); | ||
assert(process.env.PASSWORD, 'PASSWORD is not set'); | ||
|
||
setup('Login', async ({ page }) => { | ||
await page.goto('/'); | ||
await expect(page.getByRole('heading', { name: 'Ready for a new adventure?' })).toBeVisible(); | ||
|
||
await page.getByLabel('Sign in').click(); | ||
await expect(page.getByRole('heading', { name: 'Login' })).toBeVisible(); | ||
|
||
await page.getByPlaceholder('Username').fill(process.env.USERNAME1!); | ||
await page.getByPlaceholder('Password').fill(process.env.PASSWORD!); | ||
await page.getByRole('button', { name: 'Login' }).click(); | ||
await expect(page.getByRole('heading', { name: 'Ready for a new adventure?' })).toBeVisible(); | ||
await page.context().storageState({ path: STORAGE_STATE }); | ||
}) |
Oops, something went wrong.