-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement ability for e2e tests to patch appConfig (#4548)
- Loading branch information
1 parent
4bd4239
commit afb63b3
Showing
3 changed files
with
54 additions
and
0 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,34 @@ | ||
import {test, expect} from '@playwright/test'; | ||
import {Monitoring} from './page-object-models/monitoring'; | ||
import {restoreDatabaseSnapshot, s} from './utils'; | ||
import {getStorageState} from './utils/storage-state'; | ||
|
||
test.use({ | ||
storageState: getStorageState({ui: {publishEmbargo: false}}), | ||
}); | ||
|
||
test('disabling publish embargo by adjusting instance configuration', async ({page}) => { | ||
await restoreDatabaseSnapshot(); | ||
|
||
const monitoring = new Monitoring(page); | ||
|
||
await page.goto('/#/workspace/monitoring'); | ||
|
||
await monitoring.selectDeskOrWorkspace('Sports'); | ||
|
||
await page.locator( | ||
s('monitoring-group=Sports / Working Stage', 'article-item=test sports story'), | ||
).dblclick(); | ||
|
||
await page.locator(s('authoring', 'open-send-publish-pane')).click(); | ||
|
||
// "target" section is not relevant for this test | ||
// but is used as a control to make sure panel content has finished loading | ||
await expect( | ||
page.locator(s('authoring', 'interactive-actions-panel')).getByRole('button', {name: 'Target'}), | ||
).toBeVisible(); | ||
|
||
await expect( | ||
page.locator(s('authoring', 'interactive-actions-panel')).getByRole('button', {name: 'Embargo'}), | ||
).not.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,16 @@ | ||
import {BrowserContextOptions} from '@playwright/test'; | ||
import {ISuperdeskGlobalConfig} from 'superdesk-api'; | ||
import storageState from '../.auth/user.json'; | ||
|
||
type StorageState = BrowserContextOptions['storageState']; | ||
|
||
/** | ||
* Allows to set custom application configs while preserving values defined in .auth/user.json | ||
*/ | ||
export function getStorageState(appConfigPatch: Partial<ISuperdeskGlobalConfig>): StorageState { | ||
const storageStateCopy = JSON.parse(JSON.stringify(storageState)); | ||
|
||
storageStateCopy['origins'][0].localStorage.push({name: 'TEST_APP_CONFIG', value: JSON.stringify(appConfigPatch)}); | ||
|
||
return storageStateCopy; | ||
} |
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