diff --git a/cypress/ambassadors.cy.js b/cypress/ambassadors.cy.js new file mode 100644 index 000000000000..ef3e887a767b --- /dev/null +++ b/cypress/ambassadors.cy.js @@ -0,0 +1,52 @@ +import HomePage from './pages/homepage'; +import AmbassadorsPage from './pages/ambassadors'; + +let homePage; +let ambassadorsPage; + +beforeEach(() => { + homePage = new HomePage(); + ambassadorsPage = new AmbassadorsPage(); + homePage.visit(); + homePage.goToAmbassadorsPage(); +}); + +describe('Ambassadors Page', () => { + it('verifies key sections and links', () => { + ambassadorsPage.verifyKeySectionsAndLinks(); + }); + + it('verifies social links for selected Ambassadors', () => { + const ambassadors = [ + { + name: 'Quetzalli Writes', + links: { + github: 'https://www.github.com/quetzalliwrites', + twitter: 'https://www.twitter.com/QuetzalliWrites', + linkedin: 'https://www.linkedin.com/in/quetzalli-writes' + } + }, + { + name: 'Daniel Kocot', + links: { + github: 'https://www.github.com/danielkocot', + twitter: 'https://www.twitter.com/dk_1977', + linkedin: 'https://www.linkedin.com/in/danielkocot' + } + }, + { + name: 'Hugo Guerrero', + links: { + github: 'https://www.github.com/hguerrero', + twitter: 'https://www.twitter.com/hguerreroo', + linkedin: 'https://www.linkedin.com/in/hugoguerrero' + } + } + ]; + + ambassadors.forEach(({ name, links }) => { + ambassadorsPage.verifyAmbassadorSocialLinks(name, links); + }); + }); +}); + diff --git a/cypress/pages/ambassadors.js b/cypress/pages/ambassadors.js new file mode 100644 index 000000000000..d7d3729289a3 --- /dev/null +++ b/cypress/pages/ambassadors.js @@ -0,0 +1,33 @@ +class AmbassadorsPage { + visit() { + cy.visit('/community/ambassadors'); + } + + verifyKeySectionsAndLinks() { + cy.get('a[href="https://github.com/asyncapi/community/blob/master/docs/020-governance-and-policies/AMBASSADOR_PROGRAM.md"]' + ) + .should('be.visible'); + cy.get('[data-testid="Ambassadors-Iframe"]') + .should('be.visible'); + cy.get('[data-testid="Ambassadors-members-main"]') + .should('be.visible'); + cy.get('a[href="https://github.com/asyncapi/community/blob/master/AMBASSADOR_ORGANIZATION.md#are-you-interested-in-becoming-an-official-asyncapi-ambassador"]') + .should('be.visible'); + cy.get('a[href="https://www.asyncapi.com/blog/asyncapi-ambassador-program"]') + .should('be.visible'); + +} + + verifyAmbassadorSocialLinks(name, links) { + + cy.contains('[data-testid="Ambassadors-members-details"]', name) + .closest('[data-testid="Ambassadors-members"]') + .within(() => { + if (links.twitter) cy.get(`a[href="${links.twitter}"]`).should('be.visible'); + if (links.github) cy.get(`a[href="${links.github}"]`).should('be.visible'); + if (links.linkedin) cy.get(`a[href="${links.linkedin}"]`).should('be.visible'); + }); + } +} + +export default AmbassadorsPage; diff --git a/cypress/pages/homepage.js b/cypress/pages/homepage.js index fdd8c45777e8..962c767ba67a 100644 --- a/cypress/pages/homepage.js +++ b/cypress/pages/homepage.js @@ -1,3 +1,5 @@ +import AmbassadorsPage from './ambassadors'; +import TSCPage from './tscpage'; import CaseStudiesPage from './CaseStudiesPage'; import DocsPage from './DocsPage'; import RoadmapPage from './RoadmapPage'; @@ -140,6 +142,16 @@ class HomePage { cy.contains('a', 'Roadmap').click(); return new RoadmapPage(); } + + goToTSCPage(){ + cy.visit('/community/tsc'); + return new TSCPage(); + } + + goToAmbassadorsPage() { + cy.visit('/community/ambassadors'); + return new AmbassadorsPage(); + } } -export default HomePage; +export default HomePage; \ No newline at end of file diff --git a/cypress/pages/slack.js b/cypress/pages/slack.js new file mode 100644 index 000000000000..3c8ebc361456 --- /dev/null +++ b/cypress/pages/slack.js @@ -0,0 +1,85 @@ +class SlackPage { + visitSlack() { + cy.visit( + 'https://asyncapi.slack.com/join/shared_invite/zt-3clk6rmc0-Cujl2fChHYnHDUwFKRlQCw#/shared-invite/email', + ); + } + + waitForPageLoad() { + cy.get('body', { timeout: 10000 }).should(($body) => { + const hasInactiveMessage = + $body.find('.p-refreshed_page__heading').length > 0; + const hasLoginButton = + $body.find('[data-qa="base_google_login_button"]').length > 0; + expect(hasInactiveMessage || hasLoginButton).to.be.true; + }); + } + + checkLinkStatus(callback) { + cy.get('body').then(($body) => { + const isInactive = + $body.find('.p-refreshed_page__heading').length > 0 && + $body.text().includes('This link is no longer active'); + callback(isInactive); + }); + } + + verifyInactiveLinkMessage() { + cy.get('.p-refreshed_page__heading') + .should('be.visible') + .and('have.text', 'This link is no longer active'); + } + + verifyAllLoginMethods() { + this.verifyGoogleLoginButton(); + this.verifyAppleLoginButton(); + this.verifyContinueWithEmail(); + } + + verifyAllFooterLinks() { + this.verifyPrivacyAndTerms(); + this.verifyContactUs(); + this.verifyChangeRegion(); + } + + verifyGoogleLoginButton() { + cy.get('[data-qa="base_google_login_button"]') + .should('be.visible') + .and('have.id', 'google_login_button') + .and('have.attr', 'type', 'button'); + } + + verifyAppleLoginButton() { + cy.get('[data-qa="base_apple_login_button"]') + .should('be.visible') + .and('have.id', 'apple_login_button') + .and('have.attr', 'href') + .and('include', 'slack.com/shared-invite/oauth/apple/start'); + } + + verifyContinueWithEmail() { + cy.get('[data-qa="join_with_email"]') + .should('be.visible') + .and('have.attr', 'type', 'button'); + } + + verifyPrivacyAndTerms() { + cy.get('[href="/legal"]') + .should('be.visible') + .and('have.attr', 'href', '/legal'); + } + + verifyContactUs() { + cy.get('[href="/help/requests/new"]') + .should('be.visible') + .and('have.attr', 'href', '/help/requests/new'); + } + + verifyChangeRegion() { + cy.get('a[href="#"]') + .should('be.visible') + .and('contain.text', 'Change region'); + } +} + +export default SlackPage; diff --git a/cypress/pages/tscpage.js b/cypress/pages/tscpage.js new file mode 100644 index 000000000000..c8554e440e4c --- /dev/null +++ b/cypress/pages/tscpage.js @@ -0,0 +1,39 @@ + +class TSCPage { + + + hoverCommunityLink() { + cy.get('[data-testid="NavItem-Link"]').contains('Community').trigger('mouseover'); + } + + fillNewsletterForm(name, email) { + cy.get('[data-testid="NewsletterSubscribe-text-input"]').type(name); + cy.get('[data-testid="NewsletterSubscribe-email-input"]').type(email); + } + + submitNewsletter() { + cy.get('[data-testid="Button-main"]').click(); + } + + getSuccessMessage() { + return cy.get('[data-testid="Paragraph-test"]').contains( + `You'll receive an email whenever someone requests the TSC to vote.` + ); + } + + getFailureMessage() { + return cy.get('[data-testid="Paragraph-test"]').contains(`Subscription failed, please let us know about it by submitting a bug`) + } + verifyMemberSocialLinks(name, links) { + cy.contains('[data-testid="UserInfo-name"]', name) + .closest('[data-testid="UserInfo-list"]') + .within(() => { + if (links.GitHub) cy.get(`a[href="${links.GitHub}"]`).should('be.visible'); + if (links.Twitter) cy.get(`a[href="${links.Twitter}"]`).should('be.visible'); + if (links.Linkedin) cy.get(`a[href="${links.Linkedin}"]`).should('be.visible'); + }); + } +} + +export default TSCPage; + diff --git a/cypress/slackworkspace.cy.js b/cypress/slackworkspace.cy.js new file mode 100644 index 000000000000..9b7f023e913c --- /dev/null +++ b/cypress/slackworkspace.cy.js @@ -0,0 +1,36 @@ +import SlackPage from './pages/slack'; + +describe('Slack workspace tests', () => { + const slackPage = new SlackPage(); + + beforeEach(() => { + slackPage.visitSlack(); + }); + + it('User can access all login methods', () => { + slackPage.waitForPageLoad(); + slackPage.checkLinkStatus((isInactive) => { + if (isInactive) { + slackPage.verifyInactiveLinkMessage(); + } else { + slackPage.verifyAllLoginMethods(); + } + }); + }); + + it('Should handle inactive Slack invite link gracefully', () => { + slackPage.checkLinkStatus((isInactive) => { + if (isInactive) { + slackPage.verifyInactiveLinkMessage(); + } + }); + }); + + it('User can view links for Privacy, Contact Us, and Region Change', () => { + slackPage.checkLinkStatus((isInactive) => { + if (!isInactive) { + slackPage.verifyAllFooterLinks(); + } + }); + }); +}); diff --git a/cypress/tscpage.cy.js b/cypress/tscpage.cy.js new file mode 100644 index 000000000000..4f551fbf2c3a --- /dev/null +++ b/cypress/tscpage.cy.js @@ -0,0 +1,81 @@ +import HomePage from './pages/homepage'; +import TSCPage from './pages/tscpage'; + +let homePage; +let tscpage; + +beforeEach(() => { + homePage = new HomePage(); + tscpage = new TSCPage(); + homePage.visit(); + homePage.goToTSCPage(); +}); + +describe('TSC Newsletter Subscription', () => { + it('should succeed in subscribing to the newsletter', () => { + tscpage.fillNewsletterForm('anushka', 'valid@example.com'); + tscpage.submitNewsletter(); + tscpage.getSuccessMessage().should('be.visible'); + }); + + it('should show correct failure message', () => { + tscpage.fillNewsletterForm('aditi', 'kerghjh@fhgj'); + tscpage.submitNewsletter(); + tscpage.getFailureMessage().should('be.visible'); + }); + + it('verifies key links on the TSC page', () => { + const linksToVerify = [ + { + href: 'https://github.com/asyncapi/community/blob/master/TSC_MEMBERSHIP.md', + label: 'Link', + }, + { + href: 'https://github.com/asyncapi/community/blob/master/CHARTER.md', + label: 'Open Governance Model', + }, + { + href: 'https://www.asyncapi.com/blog/governance-motivation', + label: 'this', + }, + ]; + + linksToVerify.forEach(({ href, label }) => { + cy.get(`a[href="${href}"]`).contains(label).should('be.visible'); + }); + }); + + it('verifies social links for selected TSC members', () => { + + const members = [ + { + name: 'Aishat Muibudeen', + links: { + GitHub: 'https://www.github.com/Mayaleeeee', + Twitter: 'https://www.twitter.com/maya_ux_ui', + Linkedin: 'https://www.linkedin.com/in/aishatmuibudeen' + } + }, + { + name: 'Khuda Dad Nomani', + links: { + GitHub: 'https://www.github.com/KhudaDad414', + Twitter: 'https://www.twitter.com/KhudaDadNomani', + Linkedin: 'https://www.linkedin.com/in/khudadadnomani' + } + }, + { + name: 'Lukasz Gornicki', + links: { + GitHub: 'https://www.github.com/derberg', + Twitter: 'https://www.twitter.com/derberq', + Linkedin: 'https://www.linkedin.com/in/lukasz-gornicki-a621914' + } + } + ]; + + members.forEach(({ name, links }) => { + tscpage.verifyMemberSocialLinks(name, links); + }); + }); +});