-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Extend DescribeSystemsForm * Extend PrivacyDeclarationForm * Add joint controller and data protection impact assessment * Move system dependency field to abridged form * Prepare data protection impact assessment for payload * Add cypress tests * Extend ReviewSystemForm * Add tests for extended review form * Fix adding another declaration when name field is blank * Rename SuccessPage --> SystemRegisterSuccess * Pass system object through props * Update tests * Update changelog * Refactor ReviewSystemForm * Move config wizard system forms to system directory (#1097) * Move system forms to system directory * Refactor form layout components into its own file * Rename files from form --> step * Update changelog
- Loading branch information
1 parent
1d3bffc
commit 3f17946
Showing
16 changed files
with
512 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,6 +127,12 @@ describe("System management page", () => { | |
cy.intercept("GET", "/api/v1/data_use", { | ||
fixture: "data_uses.json", | ||
}).as("getDataUse"); | ||
cy.intercept("GET", "/api/v1/system", { | ||
fixture: "systems.json", | ||
}).as("getSystems"); | ||
cy.intercept("GET", "/api/v1/dataset", { fixture: "datasets.json" }).as( | ||
"getDatasets" | ||
); | ||
}); | ||
|
||
it("Can step through the flow", () => { | ||
|
@@ -135,13 +141,19 @@ describe("System management page", () => { | |
cy.visit("/system/new"); | ||
cy.getByTestId("manually-generate-btn").click(); | ||
cy.url().should("contain", "/system/new/configure"); | ||
cy.wait("@getSystems"); | ||
cy.getByTestId("input-name").type(system.name); | ||
cy.getByTestId("input-fides_key").type(system.fides_key); | ||
cy.getByTestId("input-description").type(system.description); | ||
cy.getByTestId("input-system_type").type(system.system_type); | ||
system.tags.forEach((tag) => { | ||
cy.getByTestId("input-tags").type(`${tag}{enter}`); | ||
}); | ||
cy.getByTestId("input-system_dependencies").click(); | ||
cy.getByTestId("input-system_dependencies").within(() => { | ||
cy.contains("Demo Analytics System").click(); | ||
}); | ||
|
||
cy.getByTestId("confirm-btn").click(); | ||
cy.wait("@postSystem").then((interception) => { | ||
const { body } = interception.request; | ||
|
@@ -153,6 +165,8 @@ describe("System management page", () => { | |
system_type: system.system_type, | ||
tags: system.tags, | ||
privacy_declarations: [], | ||
third_country_transfers: [], | ||
system_dependencies: ["demo_analytics_system"], | ||
}); | ||
}); | ||
|
||
|
@@ -183,9 +197,10 @@ describe("System management page", () => { | |
cy.getByTestId("next-btn").click(); | ||
cy.wait("@putSystem").then((interception) => { | ||
const { body } = interception.request; | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
const { dataset_references, ...expected } = declaration; | ||
expect(body.privacy_declarations[0]).to.eql(expected); | ||
expect(body.privacy_declarations[0]).to.eql({ | ||
...declaration, | ||
dataset_references: [], | ||
}); | ||
}); | ||
|
||
// Now at the Review stage | ||
|
@@ -199,6 +214,9 @@ describe("System management page", () => { | |
system.tags.forEach((tag) => { | ||
cy.getByTestId("review-System tags").contains(tag); | ||
}); | ||
system.system_dependencies.forEach((dep) => { | ||
cy.getByTestId("review-System dependencies").contains(dep); | ||
}); | ||
// Open up the privacy declaration | ||
cy.getByTestId( | ||
"declaration-Analyze customer behaviour for improvements." | ||
|
@@ -216,6 +234,9 @@ describe("System management page", () => { | |
cy.getByTestId("declaration-Data qualifier").contains( | ||
reviewDeclaration.data_qualifier | ||
); | ||
reviewDeclaration.dataset_references.forEach((dr) => { | ||
cy.getByTestId("declaration-Dataset references").contains(dr); | ||
}); | ||
|
||
cy.getByTestId("confirm-btn").click(); | ||
|
||
|
@@ -228,6 +249,141 @@ describe("System management page", () => { | |
cy.url().should("match", /system$/); | ||
}); | ||
}); | ||
|
||
it("Can render and post extended form fields", () => { | ||
const system = { | ||
fides_key: "foo", | ||
system_type: "cool system", | ||
data_responsibility_title: "Sub-Processor", | ||
organization_fides_key: "default_organization", | ||
administrating_department: "department", | ||
third_country_transfers: ["USA"], | ||
joint_controller: { | ||
name: "bob", | ||
email: "[email protected]", | ||
}, | ||
data_protection_impact_assessment: { | ||
is_required: true, | ||
progress: "in progress", | ||
link: "http://www.ethyca.com", | ||
}, | ||
}; | ||
cy.visit("/system/new"); | ||
cy.getByTestId("manually-generate-btn").click(); | ||
// input required fields | ||
cy.getByTestId("input-fides_key").type(system.fides_key); | ||
cy.getByTestId("input-system_type").type(system.system_type); | ||
|
||
// now input extra fields | ||
cy.getByTestId("input-data_responsibility_title").click(); | ||
cy.getByTestId("input-data_responsibility_title").within(() => { | ||
cy.contains(system.data_responsibility_title).click(); | ||
}); | ||
cy.getByTestId("input-administrating_department").type( | ||
system.administrating_department | ||
); | ||
cy.getByTestId("input-third_country_transfers").type( | ||
"United States of America{enter}" | ||
); | ||
cy.getByTestId("input-joint_controller.name").type( | ||
system.joint_controller.name | ||
); | ||
cy.getByTestId("input-joint_controller.email").type( | ||
system.joint_controller.email | ||
); | ||
cy.getByTestId( | ||
"input-data_protection_impact_assessment.is_required" | ||
).within(() => { | ||
cy.getByTestId("option-true").click(); | ||
}); | ||
cy.getByTestId("input-data_protection_impact_assessment.progress").type( | ||
system.data_protection_impact_assessment.progress | ||
); | ||
cy.getByTestId("input-data_protection_impact_assessment.link").type( | ||
system.data_protection_impact_assessment.link | ||
); | ||
|
||
cy.getByTestId("confirm-btn").click(); | ||
cy.wait("@postSystem").then((interception) => { | ||
const { body } = interception.request; | ||
expect(body).to.eql({ | ||
name: "", | ||
organization_fides_key: system.organization_fides_key, | ||
fides_key: system.fides_key, | ||
description: "", | ||
system_type: system.system_type, | ||
tags: [], | ||
privacy_declarations: [], | ||
third_country_transfers: ["USA"], | ||
system_dependencies: [], | ||
administrating_department: system.administrating_department, | ||
data_responsibility_title: system.data_responsibility_title, | ||
joint_controller: { | ||
...system.joint_controller, | ||
address: "", | ||
phone: "", | ||
}, | ||
data_protection_impact_assessment: | ||
system.data_protection_impact_assessment, | ||
}); | ||
}); | ||
|
||
// Fill in the privacy declaration form | ||
cy.wait("@getDataCategory"); | ||
cy.wait("@getDataQualifier"); | ||
cy.wait("@getDataSubject"); | ||
cy.wait("@getDataUse"); | ||
cy.wait("@getDatasets"); | ||
cy.getByTestId("privacy-declaration-form"); | ||
const declaration = { | ||
name: "my declaration", | ||
data_categories: ["user.biometric", "user.contact"], | ||
data_use: "advertising", | ||
data_subjects: ["citizen_voter", "consultant"], | ||
dataset_references: ["demo_users_dataset_2"], | ||
}; | ||
cy.getByTestId("input-name").type(declaration.name); | ||
declaration.data_categories.forEach((dc) => { | ||
cy.getByTestId("input-data_categories").type(`${dc}{enter}`); | ||
}); | ||
cy.getByTestId("input-data_use").type(`${declaration.data_use}{enter}`); | ||
declaration.data_subjects.forEach((ds) => { | ||
cy.getByTestId("input-data_subjects").type(`${ds}{enter}`); | ||
}); | ||
cy.getByTestId("input-dataset_references").click(); | ||
cy.getByTestId("input-dataset_references").within(() => { | ||
cy.contains("Demo Users Dataset 2").click(); | ||
}); | ||
cy.getByTestId("add-btn").click(); | ||
cy.getByTestId("next-btn").click(); | ||
cy.wait("@putSystem").then((interception) => { | ||
const { body } = interception.request; | ||
expect(body.privacy_declarations[0]).to.eql(declaration); | ||
}); | ||
|
||
// Now at the Review stage | ||
cy.getByTestId("review-heading"); | ||
cy.getByTestId("review-Data responsibility title").contains( | ||
"Controller" | ||
); | ||
cy.getByTestId("review-Administrating department").contains( | ||
"Engineering" | ||
); | ||
cy.getByTestId("review-Geographic location").contains("USA"); | ||
cy.getByTestId("review-Geographic location").contains("CAN"); | ||
cy.getByTestId("review-Joint controller").within(() => { | ||
cy.getByTestId("review-Name").contains("Sally Controller"); | ||
}); | ||
cy.getByTestId("review-Data protection impact assessment").within( | ||
() => { | ||
cy.getByTestId("review-Is required").contains("Yes"); | ||
cy.getByTestId("review-Progress").contains("Complete"); | ||
cy.getByTestId("review-Link").contains( | ||
"https://example.org/analytics_system_data_protection_impact_assessment" | ||
); | ||
} | ||
); | ||
}); | ||
}); | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.