Files
explore/playwright/fixtures/mockFeatures.ts
T
tom goriunovandGitHub aa8a5841f7 Playwright tests refactoring, pt.2 (#1787)
* create storageState fixture

* remove auth fixture

* renaming

* migrate bridge tokens and shibarium rollup tests

* migrate to common app config

* update screenshots

* re-implement fixtures for mocking envs, features and auth state

* update screenshot
2024-04-17 20:20:02 +02:00

17 lines
550 B
TypeScript

/* eslint-disable max-len */
import type { TestFixture, Page } from '@playwright/test';
export type MockFeaturesFixture = (features: Array<[string, unknown]>) => Promise<void>;
const fixture: TestFixture<MockFeaturesFixture, { page: Page }> = async({ page }, use) => {
await use(async(features) => {
for (const [ name, value ] of features) {
await page.evaluate(({ name, value }) => {
window.localStorage.setItem(`pw_feature:${ name }`, JSON.stringify(value));
}, { name, value });
}
});
};
export default fixture;