Skip to content
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

Added Selenium tests for inventory page #75

Open
wants to merge 29 commits into
base: react
Choose a base branch
from

Conversation

BenMueller1
Copy link
Contributor

No description provided.

@BenMueller1 BenMueller1 changed the base branch from react-inventory to react March 11, 2022 02:09
patient_pk = request.POST['patient_pk']
drug = models.Drug.objects.get(pk=pk)
patient = Patient.objects.get(pk=patient_pk)
can_dispense = drug.can_dispense(int(num))
can_dispense = drug.can_dispense(int(num))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't want extra space at end of line

@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import pdb
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Comment on lines 123 to 139

















Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get rid of extra space

Comment on lines 26 to 30
const nameComparator = simpleComparator('name');
const categoryComparator = simpleComparator('category');
const expirationDateComparator = simpleComparator('expiration_date');
const stockComparator = simpleComparator('stock');
const doseComparator = React.useMemo(() => (rowA,rowB,columnId,desc) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I checked with the drugExample data, sorting is not working for stock, expiration date, dose. Sort by manufacturer should ignore case differences

Comment on lines +41 to +44
{<SearchBar
globalFilter={state.globalFilter}
setGlobalFilter={setGlobalFilter}
/>
/>}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove extra brackets

Copy link
Member

@wwick wwick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sorting issue was not fixed with the last revision. See comments. There should be selenium tests to catch this and similar issues.

A big thing is that this PR has almost no comments (my fault mostly). A standard rule is that every function should have a comment explaining what it does. There should also be comments explaining why things are coded as they are

Comment on lines +31 to +37
const manufacturerComparator = React.useMemo(() => (rowA,rowB,columnId,desc) => {
let cmp = compare(rowA.original.unit,rowB.original.unit);
if (cmp == 0) {
cmp = compare(rowA.original.manufacturer.toLowerCase(), rowB.original.manufacturer.toLowerCase());
}
return cmp;
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There shouldn't be any comparison of units. The simple lowerCase() comparator should work fine here

Comment on lines +26 to +29
const nameComparator = simpleComparator('name');
const categoryComparator = simpleComparator('category');
const expirationDateComparator = simpleComparator('expiration_date');
const stockComparator = simpleComparator('stock');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's still a bug with the comparators. It seems that all the comparators after nameComparator are just returning the same result as the name comparator. I'm fairly certain this is a bug related to the memoization in simpleComparator. useMemo() is required by React Table, and it allows you to specify dependencies, which I'm guessing we need to do

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct sorting is something that the selenium tests really need to check for

Comment on lines +111 to +113
By.XPATH,
"/html[@class='no-js']/body[@class='modal-open']/div[@class='fade modal show']/div[@class='modal-dialog']/div[@class='modal-content']/form/div[@class='modal-footer']/button[@class='btn btn-primary']"
).click()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to find by ID instead of XPATH?

@@ -132,6 +132,7 @@ def form_valid(self, form):
def drug_dispense(request):
pk = request.POST['pk']
num = request.POST['num']

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove extra line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants