Skip to content

Commit

Permalink
OCLOMRS-984: Add tests for copying a dictionary (#726)
Browse files Browse the repository at this point in the history
  • Loading branch information
suruchee committed Aug 5, 2021
1 parent 38969bb commit 266b6ee
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cypress/integration/dictionary/copyDictionary.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Feature: Copying a dictionary
Background:
Given the user is logged in
And a dictionary exists
And a version exists
And a version is released

@dictionary
@version
Scenario: The user should be able to copy dictionary
Given the user is on the dictionary page
When the user clicks the more actions button
And the user selects the "Copy Dictionary" menu list item
And the user is on copy dictionary form
And the user enters the new dictionary information
And the user submits the form
Then the new dictionary should be created
And the new source should be created
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import "cypress-wait-until";
import { Given, Then, When } from "cypress-cucumber-preprocessor/steps";
import { getDictionaryId, getUser } from "../../../utils";

Given("the user is on the dictionary page", () => {
cy.visit(`/users/${getUser()}/collections/${getDictionaryId()}/`);
cy.findByText("Versions").should("be.visible");
});
When("the user clicks the more actions button", () =>
cy.findByTitle("More actions").click()
);
When(/the user selects the "(.+)" menu list item/, menuItem =>
cy.findByText(menuItem).click()
);
When("the user is on copy dictionary form", () =>
cy.url().should("contain", `/collections/new/`)
);
When("the user enters the new dictionary information", () => {
cy.findByLabelText(/Dictionary Name/i).type(`${getDictionaryId()}-new`);
cy.findByLabelText(/Short Code/i).type(`${getDictionaryId()}-new`);
});
When("the user submits the form", () => {
cy.get("form").submit();
cy.waitUntil(
() =>
cy
.url()
.should(
"contain",
`/users/${getUser()}/collections/${getDictionaryId()}-new/`
),
{ timeout: 10000 }
);
});
Then("the new dictionary should be created", () =>
cy.getDictionary(`${getDictionaryId()}-new`).should("exist")
);
Then("the new source should be created", () =>
cy.getSource(`${getDictionaryId()}-new`).should("exist")
);

0 comments on commit 266b6ee

Please sign in to comment.