Skip to content

Commit

Permalink
Last modified date and openacr version name (GSA#51)
Browse files Browse the repository at this point in the history
* Added last modified date and version fields as readonly. Added logic to set the last modified date to the most recent and increment the version on import.

* Added new fields to report. Adjusted reportFilename to include version in it.

* Updated and tests to check for dates and version in report.

* Added darker styling for readonly fields. Updated packages and tests.
  • Loading branch information
dmundra authored Feb 18, 2022
1 parent c8657de commit 0a937cc
Show file tree
Hide file tree
Showing 12 changed files with 789 additions and 852 deletions.
2 changes: 2 additions & 0 deletions cypress/fixtures/drupal-9.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ author:
phone: (510) 408-7510
website: https://civicactions.com/
report_date: 8/31/2021
last_modified_date: 11/16/2021
version: 12
notes: Links to the issues identified are included where possible to ensure that this is a living document where outstanding issues are regularly reviewed for compliance. The Authoring tool is evaluated against ATAG 2.0, Part A and B. Incorporating feedback from the Drupal community.
evaluation_methods_used: Use of automated tools like WAVE and Accessibility Insights. Manual keyboard only testing. Some testing with JAWS, NVDA and VoiceOver. The evaluation process also includes a review of the Drupal Core accessibility issue queue.
legal_disclaimer: The information herein is provided in good faith based on the analysis of the web application at the time of the review and does not represent a legally-binding claim. Please contact us to report any accessibility errors or conformance claim errors for re-evaluation and correction, if necessary.
Expand Down
62 changes: 61 additions & 1 deletion cypress/integration/import.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
/// <reference types="Cypress" />

describe("Import", () => {
const today = new Date().toLocaleDateString();
const yamlExamples = [
{
filename: "drupal-9.yaml",
reportDate: "8/31/2021",
lastModifiedDate: "11/16/2021",
version: "drupal-9.1-13",
reportname: "Drupal",
total: 184,
success_criteria_level_a: 100,
Expand All @@ -16,6 +20,9 @@ describe("Import", () => {
},
{
filename: "govready-0.9.yaml",
reportDate: today,
lastModifiedDate: today,
version: "govready-0.9.1.36-1",
reportname: "GovReady",
total: 160,
success_criteria_level_a: 100,
Expand Down Expand Up @@ -108,12 +115,65 @@ describe("Import", () => {
.should(
"contain",
`${yamlExample.reportname} Accessibility Conformance Report`
);
)
.get("a[id='download-zip']")
.invoke("attr", "download")
.should("contain", `${yamlExample.version}.zip`)
.get("a[id='download-yaml']")
.invoke("attr", "download")
.should("contain", `${yamlExample.version}.yaml`)
.get('[id="report-date-editor"] + ul')
.should("contain", `Report Date: ${yamlExample.reportDate}`)
.should(
"contain",
`Last Modified Date: ${yamlExample.lastModifiedDate}`
)
.should("contain", `Version: ${yamlExample.version}`);

cy.get("@consoleError").should("not.be.called");
});
});

it(`should change last modified date on change`, () => {
const fileType = "application/x-yaml";
const yamlExample = yamlExamples[0];
cy.fixture(yamlExample.filename).as("yamlFixture");

cy.visit("/");

cy.on("window:alert", cy.stub().as("alerted"));

cy.get("input[type='file']").then(function ($input) {
const blob = Cypress.Blob.binaryStringToBlob(this.yamlFixture, fileType);
const file = new File([blob], yamlExample.filename, { type: fileType });
const list = new DataTransfer();

list.items.add(file);
const myFileList = list.files;

$input[0].files = myFileList;
$input[0].dispatchEvent(new Event("change", { bubbles: true }));
});

cy.get("@alerted")
.should("have.been.calledOnce")
.and(
"have.been.calledWith",
`OpenACR "${yamlExample.reportname}" loaded`
);

cy.visit("/about")
.get("#evaluation-vendor-name")
.type("CivicActions")
.get("button")
.contains("View Report")
.click()
.get(".usa-alert")
.should("contain", "Valid Report")
.get("#content")
.should("contain", today);
});

it(`should reject invalid example`, () => {
const fileType = "application/x-yaml";
const yamlExample = {
Expand Down
19 changes: 15 additions & 4 deletions cypress/integration/report.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ describe("Report", () => {
it("should have default filename", () => {
cy.get("a[id='download-zip']")
.invoke("attr", "download")
.should("contain", "report.zip");
.should("contain", "report-1.zip");

cy.get("a[id='download-yaml']")
.invoke("attr", "download")
.should("contain", "report.yaml");
.should("contain", "report-1.yaml");
});

it("should show entered name and version", () => {
Expand All @@ -33,15 +33,15 @@ describe("Report", () => {

cy.get("a[id='download-zip']")
.invoke("attr", "download")
.should("contain", "drupal-9.1.zip");
.should("contain", "drupal-9.1-1.zip");

cy.get("a[id='download-zip']")
.invoke("attr", "href")
.should("include", "data:application/zip");

cy.get("a[id='download-yaml']")
.invoke("attr", "download")
.should("contain", "drupal-9.1.yaml");
.should("contain", "drupal-9.1-1.yaml");

cy.get("a[id='download-yaml']")
.invoke("attr", "href")
Expand All @@ -59,6 +59,17 @@ describe("Report", () => {
cy.get("#content").should("contain", "12/31/2021");
});

it("should show last modified date as today", () => {
cy.visit("/about");
const today = new Date().toLocaleDateString();

cy.get("button").contains("View Report").click();

cy.get(".usa-alert").should("contain", "Valid Report");

cy.get("#content").should("contain", today);
});

it("should show selected license", () => {
cy.visit("/about");
cy.get("#evaluation-license")
Expand Down
Loading

0 comments on commit 0a937cc

Please sign in to comment.