Skip to content
25 changes: 25 additions & 0 deletions cypress/dashboard.cy.js
Original file line number Diff line number Diff line change
@@ -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();
});
});
53 changes: 53 additions & 0 deletions cypress/events.cy.js
Original file line number Diff line number Diff line change
@@ -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 first 4 event cards match source data on All tab', () => {
events.verifyAllEventCards(4);
});

it('User switches to Upcoming tab and verifies first 3 event cards match source data', () => {
events.switchToUpcoming();
events.verifyUpcomingEventCards(3);
});

it('User switches to Recorded tab and verifies first 3 event cards match source data', () => {
events.switchToRecorded();
events.verifyRecordedEventCards(3);
});
});
62 changes: 62 additions & 0 deletions cypress/pages/dashboard.js
Original file line number Diff line number Diff line change
@@ -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;
147 changes: 147 additions & 0 deletions cypress/pages/events.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
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({ force: true });
}

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(count) {
cy.get('[data-testid="EventPostItem-main"]')
.should('have.length.at.least', count)
.each(($card, index) => {
if (index < count) {
cy.wrap($card)
.find('a[data-testid="EventPostItem-link"]')
.should('have.attr', 'href')
.and('match', /github\.com\/asyncapi\/community\/issues\/\d+/);
}
});
}

verifyAllEventCards(count) {
this.verifyEventCards(count);
}

switchToAll() {
this.switchToFilter('All');
}

switchToUpcoming() {
this.switchToFilter('Upcoming');
}

switchToRecorded() {
this.switchToFilter('Recorded');
}

verifyUpcomingEventCards(count) {
this.verifyEventCards(count);
}

verifyRecordedEventCards(count) {
this.verifyEventCards(count);
}

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;
Loading