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

Add test for Analysis object Fill form and check Summary amount of ob… #125

Merged
merged 4 commits into from
Jan 11, 2021
Merged
Changes from 2 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
86 changes: 81 additions & 5 deletions cypress/integration/app.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe("Basic e2e", function () {
cy.get('[alt="CSC Login"]').click()
})

it("should create new folder, add study form and publish folder", () => {
it("should create new folder, add Study form, upload Study XML file, add Analysis form and publish folder", () => {
cy.visit(baseUrl)
cy.get('[alt="CSC Login"]').click()
cy.visit(baseUrl + "newdraft")
Expand All @@ -19,15 +19,15 @@ describe("Basic e2e", function () {
cy.get("textarea[name='description']").type("Test description")
cy.get("button[type=button]").contains("Next").click()

// Fill a study form and submit object
// Fill a Study form and submit object
cy.get("div[role=button]").contains("Study").click()
cy.get("div[role=button]").contains("Fill Form").click()
cy.get("input[name='descriptor.studyTitle']").type("Test title")
cy.get("select[name='descriptor.studyType']").select("Metagenomics")
cy.get("button[type=submit]").contains("Submit").click()
cy.get(".MuiListItem-container", { timeout: 10000 }).should("have.length", 1)

// Upload an xml file.
// Upload a Study xml file.
cy.get("div[role=button]").contains("Upload XML File").click()
cy.fixture("study_test.xml").then(fileContent => {
cy.get('input[type="file"]').attachFile({
Expand All @@ -40,11 +40,87 @@ describe("Basic e2e", function () {
// Hacky way to get past RHF watch -method problem that doesn't allow cypress to get updated value for file
cy.get("form").submit()

// Saved objects list should have newly added item
// Saved objects list should have newly added item from Study object
cy.get(".MuiListItem-container", { timeout: 10000 }).should("have.length", 2)

// // Navigate to summary and publish
// Fill an Analysis form and submit object
cy.get("div[role=button]").contains("Analysis").click()
cy.get("div[role=button]").contains("Fill Form").click()
blankdots marked this conversation as resolved.
Show resolved Hide resolved

cy.get("form").within(() => {
// Experiment
cy.get("input[name='experimentRef.accessionId']").type("Experiement Test Accession Id")
hannyle marked this conversation as resolved.
Show resolved Hide resolved
cy.get("input[name='experimentRef.identifiers.submitterId.namespace']").type("Experiement Test Namespace")
hannyle marked this conversation as resolved.
Show resolved Hide resolved
cy.get("input[name='experimentRef.identifiers.submitterId.value']").type("Experiement Test Value")
hannyle marked this conversation as resolved.
Show resolved Hide resolved

// Study
cy.get("input[name='studyRef.accessionId']").type("Study Test Accession Id")
cy.get("input[name='studyRef.identifiers.submitterId.namespace']").type("Study Test Namespace")
cy.get("input[name='studyRef.identifiers.submitterId.value']").type("Study Test Value")

// Sample
cy.get("input[name='sampleRef.accessionId']").type("Sample Test Accession Id")
cy.get("input[name='sampleRef.identifiers.submitterId.namespace']").type("Sample Test Namespace")
cy.get("input[name='sampleRef.identifiers.submitterId.value']").type("Sample Test Value")

// Run
cy.get("input[name='runRef.accessionId']").type("Run Test Accession Id")
cy.get("input[name='runRef.identifiers.submitterId.namespace']").type("Run Test Namespace")
cy.get("input[name='runRef.identifiers.submitterId.value']").type("Run Test Value")

// Analysis
cy.get("input[name='analysisRef.accessionId']").type("Analysis Test Accession Id")
cy.get("input[name='analysisRef.identifiers.submitterId.namespace']").type("Analysis Test Namespace")
cy.get("input[name='analysisRef.identifiers.submitterId.value']").type("Analysis Test Value")

cy.get("h3")
.contains("Reference Alignment")
.parent("div.formSection")
.within(() => {
cy.get("button").contains("Add new item").click()
cy.get("input[name='analysisType.referenceAlignment.sequence[0].accessionId']").type("Reference Accession Id")
})

cy.get("h3")
.contains("Sequence Variation")
.parent("div.formSection")
.within(() => {
cy.get("input[name='analysisType.sequenceVariation.assembly.standard.accessionId']").type(
"Sequence Standard Accession Id"
)
cy.get("button").contains("Add new item").click()
cy.get("input[name='analysisType.sequenceVariation.sequence[0].accessionId']").type(
"Squence Sequence Accession Id"
)
})

cy.get("h3")
.contains("Processed Reads")
.parent("div.formSection")
.within(() => {
cy.get("input[name='analysisType.processedReads.assembly.standard.accessionId']").type(
"Processed Standard Accession Id"
)
cy.get("button").contains("Add new item").click()

cy.get("input[name='analysisType.processedReads.sequence[0].accessionId']").type(
"Processed Sequence Accession Id"
)
})
cy.root().submit()
})

// Saved objects list should have newly added item from Analysis object
cy.get(".MuiListItem-container", { timeout: 10000 }).should("have.length", 1)

// Navigate to summary
cy.get("button[type=button]").contains("Next").click()

// Check the amount of submitted objects in each object type
cy.get("h6").contains("Study").parent("div").children().eq(1).should("have.text", 2)
cy.get("h6").contains("Analysis").parent("div").children().eq(1).should("have.text", 1)

// Navigate to publish
cy.get("button[type=button]").contains("Publish").click()
cy.get('button[aria-label="Publish folder contents and move to frontpage"]').contains("Publish").click()
})
Expand Down