Skip to content

Commit

Permalink
Merge pull request #627 from CSCfi/feature/cypress-tests-for-JSON-sch…
Browse files Browse the repository at this point in the history
…emas-changes

Update cypress tests for JSON schemas changes
  • Loading branch information
hannyle authored Jan 26, 2022
2 parents 5120c16 + 5a687ae commit 43dada3
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 183 deletions.
20 changes: 10 additions & 10 deletions cypress/integration/app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,21 +111,21 @@ describe("Basic e2e", function () {
// Analysis type
cy.get("select[data-testid='analysisType']").select("Reference Alignment")
cy.get("select[data-testid='analysisType.referenceAlignment.assembly']").select("Standard")
cy.get("[data-testid='analysisType.referenceAlignment.assembly.accessionId']").type("Standard Accession Id")
cy.get("[data-testid='analysisType.referenceAlignment.assembly.accession']").type("Standard Accession version")
cy.get("h4").contains("Sequence").parents().children("button").click()
cy.get("[data-testid='analysisType.referenceAlignment.sequence.0.accessionId']").type(
cy.get("[data-testid='analysisType.referenceAlignment.sequence.0.accession']").type(
"Sequence Standard Accession Id"
)

// Experiment
cy.get("h2").contains("Experiment Reference").parents().children("button").click()
cy.get("[data-testid='experimentRef.0.accessionId']").type("Experiment Test Accession Id")
cy.get("[data-testid='experimentRef.0.identifiers.submitterId.namespace']").type("Experiment Test Namespace")
cy.get("[data-testid='experimentRef.0.identifiers.submitterId.value']").type("Experiment Test Value")

// Study
cy.get("[data-testid='studyRef.identifiers.submitterId.namespace']").type("Study Test Namespace")
cy.get("[data-testid='studyRef.identifiers.submitterId.value']").type("Study Test Value")
cy.get("[data-testid='studyRef.accessionId']").type("Study Test Accession Id")
cy.get("[data-testid='studyRef.refname']").type("Study Test Record Name")
cy.get("[data-testid='studyRef.refcenter']").type("Study Test Namespace")

// Experiment
cy.get("[data-testid='experimentRef.accessionId']").type("Experiment Test Accession Id")
cy.get("[data-testid='experimentRef.refcenter']").type("Experiment Test Record Name")
cy.get("[data-testid='experimentRef.refname']").type("Experiment Test Namespace")

// Sample
cy.get("h2").contains("Sample Reference").parents().children("button").click()
Expand Down
8 changes: 4 additions & 4 deletions cypress/integration/doiForm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ describe("DOI form", function () {

const testRunData = {
title: "Test Run",
experimentRefLabel: "Test Experiment reference label",
experimentAccessionId: "Test Experiment AccessionId",
}

cy.get("[data-testid='title']").type(testRunData.title)
cy.get("[data-testid='experimentRef']").parents().children("button").click()
cy.get("[data-testid='experimentRef.0.label']").type(testRunData.experimentRefLabel)
cy.get("[data-testid='experimentRef.0.accessionId']").type(testRunData.experimentAccessionId)

const testRunFile = {
fileName: "Run file name",
Expand Down Expand Up @@ -54,7 +54,7 @@ describe("DOI form", function () {
cy.get("[data-testid='title']").type(testAnalysisData.title1)
cy.get("[data-testid='analysisType']").select("Reference Alignment")
cy.get("[data-testid='analysisType.referenceAlignment.assembly']").select("Standard")
cy.get("[data-testid='analysisType.referenceAlignment.assembly.accessionId']").type("Standard Accession Id")
cy.get("[data-testid='analysisType.referenceAlignment.assembly.accession']").type("Standard Accession Version")

const testAnalysisFile = {
fileName: "Analysis file name",
Expand All @@ -81,7 +81,7 @@ describe("DOI form", function () {
cy.get("[data-testid='title']").type(testAnalysisData.title2)
cy.get("[data-testid='analysisType']").select("Reference Alignment")
cy.get("[data-testid='analysisType.referenceAlignment.assembly']").select("Standard")
cy.get("[data-testid='analysisType.referenceAlignment.assembly.accessionId']").type("Standard Accession Id")
cy.get("[data-testid='analysisType.referenceAlignment.assembly.accession']").type("Standard Accession Id")
// Select fileType
cy.get("[data-testid='files.0.filename']").type(testAnalysisFile.fileName)
cy.get("[data-testid='files.0.filetype']").select(testAnalysisFile.fileType2)
Expand Down
45 changes: 11 additions & 34 deletions cypress/integration/editForm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe("Populate form and render form elements by object data", function () {
description: "Test experiment description",
designDescription: "Test design description",
sampleReference: "Individual Sample",
individualSampleLabel: "Individual Sample test label",
individualSampleAccessionId: "Individual Sample AccessionId",
singleProcessing: "Single Processing",
singleProcessingLabel: "Single Processing label",
complexProcessing: "Complex Processing",
Expand All @@ -87,29 +87,16 @@ describe("Populate form and render form elements by object data", function () {
cy.get("[data-testid='title']").type(testData.title)
cy.get("[data-testid='description']").type(testData.description)
cy.get("[data-testid='design.designDescription']").type(testData.designDescription)
cy.get("select[data-testid='design.sampleDescriptor']").select(testData.sampleReference)
cy.get("[data-testid='design.sampleDescriptor.label']").type(testData.individualSampleLabel)
cy.get("select[data-testid='design.sampleDescriptor']", { timeout: 10000 }).select(testData.sampleReference)
cy.get("[data-testid='design.sampleDescriptor.accessionId']").type(testData.individualSampleAccessionId)

// Expected Base Call Table
cy.get("div").contains("Expected Base Call Table").parents().children("button").click()
cy.get("[data-testid='design.spotDescriptor.readSpec.expectedBaseCallTable.0.baseCall']").type("Test base call")
cy.get("[data-testid='design.spotDescriptor.readSpec.expectedBaseCallTable.0.readGroupTag']").type(
"Test read group tag"
)

// Select and fill Single processing
cy.get("select[data-testid='processing']").select(testData.singleProcessing)
cy.get("input[data-testid='processing']").type(testData.singleProcessingLabel)

// Switch to select and fill Complex processing
cy.get("select[data-testid='processing']").select(testData.complexProcessing)
cy.get("[data-testid='processing']").parents().children("button").click()
cy.get("[data-testid='processing.0.pipeline.pipeSection']").parent().children("button").click()
cy.get("[data-testid='processing.0.pipeline.pipeSection.0.stepIndex']").type(testData.stepIndex)
cy.get("select[data-testid='processing.0.pipeline.pipeSection.0.prevStepIndex']").select(testData.stringValue, {
force: true,
})
cy.get("input[data-testid='processing.0.pipeline.pipeSection.0.prevStepIndex']").type(testData.prevStepIndexValue)

// Save Experiment form
cy.get("button[type='button']").contains("Save as Draft").click()
cy.get("div[role=alert]", { timeout: 10000 }).contains("Draft saved with")
Expand All @@ -120,8 +107,11 @@ describe("Populate form and render form elements by object data", function () {
cy.get("[data-testid='title']").should("have.value", testData.title)
cy.get("[data-testid='description']").should("have.value", testData.description)
cy.get("[data-testid='design.designDescription']").should("have.value", testData.designDescription)
cy.get("[data-testid='design.sampleDescriptor']").should("have.value", testData.sampleReference)
cy.get("[data-testid='design.sampleDescriptor.label']").should("have.value", testData.individualSampleLabel)
cy.get("select[data-testid='design.sampleDescriptor']").should("have.value", testData.sampleReference)
cy.get("[data-testid='design.sampleDescriptor.accessionId']").should(
"have.value",
testData.individualSampleAccessionId
)
cy.get("[data-testid='design.spotDescriptor.readSpec.expectedBaseCallTable.0.baseCall']").should(
"have.value",
"Test base call"
Expand All @@ -130,25 +120,12 @@ describe("Populate form and render form elements by object data", function () {
"have.value",
"Test read group tag"
)
cy.get("[data-testid='processing.0.pipeline.pipeSection.0.stepIndex']").should("have.value", testData.stepIndex)
cy.get("input[data-testid='processing.0.pipeline.pipeSection.0.prevStepIndex']").should(
"have.value",
testData.prevStepIndexValue
)

// Change Prev Step Index from string value to null
cy.get("select[data-testid='processing.0.pipeline.pipeSection.0.prevStepIndex']").select(testData.nullValue, {
force: true,
})

// Save Experiment form 2nd time
cy.get("button[type='button']").contains("Update draft").click()
cy.get("div[role=alert]", { timeout: 10000 }).contains("Draft updated with")

cy.continueFirstDraft()

// Test that Prev Step Index is nulled
cy.get("input[data-testid='processing.0.pipeline.pipeSection.0.prevStepIndex']").should("not.exist")
})

it("should render Run form correctly when editing", () => {
Expand All @@ -162,7 +139,7 @@ describe("Populate form and render form elements by object data", function () {

cy.get("[data-testid='title']").type(testData.title)
cy.get("select[data-testid='runType.referenceAlignment.assembly']").select(testData.referenceAlignment)
cy.get("[data-testid='runType.referenceAlignment.assembly.accessionId']").type(testData.accessionId)
cy.get("[data-testid='runType.referenceAlignment.assembly.accession']").type(testData.accessionId)

// Save draft
cy.get("button[type='button']").contains("Save as Draft").click()
Expand All @@ -172,7 +149,7 @@ describe("Populate form and render form elements by object data", function () {
cy.continueFirstDraft()

cy.get("[data-testid='runType.referenceAlignment.assembly']").should("have.value", testData.referenceAlignment)
cy.get("[data-testid='runType.referenceAlignment.assembly.accessionId']").should("have.value", testData.accessionId)
cy.get("[data-testid='runType.referenceAlignment.assembly.accession']").should("have.value", testData.accessionId)
})

it("should render form with checkboxes correctly", () => {
Expand Down
Loading

0 comments on commit 43dada3

Please sign in to comment.