Skip to content

Commit

Permalink
Merge branch 'main' into deleted-files
Browse files Browse the repository at this point in the history
  • Loading branch information
priyankarpal authored Oct 7, 2023
2 parents c57fa96 + 2035a96 commit 4822db4
Show file tree
Hide file tree
Showing 18 changed files with 76 additions and 54 deletions.
36 changes: 12 additions & 24 deletions cypress/e2e/homePage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,26 @@
/// <reference types="cypress" />
// / <reference types="cypress" />

import { CONTRIBUTORS_COUNT, TWEET_COUNT } from '../support/constant';
import { CONTRIBUTORS_COUNT, TESTIMONIALS_COUNT } from '../support/constant';

describe('Test home page', () => {
beforeEach(() => {
cy.intercept('POST', '**/v1/graphql').as('contribs');
cy.visit('/');
cy.wait('@contribs');
});

it('Header component should render properly', () => {
cy.get('[data-testid="app-header"]').should('be.visible');
cy.get('[data-testid="app-logo"]').should('be.visible');
cy.get('[data-testid="plays-search-box-container"]').should('not.exist');
cy.get('[data-testid="header-links-container"]').should('be.visible');
cy.get('[data-testid="browse-btn"]').should('be.visible').as('browseBtn');
cy.get('[data-testid="create-btn"]').should('be.visible');
cy.get('[data-testid="ideas-btn"]').should('be.visible');
cy.get('[data-testid="github-btn"]').should('be.visible');
cy.get('[data-testid="twitter-btn"]').should('be.visible');
cy.get('[data-testid="share-btn"]').should('be.visible');
cy.get('[data-testid="leaderboard-btn"]').should('be.visible');
cy.header();
});

cy.get('@browseBtn').click();
cy.get('[data-testid="plays-search-box-container"]').should('be.visible');
it('Testitomonials section should render and navigation must be clickable', () => {
cy.get('[data-testid="testimonials-section"]').scrollIntoView().should('be.visible');
cy.get('[data-testid="testimonials-swiper"]').scrollIntoView().should('be.visible');
});

it('Tweet section should render with all tweets', () => {
cy.intercept('GET', 'https://cdn.syndication.twimg.com/*').as('tweets');
cy.wait('@tweets');
cy.get('[data-testid="tweet-container"]').scrollIntoView().should('be.visible');
cy.get('[data-testid="tweet-container"] [id*="twitter-widget"]').should(
'have.length',
TWEET_COUNT
);
cy.get('[data-testid="watch-svg"]').should('not.exist');
it('Testitomonials should have a number of slides', () => {
cy.get('[data-testid="testimonials-swiper"]').scrollIntoView().should('be.visible');
cy.get('.swiper-slide').should('have.length', TESTIMONIALS_COUNT);
});

it('Contributors section should render with all contributors', () => {
Expand Down
11 changes: 11 additions & 0 deletions cypress/e2e/ideasPage.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// / <reference types="cypress" />

describe('Test play ideas page', () => {
beforeEach(() => {
cy.visit('/ideas');
});

it('Header component should render properly', () => {
cy.header();
});
});
11 changes: 11 additions & 0 deletions cypress/e2e/leaderboardPage.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// / <reference types="cypress" />

describe('Test leaderboard page', () => {
beforeEach(() => {
cy.visit('/leaderboard');
});

it('Header component should render properly', () => {
cy.header();
});
});
19 changes: 18 additions & 1 deletion cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// <reference types="cypress" />
// / <reference types="cypress" />
// ***********************************************
// This example commands.ts shows you how to
// create various custom commands and overwrite
Expand Down Expand Up @@ -35,3 +35,20 @@
// }
// }
// }

// methods
Cypress.Commands.add('header', () => {
cy.get('[data-testid="app-header"]').should('be.visible');
cy.get('[data-testid="app-logo"]').should('be.visible');
cy.get('[data-testid="plays-search-box-container"]').should('not.exist');
cy.get('[data-testid="header-links-container"]').should('be.visible');
cy.get('[data-testid="browse-btn"]').should('be.visible').as('browseBtn');
cy.get('[data-testid="create-btn"]').should('be.visible');
cy.get('[data-testid="ideas-btn"]').should('be.visible');
cy.get('[data-testid="github-btn"]').should('be.visible');
cy.get('[data-testid="twitter-btn"]').should('be.visible');
cy.get('[data-testid="share-btn"]').should('be.visible');
cy.get('[data-testid="leaderboard-btn"]').should('be.visible');
cy.get('@browseBtn').click();
cy.get('[data-testid="plays-search-box-container"]').should('be.visible');
});
2 changes: 1 addition & 1 deletion cypress/support/constant.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const TWEET_COUNT = 11;
export const TESTIMONIALS_COUNT = 9;
export const CONTRIBUTORS_COUNT = 29;
2 changes: 1 addition & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'App.css';
import './App.css';
import { Outlet } from 'react-router-dom';

function App() {
Expand Down
8 changes: 5 additions & 3 deletions src/common/home/Sponsors.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ const Sponsors = () => {
<h3>Event Partners</h3>
<div className="content">
<div className="partners-sponsors-grid">
{eventPartners.map((p) => (
{eventPartners.map((p, index) => (
<a
className="partners-sponsors-grid-item"
href={p.website}
key={index}
rel="noreferrer"
target="_blank"
>
Expand All @@ -72,10 +73,11 @@ const Sponsors = () => {
<h3>Event Sponsors</h3>
<div className="content">
<div className="partners-sponsors-grid">
{eventSponsors.map((s) => (
{eventSponsors.map((s, index) => (
<a
className="partners-sponsors-grid-item"
href={s.website}
key={index}
rel="noreferrer"
target="_blank"
>
Expand Down Expand Up @@ -142,7 +144,7 @@ const Sponsors = () => {
alignItems: 'center'
}}
>
{/* {primeSponsors.map((p) => (
{/* {primeSponsors.map((p,index) => (
<a className="prime-sponsors-grid-item" rel="noreferrer" target="_blank">
abcd
</a>
Expand Down
13 changes: 2 additions & 11 deletions src/common/search/FilterPlays.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,8 @@ const FilterPlays = ({ onChange, query }) => {
finalQueryObject[key] = res[key];
}
});
const final_query = { ...finalQueryObject };
const fianl_query_param = new URLSearchParams(finalQueryObject).toString();

if (fianl_query_param) {
setShowModal(false);
} else {
setShowModal(true);
}
if (onChange) {
onChange(final_query);
}
setShowModal(false);
onChange({ ...finalQueryObject });
};

const handleChange = (key, value) => {
Expand Down
4 changes: 2 additions & 2 deletions src/common/search/SearchBox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const SearchBox = ({ reset }) => {
const location = useLocation();
const navigate = useNavigate();
useEffect(() => {
const p_query = ParseQuery(location.search);
const p_query = ParseQuery(location.search) || {};
setQuery(p_query);
}, [location.pathname, location.search]);

Expand All @@ -22,7 +22,7 @@ export const SearchBox = ({ reset }) => {
};

const onClearFilter = () => {
setQuery(undefined);
setQuery({});
navigate(`/plays`);
};

Expand Down
12 changes: 7 additions & 5 deletions src/common/search/SearchPlays.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,21 @@ const SearchPlays = ({ reset, query, onChange }) => {
if (reset.search) {
resetSearchField();
}
const text = query && query.text ? query.text.split('+').join(' ') : '';
const text = query && query?.text ? query.text.split('+').join(' ') : '';

setSearchText(decodeURIComponent(text));
}, [query]);

const handleSearch = (event) => {
event.preventDefault();
const { value } = event.target;
if (event.key === 'Enter') {
query = query || {};
query.text = event.target.value;
if (onChange) {
onChange(query);
if (value) {
query.text = value;
} else {
delete query.text;
}
onChange(query);
}
};

Expand Down
4 changes: 2 additions & 2 deletions src/index.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import RouteDefs from 'common/routing/RouteDefs';
import { SearchContextProvider } from 'common/search/search-context';
import 'index.css';
import './index.css';
import React, { useState } from 'react';
import { createRoot } from 'react-dom/client';
import reportWebVitals from 'reportWebVitals';
import reportWebVitals from './reportWebVitals';
import register from './registerServiceWorker';
import ErrorBoundry from './ErrorBoundary/ErrorBoundary';
import Notification from 'common/components/Notification';
Expand Down
2 changes: 1 addition & 1 deletion src/plays/github-user-finder/components/ProfileCard.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { useResultContext } from '../context/ResultContext';
import { formatDate } from '../../../common/utils/commonUtils';
import { formatDate } from 'common/utils/commonUtils';

const ProfileCard = () => {
const { results } = useResultContext();
Expand Down
2 changes: 1 addition & 1 deletion src/plays/personal-profile-card/PersonalProfileCard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PlayHeader from 'common/playlists/PlayHeader';
import React, { useState, ChangeEvent, useEffect } from 'react';

import useLocalStorage from '../../common/hooks/useLocalStorage';
import useLocalStorage from 'common/hooks/useLocalStorage';
import ProfileType from './types';
import ProfileCard from './components/profile-card';
import ProfileForm from './components/profile-form';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useRef } from 'react';
import { FaQuoteLeft } from 'react-icons/fa';
import data from '../data';

const CardContainer = ({
gradientColor,
quote,
Expand Down
2 changes: 1 addition & 1 deletion src/plays/video-preview/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { formatDurationCount, formatViewCount } from '../../common/utils/formatCount';
import { formatDurationCount, formatViewCount } from 'common/utils/formatCount';
import { GoVerified } from 'react-icons/go';
import { VERIFIED_CHANNEL } from './utils/constants';

Expand Down

0 comments on commit 4822db4

Please sign in to comment.