-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'bugfix/multiple-bugs' into 'main' * Fix allowing one object, MUI data table not showing correctly Closes #1001, #1003, and #998 See merge request https://gitlab.ci.csc.fi/sds-dev/sd-submit/metadata-submitter-frontend/-/merge_requests/1053 Approved-by: Liisa Lado-Villar <[email protected]> Merged by Hang Le <[email protected]>
- Loading branch information
Showing
13 changed files
with
199 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { expect } from "@playwright/test" | ||
|
||
import test from "../fixtures/commands" | ||
|
||
import { ObjectTypes } from "constants/wizardObject" | ||
|
||
test.describe("One draft or submitted object is allowed", () => { | ||
test.beforeEach(async ({ login, resetDB, newSubmission }) => { | ||
await resetDB() | ||
await login() | ||
|
||
// Add submission name & description | ||
await newSubmission() | ||
}) | ||
|
||
test("should be able to save only one draft or submit one version for Study", async ({ | ||
page, | ||
clickAddObject, | ||
formActions, | ||
}) => { | ||
test.slow() | ||
|
||
// Add Study form | ||
await clickAddObject(ObjectTypes.study) | ||
await page.getByTestId("descriptor.studyTitle").fill("Test study") | ||
await page.getByTestId("descriptor.studyType").selectOption("Epigenetics") | ||
await page.getByTestId("descriptor.studyAbstract").fill("Study abstract") | ||
|
||
// Save Study as draft | ||
await formActions("form-draft") | ||
await page.getByRole("alert").filter({ hasText: "Draft saved successfully" }) | ||
await expect(page.getByTestId("draft-study-list-item")).toHaveCount(1) | ||
// Assert that button "Save as draft" should be changed to "Update draft" | ||
await expect(page.getByTestId("form-draft")).toHaveText("Update draft") | ||
|
||
// Update Study draft | ||
await page.getByTestId("descriptor.studyTitle").fill("Test study 2") | ||
await formActions("form-draft") | ||
await page.getByRole("alert").filter({ hasText: "Draft saved successfully" }) | ||
// Assert that the Study draft is saved again with new title, no new draft is created | ||
await expect(page.getByTestId("draft-study-list-item")).toHaveCount(1) | ||
await expect(page.getByTestId("draft-study-list-item")).toHaveText("Test study 2") | ||
|
||
// Mark Study as ready | ||
await formActions("form-ready") | ||
await page.getByRole("alert").filter({ hasText: "Submitted successfully" }) | ||
/* Assert that "Save as draft" and "Mark as ready" button are now disabled because there is one Study object submitted, | ||
* user cannot Add a new study | ||
*/ | ||
await expect(page.getByTestId("form-draft")).toBeDisabled() | ||
await expect(page.getByTestId("Add study")).toBeDisabled() | ||
|
||
// Click the submitted Study to edit, assert that user can only "Update" the submitted Study | ||
await page.getByTestId("draft-study-list-item").click() | ||
await expect(await page.getByTestId("form-ready")).toHaveText("Update") | ||
}) | ||
}) | ||
|
||
export {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.