From a2b0626702ce9aaab37931e43177f7575531560b Mon Sep 17 00:00:00 2001 From: Stuart Bennett Date: Wed, 11 Dec 2024 16:04:00 +0000 Subject: [PATCH 1/8] EES-5544 implement data file table --- .../components/DataFilesTable.module.scss | 22 ++ .../data/components/DataFilesTable.tsx | 219 ++++++++++++++++++ .../data/components/ImporterStatus.tsx | 4 +- .../components/ReleaseDataUploadsSection.tsx | 207 ++--------------- .../src/components/Tag.module.scss | 1 + 5 files changed, 268 insertions(+), 185 deletions(-) create mode 100644 src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.module.scss create mode 100644 src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.tsx diff --git a/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.module.scss b/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.module.scss new file mode 100644 index 00000000000..78e4ca7c7d5 --- /dev/null +++ b/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.module.scss @@ -0,0 +1,22 @@ +@import '~govuk-frontend/dist/govuk/base'; + +.table { + td { + padding-bottom: govuk-spacing(2); + padding-top: govuk-spacing(2); + vertical-align: middle; + } + + .fileSize { + width: 5rem; + text-align: right; + } + + .fileStatus { + max-width: 164px; + } + + .actions { + margin-bottom: 0; + } +} diff --git a/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.tsx b/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.tsx new file mode 100644 index 00000000000..3f96a737cec --- /dev/null +++ b/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.tsx @@ -0,0 +1,219 @@ +import Link from '@admin/components/Link'; +import DataFileDetailsTable from '@admin/pages/release/data/components/DataFileDetailsTable'; +import DataUploadCancelButton from '@admin/pages/release/data/components/DataUploadCancelButton'; +import ImporterStatus, { + terminalImportStatuses, +} from '@admin/pages/release/data/components/ImporterStatus'; +import { + releaseApiDataSetDetailsRoute, + releaseDataFileReplaceRoute, + ReleaseDataFileReplaceRouteParams, + releaseDataFileRoute, + ReleaseDataFileRouteParams, + ReleaseDataSetRouteParams, +} from '@admin/routes/releaseRoutes'; +import { + DataFile, + DataFileImportStatus, +} from '@admin/services/releaseDataFileService'; +import ButtonGroup from '@common/components/ButtonGroup'; +import ButtonText from '@common/components/ButtonText'; +import Modal from '@common/components/Modal'; +import { generatePath } from 'react-router'; +import React from 'react'; +import styles from './DataFilesTable.module.scss'; + +interface Props { + dataFiles: DataFile[]; + publicationId: string; + releaseId: string; + canUpdateRelease?: boolean; + handleDeleteFile: (dataFile: DataFile) => Promise; + handleStatusChange: ( + dataFile: DataFile, + { totalRows, status }: DataFileImportStatus, + ) => Promise; +} + +const DataFilesTable = ({ + dataFiles, + publicationId, + releaseId, + canUpdateRelease, + handleDeleteFile, + handleStatusChange, +}: Props) => { + return ( + <> +

Uploaded data files

+ + + + + + {/* */} + + {/* */} + {/* + */} + + + + + + {dataFiles.map(dataFile => ( + + + + {/* */} + + {/* */} + {/* */} + + + ))} + +
Subject titleSizeRowsStatusUploaded byDate uploadedActions
{dataFile.title} + {dataFile.fileSize.size.toLocaleString()}{' '} + {dataFile.fileSize.unit} + {dataFile.rows} + + + {dataFile.userName} + + {!dataFile.created ? undefined : ( + + {dataFile.created} + + )} + + + View details} + > + + + {canUpdateRelease && + terminalImportStatuses.includes(dataFile.status) && ( + <> + {dataFile.status === 'COMPLETE' && ( + <> + ( + releaseDataFileRoute.path, + { + publicationId, + releaseId, + fileId: dataFile.id, + }, + )} + > + Edit title + + {dataFile.publicApiDataSetId ? ( + Replace data + } + > +

+ This data file has an API data set linked to + it. Please remove the API data set before + replacing the data. +

+

+ ( + releaseApiDataSetDetailsRoute.path, + { + publicationId, + releaseId, + dataSetId: dataFile.publicApiDataSetId, + }, + )} + > + Go to API data set + +

+
+ ) : ( + ( + releaseDataFileReplaceRoute.path, + { + publicationId, + releaseId, + fileId: dataFile.id, + }, + )} + > + Replace data + + )} + + )} + {dataFile.publicApiDataSetId ? ( + + Delete files + + } + > +

+ This data file has an API data set linked to it. + Please remove the API data set before deleting. +

+

+ ( + releaseApiDataSetDetailsRoute.path, + { + publicationId, + releaseId, + dataSetId: dataFile.publicApiDataSetId, + }, + )} + > + Go to API data set + +

+
+ ) : ( + handleDeleteFile(dataFile)} + variant="warning" + > + Delete files + + )} + + )} + {dataFile.permissions.canCancelImport && ( + + )} +
+
+ + ); +}; + +export default DataFilesTable; diff --git a/src/explore-education-statistics-admin/src/pages/release/data/components/ImporterStatus.tsx b/src/explore-education-statistics-admin/src/pages/release/data/components/ImporterStatus.tsx index bcc76be7166..3a1aa271f45 100644 --- a/src/explore-education-statistics-admin/src/pages/release/data/components/ImporterStatus.tsx +++ b/src/explore-education-statistics-admin/src/pages/release/data/components/ImporterStatus.tsx @@ -87,11 +87,13 @@ interface ImporterStatusProps { releaseId: string; dataFile: DataFile; onStatusChange?: ImporterStatusChangeHandler; + className?: string; } const ImporterStatus = ({ releaseId, dataFile, onStatusChange, + className, }: ImporterStatusProps) => { const [currentStatus, setCurrentStatus] = useState({ status: dataFile.status, @@ -130,7 +132,7 @@ const ImporterStatus = ({ ); return ( -
+
{ const [deleteDataFile, setDeleteDataFile] = useState(); - const [activeFileIds, setActiveFileIds] = useState(); const [dataFiles, setDataFiles] = useState([]); const [bulkUploadPlan, setBulkUploadPlan] = useState(); @@ -89,22 +72,15 @@ const ReleaseDataUploadsSection = ({ const confirmBulkUploadPlan = useCallback( async (archiveDataSetFiles: ArchiveDataSetFile[]) => { - const newFiles = await releaseDataFileService.importBulkZipDataFile( + await releaseDataFileService.importBulkZipDataFile( releaseId, archiveDataSetFiles, ); setBulkUploadPlan(undefined); - setActiveFileIds([...dataFiles, ...newFiles].map(file => file.id)); refetchDataFiles(); }, - [ - releaseId, - setBulkUploadPlan, - setActiveFileIds, - dataFiles, - refetchDataFiles, - ], + [releaseId, setBulkUploadPlan, refetchDataFiles], ); const handleStatusChange = async ( @@ -124,8 +100,6 @@ const ReleaseDataUploadsSection = ({ dataFile.id, ); - setActiveFileIds([]); - setDataFiles(currentDataFiles => currentDataFiles.map(file => file.fileName !== dataFile.fileName @@ -140,6 +114,17 @@ const ReleaseDataUploadsSection = ({ ); }; + const handleDeleteFile = async (dataFile: DataFile) => { + releaseDataFileService + .getDeleteDataFilePlan(releaseId, dataFile) + .then(plan => { + setDeleteDataFile({ + plan, + file: dataFile, + }); + }); + }; + const handleSubmit = useCallback( async (values: DataFileUploadFormValues) => { const newFiles: DataFile[] = []; @@ -185,7 +170,6 @@ const ReleaseDataUploadsSection = ({ default: break; } - setActiveFileIds(newFiles.map(file => file.id)); }, [releaseId, refetchDataFiles], ); @@ -242,159 +226,14 @@ const ReleaseDataUploadsSection = ({ {dataFiles.length > 0 ? ( - { - setDataFiles( - await releaseDataFileService.updateDataFilesOrder( - releaseId, - fileIds, - ), - ); - }} - > - {dataFiles.map(dataFile => ( - -
- {dataFile.isDeleting && ( - - )} - - {canUpdateRelease && - terminalImportStatuses.includes(dataFile.status) && ( - <> - {dataFile.status === 'COMPLETE' && ( - <> - ( - releaseDataFileRoute.path, - { - publicationId, - releaseId, - fileId: dataFile.id, - }, - )} - > - Edit title - - {dataFile.publicApiDataSetId ? ( - Replace data - } - > -

- This data file has an API data set linked to - it. Please remove the API data set before - replacing the data. -

-

- ( - releaseApiDataSetDetailsRoute.path, - { - publicationId, - releaseId, - dataSetId: - dataFile.publicApiDataSetId, - }, - )} - > - Go to API data set - -

-
- ) : ( - ( - releaseDataFileReplaceRoute.path, - { - publicationId, - releaseId, - fileId: dataFile.id, - }, - )} - > - Replace data - - )} - - )} - {dataFile.publicApiDataSetId ? ( - - Delete files - - } - > -

- This data file has an API data set linked to it. - Please remove the API data set before deleting. -

-

- ( - releaseApiDataSetDetailsRoute.path, - { - publicationId, - releaseId, - dataSetId: dataFile.publicApiDataSetId, - }, - )} - > - Go to API data set - -

-
- ) : ( - - releaseDataFileService - .getDeleteDataFilePlan(releaseId, dataFile) - .then(plan => { - setDeleteDataFile({ - plan, - file: dataFile, - }); - }) - } - > - Delete files - - )} - - )} - {dataFile.permissions.canCancelImport && ( - - )} -
-
-
- ))} -
+ ) : ( No data files have been uploaded. )} diff --git a/src/explore-education-statistics-common/src/components/Tag.module.scss b/src/explore-education-statistics-common/src/components/Tag.module.scss index ddbc3cca79d..ab6dda7af92 100644 --- a/src/explore-education-statistics-common/src/components/Tag.module.scss +++ b/src/explore-education-statistics-common/src/components/Tag.module.scss @@ -3,4 +3,5 @@ // https://github.com/alphagov/govuk-frontend/issues/4626 .tag { max-width: none; + text-wrap: balance; } From d9571137ebd15cfa158621d24ea687a67035b3ce Mon Sep 17 00:00:00 2001 From: Stuart Bennett Date: Thu, 12 Dec 2024 13:30:15 +0000 Subject: [PATCH 2/8] EES-5544 add reorder fnality --- .../data/components/DataFilesTable.tsx | 348 +++++++++--------- .../components/ReleaseDataUploadsSection.tsx | 39 +- 2 files changed, 215 insertions(+), 172 deletions(-) diff --git a/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.tsx b/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.tsx index 3f96a737cec..a0112653c55 100644 --- a/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.tsx +++ b/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.tsx @@ -19,8 +19,10 @@ import { import ButtonGroup from '@common/components/ButtonGroup'; import ButtonText from '@common/components/ButtonText'; import Modal from '@common/components/Modal'; +import ReorderableList from '@common/components/ReorderableList'; +import reorder from '@common/utils/reorder'; +import React, { useEffect, useState } from 'react'; import { generatePath } from 'react-router'; -import React from 'react'; import styles from './DataFilesTable.module.scss'; interface Props { @@ -28,86 +30,146 @@ interface Props { publicationId: string; releaseId: string; canUpdateRelease?: boolean; - handleDeleteFile: (dataFile: DataFile) => Promise; - handleStatusChange: ( + isReordering: boolean; + onCancelReordering: () => void; + onConfirmReordering: (nextSeries: DataFile[]) => void; + onDeleteFile: (dataFile: DataFile) => Promise; + onStatusChange: ( dataFile: DataFile, { totalRows, status }: DataFileImportStatus, ) => Promise; } const DataFilesTable = ({ - dataFiles, + dataFiles: initialDataFiles, publicationId, releaseId, canUpdateRelease, - handleDeleteFile, - handleStatusChange, + isReordering, + onCancelReordering, + onConfirmReordering, + onDeleteFile, + onStatusChange, }: Props) => { + const [dataFiles, setDataFiles] = useState(initialDataFiles); + + useEffect(() => { + setDataFiles(initialDataFiles); + }, [initialDataFiles]); + + if (isReordering) { + return ( + ({ + id, + label: title, + }))} + onCancel={() => { + setDataFiles(initialDataFiles); + onCancelReordering(); + }} + onConfirm={() => onConfirmReordering(dataFiles)} + onMoveItem={({ prevIndex, nextIndex }) => { + const reordered = reorder(dataFiles, prevIndex, nextIndex); + setDataFiles(reordered); + }} + onReverse={() => { + setDataFiles(dataFiles.toReversed()); + }} + /> + ); + } + return ( - <> -

Uploaded data files

- - - - - - {/* */} - - {/* */} - {/* - */} - - - +
Subject titleSizeRowsStatusUploaded byDate uploadedActions
+ + + + + + + + - - {dataFiles.map(dataFile => ( - - - - {/* */} - - {/* */} - {/* */} - + {dataFiles.map(dataFile => ( + + + + + - - ))} - -
Subject titleSizeStatusActions
{dataFile.title} - {dataFile.fileSize.size.toLocaleString()}{' '} - {dataFile.fileSize.unit} - {dataFile.rows} - - - {dataFile.userName} - - {!dataFile.created ? undefined : ( - - {dataFile.created} - - )} - - - View details} - > - - - {canUpdateRelease && - terminalImportStatuses.includes(dataFile.status) && ( - <> - {dataFile.status === 'COMPLETE' && ( - <> +
{dataFile.title} + {dataFile.fileSize.size.toLocaleString()} {dataFile.fileSize.unit} + + + + + View details} + > + + + {canUpdateRelease && + terminalImportStatuses.includes(dataFile.status) && ( + <> + {dataFile.status === 'COMPLETE' && ( + <> + ( + releaseDataFileRoute.path, + { + publicationId, + releaseId, + fileId: dataFile.id, + }, + )} + > + Edit title + + {dataFile.publicApiDataSetId ? ( + Replace data + } + > +

+ This data file has an API data set linked to it. + Please remove the API data set before replacing + the data. +

+

+ ( + releaseApiDataSetDetailsRoute.path, + { + publicationId, + releaseId, + dataSetId: dataFile.publicApiDataSetId, + }, + )} + > + Go to API data set + +

+
+ ) : ( ( - releaseDataFileRoute.path, + to={generatePath( + releaseDataFileReplaceRoute.path, { publicationId, releaseId, @@ -115,104 +177,62 @@ const DataFilesTable = ({ }, )} > - Edit title + Replace data - {dataFile.publicApiDataSetId ? ( - Replace data - } - > -

- This data file has an API data set linked to - it. Please remove the API data set before - replacing the data. -

-

- ( - releaseApiDataSetDetailsRoute.path, - { - publicationId, - releaseId, - dataSetId: dataFile.publicApiDataSetId, - }, - )} - > - Go to API data set - -

-
- ) : ( - ( - releaseDataFileReplaceRoute.path, - { - publicationId, - releaseId, - fileId: dataFile.id, - }, - )} - > - Replace data - - )} - - )} - {dataFile.publicApiDataSetId ? ( - - Delete files - - } - > -

- This data file has an API data set linked to it. - Please remove the API data set before deleting. -

-

- ( - releaseApiDataSetDetailsRoute.path, - { - publicationId, - releaseId, - dataSetId: dataFile.publicApiDataSetId, - }, - )} - > - Go to API data set - -

-
- ) : ( - handleDeleteFile(dataFile)} - variant="warning" - > - Delete files - - )} - - )} - {dataFile.permissions.canCancelImport && ( - + )} + + )} + {dataFile.publicApiDataSetId ? ( + + Delete files + + } + > +

+ This data file has an API data set linked to it. + Please remove the API data set before deleting. +

+

+ ( + releaseApiDataSetDetailsRoute.path, + { + publicationId, + releaseId, + dataSetId: dataFile.publicApiDataSetId, + }, + )} + > + Go to API data set + +

+
+ ) : ( + onDeleteFile(dataFile)} + variant="warning" + > + Delete files + + )} + )} -
-
- + {dataFile.permissions.canCancelImport && ( + + )} + + + + ))} + + ); }; diff --git a/src/explore-education-statistics-admin/src/pages/release/data/components/ReleaseDataUploadsSection.tsx b/src/explore-education-statistics-admin/src/pages/release/data/components/ReleaseDataUploadsSection.tsx index 2366e31b6c1..f3c2542968a 100644 --- a/src/explore-education-statistics-admin/src/pages/release/data/components/ReleaseDataUploadsSection.tsx +++ b/src/explore-education-statistics-admin/src/pages/release/data/components/ReleaseDataUploadsSection.tsx @@ -9,10 +9,12 @@ import releaseDataFileService, { DataFileImportStatus, DeleteDataFilePlan, } from '@admin/services/releaseDataFileService'; +import Button from '@common/components/Button'; import InsetText from '@common/components/InsetText'; import LoadingSpinner from '@common/components/LoadingSpinner'; import ModalConfirm from '@common/components/ModalConfirm'; import WarningMessage from '@common/components/WarningMessage'; +import useToggle from '@common/hooks/useToggle'; import logger from '@common/services/logger'; import { useQuery } from '@tanstack/react-query'; import React, { useCallback, useEffect, useState } from 'react'; @@ -40,6 +42,7 @@ const ReleaseDataUploadsSection = ({ const [deleteDataFile, setDeleteDataFile] = useState(); const [dataFiles, setDataFiles] = useState([]); const [bulkUploadPlan, setBulkUploadPlan] = useState(); + const [isReordering, toggleReordering] = useToggle(false); const { data: initialDataFiles, @@ -226,14 +229,34 @@ const ReleaseDataUploadsSection = ({ {dataFiles.length > 0 ? ( - + <> +

Uploaded data files

+ { + setDataFiles( + await releaseDataFileService.updateDataFilesOrder( + releaseId, + nextDataFiles.map(file => file.id), + ), + ); + toggleReordering.off(); + }} + onStatusChange={handleStatusChange} + onDeleteFile={handleDeleteFile} + publicationId={publicationId} + releaseId={releaseId} + /> + + {isReordering ? undefined : ( + + )} + ) : ( No data files have been uploaded. )} From 76ac960ba4d89189faa1a3fc72f5b319d1f56997 Mon Sep 17 00:00:00 2001 From: Stuart Bennett Date: Fri, 20 Dec 2024 13:38:25 +0000 Subject: [PATCH 3/8] EES-5544 update integration tests --- .../data/components/DataFilesTable.tsx | 8 +- .../ReleaseDataUploadsSection.test.tsx | 219 +++++++----------- 2 files changed, 94 insertions(+), 133 deletions(-) diff --git a/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.tsx b/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.tsx index a0112653c55..1c6e35a5477 100644 --- a/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.tsx +++ b/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.tsx @@ -96,11 +96,11 @@ const DataFilesTable = ({ {dataFiles.map(dataFile => ( - {dataFile.title} - + {dataFile.title} + {dataFile.fileSize.size.toLocaleString()} {dataFile.fileSize.unit} - + - + { 'release-1', ); - expect(screen.getAllByTestId('accordionSection')).toHaveLength(2); + expect(screen.getAllByRole('row')).toHaveLength(3); }); - const sections = screen.getAllByTestId('accordionSection'); - const section1 = within(sections[0]); + const fileTableRows = screen.getAllByRole('row'); + const fileTableRow1 = within(fileTableRows[1]); - expect( - section1.getByRole('button', { name: /Test data 1/ }), - ).toBeInTheDocument(); - - expect(section1.getByTestId('Subject title')).toHaveTextContent( + expect(fileTableRow1.getByTestId('Subject title')).toHaveTextContent( 'Test data 1', ); - expect(section1.getByTestId('Data file')).toHaveTextContent('data-1.csv'); - expect(section1.getByTestId('Metadata file')).toHaveTextContent( - 'data-1.meta.csv', - ); - expect(section1.getByTestId('Data file size')).toHaveTextContent('50 Kb'); - expect(section1.getByTestId('Number of rows')).toHaveTextContent('100'); - expect(section1.getByTestId('Status')).toHaveTextContent('Complete'); - expect(section1.getByTestId('Uploaded by')).toHaveTextContent( - 'user1@test.com', + expect(fileTableRow1.getByTestId('Data file size')).toHaveTextContent( + '50 Kb', ); - expect(section1.getByTestId('Date uploaded')).toHaveTextContent( - '12 June 2020 12:00', - ); - - const section2 = within(sections[1]); + expect(fileTableRow1.getByTestId('Status')).toHaveTextContent('Complete'); - expect( - section2.getByRole('button', { name: /Test data 2/ }), - ).toBeInTheDocument(); + const fileTableRow2 = within(fileTableRows[2]); - expect(section2.getByTestId('Subject title')).toHaveTextContent( + expect(fileTableRow2.getByTestId('Subject title')).toHaveTextContent( 'Test data 2', ); - expect(section2.getByTestId('Data file')).toHaveTextContent('data-2.csv'); - expect(section2.getByTestId('Metadata file')).toHaveTextContent( - 'data-2.meta.csv', - ); - expect(section2.getByTestId('Data file size')).toHaveTextContent('100 Kb'); - expect(section2.getByTestId('Number of rows')).toHaveTextContent('200'); - expect(section2.getByTestId('Status')).toHaveTextContent('Complete'); - expect(section2.getByTestId('Uploaded by')).toHaveTextContent( - 'user2@test.com', - ); - expect(section2.getByTestId('Date uploaded')).toHaveTextContent( - '1 July 2020 12:00', - ); + expect(fileTableRow2.getByTestId('Status')).toHaveTextContent('Complete'); }); test("renders data file details with status of 'Replacement in progress' if being replaced", async () => { @@ -222,16 +193,16 @@ describe('ReleaseDataUploadsSection', () => { 'release-1', ); - expect(screen.getAllByTestId('accordionSection')).toHaveLength(1); + expect(screen.getAllByRole('row')).toHaveLength(2); }); - const section1 = getAccordionSection(0); + const fileTableRow1 = getTableRow(1); - expect( - section1.getByRole('button', { name: /Test data 1/ }), - ).toBeInTheDocument(); + expect(fileTableRow1.getByTestId('Subject title')).toHaveTextContent( + 'Test data 1', + ); - expect(section1.getByTestId('Status')).toHaveTextContent( + expect(fileTableRow1.getByTestId('Status')).toHaveTextContent( 'Data replacement in progress', ); }); @@ -281,21 +252,21 @@ describe('ReleaseDataUploadsSection', () => { ); await waitFor(() => { - expect(screen.getAllByTestId('accordionSection')).toHaveLength(2); + expect(screen.getAllByRole('row')).toHaveLength(3); }); - const sections = screen.getAllByTestId('accordionSection'); + const fileTableRows = screen.getAllByRole('row'); - const section1 = within(sections[0]); - expect(section1.getByTestId('Status')).toHaveTextContent('Queued'); + const fileTableRow1 = within(fileTableRows[1]); + expect(fileTableRow1.getByTestId('Status')).toHaveTextContent('Queued'); expect( - section1.queryByRole('button', { name: 'Delete files' }), + fileTableRow1.queryByRole('button', { name: 'Delete files' }), ).not.toBeInTheDocument(); - const section2 = within(sections[1]); - expect(section2.getByTestId('Status')).toHaveTextContent('Complete'); + const fileTableRow2 = within(fileTableRows[2]); + expect(fileTableRow2.getByTestId('Status')).toHaveTextContent('Complete'); expect( - section2.getByRole('button', { name: 'Delete files' }), + fileTableRow2.getByRole('button', { name: 'Delete files' }), ).toBeInTheDocument(); }); @@ -339,19 +310,19 @@ describe('ReleaseDataUploadsSection', () => { ); await waitFor(() => { - expect(screen.getAllByTestId('accordionSection')).toHaveLength(2); + expect(screen.getAllByRole('row')).toHaveLength(3); }); - const sections = screen.getAllByTestId('accordionSection'); + const fileTableRows = screen.getAllByRole('row'); expect( - within(sections[1]).getByRole('button', { + within(fileTableRows[2]).getByRole('button', { name: 'Delete files', }), ).toBeInTheDocument(); await user.click( - within(sections[1]).getByRole('button', { + within(fileTableRows[2]).getByRole('button', { name: 'Delete files', }), ); @@ -423,19 +394,19 @@ describe('ReleaseDataUploadsSection', () => { ); await waitFor(() => { - expect(screen.getAllByTestId('accordionSection')).toHaveLength(2); + expect(screen.getAllByRole('row')).toHaveLength(3); }); - const sections = screen.getAllByTestId('accordionSection'); + const fileTableRows = screen.getAllByRole('row'); expect( - within(sections[1]).getByRole('button', { + within(fileTableRows[2]).getByRole('button', { name: 'Delete files', }), ).toBeInTheDocument(); await user.click( - within(sections[1]).getByRole('button', { + within(fileTableRows[2]).getByRole('button', { name: 'Delete files', }), ); @@ -453,14 +424,12 @@ describe('ReleaseDataUploadsSection', () => { ); await waitFor(() => { - expect(screen.getAllByTestId('accordionSection')).toHaveLength(1); + expect(screen.getAllByRole('row')).toHaveLength(2); }); - expect( - within(screen.getByTestId('accordionSection')).getByRole('button', { - name: /Test data 1/, - }), - ).toBeInTheDocument(); + expect(getTableRow(1).getByTestId('Subject title')).toHaveTextContent( + 'Test data 1', + ); }); test('does not allow deleting files when linked to an API data set', async () => { @@ -482,13 +451,13 @@ describe('ReleaseDataUploadsSection', () => { ); await waitFor(() => { - expect(screen.getAllByTestId('accordionSection')).toHaveLength(1); + expect(screen.getAllByRole('row')).toHaveLength(2); }); - const sections = screen.getAllByTestId('accordionSection'); + const fileTableRows = screen.getAllByRole('row'); await user.click( - within(sections[0]).getByRole('button', { + within(fileTableRows[1]).getByRole('button', { name: 'Delete files', }), ); @@ -535,22 +504,21 @@ describe('ReleaseDataUploadsSection', () => { ); await waitFor(() => { - expect(screen.getAllByTestId('accordionSection')).toHaveLength(2); + expect(screen.getAllByRole('row')).toHaveLength(3); }); - const sections = screen.getAllByTestId('accordionSection'); - expect(sections).toHaveLength(2); + const fileTableRows = screen.getAllByRole('row'); - const section1 = within(sections[0]); - expect(section1.getByTestId('Status')).toHaveTextContent('Queued'); + const fileTableRow1 = within(fileTableRows[1]); + expect(fileTableRow1.getByTestId('Status')).toHaveTextContent('Queued'); expect( - section1.queryByRole('link', { name: 'Replace data' }), + fileTableRow1.queryByRole('link', { name: 'Replace data' }), ).not.toBeInTheDocument(); - const section2 = within(sections[1]); - expect(section2.getByTestId('Status')).toHaveTextContent('Complete'); + const fileTableRow2 = within(fileTableRows[2]); + expect(fileTableRow2.getByTestId('Status')).toHaveTextContent('Complete'); expect( - section2.getByRole('link', { name: 'Replace data' }), + fileTableRow2.getByRole('link', { name: 'Replace data' }), ).toBeInTheDocument(); }); @@ -574,14 +542,14 @@ describe('ReleaseDataUploadsSection', () => { ); await waitFor(() => { - expect(screen.getAllByTestId('accordionSection')).toHaveLength(2); + expect(screen.getAllByRole('row')).toHaveLength(3); }); - const sections = screen.getAllByTestId('accordionSection'); + const fileTableRows = screen.getAllByRole('row'); - const section2 = within(sections[1]); + const fileTableRow2 = within(fileTableRows[2]); expect( - section2.getByRole('link', { name: 'Replace data' }), + fileTableRow2.getByRole('link', { name: 'Replace data' }), ).toHaveAttribute( 'href', '/publication/publication-1/release/release-1/data/data-2/replace', @@ -607,13 +575,13 @@ describe('ReleaseDataUploadsSection', () => { ); await waitFor(() => { - expect(screen.getAllByTestId('accordionSection')).toHaveLength(1); + expect(screen.getAllByRole('row')).toHaveLength(2); }); - const sections = screen.getAllByTestId('accordionSection'); + const fileTableRows = screen.getAllByRole('row'); await user.click( - within(sections[0]).getByRole('button', { name: 'Replace data' }), + within(fileTableRows[1]).getByRole('button', { name: 'Replace data' }), ); await waitFor(() => { @@ -994,7 +962,8 @@ describe('ReleaseDataUploadsSection', () => { }); }); - test('updates the number of rows after uploading CSV file when status changes', async () => { + test('updates the file size after uploading CSV file when status changes', async () => { + // we don't display rows :/ releaseDataFileService.uploadDataFiles.mockResolvedValue( testUploadedDataFile, ); @@ -1061,8 +1030,8 @@ describe('ReleaseDataUploadsSection', () => { ); }); - const sections = screen.getAllByTestId('accordionSection'); - const section3 = within(sections[2]); + const fileTableRows = screen.getAllByRole('row'); + const fileTableRow3 = within(fileTableRows[3]); await waitFor(() => expect( @@ -1070,11 +1039,13 @@ describe('ReleaseDataUploadsSection', () => { ).toHaveBeenCalledWith('release-1', testUploadedDataFile2), ); await waitFor(() => { - expect(section3.getByTestId('Number of rows')).toHaveTextContent('100'); + expect(fileTableRow3.getByTestId('Data file size')).toHaveTextContent( + '150 Kb', + ); }); }); - test('updates the number of rows after uploading ZIP file when status changes', async () => { + test('updates the file size after uploading ZIP file when status changes', async () => { releaseDataFileService.uploadZipDataFile.mockResolvedValue({ ...testUploadedZipFile, }); @@ -1132,8 +1103,8 @@ describe('ReleaseDataUploadsSection', () => { ), ); - const sections = screen.getAllByTestId('accordionSection'); - const section3 = within(sections[2]); + const fileTableRows = screen.getAllByRole('row'); + const fileTableRow3 = within(fileTableRows[3]); await waitFor(() => expect( @@ -1141,7 +1112,9 @@ describe('ReleaseDataUploadsSection', () => { ).toHaveBeenCalledWith('release-1', testUploadedDataFile2), ); await waitFor(() => { - expect(section3.getByTestId('Number of rows')).toHaveTextContent('100'); + expect(fileTableRow3.getByTestId('Data file size')).toHaveTextContent( + '150 Kb', + ); }); }); @@ -1169,14 +1142,12 @@ describe('ReleaseDataUploadsSection', () => { , ); - await waitFor(() => - expect(screen.getAllByTestId('accordionSection')).toHaveLength(1), - ); + await waitFor(() => expect(screen.getAllByRole('row')).toHaveLength(2)); - const section = getAccordionSection(0); + const fileTableRow = getTableRow(1); expect( - section.getByRole('button', { name: 'Cancel' }), + fileTableRow.getByRole('button', { name: 'Cancel' }), ).toBeInTheDocument(); }); @@ -1203,14 +1174,12 @@ describe('ReleaseDataUploadsSection', () => { , ); - await waitFor(() => - expect(screen.getAllByTestId('accordionSection')).toHaveLength(1), - ); + await waitFor(() => expect(screen.getAllByRole('row')).toHaveLength(2)); - const section = getAccordionSection(0); + const fileTableRow = getTableRow(1); expect( - section.queryByRole('button', { name: 'Cancel' }), + fileTableRow.queryByRole('button', { name: 'Cancel' }), ).not.toBeInTheDocument(); }); }); @@ -1238,13 +1207,11 @@ describe('ReleaseDataUploadsSection', () => { , ); - await waitFor(() => - expect(screen.getAllByTestId('accordionSection')).toHaveLength(1), - ); + await waitFor(() => expect(screen.getAllByRole('row')).toHaveLength(2)); - const section = getAccordionSection(0); + const fileTableRow = getTableRow(1); - await user.click(section.getByRole('button', { name: 'Cancel' })); + await user.click(fileTableRow.getByRole('button', { name: 'Cancel' })); await waitFor(() => { expect( @@ -1286,13 +1253,11 @@ describe('ReleaseDataUploadsSection', () => { , ); - await waitFor(() => - expect(screen.getAllByTestId('accordionSection')).toHaveLength(1), - ); + await waitFor(() => expect(screen.getAllByRole('row')).toHaveLength(2)); - const section = getAccordionSection(0); + const fileTableRow = getTableRow(1); - await user.click(section.getByRole('button', { name: 'Cancel' })); + await user.click(fileTableRow.getByRole('button', { name: 'Cancel' })); await waitFor(() => { expect( @@ -1318,7 +1283,7 @@ describe('ReleaseDataUploadsSection', () => { expect(screen.queryByRole('dialog')).not.toBeInTheDocument(); expect( - section.queryByRole('button', { name: 'Cancel' }), + fileTableRow.queryByRole('button', { name: 'Cancel' }), ).not.toBeInTheDocument(); }); @@ -1337,13 +1302,11 @@ describe('ReleaseDataUploadsSection', () => { , ); - await waitFor(() => - expect(screen.getAllByTestId('accordionSection')).toHaveLength(1), - ); + await waitFor(() => expect(screen.getAllByRole('row')).toHaveLength(2)); - const section = getAccordionSection(0); + const fileTableRow = getTableRow(1); - await user.click(section.getByRole('button', { name: 'Cancel' })); + await user.click(fileTableRow.getByRole('button', { name: 'Cancel' })); await waitFor(() => { expect( @@ -1364,7 +1327,7 @@ describe('ReleaseDataUploadsSection', () => { expect(screen.queryByRole('dialog')).not.toBeInTheDocument(); expect( - section.getByRole('button', { name: 'Cancel' }), + fileTableRow.getByRole('button', { name: 'Cancel' }), ).toBeInTheDocument(); }); @@ -1385,13 +1348,11 @@ describe('ReleaseDataUploadsSection', () => { , ); - await waitFor(() => - expect(screen.getAllByTestId('accordionSection')).toHaveLength(1), - ); + await waitFor(() => expect(screen.getAllByRole('row')).toHaveLength(2)); - const section = getAccordionSection(0); + const fileTableRow = getTableRow(1); - await user.click(section.getByRole('button', { name: 'Cancel' })); + await user.click(fileTableRow.getByRole('button', { name: 'Cancel' })); await waitFor(() => { expect( @@ -1418,14 +1379,14 @@ describe('ReleaseDataUploadsSection', () => { expect(screen.queryByRole('dialog')).not.toBeInTheDocument(); expect( - section.queryByRole('button', { name: 'Cancel' }), + fileTableRow.queryByRole('button', { name: 'Cancel' }), ).not.toBeInTheDocument(); expect(screen.getByText('Cancellation failed')).toBeInTheDocument(); }); }); - function getAccordionSection(index: number) { - return within(screen.getAllByTestId('accordionSection')[index]); + function getTableRow(index: number) { + return within(screen.getAllByRole('row')[index]); } }); From 18e28a08b7e81124bd6edea65d36ba2c4f5be92d Mon Sep 17 00:00:00 2001 From: Stuart Bennett Date: Fri, 10 Jan 2025 16:37:09 +0000 Subject: [PATCH 4/8] EES-5544 fix robot tests --- package.json | 8 +- .../data/components/DataFilesTable.tsx | 2 +- .../tests/admin/bau/delete_subject.robot | 5 +- .../tests/admin/bau/release_status.robot | 39 ++++---- .../tests/admin/bau/upload_files.robot | 26 ++--- .../bau/archive_publication.robot | 59 +++++++----- .../bau/data_reordering.robot | 5 +- .../bau/subject_reordering.robot | 94 +++++++++---------- .../bau/publish_amend_and_cancel.robot | 26 ++--- .../bau/publish_release_and_amend.robot | 8 +- .../bau/publish_release_and_amend_2.robot | 8 +- .../data_set_page_absence_in_prus.robot | 13 +-- .../methodology_page_absence.robot | 2 +- .../general_public/prod_only/redirects.robot | 2 +- .../prod_only/statistics_page.robot | 16 ++-- .../tests/general_public/redirects.robot | 11 ++- .../general_public/statistics_page.robot | 14 +-- .../robot-tests/tests/libs/admin-common.robot | 44 ++++++--- tests/robot-tests/tests/libs/common.robot | 6 +- .../tests/libs/tables-common.robot | 6 +- 20 files changed, 192 insertions(+), 202 deletions(-) diff --git a/package.json b/package.json index a33cbc3fbfb..79504d4e6c5 100644 --- a/package.json +++ b/package.json @@ -81,12 +81,12 @@ "prettier --write" ], "*.robot": [ - "pipenv run robotidy --config tests/robot-tests/robotidy.toml" + "python3 -m pipenv run robotidy --config tests/robot-tests/robotidy.toml" ], "*.py": [ - "pipenv run flake8", - "pipenv run black", - "pipenv run isort" + "python3 -m pipenv run flake8", + "python3 -m pipenv run black", + "python3 -m pipenv run isort" ] } } diff --git a/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.tsx b/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.tsx index 1c6e35a5477..71e716066c1 100644 --- a/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.tsx +++ b/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.tsx @@ -83,7 +83,7 @@ const DataFilesTable = ({ } return ( - +
diff --git a/tests/robot-tests/tests/admin/bau/delete_subject.robot b/tests/robot-tests/tests/admin/bau/delete_subject.robot index 88f32f7fb58..54299295800 100644 --- a/tests/robot-tests/tests/admin/bau/delete_subject.robot +++ b/tests/robot-tests/tests/admin/bau/delete_subject.robot @@ -154,8 +154,7 @@ Navigate back to 'Data and files' page Delete UI test subject user clicks link Data uploads user waits until h2 is visible Add data file to release %{WAIT_SMALL} - user waits until page contains accordion section UI test subject %{WAIT_SMALL} - user opens accordion section UI test subject + user waits until data upload is completed UI test subject user clicks button Delete files user waits until h2 is visible Confirm deletion of selected data files %{WAIT_SMALL} @@ -166,5 +165,5 @@ Delete UI test subject user checks page contains dfe-logo.jpg user clicks button Confirm - user waits until page does not contain accordion section UI test subject + user waits until page does not contain data uploads table user waits until h2 is visible Add data file to release %{WAIT_SMALL} diff --git a/tests/robot-tests/tests/admin/bau/release_status.robot b/tests/robot-tests/tests/admin/bau/release_status.robot index 2b34f8b88ef..4efa4117920 100644 --- a/tests/robot-tests/tests/admin/bau/release_status.robot +++ b/tests/robot-tests/tests/admin/bau/release_status.robot @@ -41,7 +41,7 @@ Validate checklist errors and warnings user checks checklist errors contains link ... Release must contain a key statistic or a non-empty headline text block - user checks page does not contain testid releaseChecklist-success + user waits until page does not contain testid releaseChecklist-success Add headline text block to Content page user navigates to content page ${PUBLICATION_NAME} @@ -58,8 +58,8 @@ Validate checklist errors and warnings after adding headline text block user checks checklist warnings contains link No data files uploaded user checks checklist warnings contains link A public pre-release access list has not been created - user checks page does not contain testid releaseChecklist-errors - user checks page does not contain testid releaseChecklist-success + user waits until page does not contain testid releaseChecklist-errors + user waits until page does not contain testid releaseChecklist-success Add empty Summary section text block to the page user navigates to content page ${PUBLICATION_NAME} @@ -131,8 +131,8 @@ Validate checklist errors and warnings after adding content to text blocks user checks checklist warnings contains link No data files uploaded user checks checklist warnings contains link A public pre-release access list has not been created - user checks page does not contain testid releaseChecklist-errors - user checks page does not contain testid releaseChecklist-success + user waits until page does not contain testid releaseChecklist-errors + user waits until page does not contain testid releaseChecklist-success Submit release for Higher Review user clicks radio Ready for higher review (this will notify approvers) @@ -155,8 +155,8 @@ Verify release checklist has not been updated by status user checks checklist warnings contains link No data files uploaded user checks checklist warnings contains link A public pre-release access list has not been created - user checks page does not contain testid releaseChecklist-errors - user checks page does not contain testid releaseChecklist-success + user waits until page does not contain testid releaseChecklist-errors + user waits until page does not contain testid releaseChecklist-success Add public prerelease access list via release checklist user clicks link A public pre-release access list has not been created @@ -170,8 +170,8 @@ Verify release checklist has been updated user checks checklist warnings contains link An in-EES methodology page has not been linked to this publication user checks checklist warnings contains link No data files uploaded - user checks page does not contain testid releaseChecklist-errors - user checks page does not contain testid releaseChecklist-success + user waits until page does not contain testid releaseChecklist-errors + user waits until page does not contain testid releaseChecklist-success Approve release user clicks radio Approved for publication @@ -284,7 +284,7 @@ Verify the checklist errors and warnings for amendment user checks checklist errors contains link ... A public release note for this amendment is required, add this near the top of the content page - user checks page does not contain testid releaseChecklist-success + user waits until page does not contain testid releaseChecklist-success Navigate to contents page and add a release note user clicks link Content @@ -307,12 +307,8 @@ Create third release Upload data files user uploads subject and waits until complete Dates test subject dates.csv dates.meta.csv user clicks link Data and files - user waits until h2 is visible Uploaded data files %{WAIT_MEDIUM} - user waits until page contains accordion section Dates test subject - user opens accordion section Dates test subject - - ${section} user gets accordion section content element Dates test subject - user clicks link Replace data ${section} + user waits until page contains data uploads table + user clicks link Replace data user waits until h2 is visible Data file details user checks headed table body row contains Status Complete wait=%{WAIT_LONG} @@ -341,16 +337,13 @@ Validate checklist errors user checks checklist errors contains link ... Release must contain a key statistic or a non-empty headline text block - user checks page does not contain testid releaseChecklist-success + user waits until page does not contain testid releaseChecklist-success Navigate to data upload and confirm data replacement user clicks link Data and files - user waits until h2 is visible Uploaded data files %{WAIT_MEDIUM} - user waits until page contains accordion section Dates test subject - user opens accordion section Dates test subject + user waits until page contains data uploads table - ${section} user gets accordion section content element Dates test subject - user clicks link Replace data ${section} + user clicks link Replace data user waits until page contains Footnotes: OK user waits until page contains Data blocks: OK user waits until button is enabled Confirm data replacement @@ -374,7 +367,7 @@ Validate checklist errors (3rd release) ... All summary information must be completed on the data guidance page user checks checklist errors contains link ... Release must contain a key statistic or a non-empty headline text block - user checks page does not contain testid releaseChecklist-success + user waits until page does not contain testid releaseChecklist-success Add data guidance to subject user clicks link Data and files diff --git a/tests/robot-tests/tests/admin/bau/upload_files.robot b/tests/robot-tests/tests/admin/bau/upload_files.robot index 0b152e0cdef..14c921fde1d 100644 --- a/tests/robot-tests/tests/admin/bau/upload_files.robot +++ b/tests/robot-tests/tests/admin/bau/upload_files.robot @@ -35,23 +35,19 @@ Upload a ZIP file subject user clicks button Upload data files user waits until h2 is visible Uploaded data files - user waits until page contains accordion section Absence in PRUs - user opens accordion section Absence in PRUs - - ${section}= user gets accordion section content element Absence in PRUs + user waits until page contains data uploads table # To ensure "Data file size" and "Number of rows" will be filled user waits until page does not contain Queued %{WAIT_MEDIUM} - - user checks headed table body row contains Subject title Absence in PRUs ${section} - user checks headed table body row contains Data file absence_in_prus.csv ${section} - user checks headed table body row contains Metadata file absence_in_prus.meta.csv ${section} - user checks headed table body row contains Data file size 141 Kb ${section} - user checks headed table body row contains Number of rows 612 ${section} - user checks headed table body row contains Status Complete ${section} %{WAIT_DATA_FILE_IMPORT} + user checks table cell contains row=1 column=1 expected=Absence in PRUs parent=testid:Data files table + user checks table cell contains row=1 column=2 expected=141 Kb parent=testid:Data files table + user checks table cell contains row=1 column=3 expected=Complete parent=testid:Data files table + user checks table cell contains row=1 column=4 expected=View details parent=testid:Data files table + user checks table cell contains row=1 column=4 expected=Edit title parent=testid:Data files table + user checks table cell contains row=1 column=4 expected=Replace data parent=testid:Data files table + user checks table cell contains row=1 column=4 expected=Delete files parent=testid:Data files table Change subject title - user waits until page contains accordion section Absence in PRUs user clicks link Edit title user waits until h2 is visible Edit data file details @@ -62,11 +58,9 @@ Change subject title Validate subject title has been updated user waits until h2 is visible Uploaded data files - user waits until page contains accordion section Updated Absence in PRUs - user opens accordion section Absence in PRUs - ${section}= user gets accordion section content element Absence in PRUs - user checks headed table body row contains Subject title Updated Absence in PRUs ${section} + user checks table cell contains row=1 column=1 expected=Updated Absence in PRUs + ... parent=testid:Data files table Check subject appears in 'Data blocks' page user clicks link Data blocks diff --git a/tests/robot-tests/tests/admin_and_public/bau/archive_publication.robot b/tests/robot-tests/tests/admin_and_public/bau/archive_publication.robot index 443c712cf36..4bb19ccbf06 100644 --- a/tests/robot-tests/tests/admin_and_public/bau/archive_publication.robot +++ b/tests/robot-tests/tests/admin_and_public/bau/archive_publication.robot @@ -31,7 +31,8 @@ Navigate to archive-publication release ... ${RELEASE_NAME_ARCHIVE} Import archive-publication subject to release - user uploads subject and waits until complete ${SUBJECT_NAME_ARCHIVE} upload-file-test.csv upload-file-test.meta.csv + user uploads subject and waits until complete ${SUBJECT_NAME_ARCHIVE} upload-file-test.csv + ... upload-file-test.meta.csv Add data guidance to archive-publication subject user clicks link Data guidance @@ -127,16 +128,16 @@ Generate permalink for archive-publication user waits until table tool wizard step is available 4 Choose time period user checks previous table tool step contains 3 Regional North East - user chooses select option id:timePeriodForm-start 2005 - user chooses select option id:timePeriodForm-end 2016 + user chooses select option id:timePeriodForm-start 2005 + user chooses select option id:timePeriodForm-end 2016 user clicks element id:timePeriodForm-submit user waits until table tool wizard step is available 5 Choose your filters user checks previous table tool step contains 4 Time period 2005 to 2016 user clicks element id:filtersForm-submit Sleep 5 - - user waits until page finishes loading + + user waits until page finishes loading user waits until results table appears %{WAIT_LONG} user waits until page contains button Generate shareable link @@ -157,14 +158,17 @@ Generate permalink for archive-publication Check that archive-publication subject appears correctly on Data catalogue page user navigates to data catalogue page on public frontend - user wait for option to be available and select it css:select[id="filters-form-theme"] %{TEST_THEME_NAME} - - user checks select contains option css:select[id="filters-form-publication"] ${PUBLICATION_NAME_ARCHIVE} - user checks select does not contain option css:select[id="filters-form-publication"] ${PUBLICATION_NAME_SUPERSEDE} + user wait for option to be available and select it css:select[id="filters-form-theme"] %{TEST_THEME_NAME} + + user checks select contains option css:select[id="filters-form-publication"] ${PUBLICATION_NAME_ARCHIVE} + user checks select does not contain option css:select[id="filters-form-publication"] + ... ${PUBLICATION_NAME_SUPERSEDE} - user wait for option to be available and select it css:select[id="filters-form-publication"] ${PUBLICATION_NAME_ARCHIVE} - sleep 1 # wait a moment to wait for release filter options to get updated - user wait for option to be available and select it css:select[id="filters-form-release"] ${RELEASE_NAME_ARCHIVE} + user wait for option to be available and select it css:select[id="filters-form-publication"] + ... ${PUBLICATION_NAME_ARCHIVE} + sleep 1 # wait a moment to wait for release filter options to get updated + user wait for option to be available and select it css:select[id="filters-form-release"] + ... ${RELEASE_NAME_ARCHIVE} user checks page contains button ${RELEASE_NAME_ARCHIVE} user checks element contains testid:release-info ${RELEASE_NAME_ARCHIVE} @@ -176,7 +180,8 @@ Navigate to superseding-publication release on Admin site ... ${RELEASE_NAME_SUPERSEDE} Import superseding-publication subject to release - user uploads subject and waits until complete ${SUBJECT_NAME_SUPERSEDE} upload-file-test.csv upload-file-test.meta.csv + user uploads subject and waits until complete ${SUBJECT_NAME_SUPERSEDE} upload-file-test.csv + ... upload-file-test.meta.csv Add data guidance to superseding-publication subject user clicks link Data guidance @@ -252,13 +257,14 @@ Check data catalogue page contains archive and superseding publication subjects user wait for option to be available and select it css:select[id="filters-form-theme"] %{TEST_THEME_NAME} - user checks select contains option css:select[id="filters-form-publication"] ${PUBLICATION_NAME_ARCHIVE} - user checks select contains option css:select[id="filters-form-publication"] ${PUBLICATION_NAME_SUPERSEDE} - - user wait for option to be available and select it css:select[id="filters-form-publication"] ${PUBLICATION_NAME_SUPERSEDE} - sleep 1 # wait a moment to wait for release filter options to get updated - user wait for option to be available and select it css:select[id="filters-form-release"] ${RELEASE_NAME_SUPERSEDE} + user checks select contains option css:select[id="filters-form-publication"] ${PUBLICATION_NAME_ARCHIVE} + user checks select contains option css:select[id="filters-form-publication"] ${PUBLICATION_NAME_SUPERSEDE} + user wait for option to be available and select it css:select[id="filters-form-publication"] + ... ${PUBLICATION_NAME_SUPERSEDE} + sleep 1 # wait a moment to wait for release filter options to get updated + user wait for option to be available and select it css:select[id="filters-form-release"] + ... ${RELEASE_NAME_SUPERSEDE} user checks page contains button ${RELEASE_NAME_SUPERSEDE} user checks element contains testid:release-info ${RELEASE_NAME_SUPERSEDE} @@ -267,9 +273,11 @@ Check data catalogue page contains archive and superseding publication subjects user checks element contains testid:release-info This is the latest data user waits until page contains ${SUBJECT_NAME_SUPERSEDE} - user wait for option to be available and select it css:select[id="filters-form-publication"] ${PUBLICATION_NAME_ARCHIVE} - sleep 1 # wait a moment to wait for release filter options to get updated - user wait for option to be available and select it css:select[id="filters-form-release"] ${RELEASE_NAME_ARCHIVE} + user wait for option to be available and select it css:select[id="filters-form-publication"] + ... ${PUBLICATION_NAME_ARCHIVE} + sleep 1 # wait a moment to wait for release filter options to get updated + user wait for option to be available and select it css:select[id="filters-form-release"] + ... ${RELEASE_NAME_ARCHIVE} user checks page contains button ${RELEASE_NAME_ARCHIVE} user checks element contains testid:release-info ${RELEASE_NAME_ARCHIVE} @@ -278,11 +286,10 @@ Check data catalogue page contains archive and superseding publication subjects user waits until page contains ${SUBJECT_NAME_ARCHIVE} Check data set page shows 'Not the latest data' for archived publication subject - user clicks link ${SUBJECT_NAME_ARCHIVE} + user clicks link ${SUBJECT_NAME_ARCHIVE} user waits until page contains Data set from ${PUBLICATION_NAME_ARCHIVE} user checks page contains Not the latest data - Check archive-publication permalink has out-of-date warning [Documentation] Failing due to https://dfedigital.atlassian.net/browse/EES-4269 [Tags] Failing @@ -306,7 +313,7 @@ Set archive-publication to be no longer be superseded user clicks button Edit publication details user waits until page contains element id:publicationDetailsForm-supersede - user chooses select option id:publicationDetailsForm-supersededById None selected + user chooses select option id:publicationDetailsForm-supersededById None selected user clicks button Update publication details ${modal}= user waits until modal is visible Confirm publication changes @@ -375,7 +382,7 @@ Check data catalogue page is correct after archive-publication has been unarchiv user checks select contains option id:filters-form-publication ${PUBLICATION_NAME_ARCHIVE} user checks select contains option id:filters-form-publication ${PUBLICATION_NAME_SUPERSEDE} - user wait for option to be available and select it id:filters-form-publication ${PUBLICATION_NAME_ARCHIVE} + user wait for option to be available and select it id:filters-form-publication ${PUBLICATION_NAME_ARCHIVE} user wait for option to be available and select it id:filters-form-release ${RELEASE_NAME_ARCHIVE} user checks page contains button ${RELEASE_NAME_ARCHIVE} diff --git a/tests/robot-tests/tests/admin_and_public/bau/data_reordering.robot b/tests/robot-tests/tests/admin_and_public/bau/data_reordering.robot index 9fc9da93d75..5b8d6b0b1cc 100644 --- a/tests/robot-tests/tests/admin_and_public/bau/data_reordering.robot +++ b/tests/robot-tests/tests/admin_and_public/bau/data_reordering.robot @@ -223,9 +223,8 @@ Cancel reordering indicators Replace subject data user clicks link Data uploads - user waits until h2 is visible Uploaded data files - ${section} user gets accordion section content element ${SUBJECT_NAME} - user clicks link Replace data ${section} + user waits until page contains data uploads table + user clicks link Replace data user chooses file id:dataFileUploadForm-dataFile ${FILES_DIR}grouped-filters-and-indicators-replacement.csv user chooses file id:dataFileUploadForm-metadataFile ... ${FILES_DIR}grouped-filters-and-indicators-replacement.meta.csv diff --git a/tests/robot-tests/tests/admin_and_public/bau/subject_reordering.robot b/tests/robot-tests/tests/admin_and_public/bau/subject_reordering.robot index db7d103156e..d01b01144c3 100644 --- a/tests/robot-tests/tests/admin_and_public/bau/subject_reordering.robot +++ b/tests/robot-tests/tests/admin_and_public/bau/subject_reordering.robot @@ -48,25 +48,27 @@ Upload subjects to release ... ordering-test-2.meta.csv Validate order of subjects after upload - user checks there are x accordion sections 4 id:uploadedDataFiles - user checks accordion is in position Four 1 id:uploadedDataFiles - user checks accordion is in position Three 2 id:uploadedDataFiles - user checks accordion is in position One 3 id:uploadedDataFiles - user checks accordion is in position Two 4 id:uploadedDataFiles + user waits until page contains data uploads table + user checks table body has x rows count=4 parent=testid:Data files table + + user checks table cell contains row=1 column=1 expected=Four parent=testid:Data files table + user checks table cell contains row=2 column=1 expected=Three parent=testid:Data files table + user checks table cell contains row=3 column=1 expected=One parent=testid:Data files table + user checks table cell contains row=4 column=1 expected=Two parent=testid:Data files table Validate order of subjects after refreshing Data and files page user reloads page - user waits until page contains element id:uploadedDataFiles + user waits until page contains data uploads table + user checks table body has x rows count=4 parent=testid:Data files table - user checks there are x accordion sections 4 id:uploadedDataFiles - user checks accordion is in position Four 1 id:uploadedDataFiles - user checks accordion is in position Three 2 id:uploadedDataFiles - user checks accordion is in position One 3 id:uploadedDataFiles - user checks accordion is in position Two 4 id:uploadedDataFiles + user checks table cell contains row=1 column=1 expected=Four parent=testid:Data files table + user checks table cell contains row=2 column=1 expected=Three parent=testid:Data files table + user checks table cell contains row=3 column=1 expected=One parent=testid:Data files table + user checks table cell contains row=4 column=1 expected=Two parent=testid:Data files table Order subjects - user clicks button Reorder - user waits until page contains button Save order + user clicks button Reorder data files + user waits until page contains button Confirm order click element xpath://div[text()="Four"] CTRL user presses keys ${SPACE} @@ -82,27 +84,25 @@ Order subjects user presses keys ARROW_DOWN user presses keys ${SPACE} - user clicks button Save order + user clicks button Confirm order user waits until page contains button Reorder - user checks accordion is in position One 1 id:uploadedDataFiles - user checks accordion is in position Two 2 id:uploadedDataFiles - user checks accordion is in position Four 3 id:uploadedDataFiles - user checks accordion is in position Three 4 id:uploadedDataFiles + user checks table cell contains row=1 column=1 expected=One parent=testid:Data files table + user checks table cell contains row=2 column=1 expected=Two parent=testid:Data files table + user checks table cell contains row=3 column=1 expected=Four parent=testid:Data files table + user checks table cell contains row=4 column=1 expected=Three parent=testid:Data files table Validate new order is preserved after refresh user reloads page - user waits until page contains element id:uploadedDataFiles + user waits until page contains data uploads table - user checks accordion is in position One 1 id:uploadedDataFiles - user checks accordion is in position Two 2 id:uploadedDataFiles - user checks accordion is in position Four 3 id:uploadedDataFiles - user checks accordion is in position Three 4 id:uploadedDataFiles + user checks table cell contains row=1 column=1 expected=One parent=testid:Data files table + user checks table cell contains row=2 column=1 expected=Two parent=testid:Data files table + user checks table cell contains row=3 column=1 expected=Four parent=testid:Data files table + user checks table cell contains row=4 column=1 expected=Three parent=testid:Data files table Start replacing last subject in order - user opens accordion section Three - ${THREE_CONTENT} user gets accordion section content element Three id:uploadedDataFiles - user clicks link Replace data ${THREE_CONTENT} + user clicks link in table cell row=4 column=4 link_text=Replace data parent=testid:Data files table user chooses file id:dataFileUploadForm-dataFile ${FILES_DIR}ordering-test-3-replacement.csv user chooses file id:dataFileUploadForm-metadataFile ... ${FILES_DIR}ordering-test-3-replacement.meta.csv @@ -117,28 +117,26 @@ Start replacing last subject in order Reorder subject that is being replaced user clicks link Data and files - user waits until page contains element id:uploadedDataFiles + user waits until page contains data uploads table - user clicks button Reorder - user waits until page contains button Save order + user clicks button Reorder data files + user waits until page contains button Confirm order click element xpath://div[text()="Three"] CTRL user presses keys ${SPACE} user presses keys ARROW_UP user presses keys ${SPACE} - user clicks button Save order - user waits until page contains button Reorder + user clicks button Confirm order + user waits until page contains button Reorder data files - user checks accordion is in position One 1 id:uploadedDataFiles - user checks accordion is in position Two 2 id:uploadedDataFiles - user checks accordion is in position Three 3 id:uploadedDataFiles - user checks accordion is in position Four 4 id:uploadedDataFiles + user checks table cell contains row=1 column=1 expected=One parent=testid:Data files table + user checks table cell contains row=2 column=1 expected=Two parent=testid:Data files table + user checks table cell contains row=3 column=1 expected=Three parent=testid:Data files table + user checks table cell contains row=4 column=1 expected=Four parent=testid:Data files table Complete data replacement - user opens accordion section Three - ${THREE_CONTENT} user gets accordion section content element Three id:uploadedDataFiles - user clicks link Replace data ${THREE_CONTENT} + user clicks link in table cell row=3 column=4 link_text=Replace data parent=testid:Data files table user waits until page contains Data blocks: OK user waits until page contains Footnotes: OK @@ -147,12 +145,12 @@ Complete data replacement Validate subject order is correct after replacement user clicks link Data and files - user waits until page contains element id:uploadedDataFiles + user waits until page contains data uploads table - user checks accordion is in position One 1 id:uploadedDataFiles - user checks accordion is in position Two 2 id:uploadedDataFiles - user checks accordion is in position Three 3 id:uploadedDataFiles - user checks accordion is in position Four 4 id:uploadedDataFiles + user checks table cell contains row=1 column=1 expected=One parent=testid:Data files table + user checks table cell contains row=2 column=1 expected=Two parent=testid:Data files table + user checks table cell contains row=3 column=1 expected=Three parent=testid:Data files table + user checks table cell contains row=4 column=1 expected=Four parent=testid:Data files table Add data guidance for all subjects user clicks link Data guidance @@ -188,12 +186,12 @@ Publish release Check subjects can no longer be re-ordered after release has been published user clicks link Data and files - user waits until page contains element id:uploadedDataFiles + user waits until page contains data uploads table - user checks accordion is in position One 1 id:uploadedDataFiles - user checks accordion is in position Two 2 id:uploadedDataFiles - user checks accordion is in position Three 3 id:uploadedDataFiles - user checks accordion is in position Four 4 id:uploadedDataFiles + user checks table cell contains row=1 column=1 expected=One parent=testid:Data files table + user checks table cell contains row=2 column=1 expected=Two parent=testid:Data files table + user checks table cell contains row=3 column=1 expected=Three parent=testid:Data files table + user checks table cell contains row=4 column=1 expected=Four parent=testid:Data files table user checks element is not visible testid:reorder-files %{WAIT_SMALL} diff --git a/tests/robot-tests/tests/admin_and_public_2/bau/publish_amend_and_cancel.robot b/tests/robot-tests/tests/admin_and_public_2/bau/publish_amend_and_cancel.robot index dd0acd40ce2..2958d9aeea3 100644 --- a/tests/robot-tests/tests/admin_and_public_2/bau/publish_amend_and_cancel.robot +++ b/tests/robot-tests/tests/admin_and_public_2/bau/publish_amend_and_cancel.robot @@ -212,15 +212,8 @@ Change the Release type Navigate to data replacement page user clicks link Data and files - user waits until h2 is visible Uploaded data files %{WAIT_MEDIUM} - user waits until page contains accordion section Dates test subject - user opens accordion section Dates test subject - - ${section}= user gets accordion section content element Dates test subject - user clicks link Replace data ${section} - - user waits until h2 is visible Data file details - user checks headed table body row contains Status Complete wait=%{WAIT_LONG} + user waits until page contains data uploads table + user clicks link Replace data Upload replacement data user waits until h2 is visible Upload replacement data %{WAIT_MEDIUM} @@ -400,16 +393,11 @@ Revisit the Release after the cancellation to double check it remains unaffected Verify that the Data and Files are unchanged user clicks link Data and files - user waits until h2 is visible Uploaded data files %{WAIT_MEDIUM} - user waits until page contains accordion section Dates test subject - user opens accordion section Dates test subject - ${section}= user gets accordion section content element Dates test subject - user checks headed table body row contains Subject title Dates test subject - user checks headed table body row contains Data file dates.csv - user checks headed table body row contains Metadata file dates.meta.csv - user checks headed table body row contains Number of rows 118 wait=%{WAIT_SMALL} - user checks headed table body row contains Data file size 17 Kb wait=%{WAIT_SMALL} - user checks headed table body row contains Status Complete wait=%{WAIT_LONG} + user waits until page contains data uploads table + user checks table cell contains row=1 column=1 expected=Dates test subject + ... parent=testid:Data files table + user checks table cell contains row=1 column=2 expected=17 Kb parent=testid:Data files table + user checks table cell contains row=1 column=3 expected=Complete parent=testid:Data files table Verify that the ancillary file is unchanged user clicks link Data and files diff --git a/tests/robot-tests/tests/admin_and_public_2/bau/publish_release_and_amend.robot b/tests/robot-tests/tests/admin_and_public_2/bau/publish_release_and_amend.robot index 043a2e80e2e..29b5cee2694 100644 --- a/tests/robot-tests/tests/admin_and_public_2/bau/publish_release_and_amend.robot +++ b/tests/robot-tests/tests/admin_and_public_2/bau/publish_release_and_amend.robot @@ -491,12 +491,8 @@ Change the Release type Navigate to data replacement page user clicks link Data and files - user waits until h2 is visible Uploaded data files %{WAIT_MEDIUM} - user waits until page contains accordion section Dates test subject - user opens accordion section Dates test subject - - ${section}= user gets accordion section content element Dates test subject - user clicks link Replace data ${section} + user waits until page contains data uploads table + user clicks link Replace data user waits until h2 is visible Data file details user checks headed table body row contains Subject title Dates test subject diff --git a/tests/robot-tests/tests/admin_and_public_2/bau/publish_release_and_amend_2.robot b/tests/robot-tests/tests/admin_and_public_2/bau/publish_release_and_amend_2.robot index 37106388d74..d6d1a785a23 100644 --- a/tests/robot-tests/tests/admin_and_public_2/bau/publish_release_and_amend_2.robot +++ b/tests/robot-tests/tests/admin_and_public_2/bau/publish_release_and_amend_2.robot @@ -254,12 +254,8 @@ Create release amendment Replace subject data user clicks link Data and files user waits until page contains element id:dataFileUploadForm-subjectTitle - user waits until h2 is visible Uploaded data files - - user waits until page contains accordion section ${SUBJECT_NAME} - user opens accordion section ${SUBJECT_NAME} - ${section} user gets accordion section content element ${SUBJECT_NAME} - user clicks link Replace data ${section} + user waits until page contains data uploads table + user clicks link Replace data user chooses file id:dataFileUploadForm-dataFile ${FILES_DIR}dates.csv user chooses file id:dataFileUploadForm-metadataFile ${FILES_DIR}dates.meta.csv user clicks button Upload data files diff --git a/tests/robot-tests/tests/general_public/data_set_page_absence_in_prus.robot b/tests/robot-tests/tests/general_public/data_set_page_absence_in_prus.robot index 1766d414dc9..26c5e7b64de 100644 --- a/tests/robot-tests/tests/general_public/data_set_page_absence_in_prus.robot +++ b/tests/robot-tests/tests/general_public/data_set_page_absence_in_prus.robot @@ -22,7 +22,7 @@ Validate title Validate data set info user checks page contains Latest data user checks page contains ${PUPIL_ABSENCE_PUBLICATION_TITLE} - user checks page contains ${PUPIL_ABSENCE_RELEASE_NAME} + user checks page contains ${PUPIL_ABSENCE_RELEASE_NAME} Validate zip contains correct files [Documentation] EES-4147 @@ -30,19 +30,20 @@ Validate zip contains correct files sleep 8 # wait for file to download ${list}= create list data/absence_in_prus.csv data-guidance/data-guidance.txt - zip should contain directories and files seed-publication-pupil-absence-in-schools-in-england_2016-17.zip ${list} + zip should contain directories and files seed-publication-pupil-absence-in-schools-in-england_2016-17.zip + ... ${list} Validate data set details user checks summary list contains Theme ${PUPILS_AND_SCHOOLS_THEME_TITLE} user checks summary list contains Publication ${PUPIL_ABSENCE_PUBLICATION_TITLE} user checks summary list contains Release ${PUPIL_ABSENCE_RELEASE_NAME} - user checks summary list contains Release type Official statistics + user checks summary list contains Release type Official statistics user checks summary list contains Geographic levels Local authority, National, Regional user checks summary list contains Indicators Authorised absence rate user checks summary list contains Indicators Number of authorised absence sessions user checks summary list contains Indicators Number of authorised holiday sessions user checks summary list contains Indicators Show 24 more indicators - user checks summary list contains Time period 2013/14 to 2016/17 + user checks summary list contains Time period 2013/14 to 2016/17 Validate data set preview user checks table column heading contains 1 1 time_identifier testid:preview-table @@ -81,11 +82,11 @@ Validate data set variables Validate using this data user checks page contains button Download this data set (ZIP) user checks page contains link View or create your own tables - + Validate table tool link user clicks link View or create your own tables user waits until h1 is visible Create your own tables - user checks page contains Choose locations + user checks page contains Choose locations user checks previous table tool step contains 1 Publication ${PUPIL_ABSENCE_PUBLICATION_TITLE} user checks previous table tool step contains 2 Data set Absence in PRUs diff --git a/tests/robot-tests/tests/general_public/methodology_page_absence.robot b/tests/robot-tests/tests/general_public/methodology_page_absence.robot index 64fbd04cffa..cadc37b168d 100644 --- a/tests/robot-tests/tests/general_public/methodology_page_absence.robot +++ b/tests/robot-tests/tests/general_public/methodology_page_absence.robot @@ -26,7 +26,7 @@ Validate Published date user checks summary list contains Published 22 March 2018 Validate Last updated is not visible - user checks page does not contain testid Last updated + user waits until page does not contain testid Last updated Validate accordion sections order user checks accordion is in position 1. Overview of absence statistics 1 id:content diff --git a/tests/robot-tests/tests/general_public/prod_only/redirects.robot b/tests/robot-tests/tests/general_public/prod_only/redirects.robot index 2a702af2d45..a584c39b612 100644 --- a/tests/robot-tests/tests/general_public/prod_only/redirects.robot +++ b/tests/robot-tests/tests/general_public/prod_only/redirects.robot @@ -58,7 +58,7 @@ Verify that routes with search parameters retain them Verify that multiple rules work together user navigates to public frontend %{PUBLIC_URL}/data-catalogue/1000?foo=bar&baz=zod - user waits until page contains Data catalogue + user waits until page contains Data catalogue user checks url equals %{PUBLIC_URL}/data-catalogue?foo=bar&baz=zod user navigates to public frontend %{PUBLIC_URL}/data-catalogue/1000/?foo=bar diff --git a/tests/robot-tests/tests/general_public/prod_only/statistics_page.robot b/tests/robot-tests/tests/general_public/prod_only/statistics_page.robot index 9237010d028..c220d104639 100644 --- a/tests/robot-tests/tests/general_public/prod_only/statistics_page.robot +++ b/tests/robot-tests/tests/general_public/prod_only/statistics_page.robot @@ -33,7 +33,7 @@ Validate Related information section and links exist Validate themes filters exist user checks select contains option id:filters-form-theme All themes - user checks selected option label id:filters-form-theme All themes + user checks selected option label id:filters-form-theme All themes user checks select contains option id:filters-form-theme Children's social care user checks select contains option id:filters-form-theme COVID-19 user checks select contains option id:filters-form-theme Destination of pupils and students @@ -46,11 +46,9 @@ Validate themes filters exist user checks select contains option id:filters-form-theme Teachers and school workforce user checks select contains option id:filters-form-theme UK education and training statistics - - Validate release type filters exist user checks select contains option id:filters-form-release-type All release types - user checks selected option label id:filters-form-release-type All release types + user checks selected option label id:filters-form-release-type All release types user checks select contains option id:filters-form-release-type Accredited official statistics user checks select contains option id:filters-form-release-type Official statistics user checks select contains option id:filters-form-release-type Official statistics in development @@ -73,7 +71,7 @@ Filter by theme Remove theme filter user clicks button Pupils and schools user checks page does not contain button Pupils and schools - user checks selected option label id:filters-form-theme All themes + user checks selected option label id:filters-form-theme All themes Filter by release type user chooses select option id:filters-form-release-type Official statistics @@ -82,7 +80,7 @@ Filter by release type Remove release type filter user clicks button Official statistics user checks page does not contain button Official statistics - user checks selected option label id:filters-form-release-type All release types + user checks selected option label id:filters-form-release-type All release types Searching user clicks element id:searchForm-search @@ -92,7 +90,7 @@ Searching user clicks radio Relevance user waits until page finishes loading user checks page contains button pupil absence - user checks list item contains testid:publicationsList 1 Pupil absence in schools in England + user checks list item contains testid:publicationsList 1 Pupil absence in schools in England Removing search user clicks button pupil absence @@ -116,5 +114,5 @@ Reset all filters user checks page does not contain button Official statistics user checks page does not contain button Reset filters - user checks selected option label id:filters-form-theme All themes - user checks selected option label id:filters-form-release-type All release types + user checks selected option label id:filters-form-theme All themes + user checks selected option label id:filters-form-release-type All release types diff --git a/tests/robot-tests/tests/general_public/redirects.robot b/tests/robot-tests/tests/general_public/redirects.robot index f225e7510df..11bd90d3686 100644 --- a/tests/robot-tests/tests/general_public/redirects.robot +++ b/tests/robot-tests/tests/general_public/redirects.robot @@ -7,14 +7,15 @@ Test Setup fail test fast if required Force Tags GeneralPublic Local Dev Test Preprod + *** Variables *** -${PUBLIC_URL}= %{PUBLIC_URL} -${PUBLIC_URL_WITHOUT_AUTH} ${EMPTY} +${PUBLIC_URL}= %{PUBLIC_URL} +${PUBLIC_URL_WITHOUT_AUTH} ${EMPTY} #In local, public url contains authentication details. In order to make it work while running against dev- we need to get rid of it to compare public url against expected value. -*** Test Cases *** +*** Test Cases *** Parse and Store public url without auth details ${PUBLIC_URL_WITHOUT_AUTH}= remove auth from url %{PUBLIC_URL} set suite variable ${PUBLIC_URL_WITHOUT_AUTH} @@ -22,7 +23,7 @@ Parse and Store public url without auth details Verify that absolute paths with trailing slashes are redirected without them user navigates to public frontend %{PUBLIC_URL}/data-catalogue/ user waits until page contains Data catalogue - user checks url without auth equals ${PUBLIC_URL_WITHOUT_AUTH}/data-catalogue + user checks url without auth equals ${PUBLIC_URL_WITHOUT_AUTH}/data-catalogue user navigates to public frontend %{PUBLIC_URL}/glossary/?someRandomUrlParameter=123 user waits until page contains Glossary @@ -35,7 +36,7 @@ Verify that redirects do not affect browser history user navigates to public frontend %{PUBLIC_URL}/data-catalogue/ user waits until page contains Data catalogue - user checks url without auth equals ${PUBLIC_URL_WITHOUT_AUTH}/data-catalogue + user checks url without auth equals ${PUBLIC_URL_WITHOUT_AUTH}/data-catalogue user goes back user checks url equals about:blank diff --git a/tests/robot-tests/tests/general_public/statistics_page.robot b/tests/robot-tests/tests/general_public/statistics_page.robot index 0087eaaeace..930ebfd6b4e 100644 --- a/tests/robot-tests/tests/general_public/statistics_page.robot +++ b/tests/robot-tests/tests/general_public/statistics_page.robot @@ -35,13 +35,13 @@ Validate Related information section and links exist Validate themes filters exist user checks select contains option id:filters-form-theme All themes - user checks selected option label id:filters-form-theme All themes + user checks selected option label id:filters-form-theme All themes user checks select contains option id:filters-form-theme ${PUPILS_AND_SCHOOLS_THEME_TITLE} user checks select contains option id:filters-form-theme ${ROLE_PERMISSIONS_THEME_TITLE} Validate release type filters exist user checks select contains option id:filters-form-release-type All release types - user checks selected option label id:filters-form-release-type All release types + user checks selected option label id:filters-form-release-type All release types user checks select contains option id:filters-form-release-type Accredited official statistics user checks select contains option id:filters-form-release-type Official statistics user checks select contains option id:filters-form-release-type Official statistics in development @@ -64,7 +64,7 @@ Filter by theme Remove theme filter user clicks button ${PUPILS_AND_SCHOOLS_THEME_TITLE} user checks page does not contain button ${PUPILS_AND_SCHOOLS_THEME_TITLE} - user checks selected option label id:filters-form-theme All themes + user checks selected option label id:filters-form-theme All themes Filter by release type user chooses select option id:filters-form-release-type Official statistics @@ -73,13 +73,13 @@ Filter by release type Remove release type filter user clicks button Official statistics user checks page does not contain button Official statistics - user checks selected option label id:filters-form-release-type All release types + user checks selected option label id:filters-form-release-type All release types Searching # filter by theme first to make sure we get the seed publication on dev. user chooses select option id:filters-form-theme ${PUPILS_AND_SCHOOLS_THEME_TITLE} user checks page contains button ${PUPILS_AND_SCHOOLS_THEME_TITLE} - + user clicks element id:searchForm-search user presses keys pupil absence user clicks button Search @@ -108,5 +108,5 @@ Reset all filters user checks page does not contain button Official statistics user checks page does not contain button Reset filters - user checks selected option label id:filters-form-theme All themes - user checks selected option label id:filters-form-release-type All release types + user checks selected option label id:filters-form-theme All themes + user checks selected option label id:filters-form-release-type All release types diff --git a/tests/robot-tests/tests/libs/admin-common.robot b/tests/robot-tests/tests/libs/admin-common.robot index ff743643c7d..11d5deca2e4 100644 --- a/tests/robot-tests/tests/libs/admin-common.robot +++ b/tests/robot-tests/tests/libs/admin-common.robot @@ -486,11 +486,10 @@ user creates amendment for release user deletes subject file [Arguments] ${SUBJECT_NAME} - user waits until page contains accordion section ${SUBJECT_NAME} - user opens accordion section ${SUBJECT_NAME} - user scrolls to accordion section ${SUBJECT_NAME} - ${accordion}= user gets accordion section content element ${SUBJECT_NAME} - ${button}= user gets button element Delete files ${accordion} + user waits until page contains data uploads table + ${row}= user gets table row ${SUBJECT_NAME} testid:Data files table + user scrolls to element ${row} + ${button}= user gets button element Delete files ${row} user clicks element ${button} user clicks button Confirm @@ -575,25 +574,44 @@ user uploads subject user chooses file id:dataFileUploadForm-metadataFile ${FOLDER}${META_FILE} user clicks button Upload data files user waits until h2 is visible Uploaded data files %{WAIT_LONG} - user waits until page contains accordion section ${SUBJECT_NAME} %{WAIT_SMALL} - user scrolls to accordion section ${SUBJECT_NAME} - user opens accordion section ${SUBJECT_NAME} - ${section}= user gets accordion section content element ${SUBJECT_NAME} + user waits until page contains element testid:Data files table IF "${IMPORT_STATUS}" != "Importing" user waits until page finishes loading END - user checks headed table body row contains Status ${IMPORT_STATUS} ${section} %{WAIT_DATA_FILE_IMPORT} + user waits until page contains data uploads table + ${row}= user gets table row row_cell_text=${SUBJECT_NAME} parent=testid:Data files table + ... wait=%{WAIT_SMALL} + ${status_cell}= user gets testid element id=Status wait=%{WAIT_SMALL} parent=${row} + user scrolls to element ${status_cell} + user waits until element contains element=${status_cell} text=${IMPORT_STATUS} + ... wait=%{WAIT_DATA_FILE_IMPORT} user waits until data upload is completed [Arguments] ... ${SUBJECT_NAME} user clicks link Data and files user waits until h2 is visible Add data file to release - user opens accordion section ${SUBJECT_NAME} - ${section}= user gets accordion section content element ${SUBJECT_NAME} - user checks headed table body row contains Status Complete ${section} %{WAIT_DATA_FILE_IMPORT} + user waits until data file import is complete ${SUBJECT_NAME} + +user waits until data files table contains subject + [Arguments] + ... ${SUBJECT_NAME} + user gets table row ${SUBJECT_NAME} testid:Data files table %{WAIT_DATA_FILE_IMPORT} + +user waits until data file import is complete + [Arguments] + ... ${SUBJECT_NAME} + user waits until page contains data uploads table + ${row}= user gets table row ${SUBJECT_NAME} testid:Data files table %{WAIT_DATA_FILE_IMPORT} + user waits until element contains ${row} Complete + +user waits until page contains data uploads table + user waits until page contains testid Data files table %{WAIT_DATA_FILE_IMPORT} + +user waits until page does not contain data uploads table + user waits until page does not contain testid Data files table user puts release into draft [Arguments] diff --git a/tests/robot-tests/tests/libs/common.robot b/tests/robot-tests/tests/libs/common.robot index 742b5794980..df6d1b48822 100644 --- a/tests/robot-tests/tests/libs/common.robot +++ b/tests/robot-tests/tests/libs/common.robot @@ -353,9 +353,9 @@ user waits until page contains testid [Arguments] ${id} ${wait}=${timeout} user waits until page contains element css:[data-testid="${id}"] ${wait} -user checks page does not contain testid - [Arguments] ${id} - user checks page does not contain element css:[data-testid="${id}"] +user waits until page does not contain testid + [Arguments] ${id} ${wait}=${timeout} + user waits until page does not contain element css:[data-testid="${id}"] ${wait} user checks testid element contains [Arguments] ${id} ${text} diff --git a/tests/robot-tests/tests/libs/tables-common.robot b/tests/robot-tests/tests/libs/tables-common.robot index 825184f9bfa..0de36fc92fc 100644 --- a/tests/robot-tests/tests/libs/tables-common.robot +++ b/tests/robot-tests/tests/libs/tables-common.robot @@ -23,9 +23,10 @@ user checks table row heading contains user waits until element contains xpath://table/tbody/tr[${row}]/th[${column}] ${expected} user checks table cell contains - [Arguments] ${row} ${column} ${expected} ${parent}=css:table + [Arguments] ${row} ${column} ${expected} ${parent}=css:table ${wait}=%{WAIT_SMALL} user waits until parent contains element ${parent} ... xpath:.//tbody/tr[${row}]/td[${column}][contains(., "${expected}")] + ... timeout=${wait} user checks table cell does not contain [Arguments] ${row} ${column} ${expected} ${parent}=css:table @@ -58,7 +59,8 @@ user gets table row with heading [Return] ${elem} user gets table row - [Arguments] ${row_cell_text} ${parent}=css:table + [Arguments] ${row_cell_text} ${parent}=css:table ${wait}=%{WAIT_SMALL} + wait until page contains element ${parent} timeout=${wait} ${elem}= get child element ${parent} xpath:.//tbody/tr/td[text()="${row_cell_text}"]/.. [Return] ${elem} From 61aa59d0b6bbab4dde17a4cf82cd63ed3351ff53 Mon Sep 17 00:00:00 2001 From: Stuart Bennett Date: Mon, 20 Jan 2025 13:26:23 +0000 Subject: [PATCH 5/8] EES-5544 improved layout and code tidied --- .../Validators/ValidationMessages.cs | 2 +- .../release/data/ReleaseDataFilePage.tsx | 2 +- .../ReleaseDataFileReplacePage.test.tsx | 34 ++++++------------ .../data/components/DataFileDetailsTable.tsx | 8 ++--- .../data/components/DataFileUploadForm.tsx | 8 ++--- .../components/DataFilesTable.module.scss | 36 +++++++++++++------ .../data/components/DataFilesTable.tsx | 14 ++++---- .../data/components/ImporterStatus.tsx | 2 +- .../components/ReleaseDataUploadsSection.tsx | 18 +++++----- .../ReleaseDataUploadsSection.test.tsx | 28 ++++++--------- .../components/PrototypeDataReplace.tsx | 10 ++---- .../src/components/ButtonGroup.module.scss | 2 ++ .../tests/admin/bau/release_status.robot | 2 +- .../tests/admin/bau/upload_files.robot | 2 +- .../bau/data_reordering.robot | 8 ++--- .../bau/subject_reordering.robot | 6 ++-- .../bau/publish_amend_and_cancel.robot | 2 +- .../bau/publish_release_and_amend.robot | 10 +++--- 18 files changed, 91 insertions(+), 103 deletions(-) diff --git a/src/GovUk.Education.ExploreEducationStatistics.Admin/Validators/ValidationMessages.cs b/src/GovUk.Education.ExploreEducationStatistics.Admin/Validators/ValidationMessages.cs index 9354e84ff7a..56cacada637 100644 --- a/src/GovUk.Education.ExploreEducationStatistics.Admin/Validators/ValidationMessages.cs +++ b/src/GovUk.Education.ExploreEducationStatistics.Admin/Validators/ValidationMessages.cs @@ -207,7 +207,7 @@ public static ErrorViewModel GenerateErrorDataReplacementAlreadyInProgress() public static readonly LocalizableMessage DataSetTitleTooLong = new( Code: nameof(DataSetTitleTooLong), - Message: "Subject title '{0}' must be 120 characters or less" + Message: "Title '{0}' must be 120 characters or less" ); public static ErrorViewModel GenerateErrorDataSetTitleTooLong(string title) diff --git a/src/explore-education-statistics-admin/src/pages/release/data/ReleaseDataFilePage.tsx b/src/explore-education-statistics-admin/src/pages/release/data/ReleaseDataFilePage.tsx index f189c26ab73..d61ebdb8138 100644 --- a/src/explore-education-statistics-admin/src/pages/release/data/ReleaseDataFilePage.tsx +++ b/src/explore-education-statistics-admin/src/pages/release/data/ReleaseDataFilePage.tsx @@ -82,7 +82,7 @@ export default function ReleaseDataFilePage({ .required('Enter a title') .max( titleMaxLength, - `Subject title must be ${titleMaxLength} characters or less`, + `Title must be ${titleMaxLength} characters or less`, ), })} > diff --git a/src/explore-education-statistics-admin/src/pages/release/data/__tests__/ReleaseDataFileReplacePage.test.tsx b/src/explore-education-statistics-admin/src/pages/release/data/__tests__/ReleaseDataFileReplacePage.test.tsx index 472a1f63738..b5b37407a76 100644 --- a/src/explore-education-statistics-admin/src/pages/release/data/__tests__/ReleaseDataFileReplacePage.test.tsx +++ b/src/explore-education-statistics-admin/src/pages/release/data/__tests__/ReleaseDataFileReplacePage.test.tsx @@ -112,9 +112,7 @@ describe('ReleaseDataFileReplacePage', () => { ); await waitFor(() => { - expect(screen.getByTestId('Subject title')).toHaveTextContent( - 'Test data', - ); + expect(screen.getByTestId('Title')).toHaveTextContent('Test data'); expect(screen.getByTestId('Data file')).toHaveTextContent('data.csv'); expect(screen.getByTestId('Metadata file')).toHaveTextContent( 'data.meta.csv', @@ -216,7 +214,7 @@ describe('ReleaseDataFileReplacePage', () => { await waitFor(() => { // Replacement - expect(screen.getByTestId('Replacement Subject title')).toHaveTextContent( + expect(screen.getByTestId('Replacement Title')).toHaveTextContent( 'Test data', ); expect(screen.getByTestId('Replacement Data file')).toHaveTextContent( @@ -242,9 +240,7 @@ describe('ReleaseDataFileReplacePage', () => { ); // Original - expect(screen.getByTestId('Subject title')).toHaveTextContent( - 'Test data', - ); + expect(screen.getByTestId('Title')).toHaveTextContent('Test data'); expect(screen.getByTestId('Data file')).toHaveTextContent('data.csv'); expect(screen.getByTestId('Metadata file')).toHaveTextContent( 'data.meta.csv', @@ -252,7 +248,7 @@ describe('ReleaseDataFileReplacePage', () => { expect(screen.getByTestId('Data file size')).toHaveTextContent('200 B'); expect(screen.getByTestId('Number of rows')).toHaveTextContent('100'); expect(screen.getByTestId('Status')).toHaveTextContent( - 'Data replacement in progress', + 'Replacement in progress', ); expect(screen.getByTestId('Uploaded by')).toHaveTextContent( 'original@test.com', @@ -305,9 +301,7 @@ describe('ReleaseDataFileReplacePage', () => { ), ).toBeInTheDocument(); - expect(screen.getByTestId('Subject title')).toHaveTextContent( - 'Test data', - ); + expect(screen.getByTestId('Title')).toHaveTextContent('Test data'); expect(screen.getByTestId('Data file')).toHaveTextContent('data.csv'); expect(screen.getByTestId('Metadata file')).toHaveTextContent( 'data.meta.csv', @@ -315,7 +309,7 @@ describe('ReleaseDataFileReplacePage', () => { expect(screen.getByTestId('Data file size')).toHaveTextContent('200 B'); expect(screen.getByTestId('Number of rows')).toHaveTextContent('100'); expect(screen.getByTestId('Status')).toHaveTextContent( - 'Data replacement in progress', + 'Replacement in progress', ); expect(screen.getByTestId('Uploaded by')).toHaveTextContent( 'original@test.com', @@ -325,9 +319,7 @@ describe('ReleaseDataFileReplacePage', () => { ); expect(screen.getByText('Pending data replacement')).toBeInTheDocument(); - expect( - screen.getByText('Data replacement in progress'), - ).toBeInTheDocument(); + expect(screen.getByText('Replacement in progress')).toBeInTheDocument(); expect( screen.getByText( 'There was a problem loading the data replacement information.', @@ -376,9 +368,7 @@ describe('ReleaseDataFileReplacePage', () => { await waitFor(() => { expect(screen.getByText('Pending data replacement')).toBeInTheDocument(); - expect( - screen.getByText('Data replacement in progress'), - ).toBeInTheDocument(); + expect(screen.getByText('Replacement in progress')).toBeInTheDocument(); expect(screen.getByText('Data blocks: OK')).toBeInTheDocument(); expect(screen.getByText('Footnotes: OK')).toBeInTheDocument(); @@ -433,9 +423,7 @@ describe('ReleaseDataFileReplacePage', () => { await waitFor(() => { expect(screen.getByText('Pending data replacement')).toBeInTheDocument(); - expect( - screen.getByText('Data replacement in progress'), - ).toBeInTheDocument(); + expect(screen.getByText('Replacement in progress')).toBeInTheDocument(); expect( screen.getByText(/The replacement data file is still being processed/), ); @@ -485,9 +473,7 @@ describe('ReleaseDataFileReplacePage', () => { await waitFor(() => { expect(screen.getByText('Pending data replacement')).toBeInTheDocument(); - expect( - screen.getByText('Data replacement in progress'), - ).toBeInTheDocument(); + expect(screen.getByText('Replacement in progress')).toBeInTheDocument(); expect( screen.getByText( 'There was a problem loading the data replacement information.', diff --git a/src/explore-education-statistics-admin/src/pages/release/data/components/DataFileDetailsTable.tsx b/src/explore-education-statistics-admin/src/pages/release/data/components/DataFileDetailsTable.tsx index b39364777f2..d3003cb16db 100644 --- a/src/explore-education-statistics-admin/src/pages/release/data/components/DataFileDetailsTable.tsx +++ b/src/explore-education-statistics-admin/src/pages/release/data/components/DataFileDetailsTable.tsx @@ -39,13 +39,11 @@ const DataFileDetailsTable = ({ - + {replacementDataFile && ( - + )} diff --git a/src/explore-education-statistics-admin/src/pages/release/data/components/DataFileUploadForm.tsx b/src/explore-education-statistics-admin/src/pages/release/data/components/DataFileUploadForm.tsx index ac728bd6ba2..153cf145d09 100644 --- a/src/explore-education-statistics-admin/src/pages/release/data/components/DataFileUploadForm.tsx +++ b/src/explore-education-statistics-admin/src/pages/release/data/components/DataFileUploadForm.tsx @@ -35,9 +35,9 @@ const subjectErrorMappings = [ mapFieldErrors({ target: 'subjectTitle', messages: { - SubjectTitleMustBeUnique: 'Subject title must be unique', + SubjectTitleMustBeUnique: 'Title must be unique', SubjectTitleCannotContainSpecialCharacters: - 'Subject title cannot contain special characters', + 'Title cannot contain special characters', }, }), ]; @@ -200,7 +200,7 @@ export default function DataFileUploadForm({ }) .max( titleMaxLength, - `Subject title must be ${titleMaxLength} characters or less`, + `Title must be ${titleMaxLength} characters or less`, ), }), }); @@ -239,7 +239,7 @@ export default function DataFileUploadForm({ {!isDataReplacement && uploadType !== 'bulkZip' && ( name="subjectTitle" - label="Subject title" + label="Title" className="govuk-!-width-two-thirds" maxLength={titleMaxLength} /> diff --git a/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.module.scss b/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.module.scss index 78e4ca7c7d5..9c1f2cd8ae2 100644 --- a/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.module.scss +++ b/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.module.scss @@ -2,21 +2,35 @@ .table { td { - padding-bottom: govuk-spacing(2); - padding-top: govuk-spacing(2); vertical-align: middle; } +} - .fileSize { - width: 5rem; - text-align: right; - } +.title { + max-width: 500px; +} - .fileStatus { - max-width: 164px; - } +.fileSize { + width: 5rem; + text-align: right; +} + +.fileStatus { + max-width: 126px; +} + +.actions { + margin-bottom: 0; + + @include govuk-media-query($until: desktop) { + align-items: start; + flex-direction: column; - .actions { - margin-bottom: 0; + a, + button { + margin-bottom: 1rem; + margin-left: 0; + white-space: nowrap; + } } } diff --git a/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.tsx b/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.tsx index 71e716066c1..db33bfdafff 100644 --- a/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.tsx +++ b/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.tsx @@ -40,7 +40,7 @@ interface Props { ) => Promise; } -const DataFilesTable = ({ +export default function DataFilesTable({ dataFiles: initialDataFiles, publicationId, releaseId, @@ -50,7 +50,7 @@ const DataFilesTable = ({ onConfirmReordering, onDeleteFile, onStatusChange, -}: Props) => { +}: Props) { const [dataFiles, setDataFiles] = useState(initialDataFiles); useEffect(() => { @@ -86,7 +86,7 @@ const DataFilesTable = ({
Subject title
- Subject title + Title {dataFile.title}{dataFile.title} - {replacementDataFile.title} - {replacementDataFile.title}
- + @@ -96,7 +96,9 @@ const DataFilesTable = ({ {dataFiles.map(dataFile => ( - + @@ -234,6 +236,4 @@ const DataFilesTable = ({
Subject titleTitle Size Status Actions
{dataFile.title} + {dataFile.title} + {dataFile.fileSize.size.toLocaleString()} {dataFile.fileSize.unit}
); -}; - -export default DataFilesTable; +} diff --git a/src/explore-education-statistics-admin/src/pages/release/data/components/ImporterStatus.tsx b/src/explore-education-statistics-admin/src/pages/release/data/components/ImporterStatus.tsx index 3a1aa271f45..346db40778d 100644 --- a/src/explore-education-statistics-admin/src/pages/release/data/components/ImporterStatus.tsx +++ b/src/explore-education-statistics-admin/src/pages/release/data/components/ImporterStatus.tsx @@ -142,7 +142,7 @@ const ImporterStatus = ({ } > {dataFile.replacedBy - ? 'Data replacement in progress' + ? 'Replacement in progress' : getImportStatusLabel(currentStatus.status)}
diff --git a/src/explore-education-statistics-admin/src/pages/release/data/components/ReleaseDataUploadsSection.tsx b/src/explore-education-statistics-admin/src/pages/release/data/components/ReleaseDataUploadsSection.tsx index f3c2542968a..13294293780 100644 --- a/src/explore-education-statistics-admin/src/pages/release/data/components/ReleaseDataUploadsSection.tsx +++ b/src/explore-education-statistics-admin/src/pages/release/data/components/ReleaseDataUploadsSection.tsx @@ -117,16 +117,14 @@ const ReleaseDataUploadsSection = ({ ); }; - const handleDeleteFile = async (dataFile: DataFile) => { - releaseDataFileService - .getDeleteDataFilePlan(releaseId, dataFile) - .then(plan => { - setDeleteDataFile({ - plan, - file: dataFile, - }); - }); - }; + const handleDeleteFile = async (dataFile: DataFile) => + setDeleteDataFile({ + plan: await releaseDataFileService.getDeleteDataFilePlan( + releaseId, + dataFile, + ), + file: dataFile, + }); const handleSubmit = useCallback( async (values: DataFileUploadFormValues) => { diff --git a/src/explore-education-statistics-admin/src/pages/release/data/components/__tests__/ReleaseDataUploadsSection.test.tsx b/src/explore-education-statistics-admin/src/pages/release/data/components/__tests__/ReleaseDataUploadsSection.test.tsx index 74235870048..3d515198280 100644 --- a/src/explore-education-statistics-admin/src/pages/release/data/components/__tests__/ReleaseDataUploadsSection.test.tsx +++ b/src/explore-education-statistics-admin/src/pages/release/data/components/__tests__/ReleaseDataUploadsSection.test.tsx @@ -150,9 +150,7 @@ describe('ReleaseDataUploadsSection', () => { const fileTableRows = screen.getAllByRole('row'); const fileTableRow1 = within(fileTableRows[1]); - expect(fileTableRow1.getByTestId('Subject title')).toHaveTextContent( - 'Test data 1', - ); + expect(fileTableRow1.getByTestId('Title')).toHaveTextContent('Test data 1'); expect(fileTableRow1.getByTestId('Data file size')).toHaveTextContent( '50 Kb', ); @@ -160,9 +158,7 @@ describe('ReleaseDataUploadsSection', () => { const fileTableRow2 = within(fileTableRows[2]); - expect(fileTableRow2.getByTestId('Subject title')).toHaveTextContent( - 'Test data 2', - ); + expect(fileTableRow2.getByTestId('Title')).toHaveTextContent('Test data 2'); expect(fileTableRow2.getByTestId('Status')).toHaveTextContent('Complete'); }); @@ -198,12 +194,10 @@ describe('ReleaseDataUploadsSection', () => { const fileTableRow1 = getTableRow(1); - expect(fileTableRow1.getByTestId('Subject title')).toHaveTextContent( - 'Test data 1', - ); + expect(fileTableRow1.getByTestId('Title')).toHaveTextContent('Test data 1'); expect(fileTableRow1.getByTestId('Status')).toHaveTextContent( - 'Data replacement in progress', + 'Replacement in progress', ); }); @@ -427,7 +421,7 @@ describe('ReleaseDataUploadsSection', () => { expect(screen.getAllByRole('row')).toHaveLength(2); }); - expect(getTableRow(1).getByTestId('Subject title')).toHaveTextContent( + expect(getTableRow(1).getByTestId('Title')).toHaveTextContent( 'Test data 1', ); }); @@ -647,7 +641,7 @@ describe('ReleaseDataUploadsSection', () => { , ); - await user.type(screen.getByLabelText('Subject title'), 'Test data 1'); + await user.type(screen.getByLabelText('Title'), 'Test data 1'); await user.click( screen.getByRole('button', { @@ -655,7 +649,7 @@ describe('ReleaseDataUploadsSection', () => { }), ); - await user.click(screen.getByLabelText('Subject title')); + await user.click(screen.getByLabelText('Title')); await waitFor(() => { expect( @@ -809,7 +803,7 @@ describe('ReleaseDataUploadsSection', () => { type: 'text/csv', }); - await user.type(screen.getByLabelText('Subject title'), 'Test title'); + await user.type(screen.getByLabelText('Title'), 'Test title'); await user.upload(screen.getByLabelText('Upload data file'), dataFile); await user.upload( @@ -860,7 +854,7 @@ describe('ReleaseDataUploadsSection', () => { type: 'application/zip', }); - await user.type(screen.getByLabelText('Subject title'), 'Test zip title'); + await user.type(screen.getByLabelText('Title'), 'Test zip title'); await user.click(screen.getByLabelText('ZIP file')); @@ -1002,7 +996,7 @@ describe('ReleaseDataUploadsSection', () => { type: 'text/csv', }); - await user.type(screen.getByLabelText('Subject title'), 'Test title'); + await user.type(screen.getByLabelText('Title'), 'Test title'); await user.upload(screen.getByLabelText('Upload data file'), dataFile); await user.upload( @@ -1082,7 +1076,7 @@ describe('ReleaseDataUploadsSection', () => { type: 'application/zip', }); - await user.type(screen.getByLabelText('Subject title'), 'Test title'); + await user.type(screen.getByLabelText('Title'), 'Test title'); await user.click(screen.getByLabelText('ZIP file')); diff --git a/src/explore-education-statistics-admin/src/prototypes/components/PrototypeDataReplace.tsx b/src/explore-education-statistics-admin/src/prototypes/components/PrototypeDataReplace.tsx index 2271bab29c2..1b7a6c0e0a8 100644 --- a/src/explore-education-statistics-admin/src/prototypes/components/PrototypeDataReplace.tsx +++ b/src/explore-education-statistics-admin/src/prototypes/components/PrototypeDataReplace.tsx @@ -44,7 +44,7 @@ const PrototypeMetaPreview = () => { @@ -67,9 +67,7 @@ const PrototypeMetaPreview = () => { - - Data example 1 - + Data example 1 example-data-{updatedData ? '2' : '1'}.csv{' '} {replaceInProgress && ( @@ -116,9 +114,7 @@ const PrototypeMetaPreview = () => { (updatedData && Complete)} {replaceInProgress && ( <> - - Data replacement in progress - + Replacement in progress Before confirming the data replacement please check the information below. Making this change could affect existing diff --git a/src/explore-education-statistics-common/src/components/ButtonGroup.module.scss b/src/explore-education-statistics-common/src/components/ButtonGroup.module.scss index 11fd2f3790e..01d0e5b1a42 100644 --- a/src/explore-education-statistics-common/src/components/ButtonGroup.module.scss +++ b/src/explore-education-statistics-common/src/components/ButtonGroup.module.scss @@ -10,6 +10,7 @@ margin-bottom: govuk-spacing(6); > * { + text-align: center; margin-bottom: 0; } @@ -20,6 +21,7 @@ @include govuk-media-query($from: tablet) { flex-direction: row; + align-items: center; > * + * { margin-left: var(--horizontalSpacing); diff --git a/tests/robot-tests/tests/admin/bau/release_status.robot b/tests/robot-tests/tests/admin/bau/release_status.robot index 4efa4117920..bdce32e8c59 100644 --- a/tests/robot-tests/tests/admin/bau/release_status.robot +++ b/tests/robot-tests/tests/admin/bau/release_status.robot @@ -319,7 +319,7 @@ Navigate to data replacement page user chooses file id:dataFileUploadForm-metadataFile ${FILES_DIR}dates-replacement.meta.csv user clicks button Upload data files - user waits until page contains element testid:Replacement Subject title + user waits until page contains element testid:Replacement Title user reloads page user checks table column heading contains 1 1 Original file user checks table column heading contains 1 2 Replacement file diff --git a/tests/robot-tests/tests/admin/bau/upload_files.robot b/tests/robot-tests/tests/admin/bau/upload_files.robot index 14c921fde1d..9bdbc6a7897 100644 --- a/tests/robot-tests/tests/admin/bau/upload_files.robot +++ b/tests/robot-tests/tests/admin/bau/upload_files.robot @@ -28,7 +28,7 @@ Navigate to 'Data and files' page Upload a ZIP file subject [Documentation] EES-1397 - user enters text into element label:Subject title Absence in PRUs + user enters text into element label:Title Absence in PRUs user clicks radio ZIP file user waits until page contains element label:Upload ZIP file user chooses file label:Upload ZIP file ${FILES_DIR}upload-zip-test.zip diff --git a/tests/robot-tests/tests/admin_and_public/bau/data_reordering.robot b/tests/robot-tests/tests/admin_and_public/bau/data_reordering.robot index 5b8d6b0b1cc..49699c0f944 100644 --- a/tests/robot-tests/tests/admin_and_public/bau/data_reordering.robot +++ b/tests/robot-tests/tests/admin_and_public/bau/data_reordering.robot @@ -230,18 +230,18 @@ Replace subject data ... ${FILES_DIR}grouped-filters-and-indicators-replacement.meta.csv user clicks button Upload data files - user waits until page contains element testid:Replacement Subject title + user waits until page contains element testid:Replacement Title user checks table column heading contains 1 1 Original file user checks table column heading contains 1 2 Replacement file - user checks headed table body row cell contains Subject title 1 ${SUBJECT_NAME} + user checks headed table body row cell contains Title 1 ${SUBJECT_NAME} user checks headed table body row cell contains Data file 1 grouped-filters-and-indicators.csv user checks headed table body row cell contains Metadata file 1 grouped-filters-and-indicators.meta.csv user checks headed table body row cell contains Number of rows 1 100 wait=%{WAIT_SMALL} user checks headed table body row cell contains Data file size 1 13 Kb - user checks headed table body row cell contains Status 1 Data replacement in progress wait=%{WAIT_LONG} + user checks headed table body row cell contains Status 1 Replacement in progress wait=%{WAIT_LONG} - user checks headed table body row cell contains Subject title 2 ${SUBJECT_NAME} + user checks headed table body row cell contains Title 2 ${SUBJECT_NAME} user checks headed table body row cell contains Data file 2 grouped-filters-and-indicators-replacement.csv user checks headed table body row cell contains Metadata file 2 ... grouped-filters-and-indicators-replacement.meta.csv diff --git a/tests/robot-tests/tests/admin_and_public/bau/subject_reordering.robot b/tests/robot-tests/tests/admin_and_public/bau/subject_reordering.robot index d01b01144c3..5f6df9b697c 100644 --- a/tests/robot-tests/tests/admin_and_public/bau/subject_reordering.robot +++ b/tests/robot-tests/tests/admin_and_public/bau/subject_reordering.robot @@ -108,10 +108,10 @@ Start replacing last subject in order ... ${FILES_DIR}ordering-test-3-replacement.meta.csv user clicks button Upload data files - user waits until page contains element testid:Replacement Subject title - user checks headed table body row cell contains Subject title 1 Three + user waits until page contains element testid:Replacement Title + user checks headed table body row cell contains Title 1 Three user checks headed table body row cell contains Data file 1 ordering-test-3.csv - user checks headed table body row cell contains Subject title 2 Three + user checks headed table body row cell contains Title 2 Three user checks headed table body row cell contains Data file 2 ordering-test-3-replacement.csv user checks headed table body row cell contains Status 2 Complete wait=%{WAIT_DATA_FILE_IMPORT} diff --git a/tests/robot-tests/tests/admin_and_public_2/bau/publish_amend_and_cancel.robot b/tests/robot-tests/tests/admin_and_public_2/bau/publish_amend_and_cancel.robot index 2958d9aeea3..685d5008fc7 100644 --- a/tests/robot-tests/tests/admin_and_public_2/bau/publish_amend_and_cancel.robot +++ b/tests/robot-tests/tests/admin_and_public_2/bau/publish_amend_and_cancel.robot @@ -221,7 +221,7 @@ Upload replacement data user chooses file id:dataFileUploadForm-metadataFile ${FILES_DIR}dates-replacement.meta.csv user clicks button Upload data files - user waits until page contains element testid:Replacement Subject title + user waits until page contains element testid:Replacement Title user checks table column heading contains 1 1 Original file user checks table column heading contains 1 2 Replacement file user checks headed table body row cell contains Status 2 Complete wait=%{WAIT_DATA_FILE_IMPORT} diff --git a/tests/robot-tests/tests/admin_and_public_2/bau/publish_release_and_amend.robot b/tests/robot-tests/tests/admin_and_public_2/bau/publish_release_and_amend.robot index 29b5cee2694..9ed3d727441 100644 --- a/tests/robot-tests/tests/admin_and_public_2/bau/publish_release_and_amend.robot +++ b/tests/robot-tests/tests/admin_and_public_2/bau/publish_release_and_amend.robot @@ -495,7 +495,7 @@ Navigate to data replacement page user clicks link Replace data user waits until h2 is visible Data file details - user checks headed table body row contains Subject title Dates test subject + user checks headed table body row contains Title Dates test subject user checks headed table body row contains Data file dates.csv user checks headed table body row contains Metadata file dates.meta.csv user checks headed table body row contains Number of rows 118 wait=%{WAIT_SMALL} @@ -508,18 +508,18 @@ Upload replacement data user chooses file id:dataFileUploadForm-metadataFile ${FILES_DIR}dates-replacement.meta.csv user clicks button Upload data files - user waits until page contains element testid:Replacement Subject title + user waits until page contains element testid:Replacement Title user checks table column heading contains 1 1 Original file user checks table column heading contains 1 2 Replacement file - user checks headed table body row cell contains Subject title 1 Dates test subject + user checks headed table body row cell contains Title 1 Dates test subject user checks headed table body row cell contains Data file 1 dates.csv user checks headed table body row cell contains Metadata file 1 dates.meta.csv user checks headed table body row cell contains Number of rows 1 118 wait=%{WAIT_SMALL} user checks headed table body row cell contains Data file size 1 17 Kb wait=%{WAIT_SMALL} - user checks headed table body row cell contains Status 1 Data replacement in progress wait=%{WAIT_LONG} + user checks headed table body row cell contains Status 1 Replacement in progress wait=%{WAIT_LONG} - user checks headed table body row cell contains Subject title 2 Dates test subject + user checks headed table body row cell contains Title 2 Dates test subject user checks headed table body row cell contains Data file 2 dates-replacement.csv user checks headed table body row cell contains Metadata file 2 dates-replacement.meta.csv user checks headed table body row cell contains Number of rows 2 118 wait=%{WAIT_SMALL} From 1a5442daf537cc89efa408c3ab8e485391015994 Mon Sep 17 00:00:00 2001 From: Stuart Bennett Date: Mon, 20 Jan 2025 15:10:06 +0000 Subject: [PATCH 6/8] EES-5544 removed named params from robot tests --- .../tests/admin/bau/upload_files.robot | 18 +++--- .../bau/subject_reordering.robot | 64 +++++++++---------- .../bau/publish_amend_and_cancel.robot | 7 +- .../robot-tests/tests/libs/admin-common.robot | 8 +-- .../tests/libs/tables-common.robot | 5 ++ 5 files changed, 51 insertions(+), 51 deletions(-) diff --git a/tests/robot-tests/tests/admin/bau/upload_files.robot b/tests/robot-tests/tests/admin/bau/upload_files.robot index 9bdbc6a7897..ad46a3db7ef 100644 --- a/tests/robot-tests/tests/admin/bau/upload_files.robot +++ b/tests/robot-tests/tests/admin/bau/upload_files.robot @@ -39,13 +39,13 @@ Upload a ZIP file subject # To ensure "Data file size" and "Number of rows" will be filled user waits until page does not contain Queued %{WAIT_MEDIUM} - user checks table cell contains row=1 column=1 expected=Absence in PRUs parent=testid:Data files table - user checks table cell contains row=1 column=2 expected=141 Kb parent=testid:Data files table - user checks table cell contains row=1 column=3 expected=Complete parent=testid:Data files table - user checks table cell contains row=1 column=4 expected=View details parent=testid:Data files table - user checks table cell contains row=1 column=4 expected=Edit title parent=testid:Data files table - user checks table cell contains row=1 column=4 expected=Replace data parent=testid:Data files table - user checks table cell contains row=1 column=4 expected=Delete files parent=testid:Data files table + user checks table cell contains 1 1 Absence in PRUs testid:Data files table + user checks table cell contains 1 2 141 Kb testid:Data files table + user waits until table cell contains 1 3 Complete testid:Data files table + user checks table cell contains 1 4 View details testid:Data files table + user checks table cell contains 1 4 Edit title testid:Data files table + user checks table cell contains 1 4 Replace data testid:Data files table + user checks table cell contains 1 4 Delete files testid:Data files table Change subject title user clicks link Edit title @@ -58,9 +58,7 @@ Change subject title Validate subject title has been updated user waits until h2 is visible Uploaded data files - - user checks table cell contains row=1 column=1 expected=Updated Absence in PRUs - ... parent=testid:Data files table + user checks table cell contains 1 1 Updated Absence in PRUs testid:Data files table Check subject appears in 'Data blocks' page user clicks link Data blocks diff --git a/tests/robot-tests/tests/admin_and_public/bau/subject_reordering.robot b/tests/robot-tests/tests/admin_and_public/bau/subject_reordering.robot index 5f6df9b697c..704ca47bb1e 100644 --- a/tests/robot-tests/tests/admin_and_public/bau/subject_reordering.robot +++ b/tests/robot-tests/tests/admin_and_public/bau/subject_reordering.robot @@ -49,22 +49,22 @@ Upload subjects to release Validate order of subjects after upload user waits until page contains data uploads table - user checks table body has x rows count=4 parent=testid:Data files table + user checks table body has x rows 4 testid:Data files table - user checks table cell contains row=1 column=1 expected=Four parent=testid:Data files table - user checks table cell contains row=2 column=1 expected=Three parent=testid:Data files table - user checks table cell contains row=3 column=1 expected=One parent=testid:Data files table - user checks table cell contains row=4 column=1 expected=Two parent=testid:Data files table + user checks table cell contains 1 1 Four testid:Data files table + user checks table cell contains 2 1 Three testid:Data files table + user checks table cell contains 3 1 One testid:Data files table + user checks table cell contains 4 1 Two testid:Data files table Validate order of subjects after refreshing Data and files page user reloads page user waits until page contains data uploads table - user checks table body has x rows count=4 parent=testid:Data files table + user checks table body has x rows 4 testid:Data files table - user checks table cell contains row=1 column=1 expected=Four parent=testid:Data files table - user checks table cell contains row=2 column=1 expected=Three parent=testid:Data files table - user checks table cell contains row=3 column=1 expected=One parent=testid:Data files table - user checks table cell contains row=4 column=1 expected=Two parent=testid:Data files table + user checks table cell contains 1 1 Four testid:Data files table + user checks table cell contains 2 1 Three testid:Data files table + user checks table cell contains 3 1 One testid:Data files table + user checks table cell contains 4 1 Two testid:Data files table Order subjects user clicks button Reorder data files @@ -87,22 +87,22 @@ Order subjects user clicks button Confirm order user waits until page contains button Reorder - user checks table cell contains row=1 column=1 expected=One parent=testid:Data files table - user checks table cell contains row=2 column=1 expected=Two parent=testid:Data files table - user checks table cell contains row=3 column=1 expected=Four parent=testid:Data files table - user checks table cell contains row=4 column=1 expected=Three parent=testid:Data files table + user checks table cell contains 1 1 One testid:Data files table + user checks table cell contains 2 1 Two testid:Data files table + user checks table cell contains 3 1 Four testid:Data files table + user checks table cell contains 4 1 Three testid:Data files table Validate new order is preserved after refresh user reloads page user waits until page contains data uploads table - user checks table cell contains row=1 column=1 expected=One parent=testid:Data files table - user checks table cell contains row=2 column=1 expected=Two parent=testid:Data files table - user checks table cell contains row=3 column=1 expected=Four parent=testid:Data files table - user checks table cell contains row=4 column=1 expected=Three parent=testid:Data files table + user checks table cell contains 1 1 One testid:Data files table + user checks table cell contains 2 1 Two testid:Data files table + user checks table cell contains 3 1 Four testid:Data files table + user checks table cell contains 4 1 Three testid:Data files table Start replacing last subject in order - user clicks link in table cell row=4 column=4 link_text=Replace data parent=testid:Data files table + user clicks link in table cell 4 4 Replace data testid:Data files table user chooses file id:dataFileUploadForm-dataFile ${FILES_DIR}ordering-test-3-replacement.csv user chooses file id:dataFileUploadForm-metadataFile ... ${FILES_DIR}ordering-test-3-replacement.meta.csv @@ -130,13 +130,13 @@ Reorder subject that is being replaced user clicks button Confirm order user waits until page contains button Reorder data files - user checks table cell contains row=1 column=1 expected=One parent=testid:Data files table - user checks table cell contains row=2 column=1 expected=Two parent=testid:Data files table - user checks table cell contains row=3 column=1 expected=Three parent=testid:Data files table - user checks table cell contains row=4 column=1 expected=Four parent=testid:Data files table + user checks table cell contains 1 1 One testid:Data files table + user checks table cell contains 2 1 Two testid:Data files table + user checks table cell contains 3 1 Three testid:Data files table + user checks table cell contains 4 1 Four testid:Data files table Complete data replacement - user clicks link in table cell row=3 column=4 link_text=Replace data parent=testid:Data files table + user clicks link in table cell 3 4 Replace data testid:Data files table user waits until page contains Data blocks: OK user waits until page contains Footnotes: OK @@ -147,10 +147,10 @@ Validate subject order is correct after replacement user clicks link Data and files user waits until page contains data uploads table - user checks table cell contains row=1 column=1 expected=One parent=testid:Data files table - user checks table cell contains row=2 column=1 expected=Two parent=testid:Data files table - user checks table cell contains row=3 column=1 expected=Three parent=testid:Data files table - user checks table cell contains row=4 column=1 expected=Four parent=testid:Data files table + user checks table cell contains 1 1 One testid:Data files table + user checks table cell contains 2 1 Two testid:Data files table + user checks table cell contains 3 1 Three testid:Data files table + user checks table cell contains 4 1 Four testid:Data files table Add data guidance for all subjects user clicks link Data guidance @@ -188,10 +188,10 @@ Check subjects can no longer be re-ordered after release has been published user clicks link Data and files user waits until page contains data uploads table - user checks table cell contains row=1 column=1 expected=One parent=testid:Data files table - user checks table cell contains row=2 column=1 expected=Two parent=testid:Data files table - user checks table cell contains row=3 column=1 expected=Three parent=testid:Data files table - user checks table cell contains row=4 column=1 expected=Four parent=testid:Data files table + user checks table cell contains 1 1 One testid:Data files table + user checks table cell contains 2 1 Two testid:Data files table + user checks table cell contains 3 1 Three testid:Data files table + user checks table cell contains 4 1 Four testid:Data files table user checks element is not visible testid:reorder-files %{WAIT_SMALL} diff --git a/tests/robot-tests/tests/admin_and_public_2/bau/publish_amend_and_cancel.robot b/tests/robot-tests/tests/admin_and_public_2/bau/publish_amend_and_cancel.robot index 685d5008fc7..46788606051 100644 --- a/tests/robot-tests/tests/admin_and_public_2/bau/publish_amend_and_cancel.robot +++ b/tests/robot-tests/tests/admin_and_public_2/bau/publish_amend_and_cancel.robot @@ -394,10 +394,9 @@ Revisit the Release after the cancellation to double check it remains unaffected Verify that the Data and Files are unchanged user clicks link Data and files user waits until page contains data uploads table - user checks table cell contains row=1 column=1 expected=Dates test subject - ... parent=testid:Data files table - user checks table cell contains row=1 column=2 expected=17 Kb parent=testid:Data files table - user checks table cell contains row=1 column=3 expected=Complete parent=testid:Data files table + user checks table cell contains 1 1 Dates test subject testid:Data files table + user checks table cell contains 1 2 17 Kb testid:Data files table + user checks table cell contains 1 3 Complete testid:Data files table Verify that the ancillary file is unchanged user clicks link Data and files diff --git a/tests/robot-tests/tests/libs/admin-common.robot b/tests/robot-tests/tests/libs/admin-common.robot index 11d5deca2e4..06273e40ecd 100644 --- a/tests/robot-tests/tests/libs/admin-common.robot +++ b/tests/robot-tests/tests/libs/admin-common.robot @@ -581,12 +581,10 @@ user uploads subject END user waits until page contains data uploads table - ${row}= user gets table row row_cell_text=${SUBJECT_NAME} parent=testid:Data files table - ... wait=%{WAIT_SMALL} - ${status_cell}= user gets testid element id=Status wait=%{WAIT_SMALL} parent=${row} + ${row}= user gets table row ${SUBJECT_NAME} testid:Data files table %{WAIT_SMALL} + ${status_cell}= user gets testid element Status %{WAIT_SMALL} ${row} user scrolls to element ${status_cell} - user waits until element contains element=${status_cell} text=${IMPORT_STATUS} - ... wait=%{WAIT_DATA_FILE_IMPORT} + user waits until element contains ${status_cell} ${IMPORT_STATUS} %{WAIT_DATA_FILE_IMPORT} user waits until data upload is completed [Arguments] diff --git a/tests/robot-tests/tests/libs/tables-common.robot b/tests/robot-tests/tests/libs/tables-common.robot index 0de36fc92fc..44345a59b14 100644 --- a/tests/robot-tests/tests/libs/tables-common.robot +++ b/tests/robot-tests/tests/libs/tables-common.robot @@ -23,6 +23,11 @@ user checks table row heading contains user waits until element contains xpath://table/tbody/tr[${row}]/th[${column}] ${expected} user checks table cell contains + [Arguments] ${row} ${column} ${expected} ${parent}=css:table + user waits until parent contains element ${parent} + ... xpath:.//tbody/tr[${row}]/td[${column}][contains(., "${expected}")] + +user waits until table cell contains [Arguments] ${row} ${column} ${expected} ${parent}=css:table ${wait}=%{WAIT_SMALL} user waits until parent contains element ${parent} ... xpath:.//tbody/tr[${row}]/td[${column}][contains(., "${expected}")] From d27e7c73a7e2b88cc764cc052496c0f64650aa78 Mon Sep 17 00:00:00 2001 From: Stuart Bennett Date: Mon, 20 Jan 2025 15:58:10 +0000 Subject: [PATCH 7/8] EES-5544 abstracted out 'wait' keywords into more appropriate keywords --- tests/robot-tests/tests/libs/admin-common.robot | 9 ++++++--- tests/robot-tests/tests/libs/tables-common.robot | 8 ++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/tests/robot-tests/tests/libs/admin-common.robot b/tests/robot-tests/tests/libs/admin-common.robot index 06273e40ecd..183e4d1c2fe 100644 --- a/tests/robot-tests/tests/libs/admin-common.robot +++ b/tests/robot-tests/tests/libs/admin-common.robot @@ -581,7 +581,8 @@ user uploads subject END user waits until page contains data uploads table - ${row}= user gets table row ${SUBJECT_NAME} testid:Data files table %{WAIT_SMALL} + user waits until table contains row with ${SUBJECT_NAME} testid:Data files table %{WAIT_SMALL} + ${row}= user gets table row ${SUBJECT_NAME} testid:Data files table ${status_cell}= user gets testid element Status %{WAIT_SMALL} ${row} user scrolls to element ${status_cell} user waits until element contains ${status_cell} ${IMPORT_STATUS} %{WAIT_DATA_FILE_IMPORT} @@ -596,13 +597,15 @@ user waits until data upload is completed user waits until data files table contains subject [Arguments] ... ${SUBJECT_NAME} - user gets table row ${SUBJECT_NAME} testid:Data files table %{WAIT_DATA_FILE_IMPORT} + user waits until table contains row with ${SUBJECT_NAME} testid:Data files table %{WAIT_DATA_FILE_IMPORT} + ${row}= user gets table row ${SUBJECT_NAME} testid:Data files table user waits until data file import is complete [Arguments] ... ${SUBJECT_NAME} user waits until page contains data uploads table - ${row}= user gets table row ${SUBJECT_NAME} testid:Data files table %{WAIT_DATA_FILE_IMPORT} + user waits until table contains row with ${SUBJECT_NAME} testid:Data files table %{WAIT_DATA_FILE_IMPORT} + ${row}= user gets table row ${SUBJECT_NAME} testid:Data files table user waits until element contains ${row} Complete user waits until page contains data uploads table diff --git a/tests/robot-tests/tests/libs/tables-common.robot b/tests/robot-tests/tests/libs/tables-common.robot index 44345a59b14..ef4a497929b 100644 --- a/tests/robot-tests/tests/libs/tables-common.robot +++ b/tests/robot-tests/tests/libs/tables-common.robot @@ -64,11 +64,15 @@ user gets table row with heading [Return] ${elem} user gets table row - [Arguments] ${row_cell_text} ${parent}=css:table ${wait}=%{WAIT_SMALL} - wait until page contains element ${parent} timeout=${wait} + [Arguments] ${row_cell_text} ${parent}=css:table ${elem}= get child element ${parent} xpath:.//tbody/tr/td[text()="${row_cell_text}"]/.. [Return] ${elem} +user waits until table contains row with + [Arguments] ${row_cell_text} ${parent}=css:table ${wait}=%{WAIT_SMALL} + wait until page contains element ${parent} timeout=${wait} + get child element ${parent} xpath:.//tbody/tr/td[text()="${row_cell_text}"]/.. + user checks table body has x rows [Arguments] ${count} ${parent}=css:table ${wait}=${timeout} user waits until parent contains element ${parent} xpath:.//tbody/tr timeout=${wait} count=${count} From a8fd3cc63a356f4d10a4fa63622196fb78676928 Mon Sep 17 00:00:00 2001 From: Nicholas Tsim Date: Tue, 28 Jan 2025 17:53:58 +0000 Subject: [PATCH 8/8] EES-5544 Tidy up data files table 'Actions' styling --- .../components/DataFilesTable.module.scss | 9 ++------- .../data/components/DataFilesTable.tsx | 2 +- .../src/components/ButtonGroup.module.scss | 20 ++++++++----------- .../src/styles/_reset.scss | 10 ++++++++++ 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.module.scss b/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.module.scss index 9c1f2cd8ae2..d2cf5c89304 100644 --- a/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.module.scss +++ b/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.module.scss @@ -20,17 +20,12 @@ } .actions { + --verticalSpacing: #{govuk-spacing(1)}; margin-bottom: 0; @include govuk-media-query($until: desktop) { align-items: start; flex-direction: column; - - a, - button { - margin-bottom: 1rem; - margin-left: 0; - white-space: nowrap; - } + white-space: nowrap; } } diff --git a/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.tsx b/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.tsx index db33bfdafff..cc1b627146e 100644 --- a/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.tsx +++ b/src/explore-education-statistics-admin/src/pages/release/data/components/DataFilesTable.tsx @@ -189,7 +189,7 @@ export default function DataFilesTable({ showClose title="Cannot delete files" triggerButton={ - + Delete files } diff --git a/src/explore-education-statistics-common/src/components/ButtonGroup.module.scss b/src/explore-education-statistics-common/src/components/ButtonGroup.module.scss index 01d0e5b1a42..dac817731ec 100644 --- a/src/explore-education-statistics-common/src/components/ButtonGroup.module.scss +++ b/src/explore-education-statistics-common/src/components/ButtonGroup.module.scss @@ -8,28 +8,24 @@ display: flex; flex-direction: column; margin-bottom: govuk-spacing(6); + column-gap: var(--horizontalSpacing); + row-gap: var(--verticalSpacing); > * { - text-align: center; margin-bottom: 0; } - > * + * { - margin-left: 0; - margin-top: var(--verticalSpacing); - } - @include govuk-media-query($from: tablet) { flex-direction: row; - align-items: center; - - > * + * { - margin-left: var(--horizontalSpacing); - margin-top: 0; - } } } +td > .group { + // Avoid centering within a table cell as this + // is likely to be an 'Actions' column. + align-items: start; +} + .horizontalSpacing--m { --horizontalSpacing: #{govuk-spacing(4)}; } diff --git a/src/explore-education-statistics-common/src/styles/_reset.scss b/src/explore-education-statistics-common/src/styles/_reset.scss index e5a0ec2945f..1ab1f54351a 100644 --- a/src/explore-education-statistics-common/src/styles/_reset.scss +++ b/src/explore-education-statistics-common/src/styles/_reset.scss @@ -7,3 +7,13 @@ html { * { box-sizing: inherit; } + +button, +input, +optgroup, +select, +textarea { + // Unset line heights as normalize.css sets these + // to 1.15 for some arbitrary reason! + line-height: unset; +}