Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added iframe mocks support #17

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

penyaskito
Copy link
Contributor

@penyaskito penyaskito commented Feb 26, 2025

Adds iframe mocks support

TODO:

  • Add docs and examples

Usage

import { defineVisualDiffConfig } from '@packages/playwright-drupal';
import { Youtube } from '../packages/playwright-drupal/util/mock/youtube';
import { Mock } from '../packages/playwright-drupal/util/mock/mock';

export const config = defineVisualDiffConfig({
  name: "MySite Visual Diffs",
  description: "A series of visual diffs against MySite default site.",
  groups: [
    {
      name: "Landing Pages",
      description: "Pages built with Layout Builder.",
      testCases: [
        {
          name: "About Us",
          description: "Note only the YouTube video directly in the viewport will show.",
          path: "/about-us",
          mockClass: Mock // or Youtube
        }
      ]
    }
  ],
});

@penyaskito
Copy link
Contributor Author

@deviantintegral this is WIP, but would love your opinion on the direction.

Comment on lines +20 to +21
},
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this? We don't have a yarn lockfile or the like.

import {Mockable} from "../../testcase";
import {Youtube} from "./youtube";

export class Mock implements Mockable{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear to me that loading a Mock here actually does something with YouTube. I'm not clear why we need this extra Mock class. Would it be clearer to have YouTubeMock Implements Mockable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely bad naming. This extra Mock class was using in some projects to call all the mocks mock method. As we only have youtube here for now, makes not a lot of sense. Maybe renaming to EveryIframeServiceMock would make sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants