forked from AmadeusITGroup/otter
-
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.
test: lighthouse checks on e2e (AmadeusITGroup#1425)
## Proposed change The goal is to prevent regressions regarding accessibility on the showcase app ![image](https://github.com/AmadeusITGroup/otter/assets/110407799/84430541-7e98-43c0-93cb-e2f6e69621ff) ## Related issues - 🐛 Fixes #(issue) - 🚀 Feature #(issue) <!-- Please make sure to follow the contributing guidelines on https://github.com/amadeus-digital/Otter/blob/main/CONTRIBUTING.md -->
- Loading branch information
Showing
13 changed files
with
600 additions
and
100 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
115 changes: 115 additions & 0 deletions
115
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,115 @@ | ||
import { O3rElement } from '@o3r/testing/core'; | ||
import { type Page, test } from '@playwright/test'; | ||
import { AppFixtureComponent } from '../../src/app/app.fixture'; | ||
|
||
async function performAudit(name: string, page: Page) { | ||
const { playAudit } = await import('playwright-lighthouse'); | ||
await playAudit({ | ||
page, | ||
thresholds: { | ||
performance: 50, | ||
accessibility: 100, | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
'best-practices': 90 | ||
}, | ||
reports: { | ||
formats: { | ||
html: true | ||
}, | ||
directory: 'playwright-reports/lighthouse', | ||
name: name | ||
}, | ||
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('home', 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('run-app-locally', 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('configuration', 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('localization', 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('dynamic-content', 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('rules-engine', 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('component-replacement', 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('design-token', 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('sdk-generator', page); | ||
await page.close(); | ||
}); | ||
}); |
Binary file modified
BIN
-10 Bytes
(100%)
...playwright/sanity/screenshots/visual-sanity.e2e.ts/chromium/dynamic-content.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+0 Bytes
(100%)
...2e-playwright/sanity/screenshots/visual-sanity.e2e.ts/chromium/localization.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+383 Bytes
(100%)
...2e-playwright/sanity/screenshots/visual-sanity.e2e.ts/chromium/rules-engine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+0 Bytes
(100%)
...e-playwright/sanity/screenshots/visual-sanity.e2e.ts/chromium/sdk-generator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Oops, something went wrong.