Talk:PMC:QA:Research Sahi

From ADempiere
Revision as of 03:14, 30 May 2011 by Kthiemann (Talk) (some example scripts)

Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.

Original text from Sunny

This detail has been overtaken by updates to the Sahi software.

Start Sahi

now you can start Sahi in console

first time for start Sahi

workbox bin # ./sahi.sh
--------
SAHI_HOME: ..
SAHI_USERDATA_DIR: ../userdata
SAHI_EXT_CLASS_PATH:
--------
Sahi properties file = /mnt/sda4/Sahi/sahi/config/sahi.properties
Sahi user properties file = /mnt/sda4/Sahi/sahi/userdata/config/userdata.properties
Copying profile to /mnt/sda4/Sahi/sahi/userdata/browser/ff/profiles/sahi0
Copying profile to /mnt/sda4/Sahi/sahi/userdata/browser/ff/profiles/sahi1
Copying profile to /mnt/sda4/Sahi/sahi/userdata/browser/ff/profiles/sahi2
Copying profile to /mnt/sda4/Sahi/sahi/userdata/browser/ff/profiles/sahi3
Copying profile to /mnt/sda4/Sahi/sahi/userdata/browser/ff/profiles/sahi4
Copying profile to /mnt/sda4/Sahi/sahi/userdata/browser/ff/profiles/sahi5
Copying profile to /mnt/sda4/Sahi/sahi/userdata/browser/ff/profiles/sahi6
Copying profile to /mnt/sda4/Sahi/sahi/userdata/browser/ff/profiles/sahi7
Copying profile to /mnt/sda4/Sahi/sahi/userdata/browser/ff/profiles/sahi8
Copying profile to /mnt/sda4/Sahi/sahi/userdata/browser/ff/profiles/sahi9
>>>> Sahi started. Listening on port: 9999
>>>> Configure your browser to use this server and port as its proxy
>>>> Browse any page and CTRL-ALT-DblClick on the page to bring up the Sahi Controller

then you can access http://localhost:9999/ via your browser

you can see follow interface:

Sahi.png

test Sahi

Configuring Firefox to use Sahi's proxy

install FoxyProxy plugin.you can see it in the lower right corner of Firefox

Sahi1.png

click it,then configurate it.

1.open FoxyProxy

Sahi2.png

2.add new Proxy

Sahi3.png

select ok.

3.use Sahi's proxy(localhost:9999)

Sahi4.png

close

after configuration, you can see we are using Sahi's proxy now

Sahi5.png

Sahi Controller

start Sahi,access http://localhost:9999 and put in start URL(eg.http://www.google.co.in/)

Sahi6.png

then will pop up Sahi Controller and open http://www.google.co.in/

Script Examples

common_functions.sah

//**************************************************************
// A collection of common functions to use in
// ADempiere sahi tests.
//
// Release: 3.6.0LTS
//*************************************************************

//login with given user and password, language english and default role, client
//org and warehouse
function login($usr, $pwd) {
	_assertExists(_textbox(0));
	_setValue(_textbox(0), $usr);
	_assertExists(_password(0));
	_setValue(_password(0), $pwd);
	_assertExists(_textbox(1));
	_setValue(_textbox(1), "English");
	_assertExists(_image("Ok24.png"));
	_assert(_isVisible(_image("Ok24.png")));
	_click(_image("Ok24.png"));
	
	//use default role and org
	_assertExists(_image("Ok24.png"));
	_assert(_isVisible(_image("Ok24.png")));
	_wait(2000);
	_click(_image("Ok24.png"));
}

//login using the given values
function loginWithRole($usr, $pwd, $language, $role, $client, $org, $warehouse) {
	_assertExists(_textbox(0));
	_setValue(_textbox(0), $usr);
	_assertExists(_password(0));
	_setValue(_password(0), $pwd);
	_assertExists(_textbox(1));
	_setValue(_textbox(1), $language);
	_assertExists(_image("Ok24.png"));
	_assert(_isVisible(_image("Ok24.png")));
	_click(_image("Ok24.png"));
	
	_wait(2000);
	_assertExists(_textbox(0));
	_setValue(_textbox(0), $role);
	_assertExists(_textbox(1));
	_setValue(_textbox(1), $client);
	_assertExists(_textbox(2));
	_setValue(_textbox(2), $org);
	_assertExists(_textbox(3));
	_setValue(_textbox(3), $warehouse);
	_assertExists(_image("Ok24.png"));
	_assert(_isVisible(_image("Ok24.png")));
	_click(_image("Ok24.png"));
}

function logout() {
	_assertExists(_link("Log Out"));
	_click(_link("Log Out"));
}

Ref_6418.sah

_include("common_functions.sah");

function openOrderWindow() { 
	_assertExists(_div("Quote-to-Invoice"));
	_click(_div("Quote-to-Invoice"));
	_assertExists(_div("Sales Orders"));
	_click(_div("Sales Orders"));
	_assertExists(_div("Sales Order"));
	_click(_div("Sales Order"));
}

function addChatMsg($msg) {
	_assertExists(_image("Chat24.png"));
	_click(_image("Chat24.png"));
	_assertExists(_textarea(1));
	_setValue(_textarea(1), $msg);
	_assertExists(_image("Ok24.png"));
	_click(_image("Ok24.png"));

}

//_navigateTo("http://asds2.adempiere.de:8080/webui/");
login("GardenAdmin", "GardenAdmin");
_wait(1000);
openOrderWindow();
addChatMsg("TEST");
logout();

login("GardenUser", "GardenUser");
_wait(1000);
openOrderWindow();
addChatMsg("OK");

logout();

Rev_6419.sah

_include("common_functions.sah");

//_navigateTo("http://asds2.adempiere.de:8080/webui/");
login("GardenUser","GardenUser");
_wait(1000);

_assertExists(_div("System Admin"));
_click(_div("System Admin"));

_assertExists(_div("Organization Rules"));
_click(_div("Organization Rules"));

_assertExists(_div("Organization"));
_click(_div("Organization"));
_wait(1000);
_assertExists(_span("Organization Info"));
_click(_span("Organization Info"));
_wait(1000);
_assertExists(_span("CashBook for transfers"));
_assert(_isVisible(_span("CashBook for transfers")));

_assertExists(_span("Bank for transfers"));
_assert(_isVisible(_span("Bank for transfers")));

_assertExists(_span("Receipt Footer Msg"));
_assert(_isVisible(_span("Receipt Footer Msg")));

logout();