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

[test] Add e2e testing #125

Merged
merged 14 commits into from
Feb 13, 2025
Merged

[test] Add e2e testing #125

merged 14 commits into from
Feb 13, 2025

Conversation

yoannmoinet
Copy link
Member

@yoannmoinet yoannmoinet commented Jan 24, 2025

What and why?

It would feel safer to actually test in browser, IRL situations.

How?

Add e2e testing with Playwright.

  • move all the existing unit tests under unit/ and add the e2e/ peer directory.
  • new yarn cli dev-server command to run a local dev server.
  • add and setup playwright.
  • changed test command to yarn test:unit.
  • new yarn test:e2e command to run playwright.
  • re-organise helpers around internal builds (bundlers and plugins).
  • new smoke test to validate e2e process.

@yoannmoinet yoannmoinet changed the base branch from yoann/inject-browser-sdk to yoann/v2.5.0 February 10, 2025 15:05
@yoannmoinet yoannmoinet force-pushed the yoann/add-e2e-testing branch 2 times, most recently from 83fa727 to 0c40188 Compare February 10, 2025 15:07
@yoannmoinet yoannmoinet force-pushed the yoann/add-e2e-testing branch from 0c40188 to a9be777 Compare February 11, 2025 09:06
@yoannmoinet yoannmoinet mentioned this pull request Feb 11, 2025
@yoannmoinet yoannmoinet changed the base branch from yoann/v2.5.0 to yoann/miscelaneous-updates February 11, 2025 09:13
@yoannmoinet yoannmoinet marked this pull request as ready for review February 11, 2025 13:50
@yoannmoinet yoannmoinet requested a review from a team as a code owner February 11, 2025 13:50
@yoannmoinet yoannmoinet requested review from jakub-g, elbywan and Ayc0 and removed request for a team and jakub-g February 11, 2025 13:50
@yoannmoinet yoannmoinet mentioned this pull request Feb 12, 2025
Base automatically changed from yoann/miscelaneous-updates to yoann/v2.5.0 February 12, 2025 08:55
Copy link
Member

@elbywan elbywan left a comment

Choose a reason for hiding this comment

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

LGTM 🔥

I posted a couple of nits.

- run: yarn install

- name: Install playwright
run: yarn workspace @dd/tests playwright install --with-deps
Copy link
Member

Choose a reason for hiding this comment

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

I believe that this step will still run even when the playwright cache is hit

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it is necessary, we can only cache the binaries, but we still need to install some shared libraries (installed in a different directory than the binaries).

Though, it will not need to download the binaries (browsers mostly).

// Transform the content here with the context we have.
callback(
null,
template(chunk.toString('utf-8'), { interpolate: INTERPOLATE_RX })(context),
Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering if this could fail when a particular chunk includes the start symbol ({{) but not the other one (}}), which would in this case be included in the next chunk?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a fair concern, I'll see if I can prevent this issue from happening.

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed the streaming process, and used fs.readFile instead.
Didn't find any solution to keep the streaming.

await page.waitForSelector('body');
};

describe('Browser SDK injection', () => {
Copy link
Member

Choose a reason for hiding this comment

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

Browser SDK injection

I think this is an oversight, the description seems to be off

@yoannmoinet yoannmoinet merged commit d228bf1 into yoann/v2.5.0 Feb 13, 2025
4 checks passed
@yoannmoinet yoannmoinet deleted the yoann/add-e2e-testing branch February 13, 2025 10:50
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