-
Notifications
You must be signed in to change notification settings - Fork 39
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
Showing
6 changed files
with
546 additions
and
46 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
108 changes: 108 additions & 0 deletions
108
apps/showcase/e2e-playwright/sanity/lighthouse-sanity.e2e.ts
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,108 @@ | ||
import { O3rElement } from '@o3r/testing/core'; | ||
import { type Page, test } from '@playwright/test'; | ||
import { AppFixtureComponent } from '../../src/app/app.fixture'; | ||
|
||
async function performAudit(page: Page) { | ||
const { playAudit } = await import('playwright-lighthouse'); | ||
await playAudit({ | ||
page, | ||
thresholds: { | ||
performance: 50, | ||
accessibility: 94, | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
'best-practices': 90 | ||
}, | ||
port: 9222 | ||
}); | ||
} | ||
|
||
const baseUrl = process.env.PLAYWRIGHT_TARGET_URL || 'http://localhost:4200/'; | ||
|
||
test.describe('Lighthouse tests', () => { | ||
test('home', async ({context}) => { | ||
const page = await context.newPage(); | ||
await page.goto(baseUrl); | ||
await performAudit(page); | ||
await page.close(); | ||
}); | ||
|
||
test('run-app-locally', async ({context}) => { | ||
const page = await context.newPage(); | ||
await page.goto(baseUrl); | ||
const appFixture = new AppFixtureComponent(new O3rElement({element: page.locator('app-root'), page})); | ||
await appFixture.navigateToRunAppLocally(); | ||
await page.waitForURL('**/run-app-locally'); | ||
await performAudit(page); | ||
await page.close(); | ||
}); | ||
|
||
test('configuration', async ({context}) => { | ||
const page = await context.newPage(); | ||
await page.goto(baseUrl); | ||
const appFixture = new AppFixtureComponent(new O3rElement({element: page.locator('app-root'), page})); | ||
await appFixture.navigateToConfiguration(); | ||
await page.waitForURL('**/configuration'); | ||
await performAudit(page); | ||
await page.close(); | ||
}); | ||
|
||
test('localization', async ({context}) => { | ||
const page = await context.newPage(); | ||
await page.goto(baseUrl); | ||
const appFixture = new AppFixtureComponent(new O3rElement({element: page.locator('app-root'), page})); | ||
await appFixture.navigateToLocalization(); | ||
await page.waitForURL('**/localization'); | ||
await performAudit(page); | ||
await page.close(); | ||
}); | ||
|
||
test('dynamic-content', async ({context}) => { | ||
const page = await context.newPage(); | ||
await page.goto(baseUrl); | ||
const appFixture = new AppFixtureComponent(new O3rElement({element: page.locator('app-root'), page})); | ||
await appFixture.navigateToDynamicContent(); | ||
await page.waitForURL('**/dynamic-content'); | ||
await performAudit(page); | ||
await page.close(); | ||
}); | ||
|
||
test('rules-engine', async ({context}) => { | ||
const page = await context.newPage(); | ||
await page.goto(baseUrl); | ||
const appFixture = new AppFixtureComponent(new O3rElement({element: page.locator('app-root'), page})); | ||
await appFixture.navigateToRulesEngine(); | ||
await page.waitForURL('**/rules-engine'); | ||
await performAudit(page); | ||
await page.close(); | ||
}); | ||
|
||
test('component-replacement', async ({context}) => { | ||
const page = await context.newPage(); | ||
await page.goto(baseUrl); | ||
const appFixture = new AppFixtureComponent(new O3rElement({element: page.locator('app-root'), page})); | ||
await appFixture.navigateToComponentReplacement(); | ||
await page.waitForURL('**/component-replacement'); | ||
await performAudit(page); | ||
await page.close(); | ||
}); | ||
|
||
test('design-token', async ({context}) => { | ||
const page = await context.newPage(); | ||
await page.goto(baseUrl); | ||
const appFixture = new AppFixtureComponent(new O3rElement({element: page.locator('app-root'), page})); | ||
await appFixture.navigateToDesignToken(); | ||
await page.waitForURL('**/design-token'); | ||
await performAudit(page); | ||
await page.close(); | ||
}); | ||
|
||
test('sdk-generator', async ({context}) => { | ||
const page = await context.newPage(); | ||
await page.goto(baseUrl); | ||
const appFixture = new AppFixtureComponent(new O3rElement({element: page.locator('app-root'), page})); | ||
await appFixture.navigateToSDKGenerator(); | ||
await page.waitForURL('**/sdk'); | ||
await performAudit(page); | ||
await page.close(); | ||
}); | ||
}); |
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
Oops, something went wrong.