diff --git a/cypress/dashboard.cy.js b/cypress/dashboard.cy.js new file mode 100644 index 000000000000..cc849ed84670 --- /dev/null +++ b/cypress/dashboard.cy.js @@ -0,0 +1,25 @@ +import DashboardPage from './pages/dashboard'; + +describe('Dashboard Page Tests', () => { + const dashboard = new DashboardPage(); + + beforeEach(() => { + dashboard.visit(); + }); + + it('User navigates to the dashboard and verifies header', () => { + dashboard.verifyHeader(); + }); + + it('User verifies Hot Topics section', () => { + dashboard.verifyHotTopicsSection(); + }); + + it('User verifies Good First Issues section', () => { + dashboard.verifyGoodFirstIssuesSection(); + }); + + it('User verifies all header links point to correct URLs from source', () => { + dashboard.verifyHeaderLinks(); + }); +}); diff --git a/cypress/events.cy.js b/cypress/events.cy.js new file mode 100644 index 000000000000..d58932e06ddf --- /dev/null +++ b/cypress/events.cy.js @@ -0,0 +1,53 @@ +import EventsPage from './pages/events'; + +describe('Events Page Tests', () => { + const events = new EventsPage(); + + beforeEach(() => { + events.visit(); + }); + + it('User navigates to the events page and verifies main sections and action buttons', () => { + events.verifyMainVisible(); + events.verifyActionButtons(); + }); + + it('User verifies Google Calendar and ICS file button links', () => { + events.verifyEventButtonsLinks(); + }); + + it('User verifies recordings section with correct link', () => { + events.verifyRecordingsSection(); + events.verifyRecordingsLinkHref(); + }); + + it('User verifies all event recording links from source', () => { + events.verifyEventRecordingLinks(); + }); + + it('User verifies event types section', () => { + events.verifyEventTypes(); + }); + + it('User verifies FAQ link points to correct documentation', () => { + events.verifyFaqLink(); + }); + + it('User verifies all host profile links', () => { + events.verifyHostLinks(); + }); + + it('User verifies event cards have valid links on All tab', () => { + events.verifyAllEventCards(); + }); + + it('User switches to Upcoming tab and verifies event cards have valid links', () => { + events.switchToUpcoming(); + events.verifyUpcomingEventCards(); + }); + + it('User switches to Recorded tab and verifies event cards have valid links', () => { + events.switchToRecorded(); + events.verifyRecordedEventCards(); + }); +}); diff --git a/cypress/pages/dashboard.js b/cypress/pages/dashboard.js new file mode 100644 index 000000000000..3f85e9a851b4 --- /dev/null +++ b/cypress/pages/dashboard.js @@ -0,0 +1,62 @@ +class DashboardPage { + visit() { + cy.visit('/community/dashboard'); + } + + verifyElementIsVisible(selector) { + cy.get(selector).should('be.visible'); + } + + verifyTextVisible(text) { + cy.contains(text).should('be.visible'); + } + + verifyHeader() { + this.verifyElementIsVisible('[data-testid="Header-heading"]'); + } + + verifyGoodFirstIssuesSection() { + this.verifyTextVisible('Good First Issues'); + } + + verifyHotTopicsSection() { + this.verifyTextVisible('Hot Topics'); + } + + verifyElementHasAttribute(selector, attribute, value) { + cy.get(selector).should('have.attr', attribute, value); + } + + verifyLinkWithText(selector, text, expectedHrefPart) { + cy.contains(selector, text) + .should('be.visible') + .and('have.attr', 'href') + .and('include', expectedHrefPart); + } + + verifyHeaderLinks() { + this.verifyLinkWithText( + '[data-testid="Button-link"]', + 'Contribution Guide', + 'github.com/asyncapi', + ); + + cy.contains('[data-testid="Button-link"]', 'Contribution Guide') + .should('have.attr', 'href') + .and('include', 'type=source'); + + this.verifyLinkWithText( + '[data-testid="Button-link"]', + 'View on Github', + 'github.com/asyncapi', + ); + + this.verifyLinkWithText( + '[data-testid="Button-link"]', + 'Join on Slack', + 'slack-invite', + ); + } +} + +export default DashboardPage; diff --git a/cypress/pages/events.js b/cypress/pages/events.js new file mode 100644 index 000000000000..6b44fa398a98 --- /dev/null +++ b/cypress/pages/events.js @@ -0,0 +1,146 @@ +class EventsPage { + visit() { + cy.visit('/community/events'); + } + + verifyElementIsVisible(selector) { + cy.get(selector).should('be.visible'); + } + + verifyMainVisible() { + this.verifyElementIsVisible('[data-testid="Events-main"]'); + } + + verifyActionButtons() { + this.verifyElementIsVisible('[data-testid="Events-Button"]'); + } + + verifyRecordingsSection() { + this.verifyElementIsVisible('[data-testid="Recordings-Link"]'); + this.verifyElementIsVisible('[data-testid="RecordingsCard-img"]'); + } + + verifyEventTypes() { + this.verifyElementIsVisible('[data-testid="EventTypesCard"]'); + this.verifyElementIsVisible('[data-testid="EventTypesCard-others"]'); + this.verifyElementIsVisible('[data-testid="CommunityMeeting-Card"]'); + } + + switchToFilter(label) { + cy.get('[data-testid="EventFilters-main"]') + .contains( + '[data-testid="EventFilter-click"]', + new RegExp(`^${label}$`, 'i'), + ) + .click(); + cy.wait(500); + } + + verifyEventCardLinkByTitleAndHref(title, href, metaText) { + if (metaText) { + cy.contains('[data-testid="Event-span"]', metaText) + .parents('[data-testid="EventPostItem-main"]') + .within(() => { + cy.contains('h3', title).should('exist'); + cy.get('a[data-testid="EventPostItem-link"]').should( + 'have.attr', + 'href', + href, + ); + }); + } else { + cy.contains('[data-testid="EventPostItem-main"]', title) + .find('a[data-testid="EventPostItem-link"]') + .should('have.attr', 'href', href); + } + } + + verifyEventCardHrefByIndex(index, expectedHref) { + cy.get('[data-testid="EventPostItem-main"]') + .eq(index) + .find('a[data-testid="EventPostItem-link"]') + .should('have.attr', 'href', expectedHref); + } + + verifyEventCards() { + cy.get('[data-testid="EventPostItem-main"]') + .should('have.length.greaterThan', 0) + .each(($card) => { + cy.wrap($card) + .find('a[data-testid="EventPostItem-link"]') + .should('have.attr', 'href') + .and('match', /github\.com\/asyncapi\/community\/issues\/\d+/); + }); + } + + verifyAllEventCards() { + this.verifyEventCards(); + } + + switchToAll() { + this.switchToFilter('All'); + } + + switchToUpcoming() { + this.switchToFilter('Upcoming'); + } + + switchToRecorded() { + this.switchToFilter('Recorded'); + } + + verifyUpcomingEventCards() { + this.verifyEventCards(); + } + + verifyRecordedEventCards() { + this.verifyEventCards(); + } + + verifyEventButtonsLinks() { + cy.get('[data-testid="Events-Button"] a[data-testid="Button-link"]') + .eq(0) + .should('be.visible') + .and('have.attr', 'href') + .and('include', 'calendar.google.com'); + + cy.get('[data-testid="Events-Button"] a[data-testid="Button-link"]') + .eq(1) + .should('be.visible') + .and('have.attr', 'href') + .and('include', 'calendar.google.com/calendar/ical'); + } + + verifyFaqLink() { + cy.contains('a', 'read our FAQ') + .should('be.visible') + .and('have.attr', 'href') + .and('include', 'MEETINGS_ORGANIZATION.md'); + } + + verifyRecordingsLinkHref() { + cy.get('[data-testid="Recordings-Link"]') + .should('have.attr', 'href') + .and('include', 'playlist?list='); + } + + verifyEventRecordingLinks() { + cy.get('a[data-testid="Meeting-link"]') + .should('have.length.greaterThan', 0) + .each(($link) => { + cy.wrap($link) + .should('have.attr', 'href') + .and('match', /youtube\.com|youtu\.be/); + }); + } + + verifyHostLinks() { + cy.get('a[data-testid="TextLink-href"]') + .should('have.length.greaterThan', 0) + .each(($link) => { + cy.wrap($link).should('have.attr', 'href'); + }); + } +} + +export default EventsPage;