Skip to content

MWPW-191476-test cases fixed for firefly-share#71

Open
hkhatana26 wants to merge 11 commits into
stagefrom
mwpw-191476-firefly-shareut
Open

MWPW-191476-test cases fixed for firefly-share#71
hkhatana26 wants to merge 11 commits into
stagefrom
mwpw-191476-firefly-shareut

Conversation

@hkhatana26

@hkhatana26 hkhatana26 commented May 18, 2026

Copy link
Copy Markdown

@aem-code-sync

aem-code-sync Bot commented May 18, 2026

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run all PSI checks
  • Re-run failed PSI checks
  • Re-sync branch
Commits

@aem-code-sync

aem-code-sync Bot commented May 18, 2026

Copy link
Copy Markdown
Page Scores Audits Google
📱 / Lighthouse returned error: NOT_HTML. The page provided is not HTML (served as MIME type text/plain). PSI
🖥️ / Lighthouse returned error: NOT_HTML. The page provided is not HTML (served as MIME type text/plain). PSI

@aem-code-sync aem-code-sync Bot temporarily deployed to mwpw-191476-firefly-shareut May 21, 2026 18:54 Inactive
@aem-code-sync aem-code-sync Bot temporarily deployed to mwpw-191476-firefly-shareut June 1, 2026 09:02 Inactive
@aem-code-sync aem-code-sync Bot temporarily deployed to mwpw-191476-firefly-shareut June 4, 2026 17:46 Inactive
Comment thread test/blocks/firefly-share/firefly-share.test.js
Comment thread test/blocks/firefly-share/firefly-share.test.js Outdated
Comment thread test/blocks/firefly-share/firefly-share.test.js
Comment thread test/blocks/firefly-share/firefly-share.test.js
Comment thread test/blocks/firefly-share/firefly-share.test.js Outdated
Comment thread test/blocks/firefly-share/firefly-share.test.js Outdated
@aem-code-sync aem-code-sync Bot temporarily deployed to mwpw-191476-firefly-shareut June 8, 2026 14:36 Inactive
@hkhatana26 hkhatana26 requested a review from nkthakur48 June 9, 2026 10:28
@aem-code-sync aem-code-sync Bot temporarily deployed to mwpw-191476-firefly-shareut June 12, 2026 03:12 Inactive
@aem-code-sync aem-code-sync Bot temporarily deployed to mwpw-191476-firefly-shareut June 15, 2026 15:00 Inactive
Comment thread test/blocks/firefly-share/firefly-share.test.js Outdated
Comment thread test/blocks/firefly-share/firefly-share.test.js
Comment thread test/blocks/firefly-share/firefly-share.test.js
Comment thread test/blocks/firefly-share/firefly-share.test.js
@aem-code-sync aem-code-sync Bot temporarily deployed to mwpw-191476-firefly-shareut June 16, 2026 10:18 Inactive
@aem-code-sync aem-code-sync Bot temporarily deployed to mwpw-191476-firefly-shareut June 16, 2026 10:20 Inactive
@hkhatana26 hkhatana26 requested a review from nkthakur48 June 16, 2026 10:20
@aem-code-sync aem-code-sync Bot temporarily deployed to mwpw-191476-firefly-shareut June 16, 2026 10:56 Inactive
copyButton.click();
// wait a microtask so the promise rejection is observed by the handler
await Promise.resolve();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The source (firefly-share.js:217) calls writeText(...).then(...) with no .catch(). When this stub rejects, it creates an unhandled promise rejection — the test assertions are correct, but depending on the test runner config (--fail-on-rejection), this could silently swallow the error or break CI. Consider adding .catch(() => {}) to the source chain in a follow-up.

<div>
<p><a href="https://www.twitter.com/intent/tweet">twitter</a></p>
<p><a href="https://www.facebook.com/sharer.php">facebook</a></p>
<div><a href="https://x.bar.com/share">unknown host</a></div>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This fixture exercises two things: (1) an unrecognized platform ("bar" from x.bar.com) that getDetails silently drops, and (2) a non-<p> wrapper so share.closest("p")?.remove() no-ops. Neither behavior is explicitly asserted in the test — the count check (length === 2) covers it only implicitly.

// assert window.open was called with width parameter
expect(openStub.firstCall.args[2]).to.include('width=600');
} finally {
openStub.restore();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This assertion proves window.open() is exercised, which the source marks /* c8 ignore next 2 */ at line 167. Similarly, the clipboard tests above cover lines 214-220 (also c8 ignore). Consider removing those stale ignore comments in a follow-up so coverage reflects reality.

writeTextStub.restore();
}
});

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The source toggles a changeText flag each click, appending (zero-width space) on alternate copies to force screen readers to re-announce the aria-live region. A second click → flush → assert sequence here would verify the toggle: first copy text should lack , second should include it.

@nkthakur48

Copy link
Copy Markdown
Collaborator

Nit (nice-to-have): Some tests use fixtures from body.html (e.g. #share-default, #share-manual) while others create blocks inline via document.createElement. Both work, but the mix makes the test file slightly harder to scan. Consider adding more fixture variants to body.html (e.g. an isolated block with no preceding heading, a block for the no-clipboard scenario) to reduce inline DOM construction and keep setup patterns consistent.

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