Fix randomly failing specs in expand_collapse_diff_spec:
Fix randomly failing specs in expand_collapse_diff_spec:

```
 Failure/Error: namespace.human_name + ' / ' + name

     ActionView::Template::Error:
       undefined method `+' for nil:NilClass
     # ./app/models/project.rb:807:in `name_with_namespace'
     # ./app/views/layouts/project.html.haml:1:in `_app_views_layouts_project_html_haml___2918737809244135908_70160161538920
'
     # ./app/controllers/projects/commit_controller.rb:23:in `show'
     # ./lib/gitlab/request_profiler/middleware.rb:15:in `call'
     # ./lib/gitlab/middleware/go.rb:16:in `call'
     # ./lib/gitlab/middleware/static.rb:9:in `call'
     # ------------------

     # --- Caused by: ---
     # NoMethodError:
     #   undefined method `+' for nil:NilClass
     #   ./app/models/project.rb:807:in `name_with_namespace'
```

Capybara's `click_link` method doesn't actually wait for the page to reload.
When the `expand_all_diffs` parameter is used, we need to search for unique
elements that appear to ensure that the page has actually reloaded.

Closes #21841

shinexiao/gitlabhq,stoplightio/gitlabhq,openwide-java/gitlabhq,stoplightio/gitlabhq,htve/GitlabForChinese,LUMC/gitlabhq,openwide-java/gitlabhq,daiyu/gitlab-zh,mmkassem/gitlabhq,screenpages/gitlabhq,dreampet/gitlab,SVArago/gitlabhq,allysonbarros/gitlabhq,shinexiao/gitlabhq,stoplightio/gitlabhq,daiyu/gitlab-zh,axilleas/gitlabhq,SVArago/gitlabhq,t-zuehlsdorff/gitlabhq,t-zuehlsdorff/gitlabhq,dplarson/gitlabhq,axilleas/gitlabhq,iiet/iiet-git,shinexiao/gitlabhq,icedwater/gitlabhq,mmkassem/gitlabhq,screenpages/gitlabhq,mmkassem/gitlabhq,iiet/iiet-git,darkrasid/gitlabhq,mmkassem/gitlabhq,daiyu/gitlab-zh,darkrasid/gitlabhq,screenpages/gitlabhq,jirutka/gitlabhq,allysonbarros/gitlabhq,icedwater/gitlabhq,iiet/iiet-git,t-zuehlsdorff/gitlabhq,dplarson/gitlabhq,iiet/iiet-git,t-zuehlsdorff/gitlabhq,jirutka/gitlabhq,jirutka/gitlabhq,LUMC/gitlabhq,openwide-java/gitlabhq,axilleas/gitlabhq,SVArago/gitlabhq,darkrasid/gitlabhq,shinexiao/gitlabhq,icedwater/gitlabhq,dplarson/gitlabhq,htve/GitlabForChinese,darkrasid/gitlabhq,daiyu/gitlab-zh,jirutka/gitlabhq,dplarson/gitlabhq,axilleas/gitlabhq,dreampet/gitlab,htve/GitlabForChinese,screenpages/gitlabhq,icedwater/gitlabhq,openwide-java/gitlabhq,htve/GitlabForChinese,LUMC/gitlabhq,LUMC/gitlabhq,allysonbarros/gitlabhq,stoplightio/gitlabhq,dreampet/gitlab,allysonbarros/gitlabhq,dreampet/gitlab,SVArago/gitlabhq