-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OCLOMRS-913: The Basic User: AddConceptInDictionaryPage: Add a few concepts from CIEL in existing dictionary #723
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jwnasambu I've added some comments here. Thanks for your hard work on this. I hope these comments are enough to get you unblocked!
cy.visit(`/users/${getUser()}/collections/${getDictionaryId()}/concepts/`); | ||
}); | ||
|
||
When("the user clicks the Add concepts button", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, when I look at the build log for this, I see that the reason it is failing is this: Error: Step implementation missing for: the user clicks the "Add concepts" button
. There are a couple of others like that.
In the feature
file, the step is written as: When the user clicks the "Add concepts" button
. Note the quotation marks around Add concepts
those need to be here two, so you can either write this as:
When('the user clicks the "Add concepts" button')
Or:
When("the user clicks the \"Add concepts\" button")
To get the same result. Similarly with other tests where you have quotation marks.
}); | ||
|
||
Then("the user should be on the Import existing concept page", () => { | ||
cy.visit("/orgs/CIEL/sources/CIEL/concepts/?addToDictionary=/users/openmrs/collections/") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be something like cy.url().should("contain", "<url>")
. cy.url()
gets the current URL. cy.visit()
redirects the user to the provided url.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, instead of hard-coding openmrs
as the user here, we should use ${getUser()}
. Note that to support this the string should be surrounded by back-ticks `
. (The difference between normal strings defined with '
or "
and strings defined with `
is that the strings defined with `
allow this kind of inline string interpolation.
}); | ||
|
||
Given("the user is on the Import existing concept page", () => { | ||
cy.visit("/orgs/CIEL/sources/CIEL/concepts/?addToDictionary") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should fill in the addToDictionary
here, e.g.,
cy.visit("/orgs/CIEL/sources/CIEL/concepts/?addToDictionary") | |
cy.visit(`/orgs/CIEL/sources/CIEL/concepts/?addToDictionary=/users/${getUser()}/collections/${getDictionaryId()}/`) |
}); | ||
|
||
Then("the Serum concept should be added to the dictionary", () => { | ||
cy.visit("/orgs/CIEL/sources/concepts/?addToDictionary=%2Fusers%2Fopenmrs%2Fcollections%2Fjst12%2F&page=1&q=Serum/") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we should actually be testing the dictionary contents right?
@ibacher thanks for the review and the proposed changes. |
}); | ||
|
||
Then('the "Serum" concept should be added to the dictionary', () => { | ||
cy.visit(`/orgs/CIEL/sources/CIEL/concepts/?addToDictionary=/users/${getUser()}/collections/${getDictionaryId()}/Serum/`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it should be something like this?
cy.visit(`/orgs/CIEL/sources/CIEL/concepts/?addToDictionary=/users/${getUser()}/collections/${getDictionaryId()}/Serum/`) | |
cy.url().should('include', `/orgs/CIEL/sources/CIEL/concepts/?addToDictionary=/users/${getUser()}/collections/${getDictionaryId()}/Serum/`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any other way to determine whether the concept has been added? instead of checking the URL? A user-specific way.
ex: How a user knows when it has been created? Is it displays a success message? or it displays the created concept?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since for this case am importing the concept from the already existing concepts, it just displays the imported concept in the dictionary.
}); | ||
|
||
Given('the user is on the "Import existing concept" page', () => { | ||
cy.url().should("contain", "/orgs/CIEL/sources/CIEL/concepts/"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this one should be
cy.url().should("contain", "/orgs/CIEL/sources/CIEL/concepts/"); | |
cy.visit("/orgs/CIEL/sources/CIEL/concepts/"); |
40ed79f
to
b9aa234
Compare
…cepts from CIEL in existing dictionary
…cepts from CIEL in existing dictionary
Given the user is on the view dictionary concepts page | ||
When the user clicks the "Add concepts" button | ||
And the user selects "Import existing concept" | ||
And the user selects "Pick concepts" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems the step implementation missing for this one
}); | ||
|
||
When('the user clicks on the row for "Serum"', () => { | ||
cy.findByText("Serum").click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cypress throws the following error,
Unable to find an element with the text: Serum. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
as described in the error message, it seems there's no such element with the text "Serum"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, to address this, we actually need to create a concept called "Serum" in a source called "CIEL" owned by an organisation called "CIEL". These tests are run against an empty instance of OCL (i.e., OCL without any content).
This will probably require a new command (since the createSource
command only supports created a user source).
So we need something called before this function that does something like this:
cy.createOrganisation("CIEL", true).createOrgSource("CIEL", "CIEL", true);
And then afterwards,
cy.deleteOrganisation("CIEL", true);
Will also need a createConcept
command that takes the source that the concept belongs to and the minimum number of properties we need so we can create a "Serum" concept before this test. Does that make some kind of sense?
cy.findByTitle("Add concepts").click(); | ||
}); | ||
|
||
Then('the user selects "Import existing concept"', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This on should be When
not Then
Then('the user selects "Import existing concept"', () => { | |
When('the user selects "Import existing concept"', () => { |
cypress/integration/dictionary/addConceptInDictionaryPage.feature
Outdated
Show resolved
Hide resolved
@jwnasambu Please see @jayasanka-sack's helpful comments and let me know if there's any additional guidance you need. |
@ibacher and @jayasanka-sack for the guidance. Ian, am soon reaching out. |
…cepts from CIEL in existing dictionary
…cepts from CIEL in existing dictionary
…cepts from CIEL in existing dictionary
…cepts from CIEL in existing dictionary
…cepts from CIEL in existing dictionary
…cepts from CIEL in existing dictionary
…cepts from CIEL in existing dictionary
@suruchee I will be the happiest person to change the of status this PR but us you can see the build is still failing and basing on Ian's explanation |
@jayasanka-sack am sorry I had not your comment. Kindly forgive me. |
…cepts from CIEL in existing dictionary
@jayasanka-sack Am still getting the same error. |
cy.visit("users/openmrs/collections"); | ||
}); | ||
|
||
When('the user clicks on the "Add selected to dictionary" button', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When('the user clicks on the "Add selected to dictionary" button', () => { | |
When('the user clicks the "Add selected to dictionary" button', () => { |
.click(); | ||
}); | ||
|
||
When('the user clicks the "Add Serum to dictionary" button', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When('the user clicks the "Add Serum to dictionary" button', () => { | |
When('the user clicks on the "Add Serum to dictionary" button', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jayasanka-sack and @ibacher it has be a tough journey but am glad am remaining with 1 error though the error on the PR is different from the one on the terminal.
…cepts from CIEL in existing dictionary
…cepts from CIEL in existing dictionary
…cepts from CIEL in existing dictionary
…cepts from CIEL in existing dictionary
…cepts from CIEL in existing dictionary
@hadijahkyampeire If you have a chance, could you take a look at the changes to the ViewConceptsPage.tsx and let me know if any of the changes there don't make sense? |
@ibacher and @jayasanka-sack I can't thank you enough. It has been a real fight I now have a glimpse of what it means to be a senior dev. Though with serious errors! |
Okay @ibacher I will do that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all is fine, they all make sense and will make the importing from another dictionary work well, great work @ibacher and @jwnasambu . LGTM
@@ -336,7 +334,10 @@ const ViewConceptsPage: React.FC<Props> = ({ | |||
) | |||
} | |||
dictionaryToAddTo={dictionaryToAddTo} | |||
linkedDictionary={containerUrl} | |||
linkedDictionary={ | |||
(containerType === DICTIONARY_CONTAINER && containerUrl) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice ❤️
JIRA TICKET NAME:
The Basic User: AddConceptInDictionaryPage: Add a few concepts from CIEL in existing dictionary
Summary:
Created an automated test for "Add a few concepts from CIEL in existing dictionary"