Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Update and expand /client tests #1169

Merged
merged 25 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7f9a7a7
Update and add to client tests
howard-e Jul 22, 2024
dca7c02
Add test to open Test Page on Test Run page
howard-e Jul 22, 2024
c895366
Update TestRun tests
howard-e Jul 23, 2024
f6a9010
Update TestReview tests
howard-e Jul 23, 2024
094f316
TestRun tests fix attempt
howard-e Jul 23, 2024
08c54a3
TestRun tests fix attempt
howard-e Jul 23, 2024
e5e8928
Use predictable checked values in TestRun test
howard-e Jul 23, 2024
49f375c
log what ids are being shown in CI
howard-e Jul 23, 2024
12c9886
Additional filter constraints
howard-e Jul 23, 2024
36ebb32
log out what's happening on CI
howard-e Jul 23, 2024
a046c37
Temporarily ignore test in CI
howard-e Jul 23, 2024
431899b
Update reports tests
howard-e Jul 23, 2024
339bee6
Update Reports tests
howard-e Jul 23, 2024
4af66ea
Test with additional wait
howard-e Jul 24, 2024
d0ae434
Test with additional wait between popup
howard-e Jul 24, 2024
48b258f
Add tests for /candidate-review
howard-e Jul 24, 2024
4930e99
Add tests for /candidate-test-plan/+d/+d
howard-e Jul 24, 2024
deb35f0
Restore skipped testrun test
howard-e Jul 24, 2024
0bc24b8
Remove CI logging block
howard-e Jul 24, 2024
703ce19
Merge branch 'refs/heads/development' into update-e2e-tests
howard-e Jul 29, 2024
bed80c5
Remove unnecessary TODOs
howard-e Jul 29, 2024
10cb38e
Update snapshots
howard-e Jul 29, 2024
8f18b0a
Increase manual timeout to offset race condition
howard-e Jul 29, 2024
725d8c5
Merge branch 'refs/heads/development' into update-e2e-tests
howard-e Jul 29, 2024
93e29d3
Remove unnecessary waits
howard-e Jul 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions client/components/TestRun/Heading.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ const TestRunHeading = ({
<div className="test-info-wrapper">
<div
className="test-info-entity apg-example-name"
data-test="apg-example-name"
data-testid="apg-example-name"
>
<div className="info-label">
<b>Test Plan:</b> {testPlanTitle}
</div>
</div>
<div className="test-info-entity at-browser" data-test="at-browser">
<div className="test-info-entity at-browser" data-testid="at-browser">
<div className="at-browser-row">
<div className="info-label">
<b>AT:</b> {at}
Expand Down
2 changes: 1 addition & 1 deletion client/components/TestRun/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ const TestRun = () => {

return (
<>
<h1 ref={titleRef} data-test="testing-task" tabIndex={-1}>
<h1 ref={titleRef} data-testid="testing-task" tabIndex={-1}>
<span className="task-label">Test {currentTest.seq}:</span>
{currentTest.title}
</h1>
Expand Down
21 changes: 11 additions & 10 deletions client/components/UserSettings/UserSettings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ const UserSettings = () => {

return (
<Container id="main" as="main" tabIndex="-1">
<Container fluid data-test="user-settings-contents">
<Container fluid>
<Helmet>
<title>Settings | ARIA-AT</title>
</Helmet>
<h1>Settings</h1>
<section data-test="user-settings-authorized">
<section>
<h2>User Details</h2>
<p>
<a
Expand All @@ -87,30 +87,31 @@ const UserSettings = () => {
<div aria-atomic="true" aria-live="polite">
{savedAts.length > 0 ? (
<div>
<p>
<p data-testid="testable-ats-status">
You can currently test the following assistive technologies:
</p>
<ul>
{ats
.filter(({ id: atId }) => savedAts.includes(atId))
.map(at => (
<li key={at.id}>{at.name}</li>
<li style={{ listStyle: 'disc' }} key={at.id}>
{at.name}
</li>
))}
</ul>
</div>
) : (
<p>
You currently are not configured to run any assistive
technologies.
<p data-testid="testable-ats-status">
You have not yet selected any assistive technologies.
</p>
)}
</div>
<p>
Submit the form below to update the assistive technologies you can
test:
Update the assistive technologies you can test by selecting from the
options below:
</p>
<Form>
<h3 id="at-group-label">ATs</h3>
<h3 id="at-group-label">Assistive Technologies</h3>
<Form.Group
controlId="formBasicCheckbox"
role="group"
Expand Down
2 changes: 2 additions & 0 deletions client/components/common/AtAndBrowserDetailsModal/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ const AtAndBrowserDetailsModal = ({
onChange={handleAtVersionChange}
isInvalid={isAtVersionError}
required
data-testid="at-browser-modal-select"
>
{['Select a Version', ...atVersions].map(item => (
<option
Expand Down Expand Up @@ -545,6 +546,7 @@ const AtAndBrowserDetailsModal = ({
onChange={handleBrowserVersionChange}
isInvalid={isBrowserVersionError}
required
data-testid="at-browser-modal-input"
/>
{isBrowserVersionError && (
<Form.Control.Feedback
Expand Down
3 changes: 0 additions & 3 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.11.0",
"dotenv-webpack": "^8.1.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.8",
"eslint": "^8.57.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-jest": "^27.9.0",
Expand All @@ -84,7 +82,6 @@
"file-loader": "^6.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-enzyme": "^7.1.2",
"prettier": "^2.8.8",
"puppeteer": "^21.11.0",
"storybook-addon-apollo-client": "^4.1.4",
Expand Down
25 changes: 0 additions & 25 deletions client/tests/App.test.jsx

This file was deleted.

6 changes: 6 additions & 0 deletions client/tests/AssignTesterDropdown.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,19 @@ useMutation.mockImplementation(mutation => {
const getMocks = (atKey, browserKey) => {
const at = {
nvda: {
__typename: 'At',
id: '2',
name: 'NVDA',
key: 'nvda'
},
jaws: {
__typename: 'At',
id: '1',
name: 'JAWS',
key: 'jaws'
},
voiceover_macos: {
__typename: 'At',
id: '3',
name: 'VoiceOver for MacOS',
key: 'voiceover_macos'
Expand All @@ -93,16 +96,19 @@ const getMocks = (atKey, browserKey) => {

const browser = {
chrome: {
__typename: 'Browser',
id: '2',
name: 'Chrome',
key: 'chrome'
},
safari_macos: {
__typename: 'Browser',
id: '3',
name: 'Safari for MacOS',
key: 'safari_macos'
},
voiceover_macos: {
__typename: 'Browser',
id: '3',
name: 'VoiceOver for MacOS',
key: 'voiceover_macos'
Expand Down
66 changes: 2 additions & 64 deletions client/tests/DataManagement.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,10 @@
* @jest-environment jsdom
*/

import React, { act } from 'react';
import { render, renderHook, waitFor } from '@testing-library/react';
import { InMemoryCache } from '@apollo/client';
import { MockedProvider } from '@apollo/client/testing';
import { BrowserRouter } from 'react-router-dom';
import { act } from 'react';
import { renderHook } from '@testing-library/react';
import '@testing-library/jest-dom';
import DataManagement from '../components/DataManagement';

// eslint-disable-next-line jest/no-mocks-import
import { DATA_MANAGEMENT_PAGE_POPULATED_MOCK_DATA } from './__mocks__/GraphQLMocks';
import {
useDataManagementTableFiltering,
useDataManagementTableSorting,
Expand All @@ -24,62 +18,6 @@ import {
DATA_MANAGEMENT_TABLE_SORT_OPTIONS
} from '../components/DataManagement/utils';
import { TABLE_SORT_ORDERS } from '../components/common/SortableTableHeader';
import { AriaLiveRegionProvider } from '../components/providers/AriaLiveRegionProvider';

const setup = (mocks = []) => {
return render(
<BrowserRouter>
<AriaLiveRegionProvider>
<MockedProvider
mocks={mocks}
cache={new InMemoryCache({ addTypename: false })}
>
<DataManagement />
</MockedProvider>
</AriaLiveRegionProvider>
</BrowserRouter>
);
};

describe('Data Management page', () => {
let wrapper;

beforeEach(() => {
wrapper = setup(DATA_MANAGEMENT_PAGE_POPULATED_MOCK_DATA);
});

it('renders loading state on initialization', async () => {
const { getByTestId } = wrapper;
const element = getByTestId('page-status');

expect(element).toBeTruthy();
expect(element).toHaveTextContent('Loading');
});

it('renders Status Summary component', async () => {
// allow page time to load
await waitFor(() => new Promise(res => setTimeout(res, 0)));

const { queryAllByText } = wrapper;
const statusSummaryElement = queryAllByText(/Test Plans Status Summary/i);
const testPlanElement = queryAllByText(/Test Plan/i);
const coveredAtElement = queryAllByText(/Covered AT/i);
const overallStatusElement = queryAllByText(/Overall Status/i);
const rdElement = queryAllByText(/R&D Version/i);
const draftElement = queryAllByText(/Draft Review/i);
const candidateElement = queryAllByText(/Candidate Review/i);
const recommendedElement = queryAllByText(/Recommended Version/i);

expect(statusSummaryElement.length).toBeGreaterThanOrEqual(1);
expect(testPlanElement.length).toBeGreaterThanOrEqual(1);
expect(coveredAtElement.length).toBeGreaterThanOrEqual(1);
expect(overallStatusElement.length).toBeGreaterThanOrEqual(1);
expect(rdElement.length).toBeGreaterThanOrEqual(1);
expect(draftElement.length).toBeGreaterThanOrEqual(1);
expect(candidateElement.length).toBeGreaterThanOrEqual(1);
expect(recommendedElement.length).toBeGreaterThanOrEqual(1);
});
});

const testPlans = [
{ title: 'Test A', directory: 'dirA', id: '1' },
Expand Down
49 changes: 0 additions & 49 deletions client/tests/TestRun.test.jsx

This file was deleted.

49 changes: 0 additions & 49 deletions client/tests/UserSettings.test.jsx

This file was deleted.

Loading