I'm facing an issue where I need to execute a function at the beginning of my test before proceeding with the rest of the test steps.
Here is the custom command I am using, named internalAdviceLinksHtml:
const solr = require('solr-client')
exports.command = function() {
this
const client = solr.createClient('solr.dev.bauerhosting.com', 8080, 'cms', '/www.parkers.co.uk');
const globalSettingsQuery = client.createQuery()
.q({TypeName:'Bauer.Parkers.GlobalSettings'})
.start(0)
.rows(10);
client.search(globalSettingsQuery,function(err,obj) {
if (err) {
console.log(err);
} else {
const myresult = (obj.response.docs[0].s_InternalAdviceLinksHtml);
console.log(myresult.length);
if (myresult.length === 0) {
console.log('content block not configured');
} else {
console.log('content block configured');
}
}
});
return this;
};
Below is the content of the test file:
module.exports = {
'set up the solr query': function (browser) {
browser
.solr_query.global_settings.internalAdviceLinksHtml();
},
'links above footer on advice landing page displayed': function (browser) {
browser
.url(browser.launch_url + browser.globals.carAdvice)
.assert.elementPresent('section.seo-internal-links')
},
'closing the browser': function (browser) {
browser
.browserEnd();
},
};
The custom command functions correctly, but it seems like the subsequent test ('links above footer on advice landing page displayed') is not being triggered. It appears that the execution halts after the custom command section. I believe there must be something obvious causing this issue, but I haven't been able to identify it yet.
Your assistance in resolving this matter would be greatly appreciated.