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

Make ajax tests more rugged #362

Merged
merged 4 commits into from Feb 2, 2015
Merged

Make ajax tests more rugged #362

merged 4 commits into from Feb 2, 2015

Conversation

@fofr
Copy link
Contributor

@fofr fofr commented Jan 30, 2015

Fix tests that were intermittently failing due to changes not being picked up before assertions, or changes happening too quickly before assertions. Specifically:

  • use aria-expanded attributes to test for open/closed parts
  • be explicit about saving without ajax in video and campaign tests, and avoid save message assertion which would sometimes be missed

Tests using javascript which submit a form that cannot be saved with ajax (eg campaign image upload or video caption upload) were intermittently failing. Within save_edition there was a check for a dynamic saving message. Whilst this does show, it is likely that occasionally the form would submit and the page would change before this message appeared, leading to a failing test.

Instead pull the post-save assertions out of the save_edition method into a separate one that takes into account whether ajax is being used. Then in the video and campaign tests explicitly assert that ajax isn't used.

fofr added 4 commits Jan 30, 2015
Indicate that the part begins in an open state.

Use these attributes to test for the open/closed state, rather than
checking that some CSS isn’t there. Checking that something isn’t there
in capybara can be ambiguous when things are changing (eg
ajax/animations). This caused intermittent test fails when the check
was made before animation completed.
Occasionally poltergeist fails because it thinks there is an
overlapping element hiding the Fact check link. Use trigger to get
around this.
Tests using javascript which submit a form that cannot be saved with
ajax (eg campaign image upload or video caption upload) were
intermittently failing. Within save_edition there was a check for a
dynamic saving message. Whilst this does show, it is likely that
occasionally the form would submit and the page would change before
this message appeared, leading to a failing test.

Instead pull the post-save assertions out of the save_edition method
into a separate one that takes into account whether ajax is being used.
Then in the video and campaign tests explicitly assert that ajax isn't
used.
Both the ajax and non-ajax assertions were essentially checking for the
same message.
vinayvinay added a commit that referenced this pull request Feb 2, 2015
@vinayvinay vinayvinay merged commit 1ef795d into master Feb 2, 2015
1 check passed
1 check passed
default "Build #623 succeeded on Jenkins"
Details
@vinayvinay vinayvinay deleted the improve-ajax-tests branch Feb 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.