process group cypress tests are passing w/ burnettk

This commit is contained in:
jasquat 2022-11-04 12:20:55 -04:00
parent edfa95124a
commit 79c0ffa6e1
9 changed files with 61 additions and 50 deletions

View File

@ -10,4 +10,9 @@ module.exports = defineConfig({
// implement node event listeners here // implement node event listeners here
}, },
}, },
// this scrolls away from the elements for some reason with carbon when set to top
// https://github.com/cypress-io/cypress/issues/2353
// https://docs.cypress.io/guides/core-concepts/interacting-with-elements#Scrolling
scrollBehavior: "center",
}); });

View File

@ -30,9 +30,9 @@ describe('process-groups', () => {
newGroupDisplayName newGroupDisplayName
); );
cy.contains('Delete').click(); cy.contains('Delete Process Group').click();
cy.contains('Are you sure'); cy.contains('Are you sure');
cy.contains('OK').click(); cy.getBySel('modal-confirmation-dialog').get('.cds--btn--danger').click();
cy.url().should('include', `process-groups`); cy.url().should('include', `process-groups`);
cy.contains(groupId).should('not.exist'); cy.contains(groupId).should('not.exist');
}); });

View File

@ -101,18 +101,15 @@ Cypress.Commands.add(
); );
Cypress.Commands.add('basicPaginationTest', () => { Cypress.Commands.add('basicPaginationTest', () => {
cy.get('#pagination-page-dropdown') cy.getBySel('pagination-options').scrollIntoView();
.type('typing_to_open_dropdown_box....FIXME') cy.get('.cds--select__item-count').find('.cds--select-input').select('2');
.find('.dropdown-item')
.contains(/^2$/)
.click();
cy.contains(/^1-2 of \d+$/); // NOTE: this is a em dash instead of en dash
cy.getBySel('pagination-previous-button-inactive'); cy.contains(/\b12 of \d+/);
cy.getBySel('pagination-next-button').click(); cy.get('.cds--pagination__button--forward').click();
cy.contains(/^3-4 of \d+$/); cy.contains(/\b34 of \d+/);
cy.getBySel('pagination-previous-button').click(); cy.get('.cds--pagination__button--backward').click();
cy.contains(/^1-2 of \d+$/); cy.contains(/\b12 of \d+/);
}); });
Cypress.Commands.add('assertAtLeastOneItemInPaginatedResults', () => { Cypress.Commands.add('assertAtLeastOneItemInPaginatedResults', () => {

View File

@ -9193,9 +9193,9 @@
"integrity": "sha512-NJGVKPS81XejHcLhaLJS7plab0fK3slPh11mESeeDq2W4ZI5kUKK/LRRdVDvjJseojbPB7ZwjnyOybg3Igea/A==" "integrity": "sha512-NJGVKPS81XejHcLhaLJS7plab0fK3slPh11mESeeDq2W4ZI5kUKK/LRRdVDvjJseojbPB7ZwjnyOybg3Igea/A=="
}, },
"node_modules/cypress": { "node_modules/cypress": {
"version": "10.8.0", "version": "10.11.0",
"resolved": "https://registry.npmjs.org/cypress/-/cypress-10.8.0.tgz", "resolved": "https://registry.npmjs.org/cypress/-/cypress-10.11.0.tgz",
"integrity": "sha512-QVse0dnLm018hgti2enKMVZR9qbIO488YGX06nH5j3Dg1isL38DwrBtyrax02CANU6y8F4EJUuyW6HJKw1jsFA==", "integrity": "sha512-lsaE7dprw5DoXM00skni6W5ElVVLGAdRUUdZjX2dYsGjbY/QnpzWZ95Zom1mkGg0hAaO/QVTZoFVS7Jgr/GUPA==",
"dev": true, "dev": true,
"hasInstallScript": true, "hasInstallScript": true,
"dependencies": { "dependencies": {
@ -36484,9 +36484,9 @@
"integrity": "sha512-NJGVKPS81XejHcLhaLJS7plab0fK3slPh11mESeeDq2W4ZI5kUKK/LRRdVDvjJseojbPB7ZwjnyOybg3Igea/A==" "integrity": "sha512-NJGVKPS81XejHcLhaLJS7plab0fK3slPh11mESeeDq2W4ZI5kUKK/LRRdVDvjJseojbPB7ZwjnyOybg3Igea/A=="
}, },
"cypress": { "cypress": {
"version": "10.8.0", "version": "10.11.0",
"resolved": "https://registry.npmjs.org/cypress/-/cypress-10.8.0.tgz", "resolved": "https://registry.npmjs.org/cypress/-/cypress-10.11.0.tgz",
"integrity": "sha512-QVse0dnLm018hgti2enKMVZR9qbIO488YGX06nH5j3Dg1isL38DwrBtyrax02CANU6y8F4EJUuyW6HJKw1jsFA==", "integrity": "sha512-lsaE7dprw5DoXM00skni6W5ElVVLGAdRUUdZjX2dYsGjbY/QnpzWZ95Zom1mkGg0hAaO/QVTZoFVS7Jgr/GUPA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@cypress/request": "^2.88.10", "@cypress/request": "^2.88.10",

View File

@ -26,13 +26,6 @@ export default function ButtonWithConfirmation({
setShowConfirmationPrompt(false); setShowConfirmationPrompt(false);
}; };
const modalBodyElement = () => {
if (description) {
return <Modal.Body>{description}</Modal.Body>;
}
return null;
};
const handleConfirmation = () => { const handleConfirmation = () => {
onConfirmation(); onConfirmation();
setShowConfirmationPrompt(false); setShowConfirmationPrompt(false);
@ -43,6 +36,7 @@ export default function ButtonWithConfirmation({
<Modal <Modal
open={showConfirmationPrompt} open={showConfirmationPrompt}
danger danger
data-qa="modal-confirmation-dialog"
modalHeading={description} modalHeading={description}
modalLabel={title} modalLabel={title}
primaryButtonText={confirmButtonLabel} primaryButtonText={confirmButtonLabel}

View File

@ -56,14 +56,22 @@ export default function NavigationBar() {
return ( return (
<> <>
<HeaderGlobalAction>{UserService.getUsername()}</HeaderGlobalAction> <HeaderGlobalAction>{UserService.getUsername()}</HeaderGlobalAction>
<HeaderGlobalAction aria-label="Logout" onClick={handleLogout}> <HeaderGlobalAction
aria-label="Logout"
onClick={handleLogout}
data-qa="logout-button"
>
<Logout /> <Logout />
</HeaderGlobalAction> </HeaderGlobalAction>
</> </>
); );
} }
return ( return (
<HeaderGlobalAction aria-label="Login" onClick={handleLogin}> <HeaderGlobalAction
data-qa="login-button"
aria-label="Login"
onClick={handleLogin}
>
<Login /> <Login />
</HeaderGlobalAction> </HeaderGlobalAction>
); );

View File

@ -35,20 +35,24 @@ export default function PaginationForTable({
navigate(`${path}?page=${newPage}&per_page=${pageSize}${queryParamString}`); navigate(`${path}?page=${newPage}&per_page=${pageSize}${queryParamString}`);
}; };
return ( if (pagination) {
<> return (
{tableToDisplay} <>
<Pagination {tableToDisplay}
backwardText="Previous page" <Pagination
forwardText="Next page" data-qa="pagination-options"
itemsPerPageText="Items per page:" backwardText="Previous page"
page={page} forwardText="Next page"
pageNumberText="Page Number" itemsPerPageText="Items per page:"
pageSize={perPage} page={page}
pageSizes={perPageOptions || PER_PAGE_OPTIONS} pageNumberText="Page Number"
totalItems={(pagination as any).total} pageSize={perPage}
onChange={updateRows} pageSizes={perPageOptions || PER_PAGE_OPTIONS}
/> totalItems={pagination.total}
</> onChange={updateRows}
); />
</>
);
}
return null;
} }

View File

@ -105,6 +105,7 @@ export default function ProcessGroupForm({
const textInputs = [ const textInputs = [
<TextInput <TextInput
id="process-group-display-name" id="process-group-display-name"
name="display_name"
invalidText="Display Name is required." invalidText="Display Name is required."
invalid={displayNameInvalid} invalid={displayNameInvalid}
labelText="Display Name*" labelText="Display Name*"
@ -118,6 +119,7 @@ export default function ProcessGroupForm({
textInputs.push( textInputs.push(
<TextInput <TextInput
id="process-group-identifier" id="process-group-identifier"
name="id"
invalidText="Identifier is required and must be all lowercase characters and hyphens." invalidText="Identifier is required and must be all lowercase characters and hyphens."
invalid={identifierInvalid} invalid={identifierInvalid}
labelText="Identifier*" labelText="Identifier*"
@ -137,6 +139,7 @@ export default function ProcessGroupForm({
textInputs.push( textInputs.push(
<TextInput <TextInput
id="process-group-description" id="process-group-description"
name="description"
labelText="Description" labelText="Description"
value={processGroup.description} value={processGroup.description}
onChange={(event: any) => onChange={(event: any) =>
@ -159,7 +162,7 @@ export default function ProcessGroupForm({
<ButtonWithConfirmation <ButtonWithConfirmation
description={`Delete Process Group ${processGroup.id}?`} description={`Delete Process Group ${processGroup.id}?`}
onConfirmation={deleteProcessGroup} onConfirmation={deleteProcessGroup}
buttonLabel="Delete" buttonLabel="Delete Process Group"
confirmButtonLabel="Delete" confirmButtonLabel="Delete"
/> />
); );

View File

@ -3,11 +3,11 @@ import { Link, useNavigate, useSearchParams } from 'react-router-dom';
import { import {
Button, Button,
Table, Table,
ExpandableTile, // ExpandableTile,
TileAboveTheFoldContent, // TileAboveTheFoldContent,
TileBelowTheFoldContent, // TileBelowTheFoldContent,
TextInput, // TextInput,
ClickableTile, // ClickableTile,
// @ts-ignore // @ts-ignore
} from '@carbon/react'; } from '@carbon/react';
import ProcessBreadcrumb from '../components/ProcessBreadcrumb'; import ProcessBreadcrumb from '../components/ProcessBreadcrumb';