Skip to content

Commit

Permalink
Fix csp err
Browse files Browse the repository at this point in the history
  • Loading branch information
siarheiy committed Jul 30, 2024
1 parent fc5093e commit 6d46fae
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions uui-e2e-tests/framework/fixtures/shared/absPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,6 @@ export abstract class AbsPage {
if (this.extraStyles) {
await this.page.addStyleTag({ path: this.extraStyles });
}
/**
* We must wait for this global variable to be able to run our tests
*/
await this.page.waitForFunction((name) => {
// @ts-ignore Reason: this specific code will be run in context of web page
return !!window[name];
}, PlayWrightInterfaceName);
}

async focusElement(selector: string) {
Expand Down Expand Up @@ -76,10 +69,22 @@ export abstract class AbsPage {

protected async _clientRedirect<T extends object>(params: T) {
await this.page.mouse.move(0, 0);
await this.page.evaluate((_params: string) => {
await this.page.evaluate(async (_params: string) => {
const [p, i] = _params.split('[||||]');
// @ts-ignore Reason: this specific code will be run in context of web page
(window as any)[i](p);
const globalObj = window as any;
const waitForInterface = () => {
return new Promise<any>((resolve) => {
const get = () => globalObj[i];
const _intervalId = globalObj.setInterval(() => {
if (get()) {
globalObj.clearInterval(_intervalId);
resolve(get());
}
}, 300);
});
};
(await waitForInterface())(p);
}, [jsonStringify(params), PlayWrightInterfaceName].join('[||||]'));
}
}
Expand Down

0 comments on commit 6d46fae

Please sign in to comment.