I have written an OPA Script but it was not identifying the View id's. Can you please help me to solve this?
OPA Script is not able to enter the text "Testing in Description" in the Text Area Field
My Script is getting failed and im seeing below Error.
There was no Input
Opa timeout
This is what Opa logged:
all results were filtered out by the matchers - skipping the check - sap.ui.test.pipelines.MatcherPipeline
Callstack:
at fillDescription (https://webidetesting7755399-w3446edba.dispatcher.int.sap.hana.ondemand.com/webapp/test/integration/pages/ActivitySet.js?eval:58:19)
at Object.eval (https://webidetesting7755399-w3446edba.dispatcher.int.sap.hana.ondemand.com/webapp/test/integration/AllActivitySets.js?eval:32:30)
Expected:
true
Result:
false
Diff:
trufalse
Below is my Code..
Opa5.extendConfig({
viewName : "test",
arrangements: new Common(),
viewNamespace: "com.tools.melody.activityForm.view.",
autoWait: true
});
opaTest("Enter Description", function (Given, When, Then) {
// Arrangements
//Given.iStartMyApp();
//Actions
When.onTheActivitySetPage.fillDescription();
});
fillDescription: function () {
return this.waitFor({
id:"activityFormDescription",
//controlType: "sap.m.TextArea",
actions: new EnterText({
text: "Testing in Description"
}),
success: function() {
Opa5.assert.ok(true, "Testing in Description");
},
errorMessage: "There was no Input"
});
},
View File ID ::
<TextArea id="activityFormDescription" value="{default>/0/Description}" change="handleChange"></TextArea>
Try to pass viewName parameter to the waitFor function.
fillDescription: function () {
return this.waitFor({
id:"activityFormDescription",
viewName : "test",
actions: new EnterText({
text: "Testing in Description"
}),
success: function() {
Opa5.assert.ok(true, "Testing in Description");
},
errorMessage: "There was no Input"
});
},
Related
I'm trying to add some custom logs to my protractor test report. I've app log file in my project folder which has the logs captured using log4js. I want these log entries to be shown in my test report as well. Currently I'm using chercher report. Since I'm a beginner to protractor, I'm not sure how to do this. Can anybody help me on this? Thanks in advance!
spec.js
fdescribe('Protractor Perfecto Demo', function () {
it('should pass test', function () {
browser.reportingClient.stepStart('Step 1: Navigate Google');
browser.driver.get('https://www.google.com'); //Navigate to google.com
browser.reportingClient.stepEnd();
//Locate the search box element and insert text
//Click on search button
browser.reportingClient.stepStart('Step 2: Send Keys');
browser.driver.findElement(by.name('q')).sendKeys('PerfectoCode GitHub');
browser.reportingClient.stepEnd();
browser.reportingClient.stepStart('Step 3: Click');
browser.driver.findElement(by.css('#tsbb > div')).click();
browser.reportingClient.stepEnd();
});
//This test should fail
it('should fail test', function () {
browser.reportingClient.stepStart('Step 1: Navigate Google');
browser.driver.get('https://www.google.com'); //Navigate to google.com
browser.reportingClient.stepEnd();
//Locate the search box element and insert text
//Click on search button
browser.reportingClient.stepStart('Step 2: Send Keys');
browser.driver.findElement(by.name('q')).sendKeys('PerfectoCode GitHub');
browser.reportingClient.stepEnd();
browser.reportingClient.stepStart('Step 3: Click');
browser.driver.findElement(by.css('#tsbbbsdasd > div')).click();
browser.reportingClient.stepEnd();
});
afterAll(function(done){
process.nextTick(done);
});
});
conf.js
var reportingClient;
exports.config = {
//Remote address
// seleniumAddress: 'https://MY_HOST.perfectomobile.com/nexperience/perfectomobile/wd/hub',
directConnect: true,
//Capabilities to be passed to the webdriver instance.
capabilities: {
browserName: 'chrome'
// user: 'MY_USER',
// password: 'MY_PASS',
// platformName: 'Android',
//deviceName: '123456',
},
//Framework to use. Jasmine is recommended.
framework: 'jasmine',
// Spec patterns are relative to the current working directly when
// protractor is called.
specs: ['./tests/SignupAutomation_spec.js'],
// Options to be passed to Jasmine.
jasmineNodeOpts: {
showColors: true, // Use colors in the command line report.
defaultTimeoutInterval: 120000 // Time to wait in ms before a test fails. Default value = 30000
},
onComplete: function () {
// Output report URL
return reportingClient.getReportUrl().then(
function (url) {
console.log(`Report url = ${url}`);
}
);
},
onPrepare: function () {
const Reporting = require('perfecto-reporting');
reportingClient = new Reporting.Perfecto.PerfectoReportingClient(new Reporting.Perfecto.PerfectoExecutionContext({
webdriver: browser.driver,
tags: ['javascript driver']
}));
browser.reportingClient = reportingClient;
var myReporter = {
specStarted: function (result) {
reportingClient.testStart(result.fullName);
},
specDone: function (result) {
if (result.status === 'failed') {
const failure = result.failedExpectations[result.failedExpectations.length - 1];
reportingClient.testStop({
status: Reporting.Constants.results.failed,
message: `${failure.message} ${failure.stack}`
});
} else {
reportingClient.testStop({
status: Reporting.Constants.results.passed
});
}
}
}
jasmine.getEnv().addReporter(myReporter);
}
}
While running this I'm getting below error:
An error was thrown in an afterAll
AfterAll JavascriptError: javascript error: end is not defined
(Session info: chrome=90.0.4430.212)
(Driver info: chromedriver=90.0.4430.24 (4c6d850f087da467d926e8eddb76550aed655991-refs/branch-heads/4430#{#429}),platform=Windows NT 10.0.19042 x86_64)
I wonder how to test with OPA5 if a Dialog is successfully closed after pressing the corresponding button.
This is how I test if the dialog is open:
{
// ...
iShouldSeeTheSortDialog: function () {
return this.waitFor({
controlType: "sap.m.ViewSettingsDialog",
id: "sortDialog",
fragmentId: "sortFragment",
success: function () {
Opa5.assert.ok(true, "The sort dialog is open");
},
errorMessage: "Did not find the sort dialog control"
});
},
}
Now I'm looking for the exact opposite test case. I would like to search for the sortDialog and throw a success if it is not found anymore.
Could you please suggest a solution?
I found the answer myself, maybe it will be helpful for someone else.
If you want to check if a dialog has been closed but not destroyed, you can do it this way:
{
//..
iShouldNotSeeDialog: function () {
return this.waitFor({
id: "dialogID",
visible: false,
success: function (oDialog) {
Opa5.assert.notOk(oDialog.getVisible(), "Dialog is not visible -- OK");
},
errorMessage: "Checking Field: dialogID -- Assertion Failed"
});
}
}
If you want to check if a dialog has been destroyed, you can do this as follows:
{
//..
iShouldNotSeeDialog: function () {
return this.waitFor({
success: function () {
var bExists = (Opa5.getJQuery()("#" + "dialogID").length > 0);
Opa5.assert.notOk(bExists, "Dialog doesn't exist -- OK");
},
errorMessage: "-- Assertion Failed"
});
}
}
Trying to add class to only selected paragraphs in WordPress Editor.
Added a button called 'Add stylish '<li>' where there is an item called 'Includes'. So my need is to add class to the selected '<p>' when 'Includes' is pressed. Any help will be really grateful. Thanks!
(function() {
tinymce.PluginManager.add('sanjog_custom_tinymce_button', function( editor, url ) {
editor.addButton( 'sanjog_custom_tinymce_button', {
title: 'Add stylish <li>',
type: 'menubutton',
fixedWidth: true,
icon: 'icon dashicons-menu',
menu: [
{
text: 'Includes',
onclick: function() {
tinyMCE.activeEditor.focus();
tinyMCE.activeEditor.dom.addClass(tinyMCE.activeEditor.selection.select('p'),'test');
}
},
]
});
});
})();
How does a OPA match pattern for a sap.m.MessageToast.show call looks like?
I looked into the Code of sap.m.MessageToast.show and assumed the use control is sap.ui.core.Popup. Therefore I tried the following matcher:
iShouldSeeAToastMessage : function() {
return this.waitFor({
controlType : "sap.ui.core.Popup",
success : function (aDialog) {
ok(true, "Found a Toast: " + aDialog[0]);
},
errorMessage : "No Toast message detected!"
});
},
Is the controlType correct? How could the matcher section look like?
This should work:
return this.waitFor({
pollingInterval : 100,
viewName : "YOUR_VIEW_NAME_HERE",
check : function () {
return !!sap.ui.test.Opa5.getJQuery()(".sapMMessageToast").length;
},
success : function () {
ok(true, "Found a Toast");
},
errorMessage : "No Toast message detected!"
});
I have the response json string returned from the first FS(filteringSelect) with the contents of the second , but i can't make it load it. I've tried with store.clearOnClose , but it doesn't work , my javascript is valid. How do you do this ?
Here is the code from my form with the 2 filteringSelects:
$category=new Zend_Dojo_Form_Element_FilteringSelect("category");
$category->setLabel("Category");
$category->setAttrib("id","category")
->setAttrib("onChange","
var cat=dojo.query('#category ')[0].value;
dojo.xhrPost({
url: 'getsubcategories',
handleAs: 'text',
content: { category:cat } ,
load: function(data, ioArgs) {
var store=subCatStore.store;
store.data=data;
store.close()
},
error: function(data,ioArgs) {
if(typeof data== 'error'){
console.warn('error');
console.log(ioArgs);
}
}
});
"
);
$category->setOptions(array(
"autocomplete"=>false,
"storeId"=>"category",
"storeType"=>"dojo.data.ItemFileReadStore",
"storeParams"=>array("url"=>"getcategories"),
"dijitParams"=>array("searchAttr"=>"name")
)
)
->setRequired(true);
$subCategory=new Zend_Dojo_Form_Element_FilteringSelect("subCategory");
$subCategory->setLabel("Sub Category")
->setAttrib("id","subCategory");
$subCategory->setOptions(array(
"autocomplete"=>false,
"storeId"=>"subCatStore",
"jsId"=>"subCatStore",
"storeType"=>"dojo.data.ItemFileReadStore",
"storeParams"=>array("clearOnClose"=>true,"url"=>"getsubcategories"),
"dijitParams"=>array("searchAttr"=>"name")))
->setRequired(true);
I've red on the net that this is the way to do it , get the element of the 2nd dropdown and
passed it values when 1st changes. Am i Wrong ?
Tnx for your attention.
i dont know about zf, but this is how we do in js :
new dijit.form.FilteringSelect({
id: "country",
name: "country",
store: countryStore,
required: false,
onChange: function(country) {
dijit.byId('state').query.countryId = country ;
},
searchAttr: "name"
},"country");