Skip to content

Commit

Permalink
Update formatting in test files
Browse files Browse the repository at this point in the history
  • Loading branch information
akshatnema committed Jul 18, 2023
1 parent 9ad0ca2 commit 5049edb
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 57 deletions.
40 changes: 21 additions & 19 deletions cypress/test/pages/community/ambassadors/index.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Test for Ambassadors', () => {
it('renders the ambassador list with correct data', () => {
ambassadorList.contents.forEach((link) => {
cy.get('[data-testid="Ambassadors-list"]')
.find(`img[alt="${ link.title }"]`)
.find(`img[alt="${link.title}"]`)
.should('exist')
.and('have.attr', 'src', link.icon);

Expand All @@ -34,6 +34,7 @@ describe('Test for Ambassadors', () => {
.should('exist');
});
});

it('renders the ambassadors with correct data', () => {
const asyncapiAmbassadors = sortBy(
ambassadors.map((user) => addAdditionalUserInfo(user)),
Expand All @@ -48,7 +49,7 @@ describe('Test for Ambassadors', () => {
.contains('div', ambassador.name)

cy.get('[data-testid="Ambassadors-members-img"]')
.find(`img[alt="${ ambassador.name }"]`)
.find(`img[alt="${ambassador.name}"]`)

.and('have.attr', 'src', ambassador.img);

Expand All @@ -58,36 +59,37 @@ describe('Test for Ambassadors', () => {
});

});

it('displays the Tokens of our appreciation section with correct data', () => {
cy.contains('Tokens of our appreciation').should('exist');

cy.contains('We appreciate your commitment and passion for sharing your knowledge with your communities. Let us support you!')
.should('exist');
.should('exist');

ambassadorList.tokens.forEach((token) => {
cy.contains('.mt-20 li', token.emoji).should('exist');
cy.contains('.mt-20 li', token.title).should('exist');
cy.contains('.mt-20 li', token.details).should('exist');
cy.contains('.mt-20 li', token.emoji).should('exist');
cy.contains('.mt-20 li', token.title).should('exist');
cy.contains('.mt-20 li', token.details).should('exist');
});
});
it('displays the Become an AsyncAPI Ambassador section with correct data', () => {
});

it('displays the Become an AsyncAPI Ambassador section with correct data', () => {
cy.contains('Become an AsyncAPI Ambassador').should('exist');

cy.contains('The AsyncAPI Ambassador program is now open for applications! If you’re selected, you’ll join AsyncAPI\'s mission of helping community members all over the world, build the future of Event-Driven APIs.')
.should('exist');
.should('exist');

cy.contains('Become an Ambassador now')
.should('have.attr', 'href', 'https://github.com/asyncapi/community/blob/master/AMBASSADOR_ORGANIZATION.md#are-you-interested-in-becoming-an-official-asyncapi-ambassador');
});
it('should display NewsletterSubscribe',()=>{
.should('have.attr', 'href', 'https://github.com/asyncapi/community/blob/master/AMBASSADOR_ORGANIZATION.md#are-you-interested-in-becoming-an-official-asyncapi-ambassador');
});

it('should display NewsletterSubscribe', () => {
cy.get('[data-testid="NewsletterSubscribe-main"]').should('exist');
cy.get('[data-testid="NewsletterSubscribe-text-input"]').type("name");
cy.get('[data-testid="NewsletterSubscribe-email-input"]').type("[email protected]")
cy.get('form[name="form 1"]').should('exist');
cy.get('input[name="type"]').should('exist');
cy.get('input[name="name"]').should('exist');
cy.get('input[name="email"]').should('exist');
});

});
});
32 changes: 13 additions & 19 deletions cypress/test/pages/community/dashboard.cy.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,28 @@
import MockApp from "../../../utils/mockApp";
import Home from "../../../../pages/community/dashboard";
import Header from "../../../../components/dashboard/Header";
import {mount } from '@cypress/react'
import { mount } from '@cypress/react'
describe('Integration Test for Dashboard ', () => {

it('should filter GoodFirstIssues and check dashboard render ', () => {

it('should filter GoodFirstIssues and check dashboard render ', () => {
mount(
<MockApp>
<Home />
<Home />
</MockApp>
);
);
// Click on the first filter option
cy.get(Header).should('exist')

cy.contains('AsyncAPI - Dashboard')

cy.get('[data-testid="Filters-img-container"]').click({force:true});

cy.get('[data-testid="Filters-img-container"]').click({ force: true });
cy.get('[data-testid="Filter-menu"]').within(() => {
cy.get('[data-testid="Select-form"]').eq(0).select('asyncapi/generator', { force: true });

cy.get('[data-testid="Select-form"]').eq(1).select('docs')
});
//check if selected is only displayed
cy.contains('asyncapi/generator');
cy.contains('docs')
//check if this is not selected options are not displayed
cy.should('not.contain','asyncapi/community');
cy.should('not.contain','javascript');
});

});
//check if selected is only displayed
cy.contains('asyncapi/generator');
cy.contains('docs')
//check if this is not selected options are not displayed
cy.should('not.contain', 'asyncapi/community');
cy.should('not.contain', 'javascript');
});
});
7 changes: 5 additions & 2 deletions cypress/test/pages/community/index.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ describe('CommunityIndexPage', () => {
cy.get('[data-testid="Card-heading-lg"]').should('exist');
cy.get('[data-testid="Card-desc-lg"]').should('exist');
cy.get(`[href="/community/dashboard"]`).should('exist');

});

it('should display the Newsroom Card', () => {
Expand All @@ -34,21 +33,24 @@ describe('CommunityIndexPage', () => {
cy.get('[data-testid="Card-desc-lg"]').should('exist');
cy.get('[href="/community/newsroom"]').should('exist');
});

it('should display the Toolings Card', () => {
cy.get('[data-testid="CommunityIndex-Toolings-Card"]').should('exist');
cy.get('[data-testid="Card-lg-tagline"]').should('exist')
cy.get('[data-testid="Card-heading-lg"]').should('exist')
cy.get('[data-testid="Card-desc-lg"]').should('exist')
cy.get('[href="/tools"]').should('exist');
});

it('should display other cards correctly', () => {
cy.get('[data-testid="CommunityCards-Goals"]').should('exist');
cy.get('[href="https://github.com/asyncapi/community/discussions/513"]').should('exist');
cy.get('[data-testid="CommunityCards-Contributors"]').should('exist');
cy.get('[href="https://github.com/orgs/asyncapi/discussions/593"]').should('exist');
cy.get('[data-testid="CommunityCards-TSC"]').should('exist');
cy.get('[href="/community/tsc"]').should('exist');
})
});

it('should display slack card ' ,() => {
cy.get('[data-testid="CommunityCards-Slack"]').should('exist');
cy.get('[data-testid="CommunityIndex-HomeCard"]').should('exist')
Expand All @@ -58,6 +60,7 @@ describe('CommunityIndexPage', () => {
cy.get('[data-testid="HomeCard-button"]').should('exist');
cy.get(".bg-channelCover").should('exist')
});

it('should display NewsletterSubscribe',()=>{
cy.get('[data-testid="CommunityCard-subscribe"]').should('exist');
cy.get('[data-testid="NewsletterSubscribe-main"]').should('exist');
Expand Down
34 changes: 17 additions & 17 deletions cypress/utils/MockApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ import MockRouter from "./router";

import Head from "next/head";

export default function MockApp({ children }) {
return (
<AppContext.Provider value={{ path: createRouter.asPath }}>
<Head>
<script async defer src="https://buttons.github.io/buttons.js"></script>
</Head>
<MDXProvider>
<AlgoliaSearch>
<div className="flex flex-col min-h-screen">
export default function MockApp({ children }) {
return (
<AppContext.Provider value={{ path: createRouter.asPath }}>
<Head>
<script async defer src="https://buttons.github.io/buttons.js"></script>
</Head>
<MDXProvider>
<AlgoliaSearch>
<div className="flex flex-col min-h-screen">
<MockRouter pathname="/">
<Layout> {children} </Layout>
</MockRouter>
</div>
</AlgoliaSearch>
</MDXProvider>
</AppContext.Provider>
)
}
<Layout> {children} </Layout>
</MockRouter>
</div>
</AlgoliaSearch>
</MDXProvider>
</AppContext.Provider>
)
}

0 comments on commit 5049edb

Please sign in to comment.