Skip to content

Commit d15c088

Browse files
NickLanamcopybaranaut
authored andcommitted
Don't count Cypress as embedding
Summary: Cypress puts the application under test in an iframe. It tries to mask this, but doesn't do a perfect job and our embed detection happened to notice. This makes an exception to the rule by explicitly checking for Cypress. I tried having it also check that the parent frame has a Cypress-specific location (so that we can detect if we're in a nested frame for actual embed tests), but Cypress fakes the top URL so we can't detect that difference. Test Plan: Run normally. Test that embed still behave as they should. Cypress should now load again (it was broken). Reviewers: michelle, vihang Reviewed By: michelle Signed-off-by: Nick Lanam <nlanam@pixielabs.ai> Differential Revision: https://phab.corp.pixielabs.ai/D11699 GitOrigin-RevId: 5db68c7
1 parent 05a0098 commit d15c088

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/ui/src/common/embed-context.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ import { WithChildren } from 'app/utils/react-boilerplate';
2323
/** Returns true if Pixie appears to be in an iframe or is otherwise embedded. */
2424
export function isPixieEmbedded(): boolean {
2525
try {
26-
return globalThis.self !== globalThis.top;
26+
const isInFrame = globalThis.self !== globalThis.top;
27+
const isCypress = !!(window as any).Cypress; // Make an exception for the testing framework
28+
29+
return isInFrame && !isCypress;
2730
} catch (_) {
2831
return true;
2932
}

0 commit comments

Comments
 (0)