Yoast / yoast-acf-analysis

WordPress plugin that adds the content of all ACF fields to the Yoast SEO score analysis.
https://wordpress.org/plugins/acf-content-analysis-for-yoast-seo/
GNU General Public License v3.0
61 stars 20 forks source link

Test might fail depending on last opened Media Modal tab #42

Closed kraftner closed 7 years ago

kraftner commented 7 years ago

So #34 also changed the Nightwatch test for the Image Field.

https://github.com/Yoast/yoast-acf-analysis/blob/0307dcb051f56061b3815d70eabbdf73cc6ab3d2/tests/js/system/tests/general/content.js#L71-L75

The reasoning was

The image modal opens on the upload tab. Added code to switch to the Media Library.

I was already wondering about this because the tests seemed to run fine until then for everyone. So now when I looked at it again - it now failed for me.

After some looking I realised that the media modal seems to remember which tab it had opened last. So this is why for me it opened up on another tab than it apparently did for @herregroen. The problem is that the change of the test didn't fix the issue, it just made it fail for the other half of the time. :grin:

herregroen commented 7 years ago

@kraftner I'm a bit confused when you say that the test fail the other half of the time?

As far as I can see clicking the Media Library tab if you're already there doesn't change anything, you'll stay in the Media Library and the tests proceed as expected.

Are you experiencing different results or am I misreading the issue?

kraftner commented 7 years ago

The reason the test failed for me was that when the tab is already active it doesn't only have the media-menu-item class but also the active class. And as you used a[@class='media-menu-item' and text()='Media Library'] instead of a[contains(@class, 'media-menu-item') and text()='Media Library'] it only matched if the class property was exactly media-menu-item.

kraftner commented 7 years ago

Fixed by #43