-
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.
fix(showcase): clear override button not working for dynamic content … (
#1321) …page ## Proposed change <!-- Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that is required for this change. --> ## 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
6 changed files
with
70 additions
and
5 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
apps/showcase/e2e-playwright/scenarios/dynamic-content-page-scenario.e2e-playwright-spec.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,33 @@ | ||
import { O3rElement } from '@o3r/testing/core'; | ||
import { expect, test } from '@playwright/test'; | ||
import { AppFixtureComponent } from '../../src/app/app.fixture'; | ||
import { DynamicContentFixtureComponent } from '../../src/app/dynamic-content/dynamic-content.fixture'; | ||
|
||
test.describe.serial('Test dynamic content page', () => { | ||
test('Go to dynamic content and play with override button', async ({ page }) => { | ||
await page.goto(process.env.PLAYWRIGHT_TARGET_URL || 'http://localhost:4200/'); | ||
const appFixture = new AppFixtureComponent(new O3rElement({element: page.locator('app-root'), page})); | ||
|
||
await test.step('go to dynamic content', async () => { | ||
await appFixture.navigateToDynamicContent(); | ||
await page.waitForURL('**/dynamic-content'); | ||
}); | ||
|
||
await test.step('override dynamic content', async () => { | ||
const dynamicContentFixture = new DynamicContentFixtureComponent(new O3rElement({element: page.locator('app-root'), page})); | ||
const overrideButton = (await dynamicContentFixture.getOverrideButton())!; | ||
const clearOverrideButton = (await dynamicContentFixture.getClearOverrideButton())!; | ||
|
||
await expect(overrideButton.sourceElement.element).toBeEnabled(); | ||
await expect(clearOverrideButton.sourceElement.element).toBeDisabled(); | ||
|
||
await overrideButton.click(); | ||
await expect(overrideButton.sourceElement.element).toBeDisabled(); | ||
await expect(clearOverrideButton.sourceElement.element).toBeEnabled(); | ||
|
||
await clearOverrideButton.click(); | ||
await expect(overrideButton.sourceElement.element).toBeEnabled(); | ||
await expect(clearOverrideButton.sourceElement.element).toBeDisabled(); | ||
}); | ||
}); | ||
}); |
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
25 changes: 25 additions & 0 deletions
25
apps/showcase/src/app/dynamic-content/dynamic-content.fixture.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,25 @@ | ||
import { ComponentFixtureProfile, O3rComponentFixture, O3rElement } from '@o3r/testing/core'; | ||
|
||
/** | ||
* A component fixture abstracts all the interaction you can have with the component's DOM | ||
* for testing purpose, including instantiating the fixtures of sub-components. | ||
* It should be used both for component testing and automated testing. | ||
*/ | ||
export interface DynamicContentFixture extends ComponentFixtureProfile { | ||
/** Get Override button */ | ||
getOverrideButton: () => Promise<O3rElement | undefined>; | ||
/** Get Clear override button */ | ||
getClearOverrideButton: () => Promise<O3rElement | undefined>; | ||
} | ||
|
||
export class DynamicContentFixtureComponent extends O3rComponentFixture implements DynamicContentFixture { | ||
/** @inheritDoc */ | ||
public getOverrideButton() { | ||
return this.query('#btn-override-config'); | ||
} | ||
|
||
/** @inheritDoc */ | ||
public getClearOverrideButton() { | ||
return this.query('#btn-clear-override-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
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