-
-
Notifications
You must be signed in to change notification settings - Fork 996
test: add e2e tests for dashboard and events pages #4548
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
Open
anushkaaaaaaaa
wants to merge
8
commits into
asyncapi:master
Choose a base branch
from
anushkaaaaaaaa:dashboard-and-events
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+286
−0
Open
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
951e5af
test: add Events Page class and tests
anushkaaaaaaaa 3918299
Test: add Dashboard Page class and tests
anushkaaaaaaaa 0b04fa6
Merge branch 'master' into dashboard-and-events
anushkaaaaaaaa c513668
refactor: consolidate event card verification methods
anushkaaaaaaaa b5f8e1c
test: update event card verification to check for at least one card a…
anushkaaaaaaaa 6760dc8
test: update event card verification methods to ensure valid links ac…
anushkaaaaaaaa 656e1fb
Merge branch 'master' into dashboard-and-events
anushkaaaaaaaa 89b7fad
Merge branch 'master' into dashboard-and-events
anushkaaaaaaaa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.