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

feat(cypress): Test locations & roles display #232

Merged
merged 3 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/workflows/deploy-container-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
uses: actions/checkout@v3
with:
repository: EasyDynamics/oscal-demo-content
ref: "test-content"
path: all-in-one/oscal-content

- name: Set Up Docker Buildx
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-container-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
uses: actions/checkout@v3
with:
repository: EasyDynamics/oscal-demo-content
ref: "test-content"
path: all-in-one/oscal-content

- name: Set Up Docker Buildx
Expand Down
43 changes: 42 additions & 1 deletion end-to-end-tests/cypress/e2e/OSCAL/OSCAL_Load_Tests.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ describe('Loading system security plans', () => {
it('displays Enterprise Asset Owners Party', () => {
cy.navToSspEditor(SSP_TITLE_ORIG);
cy.waitForLoad();
cy.contains("Parties").click();
cy.get(`[aria-label="Enterprise Asset Owners details button"]`).click();
cy.contains("No address information provided");
cy.contains("No telephone information provided");
Expand All @@ -34,6 +35,7 @@ describe('Loading system security plans', () => {
it('displays Enterprise Asset Administrators Party', () => {
cy.navToSspEditor(SSP_TITLE_ORIG);
cy.waitForLoad();
cy.contains("Parties").click();
cy.get(`[aria-label="Enterprise Asset Administrators details button"]`).click();
cy.contains("0000 St");
cy.contains("+18005555555");
Expand All @@ -47,6 +49,7 @@ describe('Loading Component Definitions', () => {
cy.navToCdefEditor(COMP_DEF_TITLE_ORIG)
cy.waitForLoad();
cy.contains(COMP_DEF_TITLE_ORIG).should('be.visible')
cy.contains("Parties").click();
cy.contains('Test Vendor').should('be.visible')
cy.scrollTo('bottom')
})
Expand All @@ -58,9 +61,47 @@ describe('Loading Component Definitions', () => {
cy.contains('OSCAL Component URL').first().should('exist').next().click().clear().type(Cypress.env('base_url') + "/oscal/v1/component-definitions/8223d65f-57a9-4689-8f06-2a975ae2ad72")
cy.contains('Reload').click()
cy.contains(COMP_DEF_TITLE_ORIG).should('be.visible')
cy.contains("Parties").click();
cy.contains('Test Vendor').should('be.visible')
cy.scrollTo('bottom')
})
});

it('loads metadata roles', () => {
cy.navToCdefEditor(COMP_DEF_TITLE_ORIG);
cy.waitForLoad();
cy.contains("Roles").click();
cy.contains("Document creator");
cy.contains("Contact");
});

it('loads metadata role details', () => {
cy.navToCdefEditor(COMP_DEF_TITLE_ORIG);
cy.waitForLoad();
cy.contains("Roles").click();
cy.get(`[aria-label="Document creator details button"]`).click();
cy.contains("Creates documents describing the system");
});

it('loads metadata locations', () => {
cy.navToCdefEditor(COMP_DEF_TITLE_ORIG);
cy.waitForLoad();
cy.contains("Locations").click();
cy.contains("NIST");
cy.contains("Not Specified");
});

it('loads metadata location details', () => {
cy.navToCdefEditor(COMP_DEF_TITLE_ORIG);
cy.waitForLoad();
cy.contains("Locations").click();
cy.get(`[aria-label="NIST details button"]`).click();
cy.contains("100 Bureau Drive");
cy.contains("Mail Stop 8970");
cy.contains("Gaithersburg, MD 20899-8970");
cy.contains("301-975-8616");
cy.contains("itl_inquiries@nist.gov");
cy.contains("https://www.nist.gov/");
});
})

describe('Errors caused by loading a bad component definition', () => {
Expand Down
1 change: 0 additions & 1 deletion end-to-end-tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,3 @@ Cypress.Commands.add("setTestSspJson", (sspJson) => {
sspJson
);
});

6 changes: 4 additions & 2 deletions end-to-end-tests/cypress/support/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,20 @@ import './commands'
// Alternatively you can use CommonJS syntax:
// require('./commands')

Cypress.on('uncaught:exception', (err, runnable) => {
Cypress.on('uncaught:exception', (err) => {
// monaco-editor sometimes throws errors when reloading
// and we don't want to fail the test so we return false
if (err.message.includes("Failed to execute 'importScripts' on 'WorkerGlobalScope'")) {
return false
}

if (err.message.includes("Cannot read properties of null (reading 'getText')")) {
return false
}

// TODO: Find a fix where we don't need to avoid this exception
// https://github.com/EasyDynamics/oscal-editor-deployment/issues/121
if (err.message.includes("ResizeObserver loop limit exceeded")) {
if (err.message.includes("ResizeObserver loop")) {
kylelaker marked this conversation as resolved.
Show resolved Hide resolved
return false
}
})