-
Notifications
You must be signed in to change notification settings - Fork 9
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
Await grid paste success #1834
Await grid paste success #1834
Conversation
Initial test pass results show failures because values like "" and " " weren't in the actual grid cell texts; I pushed a change to filter those values out of the expected set so we aren't trying to validate non-values like that. Hopefully this resolves the failures we saw in the first runs. If we get acceptable results here we can consider whether it would be best for validating like this to be opt-in (or default) behavior; if we don't it probably makes sense for it to be opt-in only or possibly not worth doing at all. |
Update: test results with the latest change show only error-case pastes (where an invalid value was pasted in) failing; in biologics there were just 3 tests failing as a result. Given this result I think it would probably worthwhile to opt those 3 cases out and have this sort of validation be default behavior. |
Assuming a successful operation is pretty typical for our helpers. |
Seems fair enough. I'll flip it to be opt-in, and update calling code where I suspect test failures to involve the test racing ahead of the page consuming pasted content. |
…n, only if opted in Make explicit check for all expected items public
One thing I could do here is get rid of the overload that causes Another thing I could do is just make I could also wrap the asserts in those methods with a The ability to do this sort of validation/synchronization occurred to me as needed while testing early iterations of plate configuration- the grid was (at that time) not form-submitted, it was dynamic and when there was no waiting for the form-submit button to become clickable in order to leave the page, tests would routinely race ahead of the product and it was hard to know if pasted content had made it into the app or not- (it sure seemed like it wasn't, and that uncertainty seemed at odds with our objectives of creating low-noise, stable tests). Also, the results from running tests against this branch (with full validation) seems to show that it was the error cases (in which paste-data into a lookup cell didn't resolve anything but still visually has pasted text in it) that came up with failures. Perhaps those cells with errors don't appear in |
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.
You have an unused method that should not be public.
// split pasteContent into its parts | ||
var contentParts = pasteContent.replace("\n", "\t").split("\t"); | ||
// filter out empty and space-only values | ||
var filteredParts = Arrays.stream(contentParts).filter(a-> !a.isEmpty() && !a.equals(" ")).collect(Collectors.toList()); |
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 list is not going to be modified so you can just call .toList here.
var filteredParts = Arrays.stream(contentParts).filter(a-> !a.isEmpty() && !a.equals(" ")).toList());
public void waitForPasteContent(String pasteContent) | ||
{ | ||
// split pasteContent into its parts | ||
var contentParts = pasteContent.replace("\n", "\t").split("\t"); | ||
// filter out empty and space-only values | ||
var filteredParts = Arrays.stream(contentParts).filter(a-> !a.isEmpty() && !a.equals(" ")).collect(Collectors.toList()); | ||
await().atMost(Duration.ofSeconds(2)) | ||
.untilAsserted(()-> Assertions.assertThat(getSelectionCellTexts()) | ||
.containsAll(filteredParts)); | ||
} |
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.
It doesn't look like this method is used.
This should not be public.
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.
It is offered as an option to changing the behavior of pasteFromCell
; if it's public callers can chain this method after pasting content if they want to assert that content.
Please, if you're going to press for no change and then press for no new public methods, consider that both of these options at once doesn't make sense. If the method is private and not used internally, it might as well not exist and the purpose for this whole PR is... useless
If you want to tell me what to do with the code, please let's talk about it instead of doing this in text
Rationale
Occasionally, tests like BiologicsSampleUpdateTest.testBulkEditThenEditInGrid fail because they assert grid content they just pasted and then navigated away from the grid page.
This adds a check to pasteFromCell that splits apart the paste content and awaits the presence of those parts in the cell selection range (which is also the paste target).
If this is too aggressive, it would be simple to make this optional/opt-in behavior instead of default behavior
Related Pull Requests
(branches for SM, Biologics don't have changes, just there to get test runs against this change)
Changes