Get help with testing, discuss unit testing strategies etc.


Post by SridharRS »

Currently we are working on siesta for automating our EXT JS application

We have to move back to previous page from current page to check the presence of data. For this we have any method in siesta to browse back

I searched and found right click option in siesta documentation. Please provide proper syntax to use that method because when we right click the first option is 'Back' so we can use that option to navigate back to my previous screen

Kindly help me...........................

Post by nickolay »


Post by SridharRS »

In harness.start I will add below code,

enablePageRedirect : true,

In my t.js file in will add below code to load all global variables,

var MyApp = t.global.MyApp;
var Ext = t.Ext();

And how the below method will help me for browser back option,

t.waitForPageLoad(function (window, Ext) {
var MyApp = window.MyApp;
var panel = Ext.getCmp('authResult')
t.is(panel.authResult, 'success', 'Correct authentication result')
});

Post by nickolay »

Please use "CODE" tags, when posting code.

Then you can use the "location" object in "t.global" (which is "window") to navigate the page back and forth.

Post by SridharRS »

<<My Harnesss File>>
<<CODE>>

var Harness = new Siesta.Harness.Browser.ExtJS(),
host = window.location.host,
baseHostPageUrl = "https://" + host,

baseTestURL = 'tests/carePlanning',
regressisonTestURL='tests/carePlanning/Regression Test Scripts/TestScripts';

Harness.configure({
title: 'Application Test Suite',
testClass : CarePlanningAssertions,
maxThreads: 5,
defaultTimeout : 1000000,
waitForTimeout: 500000,
subTestTimeout : 300000,
viewportWidth: 1300,
waitForAppReady :true,
runCore : 'sequential',
forceDOMVisible : false,
loaderPath: {
'application': 'app'
},
separateContext: true,
//enableCodeCoverage: true,
preload: [
"https://cdn.sencha.com/ext/gpl/5.1.0/pac ... sp-all.css",
"https://cdn.sencha.com/ext/gpl/5.1.0/bui ... l-debug.js"
]
});

Harness.start(
{
enablePageRedirect:true,
group: 'Application - Care Planning',
hostPageUrl : baseHostPageUrl + "/application/",

preload: [
baseTestURL+'/Regression Test Scripts/TestData/TestData.js',
],
items: [
{
enablePageRedirect:true,
group: 'MyWork',
preload: 'inherit',
items: [
{url: baseTestURL+'/login/Logout.t.js?' + Math.random().toString()},
{enablePageRedirect:true,url: regressisonTestURL+'/MyWork/Care Plan Guide/PrepopulateSection&SubsectionNames(6296&6298).t.js?'+ Math.random().toString()},

]
}
]

}
);

My Test File:

<<CODE>>

StartTest(function(t) {
t.describe("X", function(t) {
var timeStamp = t.getTimeStamp(),
testData=t.global.regressionTestData,
locator=t.global.CPMObjects,
MyApp = t.global.MyApp,
Ext = t.Ext(),
tabBarLoad,
startDiscussionBar,
CKeditorModalWindow,
careplanGuideConfig = {
careplanGuideDisplayName: 'CarePlanGuideDisplayName'+timeStamp
};

t.it("Will clear local storage", function(t) {
t.clearLocalStorage();
});

t.it("Will create a new Project", function(t) {
t.createProject();
});

t.it("Will create a CPG", function(t) {
t.createCarePlanGuide(careplanGuideConfig);
});
//Page - 1
t.it("Will wait till care plan guide name is displayed in the project details screen", function(t) {
t.waitForTextPresent(careplanGuideConfig.careplanGuideDisplayName+' (1.0)');

});
//Page -2
t.it("Navigate to care plan guide Authoring Screen", function(t) {
var grid = t.cq1(locator[0].projectItemGrid),
store = grid.getStore();

t.chain(
{ click: t.getCell(grid, 0, 1), offset : [23, 8]}
);
});

//I have navigate to page 1 from page 2 using any browser action - Kindly help us
//Manually -If I right click in page 2 and click 'Back' option it is navigated to page 2

});

});

Post by mats »

Please use "CODE" tags, when posting code, please clean up your post.

Post by SridharRS »

Do you think my statement is not clear

Post by SridharRS »

I am creating a item in page 1 and on clicking on that item I am navigated to page 2 in the same tab.

In this case I have to navigate to page 1 from page 2 . If I right click my first option is 'Back' I have to click that 'back' option in the right context menu. Help me how to achieve this................

Post Reply