Skip to content

Commit

Permalink
Merge pull request #432 from CSCfi/develop
Browse files Browse the repository at this point in the history
Release 0.11.0
  • Loading branch information
blankdots authored Aug 31, 2021
2 parents 0ef162c + 3ee34ef commit b5614bc
Show file tree
Hide file tree
Showing 47 changed files with 1,168 additions and 693 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Setup node ${{ matrix.node }}
uses: actions/setup-node@v2.3.0
uses: actions/setup-node@v2.4.0
with:
node-version: ${{ matrix.node }}
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2etests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v2
- name: Build Frontend
run: |
sudo npm install -g npm@7.20.0
sudo npm install -g npm@7.21.0
npx --quiet pinst --disable
npm install --production
npm run build --production
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/formatstyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Setup node ${{ matrix.node }}
uses: actions/setup-node@v2.3.0
uses: actions/setup-node@v2.4.0
with:
node-version: ${{ matrix.node }}
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/typecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Setup node ${{ matrix.node }}
uses: actions/setup-node@v2.3.0
uses: actions/setup-node@v2.4.0
with:
node-version: ${{ matrix.node }}
- name: Install dependencies
Expand Down
17 changes: 8 additions & 9 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Unit tests and coverage
on: [push]

jobs:
build:
test:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -12,18 +12,17 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Setup node ${{ matrix.node }}
uses: actions/setup-node@v2.3.0
uses: actions/setup-node@v2.4.0
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies and coveralls
run: |
npm ci
npm install coveralls
- name: Run unit tests with react-app-scripts and save coverage
- name: Run unit tests and save coverage
run: CI=true npm test -- --coverage
- name: Report coverage to coveralls
env:
COVERALLS_REPO_TOKEN: "${{ secrets.COVERALLS_REPO_TOKEN }}"
COVERALLS_GIT_BRANCH: "${{ github.ref }}"
run: |
cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage/lcov.info
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# testing
/coverage
debug.log
cypress/videos

# production
/build
Expand Down
7 changes: 6 additions & 1 deletion cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@
"port": "3000",
"mockAuthHost": "localhost",
"mockAuthPort": "8000"
}
},
"retries": {
"runMode": 3,
"openMode": 0
},
"videoCompression": false
}
44 changes: 24 additions & 20 deletions cypress/integration/draft.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,34 @@ describe("Draft operations", function () {
// Save a draft
cy.get("button[type=button]").contains("Save as Draft").click()
cy.get("div[role=alert]", { timeout: 10000 }).contains("Draft saved with")
cy.get("div[role=button]").contains("Choose from drafts").click()
cy.get("div[data-testid=Existing").find("li").should("have.length", 1)
cy.get("ul[data-testid='Draft-objects']").find("li").should("have.length", 1)

// Save another draft
cy.get("div[role=button]").contains("Fill Form").click()
cy.get("button[type=button]").contains("New form").click()
cy.get("input[name='descriptor.studyTitle']").type("Test title 2")
cy.get("button[type=button]").contains("Save as Draft").click()
cy.get("div[role=alert]", { timeout: 10000 }).contains("Draft saved with")
cy.get("ul[data-testid='Draft-objects']").find("li").should("have.length", 2)

// Update draft, save from dialog
cy.get("input[name='descriptor.studyTitle']").type(" second save")
cy.get("div[role=button]").contains("Choose from drafts").click()
cy.get("div[role=button]").contains("Fill Form").click()
cy.get("h2").contains("Would you like to save draft version of this form")
cy.get("div[role=dialog]").contains("Save").click()
cy.get("div[data-testid='Existing']").find("li").should("have.length", 2)
cy.get("ul[data-testid='Draft-objects']").find("li").should("have.length", 2)

// Delete a draft
cy.get("button[aria-label='Delete draft']").first().click()
cy.get("div[data-testid='Existing']").find("li", { timeout: 60000 }).should("have.length", 1)
cy.get("ul[data-testid='Draft-objects']")
.find("li")
.first()
.within(() => {
cy.get("button[aria-label='Delete submission']").first().click()
})
cy.get("ul[data-testid='Draft-objects']").find("li", { timeout: 60000 }).should("have.length", 1)

// Continue draft
// Clear
cy.get("button[aria-label='Continue draft']").first().click()
cy.continueFirstDraft()
cy.get("input[name='descriptor.studyTitle']")
cy.get("button[type=button]", { timeout: 10000 }).contains("Clear form").click()

Expand All @@ -52,6 +57,7 @@ describe("Draft operations", function () {
cy.get("input[name='descriptor.studyTitle']").should("have.value", "New title")
cy.get("select[name='descriptor.studyType']").select("Metagenomics")
cy.get("button[type=button]").contains("Update draft").click()
cy.get("div[role=alert]", { timeout: 10000 }).contains("Draft updated with")

// Create a new form and save as draft
cy.get("button", { timeout: 10000 }).contains("New form").click({ force: true })
Expand All @@ -63,26 +69,24 @@ describe("Draft operations", function () {

cy.get("div[role=alert]", { timeout: 10000 }).contains("Draft saved with")

// Check that there are 2 drafts saved in "Choose from drafts"
cy.get("div[role=button]").contains("Choose from drafts").click()
cy.get("div[data-testid='Existing']").find("li").should("have.length", 2)
// Check that there are 2 drafts saved in drafts list"
cy.get("ul[data-testid='Draft-objects']").find("li").should("have.length", 2)

// Submit first form draft
cy.get("button[aria-label='Continue draft']").first().click()
cy.continueFirstDraft()
cy.get("button[type=submit]").contains("Submit").click()
cy.get(".MuiListItem-container", { timeout: 10000 }).should("have.length", 1)
cy.get("div[role=alert]", { timeout: 10000 }).contains("Submitted with")
cy.get("ul[data-testid='Form-objects']").find("li").should("have.length", 1)

// Submit second form draft
cy.get("div[role=button]").contains("Choose from drafts").click()
cy.get("div[data-testid='Existing']").find("li").should("have.length", 1)
cy.get("button[aria-label='Continue draft']").first().click()
cy.get("ul[data-testid='Draft-objects']").find("li").should("have.length", 1)
cy.continueFirstDraft()
cy.get("button[type=submit]").contains("Submit").click()

// Check that there are 2 submitted objects
cy.get(".MuiListItem-container", { timeout: 10000 }).should("have.length", 2)
cy.get("ul[data-testid='Form-objects']", { timeout: 10000 }).find("li").should("have.length", 2)

// Drafts should be empty
cy.get("div[role=button]").contains("Choose from drafts").click()
cy.get("div").contains("No study drafts.")
// Drafts list should be unmounted
cy.get("ul[data-testid='Draft-objects']").should("not.exist")
})
})
12 changes: 4 additions & 8 deletions cypress/integration/editForm.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ describe("Populate form and render form elements by object data", function () {
cy.get("button[type='button']").contains("Save as Draft").click()
cy.get("div[role=alert]", { timeout: 10000 }).contains("Draft saved with")

cy.chooseFromDrafts()
cy.get("button[aria-label='Continue draft']").first().click()
cy.continueFirstDraft()

// Test that values exist
cy.get("input[data-testid='title']").should("have.value", testData.title)
Expand Down Expand Up @@ -147,8 +146,7 @@ describe("Populate form and render form elements by object data", function () {
cy.get("button[type='button']").contains("Update draft").click()
cy.get("div[role=alert]", { timeout: 10000 }).contains("Draft updated with")

cy.chooseFromDrafts()
cy.get("button[aria-label='Continue draft']").first().click()
cy.continueFirstDraft()

// Test that Prev Step Index is nulled
cy.get("input[data-testid='processing[0].pipeline.pipeSection[0].prevStepIndex']").should("not.exist")
Expand All @@ -172,8 +170,7 @@ describe("Populate form and render form elements by object data", function () {
cy.get("div[role=alert]", { timeout: 10000 }).contains("Draft saved with")

// Select newly saved draft
cy.chooseFromDrafts()
cy.get("button[aria-label='Continue draft']").first().click()
cy.continueFirstDraft()

cy.get("select[name='runType.referenceAlignment.assembly']").should("have.value", testData.referenceAlignment)
cy.get("input[data-testid='runType.referenceAlignment.assembly.accessionId']").should(
Expand All @@ -197,8 +194,7 @@ describe("Populate form and render form elements by object data", function () {
cy.get("div[role=alert]", { timeout: 10000 }).contains("Draft saved with")

// Select newly saved draft
cy.chooseFromDrafts()
cy.get("button[aria-label='Continue draft']").first().click()
cy.continueFirstDraft()

cy.get("[type='checkbox']").first().should("be.checked")

Expand Down
6 changes: 2 additions & 4 deletions cypress/integration/emptyForm.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ describe("empty form should not be alerted or saved", function () {
cy.get("div[role=alert]", { timeout: 10000 }).contains("Draft saved with")

// Select the Experiment draft
cy.chooseFromDrafts()
cy.get("button[aria-label='Continue draft']").first().click()
cy.continueFirstDraft()

cy.get("input[data-testid='title']").should("have.value", "Test experiment")
cy.get("textarea[data-testid='description']").should("have.value", "Test experiment description")
Expand All @@ -58,8 +57,7 @@ describe("empty form should not be alerted or saved", function () {
cy.get("textarea[data-testid='description']").should("have.value", "")

// Select the Experiment draft again
cy.chooseFromDrafts()
cy.get("button[aria-label='Continue draft']").first().click()
cy.continueFirstDraft()

cy.get("input[data-testid='title']").should("have.value", "Test experiment")
cy.get("textarea[data-testid='description']").should("have.value", "Test experiment description")
Expand Down
68 changes: 61 additions & 7 deletions cypress/integration/home.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,74 @@ describe("Home e2e", function () {
cy.get("input[name='descriptor.studyTitle']").type("Test title")
cy.get("select[name='descriptor.studyType']").select("Resequencing")

// Submit form
// Save draft
cy.get("button[type=button]").contains("Save as Draft").click()
cy.get("div[role=alert]", { timeout: 10000 }).contains("Draft saved with")

// Save another draft for later use
cy.get("button").contains("New form").click()
cy.get("input[name='descriptor.studyTitle']").type("Second test title")
cy.get("button[type=button]").contains("Save as Draft").click()
cy.get("div[role=alert]", { timeout: 10000 }).contains("Draft saved with")

// Save folder and navigate to Home page
cy.get("button[type=button]").contains("Save and Exit").click()
cy.get('button[aria-label="Save a new folder and move to frontpage"]').contains("Return to homepage").click()
cy.get("div", { timeout: 10000 }).contains("Logged in as:")

cy.get("button[data-testid='ViewAll-draft']", { timeout: 10000 }).click()

// Navigate to home & find folder
cy.findDraftFolder("Test unpublished folder")

cy.get('button[aria-label="Publish current folder"]').should("be.disabled")
cy.get('button[aria-label="Edit current folder"]').contains("Edit").click()
cy.get("input[name='name']").clear().type("Edited unpublished folder")
cy.get("button[type=button]").contains("Next").click()

// Navigate to home and delete object
cy.findDraftFolder("Edited unpublished folder")

cy.get("tr[data-testid='Test title']").within(() => cy.get('button[aria-label="Delete this object"]').click())
cy.get("tr[data-testid='Test title']").should("not.exist")

// Edit remaining object
cy.get("tr[data-testid='Second test title']").within(() => cy.get('button[aria-label="Edit this object"]').click())
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)
cy.get(".MuiListItem-container", { timeout: 30000 }).should("have.length", 2)

// Navigate to summary
cy.get("button[type=button]").contains("Next").click()
cy.get("button[type=button]").contains("Next", { timeout: 10000 }).click()

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

// Save folder and navigate to Home page
cy.get("button[type=button]").contains("Save and Exit").click()
cy.get('button[aria-label="Save a new folder and move to frontpage"]').contains("Return to homepage").click()
cy.get("div", { timeout: 10000 }).contains("Logged in as:")
// Navigate to home & edit submitted object
cy.findDraftFolder("Edited unpublished folder")
cy.get('button[aria-label="Edit this object"]').click()
cy.get("input[name='descriptor.studyTitle']").type(" edited")
cy.get("button[type=button]").contains("Update").click()
cy.get("div[role=alert]").contains("Object updated")

// Publish test folder from draft folders list
cy.findDraftFolder("Edited unpublished folder")
cy.get('button[aria-label="Publish current folder"]').click()
cy.get('button[aria-label="Publish folder contents and move to frontpage"]').click()

// Find published folder in corresponding list
cy.get("button[data-testid='ViewAll-published']", { timeout: 10000 }).click()
cy.get("body").then($body => {
if ($body.find("div[aria-haspopup='listbox']").length > 0) {
cy.get("div[aria-haspopup='listbox']", { timeout: 10000 }).contains(10).click()
cy.get("ul").children().last().contains("All").click()
cy.wait(500)
}
})

cy.get("ul[data-testId='published-submissions']").within(() => {
cy.get("div[role=button]").contains("Edited unpublished folder")
})
})

it("create a published folder, navigate to see folder details, delete object inside folder, navigate back to Overview submissions", () => {
Expand Down
12 changes: 6 additions & 6 deletions cypress/integration/objectTitles.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe("draft and submitted objects' titles", function () {
cy.get("div[role=button]").contains("Fill Form").click()

// Variables
cy.get("input[name='descriptor.studyTitle']").as("studyTitle")
cy.get("[data-testid='descriptor.studyTitle']").as("studyTitle")

// Fill a Study form and submit object
cy.get("@studyTitle").type("Test title")
Expand Down Expand Up @@ -62,21 +62,21 @@ describe("draft and submitted objects' titles", function () {
// Save a draft
cy.get("button[type=button]").contains("Save as Draft").click()
cy.get("div[role=alert]", { timeout: 10000 }).contains("Draft saved with")
cy.get("div[role=button]").contains("Choose from drafts").click()
cy.get("div[data-testid=Existing").find("li").should("have.length", 1)
cy.get("ul[data-testid='Draft-objects']").find("li").should("have.length", 1)

// Check the draft object has correct displayTitle
cy.get("div[data-schema='draft-study']", { timeout: 10000 }).should("contain.text", "Draft title")

// Edit draft object's title
cy.get("button[aria-label='Continue draft']").first().click()
cy.continueFirstDraft()
cy.get("input[name='descriptor.studyTitle']").type(" 2")
cy.get("input[name='descriptor.studyTitle']").should("have.value", "Draft title 2")
cy.get("button[type=button]").contains("Update draft").click()

// Check the draft object has correctly updated displayTitle
cy.get("div[role=alert]", { timeout: 10000 }).contains("Draft updated")
cy.get("div[role=button]").contains("Choose from drafts").click()
cy.get("div[data-schema='draft-study']", { timeout: 10000 }).should("contain.text", "Draft title 2")
cy.get("ul[data-testid='Draft-objects']").within(() => {
cy.get("div[data-schema='draft-study']", { timeout: 10000 }).should("contain.text", "Draft title 2")
})
})
})
Loading

0 comments on commit b5614bc

Please sign in to comment.