Skip to content

Commit

Permalink
Merge branch 'master' into OCLOMRS-1053
Browse files Browse the repository at this point in the history
  • Loading branch information
merovingienne committed Feb 16, 2022
2 parents 3421f53 + 0de0c31 commit 6d9a0d7
Show file tree
Hide file tree
Showing 103 changed files with 1,887 additions and 1,103 deletions.
11 changes: 4 additions & 7 deletions cypress/support/step_definitions/concept/create/create.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
/// <reference types="cypress" />
/// <reference types="../../../" />
import {
Given,
Then,
When
} from "cypress-cucumber-preprocessor/steps";
import { Given, Then, When } from "cypress-cucumber-preprocessor/steps";
import { getDictionaryId, getUser, getConceptId } from "../../../utils";


Given("the user is on the dictionary concepts page", () => {
cy.visit(`/users/${getUser()}/collections/${getDictionaryId()}/concepts/`);
// delay until the dictionary is fully loaded
Expand All @@ -27,7 +22,9 @@ Then("the user should be on the create concept page", () =>
);

Given("the user is on the create concept page", () => {
cy.visit(`/users/${getUser()}/sources/${getDictionaryId()}/concepts/new/?linkedDictionary=/users/${getUser()}/collections/${getDictionaryId()}/`);
cy.visit(
`/users/${getUser()}/sources/${getDictionaryId()}/concepts/new/?linkedDictionary=/users/${getUser()}/collections/${getDictionaryId()}/`
);
cy.findByText("Create concept").should("be.visible");
});

Expand Down
16 changes: 5 additions & 11 deletions cypress/support/step_definitions/concept/edit/edit.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
// <reference types="cypress" />
/// <reference types="../../../" />
import {
Given,
Then,
When
} from "cypress-cucumber-preprocessor/steps";
import { Given, Then, When } from "cypress-cucumber-preprocessor/steps";
import { getConceptVersionUrl } from "../../../utils";

Given("the user is on the edit concept page", () => {
cy.visit(`${getConceptVersionUrl()}edit/`)
cy.visit(`${getConceptVersionUrl()}edit/`);
});

When("the user edits the concept name", () => {
cy.get("input[name='names[0].name']").type("test concept edited");
});

When("the user submits the form", () =>
cy.get("form").submit()
);
When("the user submits the form", () => cy.get("form").submit());

// This has some weird behaviour, we shall come back to it later
// Then("the concept should be updated", () => {
Expand All @@ -26,13 +20,13 @@ When("the user submits the form", () =>
// });

When("the user clicks the Menu button", () => {
cy.findByTitle("Menu").click();
cy.findByLabelText("Menu").click();
});

When(/the user selects the "(.+)" menu list item/, menuItem => {
cy.findByText(menuItem).click();
});

Then("the concept should be retired", () => {
cy.url().should("not.contain", '/edit');
cy.url().should("not.contain", "/edit");
});
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/// <reference types="cypress" />
/// <reference types="../../../" />
import {
After,
Before,
Given,
Then,
When } from "cypress-cucumber-preprocessor/steps";
import { getDictionaryId, getUser } from '../../../utils';
import {
After,
Before,
Given,
Then,
When
} from "cypress-cucumber-preprocessor/steps";
import { getDictionaryId, getUser } from "../../../utils";

Given("the user is on the view dictionary concepts page", () => {
cy.visit(`/users/${getUser()}/collections/${getDictionaryId()}/concepts/`);
Expand All @@ -20,7 +21,7 @@ Given('the user is on the "Add concepts in bulk from CIEL" page', () => {
cy.visit(
`/users/${getUser()}/collections/${getDictionaryId()}/add/?fromSource=CIEL`
);

cy.url().should(
"contain",
`/users/${getUser()}/collections/${getDictionaryId()}/add/?fromSource=CIEL`
Expand All @@ -47,7 +48,7 @@ Given('CIEL concept "1000" is already in the dictionary', () => {
});

When('the user clicks the "Add concepts" button', () => {
cy.findByTitle("Add concepts").click();
cy.findByLabelText("Add concepts").click();
});

When('the user selects "Add bulk concepts"', () => {
Expand All @@ -57,39 +58,44 @@ When('the user selects "Add bulk concepts"', () => {
});

Then('the user navigates to the "Progess notification" page', () => {
cy.visit(
`/actions/`
);
cy.visit(`/actions/`);
cy.url().should("contain", `/actions`);
});

When('the user enters concept Id "1000"', () => {
cy.get("textarea").type("1000")
}
);
cy.findByTestId("bulkImportTextArea").type("1000");
});

When('the user clicks the "ADD CONCEPTS" button', () => {
cy.intercept('/orgs/CIEL/sources/CIEL/*/*').as('loadMappings');
cy.intercept('PUT', `/users/${getUser()}/collections/${getDictionaryId()}/references/*`).as('addReferences')
cy.findByText("Add concepts").click().wait('@loadMappings').wait('@addReferences');
cy.intercept("/orgs/CIEL/sources/CIEL/*/*").as("loadMappings");
cy.intercept(
"PUT",
`/users/${getUser()}/collections/${getDictionaryId()}/references/*`
).as("addReferences");
cy.findByText("Add concepts")
.click()
.wait("@loadMappings")
.wait("@addReferences");
});

When(/the user enters concept Id "(1001|1002)"/, conceptId => {
cy.findByTestId("bulkImportTextArea").type(` ${conceptId}`);
});

When(
/the user enters concept Id "(1001|1002)"/, (conceptId) => {
cy.get("textarea").type(` ${conceptId}`);
}
);

Then('the user selects "Import existing concept"', () => {
cy.findByText("Import existing concept").click();
cy.findByText("Import existing concept").click();
});

Then('the user should be on the "Add concepts in bulk from CIEL" page', () => {
cy.url().should("contain", `/users/${getUser()}/collections/${getDictionaryId()}/add/?fromSource=CIEL`);
cy.url().should(
"contain",
`/users/${getUser()}/collections/${getDictionaryId()}/add/?fromSource=CIEL`
);
});

Then(
/the concept Id "(1000|1001|1002)" should be in the dictionary/, (conceptId) => {
/the concept Id "(1000|1001|1002)" should be in the dictionary/,
conceptId => {
cy.waitUntil(
() =>
cy.getConcept(
Expand All @@ -99,54 +105,55 @@ Then(
),
{ timeout: 10000 }
);
});
}
);

Then('concept Id "1000" should be skipped', () => {
cy.visit("/actions")
cy.visit("/actions");
cy.findByText("1 concept was skipped").should("be.visible");
});

Before({ tags: "@ciel" }, () => {
cy.createOrganisation("CIEL", true)
cy.createOrganisation("CIEL", true)
.createOrgSource("CIEL", "CIEL", true)
.createConcept(
[
[
{
name: "Serum",
locale: "en",
locale_preferred: true,
name_type: "FULLY_SPECIFIED"
}
],
"/orgs/CIEL/sources/CIEL/",
"1001"
)
.createConcept(
[
{
name: "Serum",
locale: "en",
locale_preferred: true,
name_type: "FULLY_SPECIFIED"
}
],
"/orgs/CIEL/sources/CIEL/",
"1001"
)
.createConcept(
[
{
name: "Whole blood sample",
locale: "en",
locale_preferred: true,
name_type: "FULLY_SPECIFIED"
}
],
"/orgs/CIEL/sources/CIEL/",
"1000"
)
.createConcept(
[
{
name: "Plasma",
locale: "en",
locale_preferred: true,
name_type: "FULLY_SPECIFIED"
}
],
"/orgs/CIEL/sources/CIEL/",
"1002"
);
});

After({ tags: "@ciel" }, () => {
name: "Whole blood sample",
locale: "en",
locale_preferred: true,
name_type: "FULLY_SPECIFIED"
}
],
"/orgs/CIEL/sources/CIEL/",
"1000"
)
.createConcept(
[
{
name: "Plasma",
locale: "en",
locale_preferred: true,
name_type: "FULLY_SPECIFIED"
}
],
"/orgs/CIEL/sources/CIEL/",
"1002"
);
});

After({ tags: "@ciel" }, () => {
cy.deleteOrgSource("CIEL", "CIEL", true).deleteOrganisation("CIEL", true);
});
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Given('the user is on the "Import existing concept" page', () => {
});

When('the user clicks the "Add concepts" button', () => {
cy.findByTitle("Add concepts").click();
cy.findByTestId("addConceptsIcon").click();
});

When('the user selects "Pick concepts"', () => {
Expand All @@ -44,7 +44,7 @@ When('the user selects "Pick concepts"', () => {
});

When('the user clicks on the "Add selected to dictionary" button', () => {
cy.findByTitle("Add selected to dictionary").click();
cy.findByTestId("addSelectedToDictionary").click();
});

When(
Expand All @@ -66,7 +66,7 @@ When("the user is sent to the view concept page", () => {
});

When('the user clicks on the "Add Serum to dictionary" button', () => {
cy.findByTitle("Add Serum to dictionary").click({ force: true });
cy.findByLabelText("Add Serum to dictionary").click({ force: true });
});

Then('the current source should be "CIEL"', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Given("the user is on the dictionary page", () => {
cy.findByText("Versions").should("be.visible");
});
When("the user clicks the more actions button", () =>
cy.findByTitle("More actions").click()
cy.findByTestId("more-actions").click()
);
When(/the user selects the "(.+)" menu list item/, menuItem =>
cy.findByText(menuItem).click()
Expand Down
15 changes: 7 additions & 8 deletions cypress/support/step_definitions/dictionary/create/create.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
/// <reference types="cypress" />
/// <reference types="../../../" />
import {
Given,
Then,
When
} from "cypress-cucumber-preprocessor/steps";
import { Given, Then, When } from "cypress-cucumber-preprocessor/steps";
import { getDictionaryId, getUser } from "../../../utils";

Given("the user is on the dictionaries page", () =>
Expand All @@ -16,7 +12,7 @@ Given("the user is on the create new dictionary page", () =>
);

When("the user clicks on the create new dictionary button", () =>
cy.findByTitle(/Create new dictionary/i).click()
cy.findByLabelText(/Create new dictionary/i).click()
);

When("the user enters the dictionary information", () => {
Expand Down Expand Up @@ -46,7 +42,10 @@ When(/the user selects "(.+)" visibility/, public_access => {

When("the user submits the form", () => {
cy.get("form").submit();
cy.url().should("contain", `/users/${getUser()}/collections/${getDictionaryId()}/`);
cy.url().should(
"contain",
`/users/${getUser()}/collections/${getDictionaryId()}/`
);
});

Then("the user should be on the create new dictionary page", () =>
Expand Down Expand Up @@ -87,4 +86,4 @@ Then("the source should not be publicly visible", () =>
.getSource(getDictionaryId())
.its("public_access")
.should("eq", "None")
);
);
Loading

0 comments on commit 6d9a0d7

Please sign in to comment.