Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions cypress/ambassadors.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
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: 'Giri Venkatesan',
links: {
github: 'https://www.github.com/gvensan',
twitter: 'https://www.twitter.com/giri_venkatesan',
linkedin: 'https://www.linkedin.com/in/girivenkatesan'
}
},
{
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);
});
});
});
67 changes: 67 additions & 0 deletions cypress/blogpage.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import BlogPage from './pages/BlogPage';

describe('Blog Page Tests', () => {
const blog = new BlogPage();

beforeEach(() => {
blog.visit();
});

it('Navigation to blog page and verification of header', () => {
blog.verifyHeader();
});

it('Verification of submit blog post link', () => {
blog.verifySubmitLink();
});

it('Verification of RSS feed link and image', () => {
blog.verifyRSSLink();
blog.verifyRSSImage();
});

it('Verification of clear filters button', () => {
blog.filterByType('Strategy');
blog.verifyClearFiltersButton();
blog.clickClearFilters();
blog.verifyNoFilterButton();
});

it('Verification of filtered posts', () => {
blog.filterByType('Engineering');
blog.verifyFilteredPostsVisible();
});

it('Verification of specific post link, and checking post header', () => {
blog.filterByType('Communication');
blog.verifyPostLinkAndClick(
/How TransferGo Adopted AsyncAPI/i,
'/blog/transfergo-asyncapi-story',
);
blog.verifyPostHeader('How TransferGo adopted AsyncAPI');
});

it('Verification of filters by author and checking filtered posts appear', () => {
blog.filterByFirstAvailableAuthor();
blog.verifyFilteredPostsVisible();
});

it('Verification of filters by author, clicking a post, and verifying post detail page loads', () => {
blog.filterByFirstAvailableAuthor();
blog.verifyFilteredPostsVisible();
blog.clickFirstVisiblePost();
blog.verifyPostDetailPageLoaded();
});

it('Verification of filters by tag and checking filtered posts appear', () => {
blog.filterByFirstAvailableTag();
blog.verifyFilteredPostsVisible();
});

it('Verification of filters by tag, clicking a post, and verifying post detail page loads', () => {
blog.filterByFirstAvailableTag();
blog.verifyFilteredPostsVisible();
blog.clickFirstVisiblePost();
blog.verifyPostDetailPageLoaded();
});
});
104 changes: 104 additions & 0 deletions cypress/pages/BlogPage.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,110 @@
class BlogPage {
visit() {
cy.visit('/blog');
}

verifyPageLoaded() {
cy.contains('h1', 'Welcome to our blog!').should('be.visible');
}

verifyHeader() {
cy.contains('h1', 'Welcome to our blog!').should('be.visible');
}

verifySubmitLink() {
cy.contains('a', 'Submit yours!')
.should('be.visible')
.and('have.attr', 'href')
.and(
'include',
'github.com/asyncapi/website/issues/new?template=blog.md',
);
}

verifyRSSLink() {
cy.contains('a', 'RSS Feed')
.should('be.visible')
.and('have.attr', 'href', '/rss.xml');
}

verifyRSSImage() {
cy.get('img[alt="RSS feed"]')
.should('be.visible')
.and('have.attr', 'src', '/img/logos/rss.svg');
}

verifyFilteredPostsVisible() {
cy.get('[data-testid="BlogPostItem-Link"]', { timeout: 10000 }).should(
'have.length.greaterThan',
0,
);
}

verifyClearFiltersButton() {
cy.contains('button', 'Clear filters').should('be.visible');
}

clickClearFilters() {
cy.contains('button', 'Clear filters').click();
}

verifyNoFilterButton() {
cy.contains('button', 'Clear filters').should('not.exist');
}

filterByType(type) {
cy.contains('select', 'Filter by type').select(type);
}

filterByAuthor(author) {
cy.contains('select', 'Filter by authors').select(author);
}

filterByTag(tag) {
cy.contains('select', 'Filter by tags').select(tag);
}

verifyPostLinkAndClick(titlePattern, expectedHref) {
cy.contains('h5', titlePattern)
.closest('a')
.should('have.attr', 'href', expectedHref)
.click();
}

verifyPostHeader(expectedHeaderText) {
cy.get('[data-testid="BlogLayout-main"]')
.should('be.visible')
.and('contain', expectedHeaderText);
}

filterByFirstAvailableAuthor() {
cy.get('[data-testid="BlogPostItem-Link"]', { timeout: 10000 }).should('have.length.greaterThan', 0);
cy.contains('select', 'Filter by authors').find('option', { timeout: 10000 }).should('have.length.greaterThan', 1);
cy.contains('select', 'Filter by authors').find('option').then(($options) => {
const nonEmptyOptions = [...$options].filter(opt => opt.value && opt.value !== '');
expect(nonEmptyOptions.length, 'No author filter options available').to.be.greaterThan(0);
cy.contains('select', 'Filter by authors').select(nonEmptyOptions[0].value);
});
}

filterByFirstAvailableTag() {
cy.get('[data-testid="BlogPostItem-Link"]', { timeout: 10000 }).should('have.length.greaterThan', 0);
cy.contains('select', 'Filter by tags').find('option', { timeout: 10000 }).should('have.length.greaterThan', 1);
cy.contains('select', 'Filter by tags').find('option').then(($options) => {
const nonEmptyOptions = [...$options].filter(opt => opt.value && opt.value !== '');
expect(nonEmptyOptions.length, 'No tag filter options available').to.be.greaterThan(0);
cy.contains('select', 'Filter by tags').select(nonEmptyOptions[0].value);
});
}

clickFirstVisiblePost() {
cy.get('[data-testid="BlogPostItem-Link"]').first().click();
}

verifyPostDetailPageLoaded() {
cy.get('[data-testid="BlogLayout-main"]').should('be.visible');
cy.url().should('include', '/blog/');
}
}

export default BlogPage;
29 changes: 29 additions & 0 deletions cypress/pages/ambassadors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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://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;
12 changes: 12 additions & 0 deletions cypress/pages/homepage.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import AmbassadorsPage from './ambassadors';
import TSCPage from './tscpage';
import CaseStudiesPage from './CaseStudiesPage';
import DocsPage from './DocsPage';
import RoadmapPage from './RoadmapPage';
Expand Down Expand Up @@ -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;
85 changes: 85 additions & 0 deletions cypress/pages/slack.js
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',
);
}

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