Add new tests and minor changes to enrich communication with hawk-apiserver#298
Conversation
…-apserver The created/updated/delete status is kept in the rails internal cookies, which are not accessible from hawk-apiserver. However, newer versions of hawk require this status.
The newer versions of hawk-apiserver need to check if the sessions is still logged in.
| end | ||
|
|
||
| def types | ||
| flash[:success] = _("Primitive deleted successfully") if params[:flash] == "deleted" |
There was a problem hiding this comment.
I can't catch up on the context for the recent changes.
What does this flash mean here? Could it be replaced with a more meaningful word?
There was a problem hiding this comment.
Yap, this is not obvious.
Basically, what it does is show a green so-called flash alert if there is a URL parameter flash=deleted. It's specifically designed for the newer version of hawk-apiserver. This newer version of hawk-apiserver implements cib/live/primitives/{primitive-id}/edit (there is a button "Delete"), and if you delete a primitive, hawk would forward you to cib/live/resources/types and prompt a success alert.
Original Ruby hawk knows that a primitive was deleted from its internal cookies. When redirected from the hawk-apiserver, we have to inform hawk somehow, so we do this via the URL flash parameter.
I will create a PR for hawk-apiserver, and comment on the flash=deleted to make it clearer.
e2e_test/hawk_test_driver.py
Outdated
| self.check_and_click_by_xpath(Error.COOL_PRIMITIVE_ERR, [Xpath.DROP_DOWN_FORMAT.format(resource_number_from_top), | ||
| Xpath.COOL_PRIMITIVE_EDIT]) | ||
|
|
||
| # Second, rename the cool_primitive to hot_primitive |
There was a problem hiding this comment.
rename should be copy here
There was a problem hiding this comment.
Good catch!
e2e_test/hawk_test_driver.py
Outdated
| submit_btn.click() | ||
|
|
||
| if self.verify_success(): | ||
| print("INFO: cool_primitive successfully renamed copied as hot_primitive") |
There was a problem hiding this comment.
typo here? renamed or copied
There was a problem hiding this comment.
Copied=) Good catch!
liangxin1300
left a comment
There was a problem hiding this comment.
Other parts look good to me
Thanks!
* test_copy_primitive * test_rename_primitive * test_delete_primitive The test_click_on_status is removed because it's implied in the new tests
4a2f6e6 to
a2ffce4
Compare
Big changes are coming to the hawk-apiserver. Its newer version will move some logic from hawk itself, and this requires a small amount of glue code in hawk (to make it working in hawk-apiserver). This glue code is introduced in the first two “Dev” commits. The final commit, “Tests”, only adds new end-to-end tests.