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

EES-4996 Fix various test issues from data catalogue work #4874

Merged
merged 3 commits into from
May 21, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function UrlContainer({
id,
label = 'URL',
labelHidden = true,
testId,
testId = id,
url,
}: Props) {
return (
Expand Down
8 changes: 4 additions & 4 deletions src/explore-education-statistics-frontend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ if (process.env.APPINSIGHTS_INSTRUMENTATIONKEY) {

const cspConnectSrc = [
"'self'",
process.env.CONTENT_API_BASE_URL,
process.env.DATA_API_BASE_URL,
process.env.NOTIFICATION_API_BASE_URL,
process.env.PUBLIC_API_BASE_URL,
`${process.env.CONTENT_API_BASE_URL}/`,
`${process.env.DATA_API_BASE_URL}/`,
`${process.env.NOTIFICATION_API_BASE_URL}/`,
`${process.env.PUBLIC_API_BASE_URL}/`,
'https://*.googletagmanager.com',
'https://*.google-analytics.com',
'https://*.analytics.google.com',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from '@frontend/modules/data-catalogue/__data__/testDataSets';
import DataSetFileApiVersionHistory from '@frontend/modules/data-catalogue/components/DataSetFileApiVersionHistory';
import _apiDataSetService from '@frontend/services/apiDataSetService';
import { screen, waitFor, within } from '@testing-library/react';
import { screen, within } from '@testing-library/react';
import { times } from 'lodash';
import { MemoryRouterProvider } from 'next-router-mock/MemoryRouterProvider';
import React, { ReactElement } from 'react';
Expand All @@ -31,7 +31,9 @@ describe('DataSetFileApiVersionHistory', () => {
screen.getByRole('heading', { name: 'API data set version history' }),
).toBeInTheDocument();

const table = within(await screen.findByRole('table'));
expect(await screen.findByText('Version')).toBeInTheDocument();

const table = within(screen.getByRole('table'));

const rows = table.getAllByRole('row');
expect(rows).toHaveLength(4);
Expand Down Expand Up @@ -81,7 +83,9 @@ describe('DataSetFileApiVersionHistory', () => {
/>,
);

const table = within(await screen.findByRole('table'));
expect(await screen.findByText('Version')).toBeInTheDocument();

const table = within(screen.getByRole('table'));

const rows = table.getAllByRole('row');
expect(rows).toHaveLength(4);
Expand Down Expand Up @@ -130,7 +134,9 @@ describe('DataSetFileApiVersionHistory', () => {
/>,
);

let table = within(await screen.findByRole('table'));
expect(await screen.findByText('Version')).toBeInTheDocument();

let table = within(screen.getByRole('table'));

let rows = table.getAllByRole('row');
expect(rows).toHaveLength(4);
Expand All @@ -148,7 +154,7 @@ describe('DataSetFileApiVersionHistory', () => {
expect(within(rows[3]).getByText('2.0 (current)')).toBeInTheDocument();

const pagination = within(
await screen.findByRole('navigation', {
screen.getByRole('navigation', {
name: 'Version history pagination',
}),
);
Expand All @@ -170,9 +176,7 @@ describe('DataSetFileApiVersionHistory', () => {

await user.click(pagination.getByRole('link', { name: 'Next page' }));

await waitFor(() => {
expect(screen.getByText('1.1')).toBeInTheDocument();
});
expect(await screen.findByText('1.1')).toBeInTheDocument();

table = within(screen.getByRole('table'));

Expand Down