Skip to content
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

feat/favourite-activity-test-created #544

Merged
merged 16 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from 12 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
134 changes: 134 additions & 0 deletions frontend/cypress/e2e/smoke-test/dashboard-page.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { NavigationLabels } from '../../utils/labels';
import prefix from '../../../src/styles/classPrefix';

describe('Dashboard page test', () => {
let dashboardPageData: {
Expand Down Expand Up @@ -29,4 +30,137 @@ describe('Dashboard page test', () => {
.find('.recent-activity-subtitle')
.should('have.text', dashboardPageData.secondSectionSubtitle);
});

it('seedlots favourite activity is working properly', () => {
// Navigate to Seedlot page
cy.navigateTo(NavigationLabels.Seedlots);
// Favourite Seedlot page
cy.get('.title-favourite')
.find(`.${prefix}--popover-container`)
.click();
// Navigate to Dashboard page
cy.navigateTo(NavigationLabels.Dashboard);
// Check if seedlot card is appearing at favourites activities
cy.get('.favourite-activities-cards')
.find('.fav-card-content')
.find('.fav-card-title-large')
.contains('Seedlots')
.click();
cy.isPageTitle(NavigationLabels.Seedlots);
});

it('a class seedlot favourite activity is working properly', () => {
// Navigate to Seedlot page
cy.navigateTo(NavigationLabels.Seedlots);

// Favourite A class Seedlot page
cy.get('.seedlot-activities-cards')
.find('.std-card-title')
.contains('Register an A class seedlot')
.click();
cy.get('.title-favourite')
.find(`.${prefix}--popover-container`)
.click();

// Navigate to Dashboard page
cy.navigateTo(NavigationLabels.Dashboard);

// Check if Create A Class Seedlot card is appearing at favourites activities
cy.get('.favourite-activities-cards')
.find('.fav-card-content')
.find('.fav-card-title-large')
.contains('Create A class seedlot')
.click();

cy.isPageTitle('Create A class seedlot');
});

it('my Seedlots favourite activity is working properly', () => {
// Navigate to My seedlot page
cy.navigateTo(NavigationLabels.Seedlots);
cy.get('.seedlot-activities-cards')
.find('.std-card-title')
.contains('My seedlots')
.click();

// Favourite My Seedlot page
cy.get('.title-favourite')
.find(`.${prefix}--popover-container`)
.click();

// Navigate to Dashboard page
cy.navigateTo(NavigationLabels.Dashboard);

// Check if My Seedlot card is appearing at favourites activities
// and if redirects to the correct page
cy.get('.favourite-activities-cards')
.find('.fav-card-content')
.find('.fav-card-title-large')
.contains('My Seedlots')
.click();

cy.isPageTitle('My Seedlots');
});

it('highlight favourite activity is working', () => {
// Highlight Seedlots Card
cy.get('.favourite-activities-cards')
.find('.fav-card-main:first')
.find('.fav-card-overflow')
.click();
cy.get(`.${prefix}--overflow-menu-options__option-content:first`)
.click();

// Check if the Seedlots card is unique and highlighted
cy.get('.fav-card-main-highlighted')
.should('have.length', 1)
.should('contain.text', 'Seedlots');

// Highlight Create A Class Seedlot card
cy.get('.favourite-activities-cards')
.find('.fav-card-main:first')
.find('.fav-card-overflow')
.click();
cy.get(`.${prefix}--overflow-menu-options__option-content:first`)
.click();

// Check if the Create A Class Seedlot card is unique and highlighted
cy.get('.fav-card-main-highlighted')
.should('have.length', 1)
.should('contain.text', 'Create A class seedlot');
});

it('check if delete seedlots favourite card is working', () => {
// Delete Seedlots card
cy.get('.favourite-activities-cards')
.find('.fav-card-main:first')
.find('.fav-card-overflow')
.click();
cy.get(`.${prefix}--overflow-menu-options__option-content:last`)
.click();
ArthurEncr marked this conversation as resolved.
Show resolved Hide resolved
});

it('check if delete create a class seedlot favourite card is working', () => {
// Delete Create A Class Seedlot card
cy.get('.fav-card-main-highlighted')
.find('.fav-card-overflow')
.click();
cy.get(`.${prefix}--overflow-menu-options__option-content:last`)
.click();
});

it('check if delete my seedlots favourite card is working', () => {
// Delete my seedlots card
cy.get('.favourite-activities-cards')
.find('.fav-card-main:first')
.find('.fav-card-overflow')
.click();
cy.get(`.${prefix}--overflow-menu-options__option-content:last`)
.click();
});

it('check if the empty section is correctly appearing', () => {
cy.get('.empty-section-title')
.should('contain.text', "You don't have any favourites to show yet!");
});
});
3 changes: 2 additions & 1 deletion frontend/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { AuthProvider } from './contexts/AuthContext';
import { ThemePreference } from './utils/ThemePreference';
import { env } from './env';
import makeServer from './mock-server/server';
import prefix from './styles/classPrefix';

const appVersion: string = env.VITE_NRSPARWEBAPP_VERSION || 'dev';

Expand Down Expand Up @@ -39,7 +40,7 @@ const root = ReactDOM.createRoot(
root.render(
<AuthProvider>
<React.StrictMode>
<ClassPrefix prefix="bx">
<ClassPrefix prefix={prefix}>
<ThemePreference>
<QueryClientProvider client={queryClient}>
<App />
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/styles/classPrefix.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const prefix = 'bx';

export default prefix;
Loading