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

fix(puppeteer-page): add existing head content to page #3257

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

Conversation

Trendy
Copy link

@Trendy Trendy commented Feb 25, 2022

Read the existing head element content, add that content to the e2e page that is being created. This prevents a user losing script or style tags that may have been added to the page before using the setContent method. Fixes #3229

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build (npm run build) was run locally and any changes were pushed
  • Unit tests (npm test) were run locally and passed
  • E2E Tests (npm run test.karma.prod) were run locally and passed
  • Prettier (npm run prettier) was run locally and passed

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Fixes the issue described in #3229

GitHub Issue Number: 3229

What is the new behavior?

Before creating the new e2e page, pull the content from the head element and add the content to the new page.
This prevents e2ePage.setContent from removing style and script tags added to the page before calling setContent.

Does this introduce a breaking change?

  • Yes
  • No

Testing

I manually linked the project into a Stencil project of my own. I used Puppeteer's addScriptTag method to add scripts to my e2ePage, then called the setContent method. Afterwards, I manually verified that the script tags were still present in my e2e page.

Read the existing head element content, add that content to the e2e page that is being created. This prevents a user losing script or style tags that may have been added to the page before using the setContent method. Fixes ionic-team#3229
@Trendy Trendy requested a review from a team February 25, 2022 19:11
@Trendy
Copy link
Author

Trendy commented Feb 27, 2022

Apologies, I didn't realize the tests were failing until this evening. I'll take a look at the failures and attempt to fix this tomorrow.

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.

bug: E2EPage setContent removes all script and style tags from the page
1 participant