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

Use playwright mocks in Transactions e2e, update e2e tags #406

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

telmanagababov
Copy link
Collaborator

@telmanagababov telmanagababov commented Feb 7, 2025

Use Playwright mocks in transactions e2e,
Add useMocks parameter to bypass mocks data in modelbank/ephemeral tests.

Update e2e tags to follow the Guideline https://backbase.atlassian.net/wiki/spaces/GUIL/pages/5259559552/E2E+tests+migration+guidelines

@telmanagababov telmanagababov changed the title Use playwright mocks in Transactions e2e Use playwright mocks in Transactions e2e, update e2e tags Feb 7, 2025
@telmanagababov telmanagababov marked this pull request as ready for review February 7, 2025 15:56
await detailsPage.navigate(detailsData.id);
});
test.beforeEach(
async ({ page, detailsPage, detailsData, detailsMocks }) => {

Choose a reason for hiding this comment

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

This is great.
The only thing i would consider is to move this whole code (which sets page.route) into fixture.
This way engineers will have full control when they want to override something on the app level

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated. Added listMocksSetup and detailsMocksSetup which can be overriden.

An example:

  // override list mocks setup
  listMocksSetup: async ({ useMocks, page }, use) => await use(() => {
    if (useMocks) {
      page.route(
        '**/accessgroups/users/permissions/summary',
        (route) => route.fulfill({ json: JSON.parse(readFileSync('./my-mocks/summary.json','utf-8')) })
      );
      page.route(
        '**/accessgroups/service-agreements/context',
        (route) => route.fulfill({ json: JSON.parse(readFileSync('./my-mocks/agreements.json', 'utf-8')) })
      );
      page.route(
        '**/productsummary/context/arrangements**',
        (route) => route.fulfill({ json: JSON.parse(readFileSync('./my-mocks/arrangements.json', 'utf-8')) })
      );
      page.route(
        '**/v2/transactions',
        (route) => route.fulfill({ json: JSON.parse(readFileSync('./my-mocks/transactions.json', 'utf-8')) })
      );
    }
  }),

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.

3 participants