-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix finance memory leak remove resize listener leak and layout shift #5285
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
base: master
Are you sure you want to change the base?
Changes from all commits
9f9f6a7
5381bcd
3648d65
94e8b66
464012d
f5160a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,181 @@ | ||
| describe('Ambassadors Page - Social Links Rendering', () => { | ||
| beforeEach(() => { | ||
| cy.visit('/community/ambassadors'); | ||
| }); | ||
|
|
||
| describe('Social Links Conditional Rendering', () => { | ||
| it('should render ambassador cards', () => { | ||
| cy.get('[data-testid="Ambassadors-members"]').should('have.length.greaterThan', 0); | ||
| }); | ||
|
|
||
| it('should not render links with undefined href attributes', () => { | ||
| // Check that no anchor tags have href="undefined" | ||
| cy.get('[data-testid="Ambassadors-members-socials"] a').each(($link) => { | ||
| const href = $link.attr('href'); | ||
| expect(href).not.to.equal('undefined'); | ||
| expect(href).not.to.be.empty; | ||
| expect(href).to.match(/^https?:\/\//); // Must start with http/https | ||
| }); | ||
| }); | ||
|
|
||
| it('should only render Twitter links when twitter URL exists', () => { | ||
| cy.get('[data-testid="Ambassadors-members"]').each(($card) => { | ||
| const twitterLink = cy.wrap($card).find('[data-testid="Ambassadors-members-twitter"]'); | ||
|
|
||
| // If Twitter link exists, verify it has a valid href | ||
| twitterLink.then(($el) => { | ||
| if ($el.length > 0) { | ||
| expect($el.attr('href')).to.include('twitter.com'); | ||
| expect($el.attr('href')).not.to.equal('undefined'); | ||
| } | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| it('should only render GitHub links when github URL exists', () => { | ||
| cy.get('[data-testid="Ambassadors-members-socials"]').each(($socialsDiv) => { | ||
| // Get all links in the socials section | ||
| const links = cy.wrap($socialsDiv).find('a'); | ||
|
|
||
| links.each(($link) => { | ||
| const href = $link.attr('href'); | ||
| // If it's a GitHub link, ensure it's valid | ||
| if (href && href.includes('github.com')) { | ||
|
Check warning on line 43 in cypress/ambassadors.cy.ts
|
||
| expect(href).not.to.equal('undefined'); | ||
| expect(href).to.include('github.com'); | ||
| } | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| it('should only render LinkedIn links when linkedin URL exists', () => { | ||
| cy.get('[data-testid="Ambassadors-members-socials"]').each(($socialsDiv) => { | ||
| // Get all links in the socials section | ||
| const links = cy.wrap($socialsDiv).find('a'); | ||
|
|
||
| links.each(($link) => { | ||
| const href = $link.attr('href'); | ||
| // If it's a LinkedIn link, ensure it's valid | ||
| if (href && href.includes('linkedin.com')) { | ||
|
Check warning on line 59 in cypress/ambassadors.cy.ts
|
||
| expect(href).not.to.equal('undefined'); | ||
| expect(href).to.include('linkedin.com/in'); | ||
| } | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| it('should render valid links with proper target and rel attributes', () => { | ||
| cy.get('[data-testid="Ambassadors-members-socials"] a').each(($link) => { | ||
| expect($link.attr('target')).to.equal('_blank'); | ||
| expect($link.attr('rel')).to.include('noreferrer'); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| describe('Ambassador Images', () => { | ||
| it('should not render broken image URLs', () => { | ||
| cy.get('[data-testid="Ambassadors-members-img"] img').each(($img) => { | ||
| const src = $img.attr('src'); | ||
| expect(src).not.to.equal('undefined.png'); | ||
| expect(src).not.to.be.empty; | ||
| }); | ||
| }); | ||
|
|
||
| it('should load ambassador images without 404 errors', () => { | ||
| cy.get('[data-testid="Ambassadors-members-img"] img').each(($img) => { | ||
| cy.wrap($img).should('be.visible'); | ||
| // Verify image is loaded (naturalHeight should be set for successful loads) | ||
| cy.wrap($img).should(($el) => { | ||
| // Just check that src is valid | ||
| expect($el.attr('src')).to.exist; | ||
| expect($el.attr('src')).not.to.include('undefined'); | ||
| }); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| describe('Social Links Navigation', () => { | ||
| it('should navigate to Twitter when clicking Twitter link', () => { | ||
| cy.get('[data-testid="Ambassadors-members-twitter"]').first().then(($link) => { | ||
| if ($link.length > 0) { | ||
| const href = $link.attr('href'); | ||
| expect(href).to.include('twitter.com'); | ||
| cy.wrap($link).should('have.attr', 'href', href); | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| it('should navigate to GitHub when clicking GitHub link', () => { | ||
| cy.get('[data-testid="Ambassadors-members-socials"]').first().then(($socialsDiv) => { | ||
| const githubLink = cy.wrap($socialsDiv).find('a').filter(':contains("Github")'); | ||
|
|
||
| githubLink.then(($link) => { | ||
| if ($link.length > 0) { | ||
| const href = $link.attr('href'); | ||
| expect(href).to.include('github.com'); | ||
| } | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| it('should navigate to LinkedIn when clicking LinkedIn link', () => { | ||
| cy.get('[data-testid="Ambassadors-members-socials"]').first().then(($socialsDiv) => { | ||
| const linkedinLink = cy.wrap($socialsDiv).find('a').filter(':contains("Linkedin")'); | ||
|
|
||
| linkedinLink.then(($link) => { | ||
| if ($link.length > 0) { | ||
| const href = $link.attr('href'); | ||
| expect(href).to.include('linkedin.com'); | ||
| } | ||
| }); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| describe('Ambassador Card Layout', () => { | ||
| it('should display ambassador name and country', () => { | ||
| cy.get('[data-testid="Ambassadors-members-details"]').each(($detail) => { | ||
| expect($detail).to.contain.text(''); | ||
| // Should have name and country | ||
| cy.wrap($detail).find('div').should('have.length.at.least', 2); | ||
| }); | ||
|
Comment on lines
+137
to
+141
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tautological / no-op assertions.
🛡️ Proposed fix- it('should display ambassador name and country', () => {
- cy.get('[data-testid="Ambassadors-members-details"]').each(($detail) => {
- expect($detail).to.contain.text('');
- // Should have name and country
- cy.wrap($detail).find('div').should('have.length.at.least', 2);
- });
- });
+ it('should display ambassador name and country', () => {
+ cy.get('[data-testid="Ambassadors-members-details"]').each(($detail) => {
+ expect($detail.text().trim()).to.not.equal('');
+ expect($detail.find('div').length).to.be.at.least(2);
+ });
+ });- // At least some ambassadors should have GitHub
- if (hasValidLinks) {
- expect(hasValidLinks).to.be.true;
- }
+ expect(hasValidLinks, 'at least one ambassador should expose a GitHub link').to.be.true;🤖 Prompt for AI Agents |
||
| }); | ||
|
|
||
| it('should display ambassador title and bio', () => { | ||
| cy.get('[data-testid="Ambassadors-members"]').each(($card) => { | ||
| cy.wrap($card).should('be.visible'); | ||
| // Should have title in rounded border | ||
| cy.wrap($card).find('.rounded-lg').should('be.visible'); | ||
| }); | ||
| }); | ||
|
|
||
| it('should display social links section for each ambassador', () => { | ||
| cy.get('[data-testid="Ambassadors-members-socials"]').should('have.length.greaterThan', 0); | ||
| }); | ||
| }); | ||
|
|
||
| describe('Edge Cases', () => { | ||
| it('should handle ambassadors with only GitHub', () => { | ||
| // Find an ambassador card and verify GitHub link exists | ||
| cy.get('[data-testid="Ambassadors-members-socials"]').first().within(() => { | ||
| cy.get('a').then(($links) => { | ||
| const links = $links.toArray(); | ||
| const hasValidLinks = links.some((link) => { | ||
| const href = link.getAttribute('href'); | ||
| return href && href.includes('github.com') && href !== 'undefined'; | ||
|
Check warning on line 165 in cypress/ambassadors.cy.ts
|
||
| }); | ||
|
|
||
| // At least some ambassadors should have GitHub | ||
| if (hasValidLinks) { | ||
| expect(hasValidLinks).to.be.true; | ||
| } | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| it('should not have any broken hrefs in the entire page', () => { | ||
| cy.get('a[href="undefined"]').should('have.length', 0); | ||
| cy.get('a[href=""]').should('not.exist'); | ||
| }); | ||
| }); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: asyncapi/website
Length of output: 181
🏁 Script executed:
Repository: asyncapi/website
Length of output: 7998
🏁 Script executed:
fd -t f 'cypress\.config\.(js|ts|mjs|cjs)$'Repository: asyncapi/website
Length of output: 78
🏁 Script executed:
Repository: asyncapi/website
Length of output: 566
The
test:e2escript does not orchestrate a server, causing E2E tests to fail.The script is bare
npx cypress runwithout server orchestration, and the workflow has no step to start a server. Cypress is configured to connect tohttp://127.0.0.1:3000, but nothing serves on that port when tests run. Usestart-server-and-testor similar to wrapcypress runwith a server launcher (likely thestartscript which usesserve@latest out), or integrate server startup into the test:e2e script itself.🤖 Prompt for AI Agents