-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
test: add e2e tests for tsc, slack and ambassadors page #4244
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
Changes from all commits
c111ab4
f7f8e6e
b40bada
d408d53
279a97f
90bea84
3200b51
21f89ca
f276e0b
6219990
f749d19
47a54aa
1e16720
d3bcbf7
0e1d14c
7a15871
ca73a27
f703eec
7353b76
7196dc4
4921a24
82bf898
cba1570
edb7441
bcfb24b
c896f11
d1e8b85
71e6594
94895ff
c995f7b
8b050f2
9a05884
9c3f1da
a2b3ac8
ef803c3
ef011a3
ed48dab
df1743a
2dba8a6
ffe4155
4c6fb52
70b287e
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,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); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| 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"]' | ||
|
Member
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. The same goes for this as well—please create a separate JSON file that contains all the Markdown files. As you may be aware, we recently went through a major restructuring of the docs in the community repo, and we are still updating links on the website even now. The reason is the same: everywhere we needed those links, they were hardcoded. Instead, we should have a single source of truth, which will make it much easier to update things in the future. |
||
| ) | ||
| .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"]') | ||
| .scrollIntoView() | ||
| .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; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| class SlackPage { | ||
| visitSlack() { | ||
| cy.visit( | ||
| 'https://asyncapi.slack.com/join/shared_invite/zt-3clk6rmc0-Cujl2fChHYnHDUwFKRlQCw#/shared-invite/email', | ||
|
Member
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. Umm, if I’m not wrong, this is the Slack invite link. Don’t you think this link keeps changing? Could you replace it with the current source we have, so we can maintain a single source of truth here? |
||
| ); | ||
| } | ||
|
|
||
| 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; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| 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`); | ||
| } | ||
| verifyTSCMemberSocialLinks(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; | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import SlackPage from './pages/slack'; | ||
|
|
||
| describe('Slack workspace tests', () => { | ||
| const slackPage = new SlackPage(); | ||
|
|
||
| beforeEach(() => { | ||
| slackPage.visitSlack(); | ||
| }); | ||
|
|
||
| it('Should show all login methods when the Slack invite link is active', () => { | ||
| cy.get('body').then(($body) => { | ||
| const isInactive = | ||
| $body.find('.p-refreshed_page__heading').length > 0 && | ||
| $body.text().includes('This link is no longer active'); | ||
|
|
||
| if (!isInactive) { | ||
| slackPage.verifyGoogleLoginButton(); | ||
| slackPage.verifyAppleLoginButton(); | ||
| slackPage.verifyContinueWithEmail(); | ||
| } else { | ||
| cy.log('Slack invite link is inactive - skipping login method tests'); | ||
| expect(isInactive).to.be.true; | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| it('Should show links for Privacy, Contact Us, and Region Change', () => { | ||
| slackPage.verifyPrivacyAndTerms(); | ||
| slackPage.verifyContactUs(); | ||
| slackPage.verifyChangeRegion(); | ||
| }); | ||
|
|
||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| 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 Page', () => { | ||
| 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', () => { | ||
princerajpoot20 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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'); | ||
| }); | ||
| }); | ||
|
Comment on lines
+29
to
+46
Member
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. As I mentioned before, please extract these out. |
||
|
|
||
| it('verifies social links for selected TSC members', () => { | ||
anushkaaaaaaaa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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' | ||
| } | ||
| } | ||
| ]; | ||
|
Comment on lines
+50
to
+74
Member
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. Hmm… as mentioned above, please move this hardcoded data out of the test file. |
||
|
|
||
| members.forEach(({ name, links }) => { | ||
| tscpage.verifyTSCMemberSocialLinks(name, links); | ||
| }); | ||
| }); | ||
| }); | ||
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.
Can you please extract this data into a JSON file?