Skip to content

Commit

Permalink
fix (tests) : broken unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
amosmachora committed Nov 27, 2024
1 parent 205f208 commit 734e2bd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions e2e/specs/billing/billling-history.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test } from '../../core';
import { expect } from '@playwright/test';
import { HomePage, BillingPage } from '../../pages';
import { test } from '../../core';
import { BillingPage, HomePage } from '../../pages';

test('Accessing the Billing page dashboard from home', async ({ page }) => {
const homePage = new HomePage(page);
Expand All @@ -15,10 +15,10 @@ test('Accessing the Billing page dashboard from home', async ({ page }) => {
await expect(page).toHaveURL(`${process.env.E2E_BASE_URL}/spa/home/billing`);
});

await test.step('Then should be able to view Cumulative, Pending and Paid bills', async () => {
await expect(page.getByRole('heading', { name: 'Cumulative Bills' })).toBeVisible();
await expect(page.getByRole('heading', { name: 'Pending Bills' })).toBeVisible();
await expect(page.getByRole('heading', { name: 'Paid Bills' })).toBeVisible();
await test.step('Then should be able to view Total, Pending and Paid bills', async () => {
await expect(page.getByRole('heading', { name: `Today's Total Bills` })).toBeVisible();
await expect(page.getByRole('heading', { name: `Today's Paid Bills` })).toBeVisible();
await expect(page.getByRole('heading', { name: `Today's Pending Bills` })).toBeVisible();
});
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import MetricsCards from './metrics-cards.component';
import { useBills } from '../billing.resource';
import React from 'react';
import { billsSummary } from '../../../../__mocks__/bills.mock';
import { useBills } from '../billing.resource';
import MetricsCards from './metrics-cards.component';

const mockUseBills = useBills as jest.Mock;

Expand Down Expand Up @@ -30,9 +30,9 @@ describe('MetricsCards', () => {
test('renders metrics cards', () => {
mockUseBills.mockReturnValue({ isLoading: false, bills: billsSummary, error: null });
renderMetricsCards();
expect(screen.getByText('Cumulative Bills')).toBeInTheDocument();
expect(screen.getByText('Pending Bills')).toBeInTheDocument();
expect(screen.getByText('Paid Bills')).toBeInTheDocument();
expect(screen.getByText(`Today's Total Bills`)).toBeInTheDocument();
expect(screen.getByText(`Today's Paid Bills`)).toBeInTheDocument();
expect(screen.getByText(`Today's Pending Bills`)).toBeInTheDocument();
});
});

Expand Down

0 comments on commit 734e2bd

Please sign in to comment.