Closed da70 closed 2 years ago
One of the tests is broken: https://github.com/NYULibraries/primo-explore-views/blob/3ad500f39ed262f865a8402e875c66ea6b33b1ff/primo-explore-e2e-cypress/cypress/integration/NYU/primo-explore-libraryh3lp-widget.spec.js#L17-L20
button.close-chat
should be button.chat-close
:
A later test does use the correct selector. This is not related to the test flakiness being addressed in this ticket. It is a broken test that always returns a false pass. I'll fix it along with the flaky test (which is also a test of initial load state).
EDIT: Note that the above was from master
branch. In development
it was recently changed to this:
it('does not have a visible close button', () => {
cy.get('button.close-chat')
.should('not.exist')
})
...as part of the upgrade of Cypress to 10. It passes because button.chose-chat
will never exist regardless of the state of the widget. I'll change it back to not.be.visible
-- but note that there is a chance this will fail, because even though the close button is not visible to the human on initial load, the display
property is computed value "block":
There are many other ways to make an element not visible other than using the display
property though, and Cypress probably will know all the methods and check them.
Preliminary research done:
The near-term goal is to get all green for development
CircleCI tests so that Vlad can merge into master
.
I believe the intent of the flaky test is to establish that widget initially loads in a closed state, with no chat
...and open:
Note the change in display
property from "none" to "block". This element is already being used in the widget-open tests -- https://github.com/NYULibraries/primo-explore-views/blob/master/primo-explore-e2e-cypress/cypress/integration/NYU/primo-explore-libraryh3lp-widget.spec.js#L28-L31:
it('it opens a visible libraryh3lp iframe', () => {
cy.get('div.chat-frame-wrap')
.should('be.visible')
})
...so in fact it would be nicely symmetrical to use the same element to test open and close state.
Pushed up the change, and tests pass: https://app.circleci.com/pipelines/github/NYULibraries/primo-explore-views/1121/workflows/e11e55f1-740b-4cf7-97a7-f6ac9c056554.
Running the CircleCI build 4x times. Meant to re-run it once but kept clicking it because couldn't tell if it was doing anything. We need to test for CircleCI flakiness anyway.
Also need to manually red light the tests (per red-green-refactor TDD practice). The VirtualBox on the laptop I'm on has a problem, and so I can't start up the dockerized local Primo dev environment, and I don't want to waste CircleCI jobs for manual red lights.
I suspect that the "Chat is offline" state is not the result of a technical failure. Yesterday Iris asked reference-services-group@nyu.edu staff if there had been any reports of issues with AAL chat or email -- see email thread subject "libraryh3lp Issues?" started by Iris on 2022-07-21 at 1:26PM. Staffers reported that between 1-2pm their "availability" (quotes theirs) was probably cutting in/out for 1-2 minutes. (It may have been caused by bad storm conditions -- one staffer said their AAL Chat connectivity was flashing purple and green right when a big storm hit). I took the "Chat is offline" screenshot during this time period, and the offline status appeared to resolve itself within minutes. Iris wondered if the widget offline status happens when the live AAL person isn't able to log in (due to a storm, for example). She said she'd check with Meg. Vlad and I both noticed that chat was offline after New York hours were over. I will check again tonight, and if the widget is in offline state I will copy the HTML to this ticket.
This being the case, determining whether the chat is offline or not is not within scope of these tests. Presumably the widget and the customizations are still working properly when they are reporting that the service is offline, so the tests should pass. Also, the libraryh3lp widget is inside an
The last six CircleCI workflow tests succeeded. I also disabled the customization on my local and confirmed that all tests failed.
Merged PR into development
: https://github.com/NYULibraries/primo-explore-views/pull/385
Vlad will merge into master
with some other changes when he deploys some work to prod.
Taken just now, 5:12pm:
Got the HTML and will put it in Description.
The "Chat is offline." status message is not inside an
From Iris, just now:
Looks like it's a dynamically updated schedule -- Friday is highlighted, and status "Chat is offline" is displayed.
See also CircleCI workflows for July 20-21, 2022 for errors and the commits associated with them. Note alternating success and failure for exact same code under test.
Current theory working theory: either libraryh3lp backend outages or application + network race conditions are causing the
.libraryh3lp
element to be absent from the DOM. This causes this test to fail in Cypress 10 (which we just upgraded to):This test expects an element with class "libraryh3lp" to always be present but initially hidden. There was a bug in versions of Cypress earlier than 6 to cause did not exist. Thus regardless of whether the
cy.get(<ELEMENT>).should('not.be.visible')
to false pass ifdiv.libraryh3lp
element was present and hidden or not present at all, our test would return true. As of Cypress 6, this test will now fail due to.libraryh3lp
being completely absent, not just present and not visible.These contradictory error messages in the CircleCI output illustrate the point:
...and...
(Note that the above messages usually were associated with different test code. For a brief period,
should(not.be.visible)
was replaced withshould(not.exist)
.We need to eliminate this test flake.
This is very likely a manifestation of the failure mode causing the test failure:
It tends to clear itself. Haven't managed to get the HTML for it yet. EDIT: Got it:
Here's what the widget normally looks like (prettified):
Here's the HTML for it:
Here's what the widget looks like when it's closed -- and note that it looks like this even when chat is offline (which the user discovers after clicking the button):
Here's the HTML for the closed widget (prettified):
References
Branch: https://github.com/NYULibraries/primo-explore-views/tree/384_libraryh3lp-e2e-test-flake