Skip to content

Commit

Permalink
Merge pull request #47 from Yoast/stories/run-replace-var-tests-condi…
Browse files Browse the repository at this point in the history
…tionally

Only run ReplaceVar tests when feature is available
  • Loading branch information
moorscode authored Aug 15, 2017
2 parents 3967635 + d97263a commit 915e239
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions tests/js/system/helpers/replaceVars.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
var logContains = require('./logContains');

module.exports = function ( browser, fieldName, fieldValue ) {
browser.execute(function () { YoastSEO.app.snippetPreview.openEditor(); } );

browser.clearValue( '.js-snippet-editor-title' );
browser.setValue( '.js-snippet-editor-title', [ '%%cf_'+fieldName+'%%' , browser.Keys.TAB ] );

browser.pause( 3000 );
browser.execute(
function() {
return YoastReplaceVarPlugin.ReplaceVar !== undefined;
},
[],
function( result ){
var replaceVarPresent = result.value;

if( replaceVarPresent ){
browser.execute(function () { YoastSEO.app.snippetPreview.openEditor(); } );

browser.clearValue( '.js-snippet-editor-title' );
browser.setValue( '.js-snippet-editor-title', [ '%%cf_'+fieldName+'%%' , browser.Keys.TAB ] );

browser.pause( 3000 );

browser.expect.element('#snippet_title').text.to.contain( fieldValue );
}
}
);

browser.expect.element('#snippet_title').text.to.contain( fieldValue );
};

0 comments on commit 915e239

Please sign in to comment.