QTP info:

Qtp Questions:
Qtp Questions
utility functions
utility functions

webbrowser function:
webbrowser function

imp functions:
imp functions

qtp scripts:
qtp scripts:


Descriptive programming:
Descriptive programming


web table objects:
web table objects

user functions&web table objects:

user functions:


function2:
function2:

Useful Links:
Useful Links

Good Info:

Good info

QTP interview questions

QTP important questions for interview
.QTP interviews


1. How Does Run time data (Parameterization) is handled in QTP?

A) You can then enter test data into the Data Table, an integrated

spreadsheet with the full functionality of Excel, to manipulate data

sets and create multiple test iterations, without programming, to

expand test case coverage. Data can be typed in or imported from

databases, spreadsheets, or text files.



2) What is keyword view and Expert view in QTP?

A) QuickTest’s Keyword Driven approach, test automation experts

have full access to the underlying test and object properties, via an

integrated scripting and debugging environment that is round-trip

synchronized with the Keyword View.

Advanced testers can view and edit their tests in the Expert View,

which reveals the underlying industry-standard VBScript that

QuickTest Professional automatically generates. Any changes

made in the Expert View are automatically synchronized with the

Keyword View.



3) Explain about the Test Fusion Report of QTP ?

A) Once a tester has run a test, a TestFusion report displays all

aspects of the test run: a high-level results overview, an expandable

Tree View of the test specifying exactly where application failures

occurred, the test data used, application screen shots for every step

that highlight any discrepancies, and detailed explanations of each

checkpoint pass and failure. By combining TestFusion reports with

QuickTest Professional, you can share reports across an entire QA

and development team.



4) To which environments does QTP supports ?

A) QuickTest Professional supports functional testing of all enterprise

environments, including Windows, Web, ..NET, Java/J2EE, SAP,

Siebel, Oracle, PeopleSoft, Visual Basic, ActiveX, mainframe

terminal emulators, and Web services.



5) What is QTP ?

A) QuickTest is a graphical interface record-playback automation tool. It is able to work with any web, java or windows client application. Quick Test enables you to test standard web objects and ActiveX controls. In addition to these environments, QuickTest Professional also enables you to test Java applets and applications and multimedia objects on Applications as well as standard Windows applications, Visual Basic 6 applications and .NET framework applications...


6) Explain QTP Testing process ?

A) The QuickTest testing process consists of 6 main phases:

Create your test plan
Prior to automating there should be a detailed description of the test including the exact steps to follow, data to be input, and all items to be verified by the test. The verification information should include both data validations and existence or state verifications of objects in the application.

Recording a session on your application
As you navigate through your application, QuickTest graphically displays each step you perform in the form of a collapsible icon-based test tree. A step is any user action that causes or makes a change in your site, such as clicking a link or image, or entering data in a form.

Enhancing your test
Inserting checkpoints into your test lets you search for a specific value of a page, object or text string, which helps you identify whether or not your application is functioning correctly.
NOTE: Checkpoints can be added to a test as you record it or after the fact via the Active Screen. It is much easier and faster to add the checkpoints during the recording process.

Broadening the scope of your test by replacing fixed values with parameters lets you check how your application performs the same operations with multiple sets of data.
Adding logic and conditional statements to your test enables you to add sophisticated checks to your test.
Debugging your test
If changes were made to the script, you need to debug it to check that it operates smoothly and without interruption.

Running your test on a new version of your application
You run a test to check the behavior of your application. While running, QuickTest connects to your application and performs each step in your test.

Analyzing the test results
You examine the test results to pinpoint defects in your application.

Reporting defects
As you encounter failures in the application when analyzing test results, you will create defect reports in Defect Reporting Tool.



7) Explain the QTP Tool interface.

A)
It contains the following key elements:

Title bar, displaying the name of the currently open test

Menu bar, displaying menus of QuickTest commands

File toolbar, containing buttons to assist you in managing tests



Test toolbar, containing buttons used while creating and maintaining tests



Debug toolbar, containing buttons used while debugging tests.



Note: The Debug toolbar is not displayed when you open QuickTest for the first time. You can display the Debug toolbar by choosing View > Toolbars > Debug. Note that this tutorial does not describe how to debug a test. For additional information, refer to the QuickTest Professional User's Guide.

Action toolbar, containing buttons and a list of actions, enabling you to view the details of an individual action or the entire test flow.

Note: The Action toolbar is not displayed when you open QuickTest for the first time. You can display the Action toolbar by choosing View > Toolbars > Action. If you insert a reusable or external action in a test, the Action toolbar is displayed automatically. For additional information, refer to the QuickTest Professional User's Guide.

Test pane, containing two tabs to view your test-the Tree View and the Expert View

Test Details pane, containing the Active Screen

Data Table, containing two tabs, Global and Action, to assist you in parameterizing your test

Debug Viewer pane, containing three tabs to assist you in debugging your test-Watch Expressions, Variables, and Command. (The Debug Viewer pane can be opened only when a test run pauses at a breakpoint.)

Status bar, displaying the status of the test



8) How QTP recognizes Objects in AUT?

A) QuickTest stores the definitions for application objects in a file called the Object Repository. As you record your test, QuickTest will add an entry for each item you interact with. Each Object Repository entry will be identified by a logical name (determined automatically by QuickTest), and will contain a set of properties (type, name, etc) that uniquely identify each object.

Each line in the QuickTest script will contain a reference to the object that you interacted with, a call to the appropriate method (set, click, check) and any parameters for that method (such as the value for a call to the set method). The references to objects in the script will all be identified by the logical name, rather than any physical, descriptive properties.



9) What are the types of Object Repositorys in QTP?

A) QuickTest has two types of object repositories for storing object information: shared object repositories and action object repositories. You can choose which type of object repository you want to use as the default type for new tests, and you can change the default as necessary for each new test.

The object repository per-action mode is the default setting. In this mode, QuickTest automatically creates an object repository file for each action in your test so that you can create and run tests without creating, choosing, or modifying object repository files. However, if you do modify values in an action object repository, your changes do not have any effect on other actions. Therefore, if the same test object exists in more than one action and you modify an object's property values in one action, you may need to make the same change in every action (and any test) containing the object.

10) Explain the check points in QTP?

A) . A checkpoint verifies that expected information is displayed in a Application while the test is running. You can add eight types of checkpoints to your test for standard web objects using QTP.

A page checkpoint checks the characteristics of a Application
A text checkpoint checks that a text string is displayed in the appropriate place on a Application.
An object checkpoint (Standard) checks the values of an object on a Application.
An image checkpoint checks the values of an image on a Application.
A table checkpoint checks information within a table on a Application
An Accessiblity checkpoint checks the web page for Section 508 compliance.
An XML checkpoint checks the contents of individual XML data files or XML documents that are part of your Web application.
A database checkpoint checks the contents of databases accessed by your web site


11) In how many ways we can add check points to an application using QTP.

A) We can add checkpoints while recording the application or we can add after recording is completed using Active screen (Note : To perform the second one The Active screen must be enabled while recording).

12) How does QTP identifes the object in the application

A) QTP identifies the object in the application by LogicalName and Class.

For example :

The Edit box is identified by

Logical Name : PSOPTIONS_BSE_TIME20

Class: WebEdit

13) If an application name is changes frequently i.e while recording it has name “Window1” and then while running its “Windows2” in this case how does QTP handles?

A) QTP handles those situations using “Regular Expressions”.

14) What is Parameterizing Tests?

A) When you test your application, you may want to check how it performs the same operations with multiple sets of data. For example, suppose you want to check how your application responds to ten separate sets of data. You could record ten separate tests, each with its own set of data. Alternatively, you can create a parameterized test that runs ten times: each time the test runs, it uses a different set of data.

15) What is test object model in QTP ?

A) The test object model is a large set of object types or classes that QuickTest

uses to represent the objects in your application. Each test object class has a

list of properties that can uniquely identify objects of that class and a set of

relevant methods that QuickTest can record for it.

A test object is an object that QuickTest creates in the test or component to

represent the actual object in your application. QuickTest stores information

about the object that will help it identify and check the object during the

run session.

A run-time object is the actual object in your Web site or application on

which methods are performed during the run session.

When you perform an operation on your application while recording,

QuickTest:

? identifies the QuickTest test object class that represents the object on which

you performed the operation and creates the appropriate test object

? reads the current value of the object’s properties in your application and

stores the list of properties and values with the test object

? chooses a unique name for the object, generally using the value of one of its

prominent properties

? records the operation that you performed on the object using the

appropriate QuickTest test object method

For example, suppose you click on a Find button with the following HTML

source code:



QuickTest identifies the object that you clicked as a WebButton test object.

It creates a WebButton object with the name Find, and records the following

properties and values for the Find WebButton:

It also records that you performed a Click method on the WebButton.

QuickTest displays your step in the Keyword View like this:

QuickTest displays your step in the Expert View like this:

Browser("Mercury Interactive").Page("Mercury Interactive").

WebButton("Find").Click



16) What is Object Spy in QTP?

A) Using the Object Spy, you can view the properties of any object in an open

application. You use the Object Spy pointer to point to an object. The Object

Spy displays the selected object’s hierarchy tree and its properties and values

in the Properties tab of the Object Spy dialog box.


17. Supported Check-Points in QTP?


17) What is the Diff between Image check-point and Bit map Check point?

A) Image checkpoints enable you to check the properties of a Web image.

You can check an area of a Web page or application as a bitmap. While

creating a test or component, you specify the area you want to check by

selecting an object. You can check an entire object or any area within an

object. QuickTest captures the specified object as a bitmap, and inserts a

checkpoint in the test or component. You can also choose to save only the

selected area of the object with your test or component in order to save disk Space

For example, suppose you have a Web site that can display a map of a city

the user specifies. The map has control keys for zooming. You can record the

new map that is displayed after one click on the control key that zooms in

the map. Using the bitmap checkpoint, you can check that the map zooms

in correctly.

You can create bitmap checkpoints for all supported testing environments

(as long as the appropriate add-ins are loaded).

Note: The results of bitmap checkpoints may be affected by factors such as

operating system, screen resolution, and color settings.



18) How many ways we can parameterize data in QTP ?

A) There are four types of parameters:

Test, action or component parameters enable you to use values passed

from your test or component, or values from other actions in your test.



Data Table parameters enable you to create a data-driven test (or action)

that runs several times using the data you supply. In each repetition, or

iteration, QuickTest uses a different value from the Data Table.



Environment variable parameters enable you to use variable values from

other sources during the run session. These may be values you supply, or

values that QuickTest generates for you based on conditions and options

you choose.



Random number parameters enable you to insert random numbers as

values in your test or component. For example, to check how your

application handles small and large ticket orders, you can have QuickTest

generate a random number and insert it in a number of tickets edit field.



20. How do u do batch testing in WR & is it possible to do in QTP, if so explain?



Ans: Batch Testing in WR is nothing but running the whole test set by selecting "Run Testset" from

the "Execution Grid".The same is possible with QTP also. If our test cases are automated then

by selecting "Run Testset" all the test scripts can be executed. In this process the Scripts

get executed one by one by keeping all the remaining scripts in "Waiting" mode.



21. if i give some thousand tests to execute in 2 days what do u do?



Ans : Adhoc testing is done. It Covers the least basic functionalities to verify that the system

is working fine.



22. what does it mean when a check point is in red color? what do u do?



Ans : A red color indicates failure. Here we analyze the the cause for failure whether it is a

Script Issue or Envronment Issue or a Application issue.



23. what do you call the window testdirector-testlab?



Ans : "Execution Grid". It is place from where we Run all Manual / Automated Scripts



24. how do u create new test sets in TD



Ans : Login to TD.

Click on "Test Lab" tab

Testing definitions





Testing Definitions:


test cases:


https://spreadsheets.google.com/pub?key=0AokO1n4ZsFBzcHFvRmF2bnp1LUF2NlJYeFdCcWFtWnc&hl=en&output=html

Testing Questions:


Test cases:

Test plan:

Web server:

Test case:

Testing question portnov

http://www.portnov.com/school
Preface

1. What are most common characteristics in software developing company for developing-engineering department of the average consumer software project ?
Consumer software projects are often characterized by a budget that is too small, a staff that is too small, a deadline that is too soon and which can’t be postponed, and by a shared vision and a shared commitment among the developers.
2. On whom depends quality of the computer software ?
The quality of a great product lies in the hands of the individuals designing, programming, testing, and documenting it, each of whom counts.
3. What does it mean: assure quality?
Assure quality is a commitment of the individuals to excellence.
4. Can the software companies change their plans, goals and products on the very short notice and on last steps of the development ? and Why ?
Product changes are made late in development. When you’re developing a product for public sale, your potential customers did not agree to any specification. If a competitor creates something more appealing, you have to respond quickly.
5. If the company decides to make drastic changes to a set plan, add or drop part of the application that one was working for last couple of months, what should experienced professional do?
An experienced professional must take the initiative and do the job anyway.
6. What some of the task management issues the tester has to deal with on the daily basis? And why is it important to an individual tester to have a clear picture of the software developing cycle?
Estimating, planning, and scheduling software testing is hard because there’s no true end point. There are always more tests and risks associated with skipping them. Individual testers need to be able to plan their time to take them into account. Testers also have to deal with design errors.
7. What is an ultimate goal of the professional tester ?
The ultimate goal of a professional tester is to find and flag problems in a product, in the service of improving its quality. Professional tester is one of few who will examine the full product in detail before it is shipped.
Chapter 1

1. How many errors can tester submit on one Problem Report? Why?
Tester must submit one Problem Report for each error.
2. Why if you expect the same result from two tests use only one of them?
If you expect the same result from two tests, they belong to the same class. All members of a class of test cases cause the program to behave in essentially the same way.
3. When you are choosing a representative test of a class for testing, which one should you choose? Why?
When you choose representatives of a class for testing, always pick the ones you think the program is most likely to fail. The best test cases are at the boundaries of a class. Anything that makes program change its behavior marks the boundary between two classes.
4. Why it is necessary analyze the program from different point of view than the programmer’s?
Analyzing the program from different point of view than the programmer’s will help you find classes, boundary conditions, critical tests, and thus missed errors.
5. What is the main reason why do we test the program?
The main reason the program is in testing is that it probably doesn’t work.
6. Should the tester run out of the formally planned tests? Why?
Tester will always run out of formally planned tests. Trust your instincts. Try any tests that feel promising, even if it’s similar to others that have already been run.
7. Should we document the "exploratory" tests or not? Why?
Because exploratory tests are whatever comes to mind, so it should be documented to remember what was done.
8. What tactic can the tester use to insure that bugs, which were founded, are fixed?
The most effective tactic for getting a bug fixed is to find test cases that make it appear so likely to occur under such innocent circumstances that absolutely no one would be willing to tolerate it.
9. If the programmer is reasonably careful, most of written test cases won't find errors, should you stop at that point and save company's money or should you continue creating new cases which may or may not find a bug?
If the programmer is reasonably careful, most of your tests won’t find errors, including many of the ones you took the most time thinking about. Don’t stop thinking. Some of your tests will find problems, and the more care you put into crafty thinking, the more you’ll find.
10. At your opinion who is the best tester: one who finds most of bugs in the shortest period of time or one who gets the most bugs fixed?
The best tester is the one who gets the most bugs fixed.

Chapter 2

1. Can we test the software completely?
No matter how careful and thorough a job you do, you will never find the last bug in a program, or if you do, you won’t know it.
2. What would be better to find more errors or find more serious errors?
You should want to find as many as possible: the more serious the problem, the better.
3. What would be some of the key issues why can't we test program correctly?
Key issues why we can’t test program completely:
1The domain of possible is too large to test.
2There are too many possible paths through the program to test
3The user interface issues are too complex to completely test.
4. Can we or can we not verify that program works correctly?
If you can’t fully test the program, you can’t verify that it works correctly.
5. Should the tester try to verify that the program runs correctly?
Testers shouldn’t try to verify that a program runs correctly: if you expect to find many bugs, you’ll find plenty. A few will be false alarms. If you expect the program to work correctly, you’ll miss many real problems.
6. If we can't find all bugs and can't prove that the program runs correctly than why should we test?
The purpose of testing a program is to find as many problems in it as possible: the more serious the problem, the better.
7. What does it mean ? "Successful testing"
A test that reveals a problem is a success. A test that did not reveal a problem was a waste of time.
8. What is the main purpose of finding bugs?
The purpose of finding bugs is to get them fixed.

Chapter 3

1 What are the software development stages?
 Planning
 Design
 Coding and documentation
 Testing and fixing
 Post-release maintenance and enhancement
2 On what stage should testing begin? Why?
Testing and fixing can be done at any stage in the life cycle. However, the later an error is found, the more it costs to fix.
3 What is Planning Stage?
Planning stage consists of:
1Objective statement
2Requirements analysis
3Functional definition
4 What testing, if any, should be done during product planning stage?
During the product planning stage the ideas tested, not code. It consist of:
1Requirements review:
o Are these the “right” requirements
o Are they complete?
o Are they compatible?
o Are they achievable?
o Are they reasonable?
o Are they testable?
2Comparative product evaluations
4Task analyses
5 What is Design Stage?
During the design stages the designer figure out how to provide the planned capabilities of the product. There are:
1External design – describes the product from the user’s point of view.
2Internal design – describes the internal workings of the product:
o Structural design – specifies how tasks will be specified among different pieces of code
o Data design – specifies what data the code will work with
o Logic design – specifies how the code will work
3Prototyping – creating a model of the system or of part of it.
6 What testing, if any, should be done during product design stage?
During the product design stage no code has been written yet, so we’re still testing ideas:
1Is the design good?
2Does the design meets requirements?
3Is the design complete?
4Is the design possible?
5How well does the design cover error handling?
7Pseudo code analyzers – looks for flaws in program’s design.
7 What is Coding Stage?
During the coding stage, the programmer writes the programs and tests them
8 What is Maintenance and Enhancement Stage?
Maintenance and enhancement stage consists of:
1Fixing errors
2Adapting the program so that it works with new hardware or with new co-residence software
3Fixing the documentation
4Performance improvements
5Making changes (enhancements) requested by users
9 Describe External Design and Internal Design?
External design – describes the product from the user’s point of view. Internal design – describes the internal workings of the product:
 Structural design – specifies how tasks will be specified among different pieces of code
 Data design – specifies what data the code will work with
 Logic design – specifies how the code will work
10 What is White Box Testing?
In White box testing, the programmer uses her understanding and access to the source code to develop test cases. This provides benefits:
1Focused testing: the programmer can test program in pieces.
2Testing coverage: the programmer can find out which parts of the program are exercised by any test.
3Control flow: the programmer knows what the program is supposed to do next.
4Data integrity: by tracking a data item through the system, the programmer can spot data manipulation by inappropriate modules.
5Internal boundaries: the programmer can see them in the code that are completely invisible to the outside tester.
6Algorithm-specific testing.
11 What is Functional Testing?
Functional testing is one type of black box testing. Functions are tested by feeding them input and examining the output. Internal program structure is rarely considered
12 What is Incremental Testing?
Under an incremental testing strategy, each piece is first tested separately. The testing of individual pieces of a process or program is called module testing, unit testing, or element testing.
13 What is Big Bang Testing?
Under a big bang testing strategy everything is tested with everything else and, usually, it all blows up together. Disadvantages: it’s too hard to figure out what caused a failure.
14 What is Integrating Testing?
Testing combinations of pieces of the product is called integration testing. Groups of modules are tested with other groups until, eventually, all of a process’ modules are tested together.
15 What is Top-Down Testing?
Top-down testing – is incremental testing. In top-down testing, the highest level modules are tested first.
16 What is Bottom-Up Testing?
Bottom-Up testing – is incremental testing. In bottom-up testing, the lowest level modules are tested first.
17 What is Regression Testing?
Regression testing is reusing old tests. There are two types of regression:
 Regression testing is done to make sure that a fix does what it’s supposed to do.
 Making sure that the change didn’t disturb anything else.
18 What is Black Box Testing?
When coding is finished, the program goes to the Testing Group for testing, in which the program is treated as a black box. You can’t see into it. The tester feeds it input data, observes output data, but doesn’t know, or pretends not to know, how the program works. Project managers often try to schedule two cycles of testing: one to find all the bugs, the second to verify the fixes.
19 What is Acceptance Test?
Each time you receive a new version of the program, check whether it’s stable enough to be tested. If it crashes at the slightest provocation, don’t waist your time on it. This first bit of testing is called acceptance or qualification testing.
20 What is Initial Stability Assessment?
Initial stability assessment is the initial evaluation of program reliability. You are not trying to find bugs at this point. You are trying to decide which areas of the program you trust least.
21 What is Function or Verification Test?
You verify a program by checking it against the most closely related design document or specification. If there is an external specification, the function test verifies the program against it.
22 What is Validation Test?
You validate a program by checking it against the published user or system requirements. System testing and integrity testing are validation tests.
23 What is Beta Testing and Beta customers?
In a beta test, people who represent your market use the product in the same way that they would if they bought the finished version and give you their comments. Beta customers are not working full time with your product. They will not test it as thoroughly or as quickly as you would like.
24 What is Integrity Testing?
Integrity testing is a more thorough release test. It provides a last chance to rethink things before the product goes out the door. The integrity tester tries to anticipate every major criticism that will appear in product reviews, or every major complaint the customer will raise for the next few months. The integrity tester should be a senior tester who wasn’t involved in the development or testing of this product.
25 What is Release Test?
In the release test, you gather all the things that will go to the customer or to a manufacturer, check that these are all the right things, copy them, and archive the copies. Then you release them.
26 What is Final Acceptance (Walk through) Testing?
If your company developed the program on contract, the customer will run an acceptance test when you deliver it. Certification is done by a third party. The certifier might be an agent of the user or an independent test agency.
27 What is Boundary Condition Testing?
Boundary Condition Testing – checking the program’s response to all extreme input values
28 What is Performance Testing?
Performance testing – is a black box testing. Identify tasks and measure how long it takes to do each.
29 What is Volume Testing?
Volume tests study the largest and the shortest tasks the program can deal with. You might feed huge programs (or empty files) to a compiler and huge (or empty) test files to a word processing program. Or you might feed an interactive program input quickly but steadily, to try to overflow the amount of data it can receive and hold in temporary storage.
30 What is Stress Testing?
Stress tests study the program’s response to peak bursts of activity. If the amount of activity has been specified, the stress test attempts to prove that the program fails at or below that level.
31 What is Storage Test?
Storage tests study how memory and space is used by the program, either in resident memory or on disk. If there are limits, storage tests attempt to prove that the program will exceed them.
32 What is Background Test?
Background test is used in a multi-processing system to evaluate how well the product does many tasks. The objective is to prove that the program fails when it tries to handle more that one task.
33 What is Error Recovery Test?
In Error Recovery testing make as many different types of errors as you can. Try to get the program to issue every error message listed in the documentation’s Error Messages appendix.
34 What is Security Test?
Security Test evaluates how easy would it be for an unauthorized user to gain access to this program. What could she do to your data if she did?
35 What is Compatibility Test?
Compatibility testing checks that one product works with another. Two products are compatible if they can share the same data files or if they can simultaneously reside in the same computer’s memory.
36 What is Conversion Test?
If two programs are not directly compatible, your program might still be able to read another’s data files by using a two step process. First, run a conversion program that rewrites the files in your program’s format. Then your program reads those new files.
37 What is Configuration Test?
The goal of the Configuration Test is finding a hardware combination that should be, but is not, compatible with the program.
38 What is Installation Test?
Installation test checks an installation utility which customizes the product to match your system configuration.

Chapter 5
7 Name 6 levels of priority?
(1) Fix immediately - this is holding up other work
(2) Fix as soon as possible
(3) Must fix before the next milestone (alpha, beta, etc)
(4) Must fix before final
(5) Fix if possible
(6) Optional - use your own judgment
8 Who can change severity or priority in previously reported bugs?
Only the project manager should change Priority and only the reporter (or lead tester) should ever change Severity.

Chapter 7
1. What are four characteristics of a good test design?
4 main characteristics of a good test design:
a.It has a reasonable probability of catching an error:
b.It is not redundant (if two tests look for the same error, why run both?)
c.It’s the best of its breed (Ex.: Boundary value inputs are better test inputs than non-boundary values because they are more likely to demonstrate an error.)
d.It is neither too simple nor too complex
2. What is Equivalent Classes of information?
If you expect the same result from two tests, you consider them equivalent.
3. How to find Equivalent Classes?
They all test the same thing.
If one catches a bug, the others probably will too.
If one test doesn’t catch a bug, the others probably won’t either.
They involve the same input variables.
They result in similar operations in the program.
They affect the same output variables.
None force the program to do error handling or all of them do.
4. Describe Boundaries of Equivalent Classes?
The boundary values are the biggest, smallest, shortest, loudest, fastest members of the class. Incorrect inequalities cause failures only at the boundaries. Programs that fail with non-boundary values usually fail at the boundaries too. You have to test each edge of an equivalence class, on all sides of each edge.
5. How do we test Race Conditions and other time dependencies?
Can the program be executed too quickly or too slowly? You can vary this directly by switching clock chips, by running the program on fast and slow models from the same line of computers or by flipping a speed switch on the machine.
Try to disrupt the program when it’s in a state of transition. Press keys or send it other I/O requests while it’s switching menus or servicing I/O.
Try to confuse the program when it’s about to change state because of a time-out. Press keys or get interrupts generated just as (just before, just after) the program times out.
Test system under heavy load. In a multi-processing system, run other programs while you test this one. In a single-user system, send files from a buffer to the printer. Use a machine with a slower clock and less memory, attach more I/O devices and have them generate interrupts as often as possible. Slow the computer down however you can.
6. How do we perform load testing?
Load testing is boundary condition testing. Run a test that the program should be able to pass (such as maximum number of terminals) and another test that the program should fail (one too many terminals). Test many limits in combination. Also, do enough general testing while you’ve got the program operating under this load to be sure it can continue to cope.
7. What is Error Guessing?
For reasons that you can’t logically describe, you may suspect that a certain class of tests will crash the program. Trust your intuition and include the test.
8. Describe Fix Verification test?
Fix Verification Test -- Regression Testing: checking whether a bug fix worked.
9. What is Regression Test Library? When and how should we use it?
The idea behind this Regression Test Library is that whenever a new version of the program is submitted for testing, you should run every test in the library. Some tactics:
Drop tests that are virtual repetitions of another.
Reduce the concentration of tests on a bug that has now been fixed.
Combine test cases.
Automate if you can.

Chapter 12
1 Is the Test plan product or tool?
Sometimes the test plan is a product; sometimes it’s a tool. The product is much more expensive than the tool. As a product: A good test plan helps organize and manage the testing effort. Their structure, format, and level of detail are determined not only by what’s best for the effectiveness of the testing effort but also by what a customer or regulating agency wants. As a tool: Customers of consumer software don’t care how it was tested. They just care that it works. For these customers, your test plan is not a product. In this case, a test plan is a valuable tool to the extent that it helps you manage your testing project and find bugs.
2 What are 3 main objectives of the detailed test planning?
Test documentation describes the technical tasks of testing.
Test documentation improves communication about testing tasks and process.
Test documentation provides structure for organizing, scheduling, and managing the testing project.
6 Name 12 most common types of black box tests? Describe them?
1)Acceptance test (into testing): Each time you receive a new version of the program, check whether it’s stable enough to be tested. If it crashes at the slightest provocation, don’t waist your time on it. This first bit of testing is called acceptance or qualification testing.
2)Control flow – how to get the program from one state to another. (You’re going to test the visible control flow, rather than the internal flow. Ask what are the different ways that you can get to a dialog box? What different ways menu paths can you take to get to the printer? What parameters can you give with commands to force the program into other states?)
3)Data flow and integrity: You can extend and deepen your analysis of the flow of data by subdividing the program into processing stages. Each stage gets input data from the stage before. Each stage passes its outputs on to the next. Checking intermediate values helps you pin down where the program fails, when it fails. Data integrity – knowledge about which parts of the program modify (or should modify) any item of data.
4)Configuration testing is concerned with checking the program’s compatibility with the many possible configurations of hardware and system software.
5)Compatibility testing checks that one product works with another.
6)Stress tests study the program’s response to peak bursts of activity.
7)User interface includes all aspects of the product that involve the user:
Functionality
Time to learn how to use the program
How well the user remembers how to use the program
Speed of performance
Rate of user errors
User’s satisfaction with the program
8)Regression testing is reusing old tests.
9)Performance testing – identifies tasks and measures how long it takes to do each.
10)Beta tests: at beta, the program is ready to send to beta testers, people who don’t work for your company, who will use the product and tell you about their experiences
11)Release tests: you gather all the things that will go to the customer or to a manufacturer, check that these are all the right things, copy them, and archive the copies. Then you release them
12)Utility test checks whether the program will satisfy the customer’s overall expectations.
7 What are the best targets (areas) where testers likely to find most of the bugs?
- Most likely errors: the more errors already found in the weakest area of the program, the more you can expect to find there in the future.
- Most visible errors in the most often used program areas, the most publicized areas, and the places that really make your program distinct from the others.
- Most often used program areas
- Distinguishing areas of the program
- Hardest areas to fix
- Most understood by you even if it’s not a critical area, you’ll gain good experience with the program and find bugs too. It will help you go much more effectively, and much more quickly, into the next area.
8 Why is it important to write easy to read and understand test cases and scripts?
After testing is finished and the program is released, work will start on the next version. These testers may be new to the product, and you might not be available to guide them. Try to prepare a set of notes to make their work easier.

test cases

test cases:test cases


Description
Login to application and navigate to Options Page
Navigate to edit "Pipeline Currency" page
Set the Currency type and rate table as Canadian Dollar (CAD) and Save the changes
Navigate to Opportunities and find the Opportunities
click on Display in Opportunity Pipeline link

Navigate to Options Page -> Edit Pipeline Currency page
Set the Currency type and rate table as Euro (EUR) and Save the changes
Navigate to Opportunities and find the Opportunities
click on Display in Opportunity Pipeline link

Login as (Schinnu \newuser) user and navigate Options Page
Navigate to Passwords change page
change the password to 'password123' and save the changes
logoff and try login using the old (Schinnu\newuser) login details
Login using new changed Login details (Schinnu\password123)
Verify that Options page is displayed
Verify that Pipeline Currency edit is displayed
Verify the changes are saved

Verify that that "values in 000's CAD" content displayed
Verify Opportunity Pipeline - View by Current Phase & Win Confidence (shown in 000's CAD)" displayed

Verify the changes are saved

Verify that that "values in 000's EUR" content displayed
Verify Opportunity Pipeline - View by Current Phase & Win Confidence (shown in 000's EUR)" displayed


Verify the password changes saved
Verify that user will not be logged in.
Verify that the user login is successful

testplan

What's a 'test plan”?

A software project test plan is a document that describes the
objectives, scope, approach, and focus of a software testing effort. The process
of preparing a test plan is a useful way to think through the efforts
needed to validate the acceptability of a software product. The
following are some of the items that might be included in a test plan,
depending on the particular project:
• Title
• Objective of testing effort
• Software product overview
• Relevant related document list, other test plans, etc.
• Relevant standards or legal requirements
• Overall software project organization and
personnel/contact-info/responsibilties
• Testing priorities and focus
• Scope and limitations of testing
• Test outline - a test approach by test type, feature, functionality,
module, etc. as applicable
• Test environment validity analysis - differences between the test and
production systems and their impact on test validity.
• Test tools to be used, including versions, patches, etc.
• Test script/test code maintenance processes and version control
• Problem tracking and resolution - tools and processes
• Reporting requirements and testing deliverables
• Software entrance and exit criteria
• Test site/location


If there are images in this attachment, they will not be displayed. Download the original attachment
Sheet1
A B C D
1 Attachment Step Name Description Expected Result
2 Step 1 Login to the web client as user who has access to client, and project.

http://host.domain.com/primavera/web
3 Step 2 Create a new client
4 Step 3 Create a new project using the client you've just created
5 Step 4 Edit General Information of the project you've just created.
6 Step 5 Change project type to PosPR, but do not select a parent project.
Enter Description
Save and Close In QA database, the project type PosPR is position based parent required. Since you have not yet select a project for as this project parent, a friendly message should appear.
7 Step 6 Click OK on the friendly message.
Select Wonder project as this project parent.
Save and Close
8 Step 7 Verify information on this project of your changes.
9 Step 8 Edit Positions
10 Step 9 Verify the following links are there:
Team Builder, New Team, New Team from Template, Gantt View, Calendar View , and Resource Balancing
11 Step 10 Click New Team from Template
12 Step 11 Find and Select an existing team. Make sure that a team that has some positions.
13 Step 12 Click on a position
14 Step 13 Set the required Classifications
15 Step 14 Click Financial of this position
16 Step 15 If the Override Project-level financial rule is not enabled, do the following steps, if not, find a position that has Override Project-level financial rule not enabled
17 Step 16 Verify links exist: Position Billing, Position Summary Report.
Verify Non-billable is set to No.
18 Step 17 Click on the Override Project-level financial rule to enabled it. You will get a confirmation message about your change cannot be revert.
19 Step 18 Click Cancel this friendly message. Verify the Override Project-level financial rule is returned back to the previous setting
20 Step 19 Click on the Override Project-level financial rule to enabled it again. You will get a confirmation message about your change cannot be revert.
21 Step 20 Click OK this friendly message. ..
22 Step 21 Verify the Override Project-level financial rule is now enabled
Verify the Non-Billable now has a checkbox and it is not checked.
23 Step 22 Click on the Non-billable checkbox
24 Step 23 Select a Billing Rate, Cost Rate Table, Organization, Financials Location, Accounting Treatment,
Set Markup %
25 Step 24 Verify Position Summary Report link is still available, and Position Billing is not.
26 Step 25 Save and Close on this position You will be returned to Positions page.
27 Step 26 Click Printer-friendly Verify Print This Page link is there in the printer-friendly page.
28 Step 27 Close Printer-friendly page.
29 Step 28 Click Save as Team Template link
30 Step 29 Click Save without providing a Name. You will get a friendly error message.
31 Step 30 Click OK on the friendly error message.
32 Step 31 Provide Name that is in the existing template list
Click Save A unique name message will be prompt to user.
33 Step 32 Click OK on that message.
34 Step 33 Provide Name that is not in the existing template list
Click Save You should be back to the positions page.
35 Step 34 Click Templates link.
36 Step 35 Find the template you have just saved.
Verify the information on this template.
37 Step 36 Go back to the project you have created earlier, either through shortcuts, or Project Finder.
38 Step 37 Edit Positions
39 Step 38 Click on a position
40 Step 39 Set the required Classifications
41 Step 40 Click Qualifications of this position
42 Step 41 Click Add Qualifications You might get a message that it needs to save before continuing on. If this is the case, select Yes.
43 Step 42 Add a Skill, Education, and Certification.
44 Step 43 Delete an Education you have added.
45 Step 44 Click Edit on the Add Qualification page.
46 Step 45 Change the Level of the skill
47 Step 46 Click on the Subsidized checkbox of the certification, and enter the Cost value.
Enter Cert #, and location. When you click on Subsidized checkbox, the Cost field will be visible to user with the currency type dropdown.
48 Step 47 Click Save and Close You will be back to the edit position page, with the qualifications you have just added.
49 Step 48 Click Save and Close on this position.
50 Step 49 Click New Team
51 Step 50 Click Save on new team without providing a name. You should get a friendly message on name is required
52 Step 51 Click OK on the friendly Error message.
53 Step 52 Click Save and Close without providing a team name. You should get the similiar message about providing the name.
54 Step 53 Click OK on the friendly message.
55 Step 54 Verify Start and End date are the same as the project start and end date.
56 Step 55 Enter Name for this new team.
Click Save and Close You will be back to the positions page, with the new team that doesn't have any position.
57 Step 56 Edit the team you have just created.
58 Step 57 Change Start and End date to start earlier than the project start date, and end later that project end date.
Enter Description.
Click Save and Close. You will receive a confirmation that project dates might be changed.
59 Step 58 Accept the confirmation message for both start and end date.

useful links

www.sqaforums.com/showflat.php?Cat=0&Number=402552&an=0&page=0
http://www.knowledgeinbox.com/documents/closingprocesses.html
http://www.techinterviews.in/all-interview-questions/3
http://geocities.com/xtremetesting/
http://www.softwareinquisition.com/2006/09/classes-objects-and-quicktest-pro-9
http://software-testing-askme.blogspot.com/2007/05/software-testing-resources-speedlinking.html
http://testingsoftware.blogspot.com/2005/07/all-posts.html
http://testingsoftware.blogspot.com/2005/07/all-posts.html
http://software-testing-zone.blogspot.com/2007/05/software-testing-for-freshers-tested.html
http://www.softwareqatest.com/
http://www.ittestpapers.com/interviewquestions/testing15.htm
http://my330space.wordpress.com/2006/05/18/interview-question-of-qtp/testingwebapplications
goodsite-for-qtpqtp-forumsabbreviationsseleniumprabhakar-interview-q'sphpmastering-webjunitJavaslideshowQuality_Assurance_Interview_Questionsfirefox-extensions
englishenglishletters1englishletter2
letters3

model script with webbrowser function

Dim tableData


'"Login as Moderator"
Call SCRIPT_BLOCK("""Login as Moderator"" action start")
Call Login("colmdr1", "newuser")
Call Verify_Text_Exists("Welcome, Moderator1 Col \(colmdr1\)" ,0)
Call SCRIPT_BLOCK("""Login as Moderator"" action end")
'"Create Workspace"
Call SCRIPT_BLOCK("""Create Workspace"" action start")
Call Click_Link("Projects", 0)
Call Click_Image("Select a Pool to Search", 0)
If TextField_Exists("ixn_pickPool_searchString", 0) Then
Call Click_Link("Tree View", 0)
End If
Call Click_Link("Enterprise", 0)
Call Set_TextField("ixn_projects_currentName", 0, "COL project")
Call Set_ComboBoxItem_ByName("ixn_projects_currentFilter", 0, "All Projects")
Call Click_Link("Find", 0)
Call Click_Link("Col Project3", 0)
Call Click_Link("Workspace", 0)
Call Set_TextField("ixn_kcCreateWorkspace_workspaceName", 0, "Col Workspace3")
Call Set_TextField("ixn_kcCreateWorkspace_workspaceDescription", 0, "Before editing Description")
Call Click_Link("Save and Close", 0)
Call Verify_Text_Exists("Col Workspace3" ,0)
Call Verify_Text_Exists("Workspace Details" ,0)
Call Verify_WebTable_Cell("Name", 1, 2, 3, "Col Workspace3")
Call Verify_WebTable_Cell("Name", 1, 4, 3, "Col Project3")
Call SCRIPT_BLOCK("""Create Workspace"" action end")

'"Edit Workspace"
Call SCRIPT_BLOCK("""Edit Workspace"" action start")
Call Click_Link("Edit", 0)
Call Set_TextField("ixn_kcEditWorkspace_workspaceDescription", 0, "After editing Description")
Call Click_Link("Save and Close", 0)
Call Verify_Text_Exists("After editing Description" ,0)
Call SCRIPT_BLOCK("""Edit Workspace"" action end")

'"Create Folder"
Call SCRIPT_BLOCK("Create Folder action start")

Call Click_Link("New Folder", 0)
Call Set_TextField("ixn_kcNewDocumentFolder_folderName", 0, "Folder3-1")
Call Set_TextField("ixn_kcNewDocumentFolder_folderDescription", 0, "Before editing Description."+vbCr+"KEY_WORD")
Call Click_Link("Save and Close", 0)
Call Verify_Text_Exists("Folder Details" ,0)
Call Verify_Text_Exists("Folder3-1" ,0)
Call SCRIPT_BLOCK("""Create Folder"" action end")

'"Edit Folder"
Call SCRIPT_BLOCK("""Edit Folder"" action start")
Call Click_Link("Edit", 0)
Call Set_TextField("ixn_kcEditDocumentFolder_folderDescription", 0, "After editing Description."+vbCr+"KEY_WORD")
Call Click_Link("Save and Close", 0)
Call Verify_Text_Exists("Folder Details" ,0)
Call Verify_Text_Exists("After editing Description.KEY_WORD" ,0)
Call SCRIPT_BLOCK("""Edit Folder"" action end")

'"Create Document"
Call SCRIPT_BLOCK("""Create Document"" action start")
Call Click_Link("Add Document", 0)
'Call Set_FileField("ixn_kcNewDocument_documentPath", 0, DataTable("Upload_Document",dtGlobalSheet))
'Call Set_FileField("ixn_kcNewDocument_documentPath", 0, "\\ashaik2k\CollabDocs\Document3-1-1.txt")
Call Set_FileField("ixn_kcNewDocument_documentPath", 0, GENERIC_FILE_FOLDER_PATH + "\Document3-1-1.txt")
Call Set_TextField("ixn_kcNewDocument_documentDescription", 0, "before editing Description"+vbCr+"KEY_WORD")
Call Click_Link("Save and Close", 0)
Call Verify_Text_Exists("Document3-1-1" ,0)
Call Verify_Text_Exists("Document Details" ,0)
Call SCRIPT_BLOCK("""Create Document"" action end")
'"Edit Document"
Call SCRIPT_BLOCK("""Edit Document"" action start")
Call Click_Link("Edit", 0)
Call Set_TextField("ixn_kcEditDocument_documentDescription", 0, "After editing Description."+vbCr+"KEY_WORD")
Call Click_Link("Save and Close", 0)
Call Verify_Text_Exists("After editing Description.KEY_WORD" ,0)
Call SCRIPT_BLOCK("""Edit Document"" action end")
'"Check Out"
Call SCRIPT_BLOCK("""Check Out"" action start")

' Where is WScript object? on my machine the object is not found.
'Set WshShell = Wscript.CreateObject("WScript.Shell")
'WshShell.SendKeys "^"
'If the setting is 1: Events, IE blocks the popup dialog.
Setting.WebPackage("ReplayType") = 2
Call Click_Link("Check Out", 0)
Setting.WebPackage("ReplayType") = 1

'If the setting is 1: Events, IE blocks the popup dialog.
Setting.WebPackage("ReplayType") = 2
Browser("hwnd:=" & hWindow).Dialog("title:=File Download").WinButton("text:=Cancel", "index:=0").Click
Setting.WebPackage("ReplayType") = 1

Call wait(2)

Call Verify_Text_Exists("Check In" ,0)
Call Verify_Text_Exists("Revert Check Out" ,0)
Call Verify_WebTable_Cell("Name", 1, 18, 5, "Checked Out By")
Call Verify_WebTable_Cell("Name", 1, 20, 5, "Checked Out Date")
Call SCRIPT_BLOCK("""Check Out"" action end")
'"Checked Out Document"
Call SCRIPT_BLOCK("""Checked Out Document"" action start")
Call Click_Link("Collaboration", 0)
Call Click_Link("Checked Out Documents", 0)
Call Verify_Text_Exists("Checked Out Documents" ,0)
Call Verify_Text_Exists("Document3-1-1" ,0)
Call Click_Link("Document3-1-1", 0)
Call Verify_Text_Exists("Document Details" ,0)
Call SCRIPT_BLOCK("""Checked Out Document"" action end")
'"Check In"
Call SCRIPT_BLOCK("""Check In"" action start")
Call Click_Link("Check In", 0)
Call Set_FileField("ixn_kcCheckinDocument_documentPath", 0, GENERIC_FILE_FOLDER_PATH + "\Document3-1-1.txt")
Call Set_TextField("ixn_kcCheckinDocument_documentCheckinComment", 0, "Second Version")
Call Click_Link("Save and Close", 0)
Call Verify_WebTable_Cell("Name", 1, 6, 3, "2")
Call Verify_Text_Exists("Check Out" ,0)
Call SCRIPT_BLOCK("""Check In"" action end")
'"Revert Check Out"
Call SCRIPT_BLOCK("""Revert Check Out"" action start")
'If the setting is 1: Events, IE blocks the popup dialog.
Setting.WebPackage("ReplayType") = 2
Call Click_Link("Check Out", 0)
Setting.WebPackage("ReplayType") = 1

'If the setting is 1: Events, IE blocks the popup dialog.
Setting.WebPackage("ReplayType") = 2
Browser("hwnd:=" & hWindow).Dialog("title:=File Download").WinButton("text:=Cancel", "index:=0").Click
Setting.WebPackage("ReplayType") = 1

Call wait(2)

Call Verify_Text_Exists("Revert Check Out" ,0)
Call Click_Link("Revert Check Out", 0)
Call Verify_Text_Exists("Check Out" ,0)
Call Verify_WebTable_Cell("Name", 1, 6, 3, "2")
Call SCRIPT_BLOCK("""Revert Check Out"" action end")
'"Version History"
Call SCRIPT_BLOCK("""Version History"" action start")
Call Click_Link("Version History", 0)
Call Verify_WebTable_Cell("Version", 0, 2, 2, "2 ")
Call Verify_WebTable_Cell("Version", 0, 2, 4, "Document3-1-1 ")
Call Verify_WebTable_Cell("Version", 0, 2, 9, "Second Version ")
Call Verify_WebTable_Cell("Version", 0, 3, 2, "1 ")
Call Verify_WebTable_Cell("Version", 0, 3, 4, "Document3-1-1 ")
Call Verify_Text_Exists("2 Versions" ,0)
Call Set_CheckBoxOnOff_ByIndex("UI:SELECT:SELECTION:0", 0, WEB_OBJECT_ON)
Call Click_Link("Delete Selected Versions", 0)
Call Click_WinButton("OK", 0)
Call Verify_WebTable_Cell("Version ", 0, 2, 2, "1 ")
Call Verify_WebTable_Cell(" Version", 0, 2, 4, "Document3-1-1 ")
Call Verify_Text_Exists("1 Versions" ,0)
Call SCRIPT_BLOCK("""Version History"" action end")
'"Start Review Any"
Call SCRIPT_BLOCK("""Start Review Any"" action start")
Call Click_Link("Document3-1-1", 0)
Call Click_Link("Start Review", 0)
Call Click_Image("Select Participants for Review", 0)
Call Set_ComboBoxItem_ByName("ixn_pickMultiWorkspaceMember_filterEntry", 0, "Active Users")
Call Click_Image("Select a Pool to Search", 0)
If TextField_Exists("ixn_pickPool_searchString", 0) Then
Call Click_Link("Tree View", 0)
End If
Call Click_Link("Enterprise", 0)
Call Set_TextField("obj_WorkspaceMembersFinderDelegate_searchString", 0, "COL")
Call Click_Link("Find", 0)
Call Click_Link("Col, Moderator1", 0)
'Call WorkaroundFor36189()
Call Click_Link("OK", 0)
Call Click_Link("Save and Close", 0)
Call Verify_Text_Exists("Review Details" ,0)
Call Verify_WebTable_Cell("Name", 1, 13, 3, "In Review")
Call SCRIPT_BLOCK("""Start Review Any"" action end")
'"Pending Reviews"
Call SCRIPT_BLOCK("""Pending Reviews"" action start")
Call Click_Link("Collaboration", 0)
Call Click_Link("Reviews", 0)
Call Click_Link("Pending Reviews", 0)
Call Verify_WebTable_Cell("Name", 0, 4, 1, "Document3-1-1 ")
Call Verify_WebTable_Cell("Name", 0, 4, 2, "In Review ")
Call Verify_WebTable_Cell("Name", 0, 4, 4, "Col, Moderator1 ")
Call SCRIPT_BLOCK("""Pending Reviews"" action end")
'"Created Reviews"
Call SCRIPT_BLOCK("""Created Reviews"" action start")
Call Click_Link("Created Reviews", 0)
Call Verify_WebTable_Cell("Name", 0, 2, 1, "Document3-1-1 ")
Call Verify_WebTable_Cell("Name", 0, 2, 2, "In Review ")
Call SCRIPT_BLOCK("""Created Reviews"" action end")
'"Go to Col Workspace3"
'Start --------------------------------------------------------------------------------
Call Open_Workspace("Col Workspace3")

'"Approve"
Call SCRIPT_BLOCK("""Approve"" action start")
Call Click_Link("Document3-1-1", 0)
Call Click_Link("Review Status", 0)
Call Click_Link("Respond", 0)
Call Click_Link("Approve", 0)
Call Verify_WebTable_Cell("Name", 1, 8, 3, "Approved")
Call SCRIPT_BLOCK("""Approve"" action end")
'"Add to Membership"
Call SCRIPT_BLOCK("""Add to Membership"" action start")
Call Click_Link("Col Workspace3", 0)
Call Click_Link("Membership", 0)
Call Set_ComboBoxItem_ByName("obj_WorkspaceMembersDisplayList_currentContext", 0, "Contributors")
Call Click_Link("Add Contributors", 0)
Call Set_ComboBoxItem_ByName("ixn_pickMultiWorkspaceMember_filterEntry", 0, "Active Users")
Call Click_Image("Select a Pool to Search", 0)
If TextField_Exists("ixn_pickPool_searchString", 0) Then
Call Click_Link("Tree View", 0)
End If
Call Click_Link("Enterprise", 0)
Call Set_TextField("obj_WorkspaceMembersFinderDelegate_searchString", 0, "COL")
Call Click_Link("Find", 0)
Call Click_Link("Col, Contributor1", 0)
'Call WorkaroundFor36189()
Call Click_Link("OK", 0)
Call Verify_Text_Exists("1 Contributors" ,0)
Call Verify_WebTable_Cell(" Name", 0, 2, 2, "Col, Contributor1 ")
Call Set_ComboBoxItem_ByName("obj_WorkspaceMembersDisplayList_currentContext", 0, "Viewers")
Call Click_Link("Add Viewers", 0)
Call Set_ComboBoxItem_ByName("ixn_pickMultiWorkspaceMember_filterEntry", 0, "Active Users")
Call Click_Image("Select a Pool to Search", 0)
If TextField_Exists("ixn_pickPool_searchString", 0) Then
Call Click_Link("Tree View", 0)
End If
Call Click_Link("Enterprise", 0)
Call Set_TextField("obj_WorkspaceMembersFinderDelegate_searchString", 0, "COL")
Call Click_Link("Find", 0)
Call Click_Link("Col, Viewer1", 0)
'Call WorkaroundFor36189()
Call Click_Link("OK", 0)
Call Verify_Text_Exists("1 Viewers" ,0)
Call Verify_WebTable_Cell("Name ", 0, 2, 2, "Col, Viewer1 ")
Call Set_ComboBoxItem_ByName("obj_WorkspaceMembersDisplayList_currentContext", 0, "All Members")
Call Click_Link("Add Members", 0)
Call Set_ComboBoxItem_ByName("ixn_pickMultiWorkspaceMember_filterEntry", 0, "Active Users")
Call Click_Image("Select a Pool to Search", 0)
If TextField_Exists("ixn_pickPool_searchString", 0) Then
Call Click_Link("Tree View", 0)
End If
Call Click_Link("Enterprise", 0)
Call Set_TextField("obj_WorkspaceMembersFinderDelegate_searchString", 0, "COL")
Call Click_Link("Find", 0)
Call Click_Link("Col, Member1", 0)
'Call WorkaroundFor36189()
Call Click_Link("OK", 0)
Call Click_Link("Name", 0)
Call Verify_WebTable_Cell("Name", 0, 2, 2, "Col, Contributor1 ")
Call Verify_WebTable_Cell("Name", 0, 3, 2, "Col, Member1 ")
Call Verify_WebTable_Cell("Name", 0, 4, 2, "Col, Moderator1 ")
Call Verify_WebTable_Cell("Name", 0, 5, 2, "Col, Viewer1 ")
Call Verify_Text_Exists("4 Members" ,0)
Call SCRIPT_BLOCK("""Add to Membership"" action end")
'"Login as Contributor"
Call SCRIPT_BLOCK("""Checking Membership"" action start")
Call Click_Link("Logout", 0)
Call Click_Link("Login", 0)
Call Set_TextField("username", 0, "colcnt1")
Call SetSecure_TextField("password", 0, "4105a11be6dcf35652fc17")
Call Click_Button("OK", 0)
Call SCRIPT_BLOCK("""Checking Membership"" action end")
'"Go to Col Workspace3"
Call Open_Workspace("Col Workspace3")
Call Verify_Link_NotFound("Edit" ,0)
Call Verify_Link_NotFound("New Discussion" ,0)
Call Verify_Link_NotFound("Delete Workspace" ,0)
'Go to Document3-1-1
Call Click_Link("Document3-1-1", 0)
' Check out
'If the setting is 1: Events, IE blocks the popup dialog.
Setting.WebPackage("ReplayType") = 2
Call Click_Link("Check Out", 0)
Setting.WebPackage("ReplayType") = 1

'If the setting is 1: Events, IE blocks the popup dialog.
Setting.WebPackage("ReplayType") = 2
Browser("hwnd:=" & hWindow).Dialog("title:=File Download").WinButton("text:=Cancel", "index:=0").Click
Setting.WebPackage("ReplayType") = 1

Call wait(2)

' Check in
Call Click_Link("Check In", 0)
'Call Set_FileField("ixn_kcCheckinDocument_documentPath_0", 0, DataTable("Upload_Document", dtGlobalSheet))
'Call Set_FileField("ixn_kcNewDocument_documentPath", 0, "\\ashaik2k\CollabDocs\Document3-1-1.txt")
Call Set_FileField("ixn_kcCheckinDocument_documentPath", 0, GENERIC_FILE_FOLDER_PATH + "\Document3-1-1.txt")

Call Set_TextField("ixn_kcCheckinDocument_documentCheckinComment.*", 0, "checked in by Contributor")
Call Click_Link("Save and Close", 0)
' Go to Version History
Call Click_Link("Version History", 0)


'Verify
tableData = Array( _
Array(null), _
Array("3", null, "Document3-1-1", null, "Not Reviewed", null, "Col, Contributor1", "checked in by Contributor"), _
Array("1", null, "Document3-1-1", null, "Approved", null, "Col, Moderator1", "") _
)
Call Verify_WebTable_Cells("Version", 0, tableData)
'Call REPORT_FAILURE2("KNOWN ISSUE:40712", "KNOWN ISSUE:40712 blank comments shows   in version history")
'The bug above has been fixed in 8.6.0sp1


Call Verify_Text_Exists("2 Versions" ,0)
'"Login as Viewer"
Call SCRIPT_BLOCK("""Login as Viewer"" action start")
Call Click_Link("Logout", 0)
Call Click_Link("Login", 0)
Call Set_TextField("username", 0, "colvwr1")
Call SetSecure_TextField("password", 0, "4105a1521508450abdc7d1")
Call Click_Button("OK", 0)
Call SCRIPT_BLOCK("""Login as Viewer"" action end")
'"Go to Col Workspace3"
Call Open_Workspace("Col Workspace3")
Call Verify_Link_NotFound("New Folder" ,0)
Call Verify_Link_Exists("Add To Favorites" ,0)
'"Login as Member"
Call SCRIPT_BLOCK("""Login as Member"" action start")
Call Click_Link("Logout", 0)
Call Click_Link("Login", 0)
Call Set_TextField("username", 0, "colmmb1")
Call SetSecure_TextField("password", 0, "4105a1721266836d35951d")
Call Click_Button("OK", 0)
Call SCRIPT_BLOCK("""Login as Member"" action end")
'"Go to Col Workspace3"
Call Open_Workspace("Col Workspace3")

Call Verify_Link_NotFound("Edit" ,0)
Call Verify_Link_NotFound("New Folder" ,0)
Call Verify_Link_Exists("Add To Favorites" ,0)
Call Click_Link("Logout", 0)
Call Click_Link("Login", 0)
'"Access Policy"
Call SCRIPT_BLOCK("""Access Policy"" action start")
'"Login as Moderator"
Call SCRIPT_BLOCK("""Login as Moderator"" action start")
Call Set_TextField("username", 0, "colmdr1")
Call SetSecure_TextField("password", 0, "41006e3a0cd5ba3caef094")
Call Click_Button("OK", 0)
Call SCRIPT_BLOCK("""Login as Moderator"" action end")
'"Go to Col Workspace3"
Call Open_Workspace("Col Workspace3")

Call Click_Link("Maximize", 0)
Call Click_Link("Access Policy", 0)
Call Set_ComboBoxItem_ByName("ixn_kcFolderAccessPolicy_accessPolicy", 0, "Custom")
Call Set_ComboBoxItem_ByName("obj_SecurityPolicyTrusteeWrapper_accessLevel", 0, "Read-Only Access")
Call Click_Link("Save and Close", 0)
Call Verify_WebTable_Cell("Name", 1, 12, 3, "Custom")

'"Login as Member"
Call SCRIPT_BLOCK("""Login as Member"" action start")
Call Click_Link("Logout", 0)
Call Click_Link("Login", 0)
Call Set_TextField("username", 0, "colmmb1")
Call SetSecure_TextField("password", 0, "4105a1721266836d35951d")
Call Click_Button("OK", 0)
Call SCRIPT_BLOCK("""Login as Member"" action end")
'"Go to Col Workspace3"
Call Open_Workspace("Col Workspace3")

Call Verify_Text_Exists("Folder: Folder3-1" ,0)
Call Click_Link("Logout", 0)
Call Click_Link("Login", 0)
'"Login as Moderator"
Call SCRIPT_BLOCK("""Login as Moderator"" action start")
Call Set_TextField("username", 0, "colmdr1")
Call SetSecure_TextField("password", 0, "41006e3a0cd5ba3caef094")
Call Click_Button("OK", 0)
Call Verify_Text_Exists("Welcome, Moderator1 Col \(colmdr1\)" ,0)
Call SCRIPT_BLOCK("""Login as Moderator"" action end")
'"Remove from Membership"
Call SCRIPT_BLOCK("""Remove from Membership"" action start")
'"Go to Col Workspace3"
Call Open_Workspace("Col Workspace3")

Call Click_Link("Membership", 0)
Call Set_ComboBoxItem_ByName("obj_WorkspaceMembersDisplayList_currentContext", 0, "Contributors")
Call Set_CheckBoxOnOff_ByIndex("UI:SELECT:SELECTION:0", 0, WEB_OBJECT_ON)
Call Click_Link("Remove Selected", 0)
Call Verify_Text_Exists("0 Contributors" ,0)
Call Set_ComboBoxItem_ByName("obj_WorkspaceMembersDisplayList_currentContext", 0, "Viewers")
Call Set_CheckBoxOnOff_ByIndex("UI:SELECT:SELECTION:0", 0, WEB_OBJECT_ON)
Call Click_Link("Remove Selected", 0)
Call Verify_Text_Exists("0 Viewers" ,0)
Call Set_ComboBoxItem_ByName("obj_WorkspaceMembersDisplayList_currentContext", 0, "All Members")
Call Click_Link("Name", 0)
Call Set_CheckBoxOnOff_ByIndex("UI:SELECT:SELECTION:0", 0, WEB_OBJECT_ON)
Call Set_CheckBoxOnOff_ByIndex("UI:SELECT:SELECTION:1", 0, WEB_OBJECT_ON)
Call Set_CheckBoxOnOff_ByIndex("UI:SELECT:SELECTION:3", 0, WEB_OBJECT_ON)
Call Click_Link("Remove Selected Members", 0)
Call Verify_Text_Exists("1 Members" ,0)
'"URL addressable"
Call SCRIPT_BLOCK("""URL addressable"" action start")
Call Click_Link("Col Workspace3", 0)
Dim url_
Call Click_Link("Logout", 0)
Call Click_Link("Login", 0)
Call Set_TextField("username", 0, "colmdr1")
Call SetSecure_TextField("password", 0, "410edf106009e3ab0e6fff")
Call Click_Button("OK", 0)
Call SCRIPT_BLOCK("""URL addressable"" action end")
'"Existing Workspace"
Call SCRIPT_BLOCK("""Existing Workspace"" action start")
'"Go to Col Workspace1"
Call Open_Workspace("Col Workspace1")
'==========================================================
'Add this section for code coverage
Call Click_Link("Delete Workspace", 0)
Call Verify_Win_StaticText_Exists("Deleting this workspace will delete all of the objects it contains\. Do you want to continue\?", 0)
Call Click_WinButton("OK", 0)
'Deleting a workspace with checkout item or in review is not allow.
Call IFrame_Verify_WebTable_Exists("This workspace cannot be deleted\. Possibly it contains checked out, in review, or locked content\.")
Call Click_IFrameButton("OK", 0)

'==========================================================
'"View Document"
Call SCRIPT_BLOCK("""View Document"" action start")
Call Click_Link("Document1-1-1", 0)

Setting.WebPackage("ReplayType") = 2
Call Click_Link("View Document", 0)
Setting.WebPackage("ReplayType") = 1

'If the setting is 1: Events, IE blocks the popup dialog.
Setting.WebPackage("ReplayType") = 2
Browser("hwnd:=" & hWindow).Dialog("title:=File Download").WinButton("text:=Cancel", "index:=0").Click
Setting.WebPackage("ReplayType") = 1

Call wait(2)

Call SCRIPT_BLOCK("""View Document"" action end")
'"New Message"
Call SCRIPT_BLOCK("""New Message"" action start")
Call Click_Link("Col Workspace1", 0)
Call Click_Link("Discussion1-1", 0)
'Call Verify_Link_URL("New Message", 0, DataTable.Value("New_Message_Link",dtGlobalSheet))
Call Verify_Link_URL("New Message", 0, "mailto:Discussion1-1.QaCollab@" & CORE_SERVER_NAME & "." & EMAIL_DOMAIN)
Call SCRIPT_BLOCK("""New Message"" action end")
'"Move"
Call SCRIPT_BLOCK("""Move"" action start")
Call Click_Link("Col Workspace1", 0)
Call Verify_Text_Exists("Workspace Details" ,0)
Call Verify_WebTable_Cell("Name", 1, 2, 3, "Col Workspace1")
Call Click_Link("Maximize", 0)
Call Set_CheckBoxOnOff_ByIndex("UI:SELECT:SELECTION:-1", 0, WEB_OBJECT_ON)
Call Click_Link("Move", 0)
Call Click_Link("Folder1-2", 0)
Call Verify_Text_Exists("Primavera could not move the items." ,0)

Call Click_Link("Item", 0)
'Call WorkaroundFor35453()

tableData = Array( _
Array(null), _
Array("Document1-1-3 ", "You cannot move items that are in review. "), _
Array("Document1-1-4 ", "You cannot move items that are checked out. "), _
Array("Sub Folder1-1-2 ", "You cannot move folders that contain items that are checked out or in review. "), _
Array("Sub Folder1-1-3 ", "You cannot move folders that contain items that are checked out or in review. ") _
)
If Verify_WebTable_Cells("Item", 0, tableData) = FAIL Then
'Call REPORT_FAILURE2("KNOWN ISSUE:40468: Order of items in not moved documents page.", "KNOWN ISSUE:40468: Order of items in not moved documents page.")
Call REPORT_FAILURE_DUE_TO_KNOWN_ISSUE("40468", "Order of items in not moved documents page.", true)
End If


Call Verify_WebTable_RowCount("Item", 0, 5)
Call Click_Link("OK", 0)
Call Click_Link("Col Workspace1", 0)
'Verification for Folder1-1
Call Verify_WebTable_Cell("Name ", 0, 2, 2, "Sub Folder1-1-2 ")
Call Verify_WebTable_Cell("Name ", 0, 3, 2, "Sub Folder1-1-3 ")
Call Verify_WebTable_Cell("Name ", 0, 4, 2, "Document1-1-3 ")
Call Verify_WebTable_Cell("Name ", 0, 5, 2, "Document1-1-4 ")
'Verification for Folder1-2
Call Verify_WebTable_Cell("Name ", 1, 2, 2, "Sub Folder1-1-1 ")
Call Verify_WebTable_Cell("Name ", 1, 3, 2, "Document1-1-1 ")
Call Verify_WebTable_Cell("Name ", 1, 4, 2, "Document1-1-2 ")
Call Click_Link("Maximize", 1)
Call Set_CheckBoxOnOff_ByIndex("UI:SELECT:SELECTION:-1", 0, WEB_OBJECT_ON)
Call Click_Link("Move", 0)
Call Click_Link("Folder1-1", 0)
Call Click_Link("Col Workspace1", 0)
'Verification for Folder1-1
Call Verify_WebTable_Cell("Name ", 0, 2, 2, "Sub Folder1-1-1 ")
Call Verify_WebTable_Cell("Name ", 0, 3, 2, "Sub Folder1-1-2 ")
Call Verify_WebTable_Cell("Name ", 0, 4, 2, "Sub Folder1-1-3 ")
Call Verify_WebTable_Cell("Name ", 0, 5, 2, "Document1-1-1 ")
Call Verify_WebTable_Cell("Name ", 0, 6, 2, "Document1-1-2 ")
Call Verify_WebTable_Cell("Name ", 0, 7, 2, "Document1-1-3 ")
Call Verify_WebTable_Cell("Name ", 0, 8, 2, "Document1-1-4 ")
'Verification for Folder1-2
Call Verify_WebTable_Cell("This folder is empty", 1, 2, 2, "This folder is empty")
Call SCRIPT_BLOCK("""Move"" action end")
'"Favorite Workspace"
Call SCRIPT_BLOCK("""Favorite Workspace"" action start")
'"Go to Col Workspace1"
Call Open_Workspace("Col Workspace1")

'"Add to Favorite Workspace"
Call SCRIPT_BLOCK("""Add to Favorite Workspace"" action start")
Call Click_Link("Add To Favorites", 0)
Call Click_IFrameButton("OK", 0)
Call SCRIPT_BLOCK("""Add to Favorite Workspace"" action end")
'"Link to Favorite Workspace"
Call SCRIPT_BLOCK("""Link to Favorite Workspace"" action start")
Call Click_Link("Collaboration", 0)
Call Click_Link("Favorite Workspaces", 0)
Call Verify_WebTable_Cell(" Workspace Name ", 0, 2, 2, "Col Workspace1 ")
Call Click_Link("Col Workspace1", 0)
'Call WorkaroundFor36189()
Call Verify_Text_Exists("Workspace Details" ,0)
Call Verify_WebTable_Cell("Name", 1, 2, 3, "Col Workspace1")
Call SCRIPT_BLOCK("""Link to Favorite Workspace"" action end")
'"Remove from Favorite Workspace"
Call SCRIPT_BLOCK("""Remove from Favorite Workspace"" action start")
Call Click_Link("Collaboration", 0)
Call Click_Link("Favorite Workspaces", 0)
Call Set_CheckBoxOnOff_ByIndex("UI:SELECT:SELECTION:0", 0, WEB_OBJECT_ON)
Call Click_Link("Remove from Favorites", 0)
Call Verify_Text_Exists("This list is empty." ,0)
Call SCRIPT_BLOCK("""Remove from Favorite Workspace"" action end")
'"Favorite Document"
Call SCRIPT_BLOCK("""Favorite Document"" action start")
'"Go to Col Workspace1"
Call Open_Workspace("Col Workspace1")

'"Add to Favorite Document"
Call SCRIPT_BLOCK("""Add to Favorite Document"" action start")
Call Click_Link("Maximize", 0)
Call Set_CheckBoxOnOff_ByIndex("UI:SELECT:SELECTION:3", 0, WEB_OBJECT_ON)
Call Click_Link("Add To Favorites", 0)
Call Click_IFrameButton("OK", 0)
Call SCRIPT_BLOCK("""Add to Favorite Document"" action end")
'"Link to Favorite Document"
Call SCRIPT_BLOCK("""Link to Favorite Document"" action start")
Call Click_Link("Collaboration", 0)
Call Click_Link("Favorite Documents", 0)
Call Verify_WebTable_Cell(" Document Name ", 0, 2, 3, "Document1-1-1 ")
Call Click_Link("Document1-1-1", 0)
'Call WorkaroundFor36189()
Call Verify_Text_Exists("Document Details" ,0)
Call Verify_WebTable_Cell("Name", 1, 2, 3, "Document1-1-1")
Call SCRIPT_BLOCK("""Link to Favorite Document"" action end")
'"Remove From Favorite Document"
Call SCRIPT_BLOCK("""Remove From Favorite Document"" action start")
Call Click_Link("Collaboration", 0)
Call Click_Link("Favorite Documents", 0)
Call Set_CheckBoxOnOff_ByIndex("UI:SELECT:SELECTION:0", 0, WEB_OBJECT_ON)
Call Click_Link("Remove from Favorites", 0)
Call Verify_Text_Exists("This list is empty." ,0)
Call SCRIPT_BLOCK("""Remove From Favorite Document"" action end")


'"Search"
Call SCRIPT_BLOCK("""Search"" action start")
'"Add Favorite Workspace for search"
Call SCRIPT_BLOCK("""Add Favorite Workspace for search"" action start")
Call Click_Link("Collaboration", 0)
Call Click_Link("Workspaces", 0)
Call Set_TextField("ixn_kcWorkspaces_searchString", 0, "Col Workspace")
Call Click_Link("Find", 0)
Call Click_Link("Workspace Name", 0)
Call Set_CheckBoxOnOff_ByIndex("UI:SELECT:SELECTION:0", 0, WEB_OBJECT_ON)
Call Set_CheckBoxOnOff_ByIndex("UI:SELECT:SELECTION:1", 0, WEB_OBJECT_ON)
Call Click_Link("Add To Favorites", 0)
Call Click_IFrameButton("OK", 0)
Call SCRIPT_BLOCK("""Add Favorite Workspace for search"" action end")

'"Standard Search"
Call SCRIPT_BLOCK("""Standard Search"" action start")
'"Go to Col Workspace1"
Call Open_Workspace("Col Workspace1")

Call Click_Link("Collaboration", 0)
Call Click_Link("Search", 0)
If TextField_Exists("ixn_kcContentSearch_searchStr", 0) Then
Call Click_Link("Standard", 0)
End If
Call SCRIPT_BLOCK("Start Standard searching with All Content, Current Workspace")
Call Set_ComboBoxItem_ByName("ixn_kcContentSearch_contentFilter", 0, "All Content")
Call Set_TextField("ixn_kcContentSearch_searchStr", 0, "KEY_WORD")
Call Set_ComboBoxItem_ByName("ixn_kcContentSearch_workspaceFilter", 0, "Current Workspace")
Call Set_ComboBoxItem_ByName("ixn_kcContentSearch_maxSize", 0, "200")

Call Click_Link("Find", 0)
Call Click_Link("Name", 0)

tableData = Array( _
Array(null, "Name", "Version", "Status", "Review Status", "Modified Date", "Modified By"), _
Array(null, "Discussion1-3", "", "", "", null, null), _
Array(null, "Document1-1-2", "1", "", "Not Reviewed", null, "Col, Moderator1"), _
Array(null, "Folder1-2", "", "", "", null, null), _
Array(null, "Message1-1-2", "", "", "", null, null) _
)
Call Verify_WebTable_Cells("Name", 0, tableData)
Call Verify_WebTable_RowCount("Name", 0, 5)


Call SCRIPT_BLOCK("Start Standard searching with All Content, Favorite Workspaces")
Call Set_ComboBoxItem_ByName("ixn_kcContentSearch_workspaceFilter", 0, "Favorite Workspaces")
Call Click_Link("Find", 0)
If Link_Exists("Show All", 0) Then
Call Click_Link("Show All", 0)
End If
Call Click_Link("Name", 0)

tableData = Array( _
Array(null, "Name", "Version", "Status", "Review Status", "Modified Date", "Modified By"), _
Array(null, "Discussion1-3", "", "", "", null, null), _
Array(null, "Discussion2-2", "", "", "", null, null), _
Array(null, "Document1-1-2", "1", "", "Not Reviewed", null, null), _
Array(null, "Document2-1-2", "1", "", "Not Reviewed", null, null), _
Array(null, "Folder1-2", "", "", "", null, "Administrator"), _
Array(null, "Folder2-2", "", "", "", null, "Administrator"), _
Array(null, "Message1-1-2", "", "", "", null, null), _
Array(null, "Message2-1-2", "", "", "", null, null) _
)
Call Verify_WebTable_Cells("Name", 0, tableData)
Call Verify_WebTable_RowCount("Name", 0, 9)


Call SCRIPT_BLOCK("Start Standard searching with All Content, All Workspaces")
Call Set_ComboBoxItem_ByName("ixn_kcContentSearch_workspaceFilter", 0, "All Workspaces")
Call Click_Link("Find", 0)
If Link_Exists("Show All", 0) Then
Call Click_Link("Show All", 0)
End If
Call Click_Link("Name", 0)

tableData = Array( _
Array(null, "Name", "Version", "Status", "Review Status", "Modified Date", "Modified By"), _
Array(null, "Discussion1-3", "", "", "", null, null), _
Array(null, "Discussion2-2", "", "", "", null, null), _
Array(null, "Document1-1-2", "1", "", "Not Reviewed", null, null), _
Array(null, "Document2-1-2", "1", "", "Not Reviewed", null, null), _
Array(null, "Document3-1-1", "3", "", "Not Reviewed", null, null), _
Array(null, "Folder1-2", "", "", "", null, null), _
Array(null, "Folder2-2", "", "", "", null, null), _
Array(null, "Folder3-1", "", "", "", null, "Col, Moderator1"), _
Array(null, "Message1-1-2", "", "", "", null, null), _
Array(null, "Message2-1-2", "", "", "", null, null) _
)
Call Verify_WebTable_Cells("Name", 0, tableData)
Call Verify_WebTable_RowCount("Name", 0, 11)


Call SCRIPT_BLOCK("Start Standard searching with Documents, All Workspaces")
Call Set_ComboBoxItem_ByName("ixn_kcContentSearch_contentFilter", 0, "Documents")
Call Click_Link("Find", 0)
Call Click_Link("Name", 0)
Call Verify_WebTable_Cell("Name", 0, 2, 2, "Document1-1-2 ")
Call Verify_WebTable_Cell("Name", 0, 3, 2, "Document2-1-2 ")
Call Verify_WebTable_Cell("Name", 0, 4, 2, "Document3-1-1 ")
Call Verify_WebTable_RowCount("Name", 0, 4)

Call SCRIPT_BLOCK("Start Standard searching with Folders, All Workspaces")
Call Set_ComboBoxItem_ByName("ixn_kcContentSearch_contentFilter", 0, "Folders")
Call Click_Link("Find", 0)
Call Click_Link("Name", 0)
Call Verify_WebTable_Cell("Name", 0, 2, 2, "Folder1-2 ")
Call Verify_WebTable_Cell("Name", 0, 3, 2, "Folder2-2 ")
Call Verify_WebTable_Cell("Name", 0, 4, 2, "Folder3-1 ")
Call Verify_WebTable_RowCount("Name", 0, 4)

'"Advanced Search"
Call SCRIPT_BLOCK("""Advanced Search"" action start")

Call SCRIPT_BLOCK("Start Advanced searching with All Content, Current Workspaces")
Call Click_Link("Advanced", 0)
Call Set_TextField("ixn_kcContentSearch_searchStr", 0, "KEY_WORD")
Call Set_ComboBoxItem_ByName("ixn_kcContentSearch_contentFilter", 0, "All Content")
Call Set_ComboBoxItem_ByName("ixn_kcContentSearch_workspaceFilter", 0, "Current Workspace")
Call Set_TextField("ixn_kcContentSearch_name", 0, "Folder")
Call Click_Link("Find", 0)
Call Verify_WebTable_Cell(" Name ", 2, 2, 2, "Folder1-2 ")
Call Verify_WebTable_RowCount(" Name ", 2, 2)

'kokomade

Call SCRIPT_BLOCK("Start Advanced searching with Discussion, Current Workspaces")
Call Set_TextField("ixn_kcContentSearch_name", 0, "Discussion")
Call Set_ComboBoxItem_ByName("ixn_kcContentSearch_workspaceFilter", 0, "All Workspaces")
Call Click_Link("Find", 0)
Call Click_Link("Name", 0)
Call Verify_WebTable_Cell(" Name ", 2, 2, 2, "Discussion1-3 ")
Call Verify_WebTable_Cell(" Name ", 2, 3, 2, "Discussion2-2 ")

Call Verify_WebTable_RowCount(" Name ", 2, 3)
Call SCRIPT_BLOCK("""Advanced Search"" action end")

'"Remove Favorite Workspace for search"
Call SCRIPT_BLOCK("""Remove Favorite Workspace for search"" action start")
Call Click_Link("Collaboration", 0)
Call Click_Link("Favorite Workspaces", 0)
Call Set_CheckBoxOnOff_ByIndex("UI:SELECT:SELECTION:0", 0, WEB_OBJECT_ON)
Call Set_CheckBoxOnOff_ByIndex("UI:SELECT:SELECTION:1", 0, WEB_OBJECT_ON)
Call Click_Link("Remove from Favorites", 0)
Call SCRIPT_BLOCK("""Remove Favorite Workspace for search"" action end")


'"Data Cleanup"
Call SCRIPT_BLOCK("""Data Cleanup"" action start")
'"Go to Col Workspace3"
Call Open_Workspace("Col Workspace3")

'"Delete Document"
Call SCRIPT_BLOCK("""Delete Document"" action start")
Call Click_Link("Maximize", 0)
Call Click_Link("Document3-1-1", 0)
Call Click_Link("Delete Document", 0)
Call Click_WinButton("OK", 0)
Call Verify_Text_Exists("0 Items" ,0)
Call SCRIPT_BLOCK("""Delete Document"" action end")
'"Delete Folder"
Call SCRIPT_BLOCK("""Delete Folder"" action start")
Call Click_Link("Delete Folder", 0)
Call Click_WinButton("OK", 0)
Call Verify_Text_Exists("Workspace Details" ,0)
Call Verify_Text_NotFound("Folder: .*", 0)
Call SCRIPT_BLOCK("""Delete Folder"" action end")

'"Delete Workspace"
Call SCRIPT_BLOCK("""Delete Workspace"" action start")
Call Click_Link("Delete Workspace", 0)
Call Click_WinButton("OK", 0)
' Verify that the workspace got deleted
Call Click_Link("Collaboration", 0)
Call Click_Link("Workspaces", 0)
Call Set_TextField("ixn_kcWorkspaces_searchString", 0, "Col Workspace")
Call Click_Link("Find", 0)
Call Verify_WebTable_Cell("Workspace Name ", 0, 2, 2, "Col Workspace1 ")
Call Verify_WebTable_Cell("Workspace Name ", 0, 3, 2, "Col Workspace2 ")
Call Verify_WebTable_RowCount("Workspace Name ", 0, 3)
Call SCRIPT_BLOCK("""Delete Workspace"" action end")
'"Logout"
Call SCRIPT_BLOCK("""Logout"" action start")
Call Click_Link("Logout", 0)
Call Click_Link("Login", 0)
Call SCRIPT_BLOCK("""Logout"" action end")

utility

Option Explicit


'DESCRIPTION
' Utility functions
' A set of functions which you can use whole application.

Function Login (user, password)
dim url_to_use, ret
Select Case URL_FLAG
Case "CORE"
url_to_use = CORE_APPLICATION_URL
Case "PMBI"
url_to_use = PMBI_CONFIGURATION_APPLICATION_URL
Case "BI"
url_to_use = BI_APPLICATION_URL
Case "SP"
url_to_use = SP_APPLICATION_URL
End Select
Call Close_All_Browsers ' Login will be used as recovery scenario.
Call Open_URL(url_to_use)
Call Set_Window(1)
Call Set_TextField("username", 0, user)
Call Set_TextField("password", 0, password)
Click_Button "OK",0
' verification Login went through:
Select Case URL_FLAG ' 02/16/05, Max: using Verify_ functions to fail scripts if Login failed.
Case "CORE"
ret = Link_Exists("Options",0)
Case "PMBI"
Call Set_Window(2)
ret = Link_Exists("Edit",0)
Case "BI"
Call Set_Window(2)
ret = Link_Exists("User Guide",0)
Case "SP"
Call Set_Window(2)
ret = Link_Exists("New...",0)
End Select
Login = ret
' this function should contain more code. i want to be able to pass/fail function based on what i want.
' one day i want to use it to verify login failed, another day i want to use it to verify login passed.
End Function

Function Verify_Login_Pass(user, password)
if Login (user, password) then
Reporter.Filter = rfEnableAll
Reporter.ReportEvent micPass , _
"Verify_Login_Pass", _
"Login Successful : username: " & user & " password: " & password
Verify_Login_Pass = PASS
Else
Call REPORT_FAILURE2("Verify_Login_Pass", _
"Login Fail : username: " & user & " password: " & password)

Verify_Login_Pass = FAIL
end if
End Function

Function Verify_Login_Fail(user, password)
if Login (user, password) then
Call REPORT_FAILURE2("Verify_Login_Fail", _
"Login Successful : username: " & user & " password: " & password)

Verify_Login_Fail = FAIL
Else
Reporter.Filter = rfEnableAll
Reporter.ReportEvent micPass , _
"Verify_Login_Fail", _
"Login Fail : username: " & user & " password: " & password
Verify_Login_Fail = PASS
end if
End Function

'OPEN_ISSUE **************************
' Need to separate into Set_DataPicker and Set_Picker
'OPEN_ISSUE **************************
'Set a value specified into Picker value such as:
' IN filed for Resource Finder
' User Defined Classification
' Pool Picker, Organization Picker
'Control between Tree View and List View
'Basically, go to List View and put the specified value onto Search field.
'Can not see root value (ex: "Enterprise") in List View.
'In this particular case, have to go to Tree View, or take it from drop-down
Function Set_Picker(pStrPickerImageAltText, pStrPickerComboboxName, pIntIndex, pStrItemName)
Call FUNCTION_START("Set_Picker")
' check that there is the item name on the actual combobox list
' If so, no need to click on Picker image
If ComboBoxItem_Exists_ByName(pStrPickerComboboxName, 0, pStrItemName) Then
Call Set_ComboBoxItem_ByName (pStrPickerComboboxName, 0, pStrItemName)
Set_Picker = PASS
Call FUNCTION_END("Set_Picker. First END point")
Exit Function
End If

If Click_Image(pStrPickerImageAltText, pIntIndex) <> PASS then
Set_Picker = FAIL
Call FUNCTION_END("Set_Picker. Eight END point")
Call CaptureWindowImage("Set_Picker Couldn't click image '" & pStrPickerImageAltText & "'")
Exit Function
End If

'If the picker page you open is List View/Tree View type page, you need to open List View.
If Link_Exists("List View", 0) Then
Call Click_Link ("List View", 0)
End If

'When you open a picker page, you might have already seen the link you need to click
If Link_Exists(pStrItemName, 0) Then
Call Click_Link(pStrItemName, 0)
Set_Picker = PASS
Reporter.Filter = rfEnableAll
Call Reporter.ReportEvent(micPass,_
"Set_Picker: found an item", _
"found and set '" & pStrItemName & "' link on '" & pStrPickerImageAltText & "'")
'msgBox "line 65"
Call FUNCTION_END("Set_Picker. Second END point")
Exit Function 'Max, 12/28/04
End If

'This code is for Assigned Resource of Risk and Issues
If ComboBox_Exists("obj_ResourceFinderProjectMembersDelegate_filterEntry", 0) Then
Call Set_ComboBoxItem_ByName ("obj_ResourceFinderProjectMembersDelegate_filterEntry", 0, "Active Resources")
End If

'This is for selecting Parent Project
If ComboBox_Exists("obj_ParentProjectListFinderDelegate_filterEntry", 0) Then
Call Set_ComboBoxItem_ByName ("obj_ParentProjectListFinderDelegate_filterEntry", 0, "All Projects")
End If

'This is for selecting Project in Third-Party T&E New Time
If ComboBox_Exists("obj_TransactionProjectListFinderDelegate_filterEntry", 0) Then
Call Set_ComboBoxItem_ByName ("obj_TransactionProjectListFinderDelegate_filterEntry", 0, "All Projects")
End If

' 01/18/05, Max: this does not work if List View needs to be clicked because if we click link, what is the next step? <-- this is something Irina complained before as well
Call Set_TextField_ByIndex (0, pStrItemName)
Call Click_Link("Find",0)

If Link_Exists(pStrItemName, 0) Then
Call Click_Link(pStrItemName, 0)
Set_Picker = PASS
Reporter.Filter = rfEnableAll
Call Reporter.ReportEvent(micPass,_
"Set_Picker: found an item", _
"found and set '" & pStrItemName & "' link on '" & pStrPickerImageAltText & "'")
Call FUNCTION_END("Set_Picker. 9th END point")
Else
Call REPORT_FAILURE2("Set_Picker: could not find an item, '" & pStrItemName & "'", _
"could not find and click on '" & pStrItemName & "' link on '" & pStrPickerImageAltText & "'")
Call Click_Link("Cancel", 0)
Set_Picker = FAIL
Call FUNCTION_END("Set_Picker. 10th END point")
End If

Call FUNCTION_END("Set_Picker. Last END point")

End Function 'The End Of Set_Picker Function

Function Set_Picker_DM(pStrPickerImageName, pStrPickerComboboxName, pIntIndex, pStrItemName, pStrLinkName) ' might need to change name if used outside of DM
Call FUNCTION_START("Set_Picker_DM")
Call Click_Image(pStrPickerImageName, pIntIndex)
If Link_Exists("List View", 0) Then
Call Click_Link ("List View", 0)
Else
If Not Link_Exists("Tree View", 0) Then ' page without Tree/List Views, of 'flat' page
If Link_Exists(pStrLinkName, 0) Then
Call Click_Link(pStrLinkName, 0)
Set_Picker_DM = PASS
Reporter.Filter = rfEnableAll
Call Reporter.ReportEvent(micPass,_
"Set_Picker_DM: found an item", _
"found and set '" & pStrItemName & "' link on '" & pStrPickerImageName & "'")
call FUNCTION_END("Set_Picker_DM. 1st exit point")
exit function
Else
Call Set_TextField_ByIndex (0, pStrItemName)
Call Click_Link("Find",0)
If Link_Exists(pStrLinkName, 0) Then
Call Click_Link(pStrLinkName, 0)
Set_Picker_DM = PASS
Reporter.Filter = rfEnableAll
Call Reporter.ReportEvent(micPass,_
"Set_Picker_DM: found an item", _
"found and set '" & pStrItemName & "' link on '" & pStrPickerImageName & "'")
call FUNCTION_END("Set_Picker_DM. 2nd exit point")
exit function
Else
Call Click_Link("Cancel", 0)
Set_Picker_DM = FAIL
'msgBox "Something is wrong"
Reporter.Filter = rfEnableAll

Call REPORT_FAILURE2("Set_Picker_DM: could not find an item", _
"could not find and click on '" & pStrItemName & "' link on '" & pStrPickerImageName & "'")

call FUNCTION_END("Set_Picker_DM. 3rd exit point")
exit function
End If
End If
Else ' actual code goes here :)
Call Set_TextField_ByIndex (0, pStrItemName)
Call Click_Link("Find",0)
If Link_Exists(pStrLinkName, 0) Then
Call Click_Link(pStrLinkName, 0)
Set_Picker_DM = PASS
Reporter.Filter = rfEnableAll
Call Reporter.ReportEvent(micPass,_
"Set_Picker_DM: found an item", _
"found and set '" & pStrItemName & "' link on '" & pStrPickerImageName & "'")
call FUNCTION_END("Set_Picker_DM. 4th exit point")
exit function
Else
Call Click_Link("Cancel", 0)
Set_Picker_DM = FAIL
'msgBox "Something is wrong"

Call REPORT_FAILURE2("Set_Picker_DM: could not find an item", _
"could not find and click on '" & pStrItemName & "' link on '" & pStrPickerImageName & "'")

call FUNCTION_END("Set_Picker_DM. 5th exit point")
exit function
End If
End If
End IF
' 01/18/05, Max: if we need to click on List View, code was doing nothing. Same change as in Set_Picker function
Call Set_TextField_ByIndex (0, pStrItemName)
Call Click_Link("Find",0)
If Link_Exists(pStrLinkName, 0) Then
Call Click_Link(pStrLinkName, 0)
Set_Picker_DM = PASS
Reporter.Filter = rfEnableAll
Call Reporter.ReportEvent(micPass,_
"Set_Picker_DM: found an item", _
"found and set '" & pStrItemName & "' link on '" & pStrPickerImageName & "'")
call FUNCTION_END("Set_Picker_DM. 6th exit point")
exit function
Else
Call Click_Link("Cancel", 0)
Set_Picker_DM = FAIL

Call REPORT_FAILURE2("Set_Picker_DM: could not find an item", _
"could not find and click on '" & pStrItemName & "' link on '" & pStrPickerImageName & "'")

call FUNCTION_END("Set_Picker_DM. 7th exit point")
exit function
End If
Call FUNCTION_END("Set_Picker_DM. Last exit point")
End Function 'The End Of Set_Picker Function

' this function now handles any case when pop up window is open as a result of using Picker in this funciton
Function Set_Picker_Popup(pStrPickerImageName, pStrPickerComboboxName, pIntIndex, pStrItemName)
Call FUNCTION_START("Set_Picker_Popup")
' check that there is the item name on the actual combobox list
' If so, no need to click on Picker image
Dim current_window_index, new_popup_window_index
If ComboBoxItem_Exists_ByName(pStrPickerComboboxName, 0, pStrItemName) Then
Call Set_ComboBoxItem_ByName (pStrPickerComboboxName, 0, pStrItemName)
Set_Picker_Popup = PASS
Call FUNCTION_END("Set_Picker_Popup")
Exit Function
End If
' since clicking on Picker image will open pop up, need to decide how many windows are already open
' so that we properly handle windows
If wHandle2 = 0 Then
current_window_index = 1
else
current_window_index = 2 ' this means that function is being called from second pop up.
End If
new_popup_window_index = current_window_index + 1
'msgBox "new_popup_window_index = " & new_popup_window_index & " and current_window_index =" & current_window_index
Call Click_Image(pStrPickerImageName, pIntIndex)
Call Set_Window(new_popup_window_index)
If Link_Exists("List View", 0) Then
Call Click_Link ("List View", 0)
End If
If Not Link_Exists("Tree View", 0) Then ' page without Tree/List Views, of 'flat' page
If Link_Exists(pStrItemName, 0) Then
Call Click_Link(pStrItemName, 0)
Set_Picker_Popup = PASS
'msgBox "Link is shown in the UI"
Reporter.Filter = rfEnableAll
Call Reporter.ReportEvent(micPass,_
"Set_Picker_Popup: found an item", _
"found and set '" & pStrItemName & "' link on '" & pStrPickerImageName & "'")
Else
If TextField_Exists_ByIndex (0) Then
Call Set_TextField_ByIndex (0, pStrItemName)
Call Click_Link("Find",0)
end if
If Link_Exists(pStrItemName, 0) Then
Call Click_Link(pStrItemName, 0)
Set_Picker_Popup = PASS
Reporter.Filter = rfEnableAll
Call Reporter.ReportEvent(micPass,_
"Set_Picker_Popup: found an item", _
"found and set '" & pStrItemName & "' link on '" & pStrPickerImageName & "'")
Else
Call Click_Link("Cancel", 0)
Set_Picker_Popup = FAIL
'msgBox "Something is wrong"

Call REPORT_FAILURE2("Set_Picker_Popup: could not find an item", _
"could not find and click on '" & pStrItemName & "' link on '" & pStrPickerImageName & "'")
End If
End If
Else ' actual code goes here :)
If TextField_Exists_ByIndex (0) Then
Call Set_TextField_ByIndex (0, pStrItemName)
Call Click_Link("Find",0)
end if
If Link_Exists(pStrItemName, 0) Then
Call Click_Link(pStrItemName, 0)
Set_Picker_Popup = PASS
Reporter.Filter = rfEnableAll
Call Reporter.ReportEvent(micPass,_
"Set_Picker_Popup: found an item", _
"found and set '" & pStrItemName & "' link on '" & pStrPickerImageName & "'")
Else
Call Click_Link("Cancel", 0)
Set_Picker_Popup = FAIL
'msgBox "Something is wrong"

Call REPORT_FAILURE2("Set_Picker_Popup: could not find an item", _
"could not find and click on '" & pStrItemName & "' link on '" & pStrPickerImageName & "'")

End If
End IF
' Sync function is much better now, nothing to worry about.
'Call wait(2) 'this is for cases when after pop up closed, no page refresh is done.
Call Set_Window(current_window_index) ' Do we need to verify if value has been selected in the combo box???
Call FUNCTION_END("Set_Picker_Popup")
End Function 'The End Of Set_Picker_Popup Function

' Usage
' Call Set_Resource_Pools(Array("Jun Resource Pool11", "Jun Resource Pool12"))
' THIS SHOULD BE DPRECATED and REPLACED WITH Set_Multi_Objects_Picker
Function Set_Resource_Pools(oObjResourcePoolNames)
Call Click_Image("Select Resource Pools", 0)

Dim index
For index = 0 to Ubound(oObjResourcePoolNames)
If oObjResourcePoolNames(index) <> "" And Not IsNull(oObjResourcePoolNames(index)) Then
Call Set_TextField("obj_ListFinderDelegate_searchString", 0, oObjResourcePoolNames(index))
Call Click_Link("Find", 0)
If Click_Link(oObjResourcePoolNames(index), 0) <> PASS then

Call REPORT_FAILURE2("Set_Resource_Pools:could not find a Resource pool", _
"could not find and click on '" & oObjResourcePoolNames(index) & "' link on Resource Pool Finder page")

Set_Resource_Pools = FAIL
Call Click_Link ("Cancel", 0)
Exit Function
End If
End If
Next

Call Click_Link("OK", 0)
Reporter.Filter = rfEnableAll
Call Reporter.ReportEvent(micPass,_
"Set_Resource_Pools: selected Resource pools", _
"Set_Resource_Pools: selected Resource pools")
Set_Resource_Pools = PASS

End Function 'The End Of Set_Resource_Pools Function

'This function is to select multiple objects such as:
' Resource Pools in a Project,
' Jobs and Resource pools in Skills Search, etc.
'USAGE:
' From Skills Search page
' Call Set_Multi_Objects_Picker("Select Jobs for Search", 0, Array("QA Manager"), true)
'
' These two lines
' Call Set_Multi_Objects_Picker("Select Recipients", 0, Array("chung, buu"), true)
' Call Set_Multi_Objects_Picker("Select Recipients", 0, Array("Bernard, Mark"), false)
' are equivalent to
' Call Set_Multi_Objects_Picker("Select Recipients", 0, Array("chung, buu", "Bernard, Mark"), true)
'
' If you just want to clear out all objects:
' Call Set_Multi_Objects_Picker("Select Resource Pools to Search", 0, null, true)
'
' Resource->Request Position->To
' Call Set_Multi_Objects_Picker("Select Recipients", 0, Array("Bernard, Michael", "alex, alex"), False)
Function Set_Multi_Objects_Picker(pStrPickerAltText, pIntPickerIndex, pAryStrObjectNames, pBlnClearExisting)
Call Click_Image(pStrPickerAltText, pIntPickerIndex)

'------------------------------------------------------------------------
' Deciding which page the function userd for
'------------------------------------------------------------------------
Const PAGE_TYPE_REGULAR = 0
Const PAGE_TYPE_JOB_PICKER = "PAGE_TYPE_JOB_PICKER" ' Skills Search -> Jobs Picker
Const PAGE_TYPE_RESOURCE_POOL_PICKER = "PAGE_TYPE_RESOURCE_POOL_PICKER" ' Skills Search -> Resources Picker: Project->Resources Picker
Const PAGE_TYPE_PROJECT_COMMITMENT_SUGGESTION_RECIPiENTS_TO = "PAGE_TYPE_PROJECT_COMMITMENT_SUGGESTION_RECIPiENTS_TO" ' Project commitment Suggestioon recipients to
Const PAGE_TYPE_PROJECT_COMMITMENT_SUGGESTION_RECIPiENTS_CC = "PAGE_TYPE_PROJECT_COMMITMENT_SUGGESTION_RECIPiENTS_CC" ' Project commitment Suggestioon recipients to
Const PAGE_TYPE_WORKSPACE_MEMBERSHIP = "PAGE_TYPE_WORKSPACE_MEMBERSHIP" ' Workspace -> Membership
Const PAGE_TYPE_RESOURCE_REQUEST_POSITION_TO = "PAGE_TYPE_RESOURCE_REQUEST_POSITION_TO" 'Resource->Request Position->To
Const PAGE_TYPE_RESOURCE_REQUEST_POSITION_CC = "PAGE_TYPE_RESOURCE_REQUEST_POSITION_CC" 'Resource->Request Position->CC
Const PAGE_TYPE_STAFFING_REQUESTS_SUGGEST_POSITION = "PAGE_TYPE_STAFFING_REQUESTS_SUGGEST_POSITION" 'Staffing Requests->Suggest position for xxx

Dim PAGE_TYPE_

If ComboBox_Exists("ixn_pickMultiUser_filterEntry", 0) and ComboBoxItem_Exists_ByName("ixn_pickMultiUser_filterEntry", 0, "All Project Pool Owners") Then 'this is for Resource->Request Position->To
End If

If TextField_Exists("obj_DisplayListFinderDelegate_searchString", 0) Then ' this is for job picker,etc...
PAGE_TYPE_ = PAGE_TYPE_JOB_PICKER
ElseIf TextField_Exists("obj_ListFinderDelegate_searchString", 0) Then ' this is for resource pool picker etc.
PAGE_TYPE_ = PAGE_TYPE_RESOURCE_POOL_PICKER
ElseIf Link_Exists("Resources", 0) And ComboBoxItem_Exists_ByName("ixn_pickMultiUser_filterEntry", 0, "All Project Pool Owners") And Text_Exists("Select To Recipients", 0) Then
PAGE_TYPE_ = PAGE_TYPE_RESOURCE_REQUEST_POSITION_TO
ElseIf Link_Exists("Staffing Requests", 0) And ComboBoxItem_Exists_ByName("ixn_pickMultiUser_filterEntry", 0, "All Project Pool Owners") And Text_Exists("Select To Recipients", 0) Then
PAGE_TYPE_ = PAGE_TYPE_STAFFING_REQUESTS_SUGGEST_POSITION
ElseIf Link_Exists("Resources", 0) And ComboBoxItem_Exists_ByName("ixn_pickMultiUser_filterEntry", 0, "Active Users") And Text_Exists("Select CC Recipients", 0) Then
PAGE_TYPE_ = PAGE_TYPE_RESOURCE_REQUEST_POSITION_CC
ElseIf TextField_Exists("obj_RecipientListFinderDelegate_searchString", 0) Then ' this is for Project commitment Suggestion Recipients
If ComboBoxItem_Exists_ByName("ixn_pickMultiUser_filterEntry", 0, "Active Users") Then ' This is "Select CC Recipients"
PAGE_TYPE_ = PAGE_TYPE_PROJECT_COMMITMENT_SUGGESTION_RECIPiENTS_CC
Else ' This is Select Recipients
PAGE_TYPE_ = PAGE_TYPE_PROJECT_COMMITMENT_SUGGESTION_RECIPiENTS_TO
End If
ElseIf Link_Exists("Workspaces", 0) Then ' this is for Membership in Workspace(Collaboration)
PAGE_TYPE_ = PAGE_TYPE_WORKSPACE_MEMBERSHIP
Else
PAGE_TYPE_ = PAGE_TYPE_REGULAR
End If

Call REPORT_MSG("PAGE_TYPE_ '" & PAGE_TYPE_ & "' is selected")

'Remove all from the right pane first if pBlnClearExisting = True
If pBlnClearExisting Then
Call Click_Link("Find", 0)

'Remove selected if exist
If CheckBox_Exists_ByIndex("UI:SELECT:TargetSelections:0", 0) Then
Call Set_CheckBoxOnOff_ByIndex ("UI:SELECT:TargetSelections:-1", 0, WEB_OBJECT_ON)
Call Click_Link("Remove Selected", 0)
End If
End If

'if pAryStrObjectNames = null then exiting this function
If IsNull(pAryStrObjectNames) Then
Call Click_Link("OK", 0)
Call REPORT_PASS("Set_Multi_Objects_Picker: selected objects", "Set_Multi_Objects_Picker: selected objects")
Set_Multi_Objects_Picker = PASS
Exit Function
End If

'------------------------------------------------------------------------
' Setting criteria (except for the text field. the text field should be set while loop.
'------------------------------------------------------------------------
If PAGE_TYPE_ = PAGE_TYPE_REGULAR Then
ElseIf PAGE_TYPE_ = PAGE_TYPE_JOB_PICKER Then
ElseIf PAGE_TYPE_ = PAGE_TYPE_RESOURCE_POOL_PICKER Then
Call Set_ComboBoxItem_ByName ("ixn_pickPools_mruPool", 0, "Enterprise")
ElseIf PAGE_TYPE_ = PAGE_TYPE_PROJECT_COMMITMENT_SUGGESTION_RECIPiENTS_TO Then
Call Set_ComboBoxItem_ByName ("ixn_pickMultiUser_filterEntry", 0, "All Resource Pool Owners")
Call Set_ComboBoxItem_ByName ("ixn_pickMultiUser_mruPool", 0, "Enterprise")
ElseIf PAGE_TYPE_ = PAGE_TYPE_PROJECT_COMMITMENT_SUGGESTION_RECIPiENTS_CC Then
Call Set_ComboBoxItem_ByName ("ixn_pickMultiUser_filterEntry", 0, "Active Users")
Call Set_ComboBoxItem_ByName ("ixn_pickMultiUser_mruPool", 0, "Enterprise")
ElseIf PAGE_TYPE_ = PAGE_TYPE_WORKSPACE_MEMBERSHIP Then
Call Set_ComboBoxItem_ByName ("obj_WorkspaceMembersDisplayList_currentContext", 0, "All Members")
ElseIF PAGE_TYPE_ = PAGE_TYPE_RESOURCE_REQUEST_POSITION_TO Then
' Call Set_ComboBoxItem_ByName ("ixn_pickMultiUser_filterEntry", 0, "All Project Pool Owners")
Call Set_ComboBoxItem_ByName ("ixn_pickMultiUser_mruPool", 0, "Enterprise")
ElseIF PAGE_TYPE_ = PAGE_TYPE_STAFFING_REQUESTS_SUGGEST_POSITION Then
' Call Set_ComboBoxItem_ByName ("ixn_pickMultiUser_filterEntry", 0, "All Project Pool Owners")
Call Set_ComboBoxItem_ByName ("ixn_pickMultiUser_mruPool", 0, "Enterprise")
ElseIF PAGE_TYPE_ = PAGE_TYPE_RESOURCE_REQUEST_POSITION_CC Then
Call Set_ComboBoxItem_ByName ("ixn_pickMultiUser_filterEntry", 0, "Active Users")
Call Set_ComboBoxItem_ByName ("ixn_pickMultiUser_mruPool", 0, "Enterprise")
End If

'------------------------------------------------------------------------
' Find and select objects
'------------------------------------------------------------------------
Dim index
Dim blnObjectFoundInTheIteration_
For index = 0 to Ubound(pAryStrObjectNames)
If pAryStrObjectNames(index) <> "" And Not IsNull(pAryStrObjectNames(index)) Then
blnObjectFoundInTheIteration_ = false

If PAGE_TYPE_ = PAGE_TYPE_JOB_PICKER Then
Call Set_TextField("obj_DisplayListFinderDelegate_searchString", 0, pAryStrObjectNames(index))
Call Click_Link("Find", 0)
If Click_Link(pAryStrObjectNames(index), 0) = PASS then blnObjectFoundInTheIteration_ = True

ElseIf PAGE_TYPE_ = PAGE_TYPE_RESOURCE_POOL_PICKER Then
Call Set_TextField("obj_ListFinderDelegate_searchString", 0, pAryStrObjectNames(index))
Call Click_Link("Find", 0)
If Click_Link(pAryStrObjectNames(index), 0) = PASS then blnObjectFoundInTheIteration_ = True

ElseIf PAGE_TYPE_ = PAGE_TYPE_PROJECT_COMMITMENT_SUGGESTION_RECIPiENTS_CC or PAGE_TYPE_ = PAGE_TYPE_PROJECT_COMMITMENT_SUGGESTION_RECIPiENTS_To Then
Call Set_TextField("obj_RecipientListFinderDelegate_searchString", 0, pAryStrObjectNames(index))
Call Click_Link("Find", 0)
If Click_Link(pAryStrObjectNames(index), 0) = PASS then blnObjectFoundInTheIteration_ = True

ElseIf PAGE_TYPE_ = PAGE_TYPE_WORKSPACE_MEMBERSHIP Then
If Click_Link(pAryStrObjectNames(index), 0) = PASS then blnObjectFoundInTheIteration_ = True

ElseIF PAGE_TYPE_ = PAGE_TYPE_RESOURCE_REQUEST_POSITION_TO Or PAGE_TYPE_ = PAGE_TYPE_STAFFING_REQUESTS_SUGGEST_POSITION Then ' This is a tricky part: There are 2 types ,"All Project Pool Owners" and "All Project Owners" and none of these covers the other.
Call Set_TextField("obj_RecipientListFinderDelegate_searchString", 0, pAryStrObjectNames(index))
Call Set_ComboBoxItem_ByName ("ixn_pickMultiUser_filterEntry", 0, "All Project Pool Owners")
Call Click_Link("Find", 0)
If Link_Exists(pAryStrObjectNames(index), 0) Then
Call Click_Link(pAryStrObjectNames(index), 0)
blnObjectFoundInTheIteration_ = True
Else
Call Set_ComboBoxItem_ByName ("ixn_pickMultiUser_filterEntry", 0, "All Project Owners")
Call Click_Link("Find", 0)
If Click_Link(pAryStrObjectNames(index), 0) = PASS then blnObjectFoundInTheIteration_ = True
End If

ElseIF PAGE_TYPE_ = PAGE_TYPE_RESOURCE_REQUEST_POSITION_CC Then
Call Set_TextField("obj_RecipientListFinderDelegate_searchString", 0, pAryStrObjectNames(index))
Call Click_Link("Find", 0)
If Click_Link(pAryStrObjectNames(index), 0) = PASS then blnObjectFoundInTheIteration_ = True

End If

If Not blnObjectFoundInTheIteration_ then
Call REPORT_FAILURE2("Set_Multi_Objects_Picker:could not find a Resource pool", _
"could not find and click on '" & pAryStrObjectNames(index) & "' link on Resource Pool Finder page")
Set_Multi_Objects_Picker = FAIL
Call Click_Link ("Cancel", 0)
Exit Function
End If
End If
Next

Call Click_Link("OK", 0)
Call REPORT_PASS("Set_Multi_Objects_Picker: selected objects", "Set_Multi_Objects_Picker: selected objects")
Set_Multi_Objects_Picker = PASS

End Function 'Set_Multi_Objects_Picker

' USAGE
' Call Set_Preferences(Array("Resource", "Overall", "Job", "Job Title", "Qualifications", "Gantt View", "Skills", "Education", "Certifications", "Optional Skills", "Optional Education", "Optional Certifications", "Pool", "Workweek"))
Function Set_Preferences(pAryStrColumnNames)
Call Click_Link("Preferences", 0)
Call Set_Window(2)

Call Select_All_ListItems("selectedItems", 0)
Call Click_Link("Remove", 0)

Dim strColumnName_
For Each strColumnName_ in pAryStrColumnNames
Call Set_ListItem_ByName("unselectedItems", 0, strColumnName_, WEB_OBJECT_ON)
Call Click_Link("Add", 0)
Next
Call Click_Link("OK", 0)
Call Set_Window(1)

End Function










'Set_Classification
'
'If a test case is required to put a particular value into a particular classification, this function should be used.
'The test case should care only 3 attributes, Classification Type, Classification Name and Classification Value wraped by Classification object
'For example of 3 attribute (URL type, "Marketing campaign", http://yahoo.com) or ( User_Defined, Clients, internal)
'This function automatically put the value into a classification, either TextField or Picker, that has the same name as Classification Name parameter.
'This function set a classificaiton onto either a picker or text
'
'USAGE:1
' Dim objClassifications
' Set objClassifications = New Classification
' objClassifications.setClassificationType(CLASSIFICATION_TYPE_USER_DEFINED) ' You have to use constant valiables for setting Classfication type
' objClassifications.strClassificationName = "Clients"
' objClassifications.strClassificationValue = "Internal"
' Call Set_Classification(objClassifications)
'Usage2
' Dim objClassification1, objClassification2
' Set objClassification1 = newClassification()
' objClassification1.setClassificationType(CLASSIFICATION_TYPE_URL)
' objClassification1.strClassificationName = Chr(34) & "Marketing campaign" & Chr(34)
' objClassification1.strClassificationValue = "http://marketing.campaign.com"
'
' Set objClassification2 = newClassification()
' objClassification2.setClassificationType(CLASSIFICATION_TYPE_USER_DEFINED )
' objClassification2.strClassificationName = "Clients"
' objClassification2.strClassificationValue = "Internal"
'
' Call Click_Link("New Resource", 0)
' Call Set_Classification(objClassification1)
' Call Set_Classification(objClassification2)
' Set objClassification1 = Nothing
' Set objClassification2 = Nothing
'
'PARAMETER
' pObjClassification as Classification
'
'RETURN:
' PASS: Succeeded to set the specified classification.
' FAIL: Failed to set the specified classification because the classification could not be found.
Function Set_Classification(pObjClassification)
If pObjClassification.getClassificationType() = CLASSIFICATION_TYPE_USER_DEFINED Then
'the classification is User-Defined
If Set_Picker("Select " & pObjClassification.strClassificationName, "", 0, pObjClassification.strClassificationValue) = PASS Then
Reporter.Filter = rfEnableAll
Call Reporter.ReportEvent(micPass,_
"Set_Classification: set", _
"set '" & pObjClassification.strClassificationValue & "' in '" & pObjClassification.strClassificationName & "' field")
Set_Classification = PASS
Else

Call REPORT_FAILURE2("Set_Classification: could not set", _
"could not set '" & pObjClassification.strClassificationValue & "' in '" & pObjClassification.strClassificationName & "' field")

Set_Classification = FAIL
End If
Else
'the classification is NOT User-Defined
'Need to convert name to the other.
Dim strClassificationName_
strClassificationName_ = Replace(pObjClassification.strClassificationName, CHR(34), "_") ' character (")
strClassificationName_ = Replace(strClassificationName_, " ", "_") ' blank
strClassificationName_ = Replace(strClassificationName_, "/", "_") ' slash
Call Set_TextField ("textClassification_" & strClassificationName_ , 0, pObjClassification.strClassificationValue)
Set_Classification = PASS
End If
End Function 'The End Of Set_Classification Function





'USAGE:
' Call Set_Classification_Default_Values("Resource")
'This function goes through a ini file below called "ClassificationDefaultValues_.ini"
'to have a set of combination between classification names and values.
' ex) ClassificationDefaultValues_QA.ini
'A test case only have to call the function with object type such as "Resource". Then, values are automatically into each classifications.
'PARAMETER
' pStrObjectType as only following Strings
' "Opportunity"
' "Project"
' "Resource"
' "Client"
' "Agency"
'RETURN:
' PASS: Succeeded to set the defalut classifications to the specified object such as Resource.
' FAIL: Failed to set the defalut classification because:
' some of classification could not be found or
' ClassificationDefaultValues_.ini could not be found or
' keys or values in the ini file could not be found.
Function Set_Classification_Default_Values(pStrObjectType)
'FIX_ME **************************************************************************
'Shoud be Global constant variable
Dim CONFIG_DIR_PATH
Dim PATH_SEPARATOR
Dim LOCALE_NAME
CONFIG_DIR_PATH = "D:\dev\qa_main\prototype"
PATH_SEPARATOR = "\"
'FIX_ME **************************************************************************

Dim value_, return_, fileName_
fileName_ = CONFIG_DIR_PATH & PATH_SEPARATOR & "ClassificationDefaultValues_" & COMPANY_NAME & ".ini"

Const CAN_NOT_GET_ANY_VALUES = "can not get any value"

Dim i_
Dim objClassifications
Set objClassifications = New Classification

i_ = 0
Do While True
i_ = i_ + 1
return_ = Extern.GetPrivateProfileString(pStrObjectType, "TYPE" & i_ , CAN_NOT_GET_ANY_VALUES, value_, 32, fileName_)

If value_ = CAN_NOT_GET_ANY_VALUES Then
Exit Do
End If

If value_ = "ALPHANUMERIC" Then
objClassifications.setClassificationType(CLASSIFICATION_TYPE_ALPHANUMERIC)
ElseIf value_ = "NUMBER" Then
objClassifications.setClassificationType(CLASSIFICATION_TYPE_NUMBER)
ElseIf value_ = "URL" Then
objClassifications.setClassificationType(CLASSIFICATION_TYPE_URL)
ElseIf value_ = "USER_DEFINED" Then
objClassifications.setClassificationType(CLASSIFICATION_TYPE_USER_DEFINED)
Else
Call REPORT_FAILURE2("Set_Classification_Default_Values: found unexpected classification type", _
"found unexpected classification type '" & value_ & "'")

Set_Classification_Default_Values = FAIL
Set objClassifications = Nothing
Exit Function
End If

return_ = Extern.GetPrivateProfileString(pStrObjectType, "NAME" & i_ , CAN_NOT_GET_ANY_VALUES, value_, 32, fileName_)

If value_ = CAN_NOT_GET_ANY_VALUES Then


Call REPORT_FAILURE2("Set_Classification_Default_Values: could not find classification name", _
"could not find classification name on '" & "NAME" & i_ & "' key")

Set_Classification_Default_Values = FAIL
Set objClassifications = Nothing
Exit Function
End If

objClassifications.strClassificationName = value_

return_ = Extern.GetPrivateProfileString(pStrObjectType, "VALUE" & i_ , CAN_NOT_GET_ANY_VALUES, value_, 32, fileName_)

If value_ = CAN_NOT_GET_ANY_VALUES Then
Call REPORT_FAILURE2("Set_Classification_Default_Values: could not find classification value", _
"could not find classification value on '" & "VALUE" & i_ & "' key")

Set_Classification_Default_Values = FAIL
Set objClassifications = Nothing
Exit Function
End If
objClassifications.strClassificationValue = value_
'FIX_ME *****************************
If Set_Classification(objClassifications) = FAIL Then
End if
'FIX_ME *****************************
Loop
Set objClassifications = Nothing
End Function 'The End Of Set_Classification_Default_Values Function

'==============Set_Classification_Position ==============================
'Whenever you edit a position created from template or new position, you will
'have to set classification. This function will handle the set classification for position.
'Call this function when you are in the edit position or new position.
Function Set_Classification_Position ()
Dim objClassification1
Set objClassification1 = newClassification()
objClassification1.setClassificationType(CLASSIFICATION_TYPE_URL)
objClassification1.strClassificationName = Chr(34) & "Marketing campaign" & Chr(34)
objClassification1.strClassificationValue = "http://marketing.campaign.com"

'This check to ensure that we are in a specific edit position, where Staffing Link and Classifications Link are on that page.
If Link_Exists("Classifications", 0) or Link_Exists("Staffing", 0) or Link_Exists("Project Team Template.*", 0) Then
If Link_Exists("Classifications", 0) Then
Call Click_Link("Classifications", 0)
End If
Call Set_Classification(objClassification1)
Set objClassification1 = nothing
Set_Classification_Position = PASS
Else
Call REPORT_FAILURE("Set_Classification_Position: Unable to set Classification. Check to see if you are in a position.")

' Call REPORT_MSG("Unable to set Classification. Check to see if you are in a position.")
Set_Classification_Position = FAIL
End If

End Function 'The End of Set_Classification_Position


'FormatDateToString function should :
' have 2 arguments (pStrDateFomat, pDtmDateTime)
' return String value
' Parameters
' yyyy 4-digit year (e.g., 1998)
' yy Last 2 digits of the year (e.g., 98)
' mm Numeric month (e.g., 07)
' dd Day of month (e.g., 24)
' hh Hour of day (1-12)
' hh24 Hour of day (0-23)
' mi Minute (00-59)
' ss Second (00-59)
' Examples
' FormatDateToString(#2/7/2005#, "mm/dd/yyyy") returns "02/07/2005"
' FormatDateToString(#2/7/2005#, "m/d/yyyy") returns "2/7/2005"
' FormatDateToString(#2005/1/13#, "yyyymmdd") returns "20050113"
' FormatDateToString(#2005/1/13#, "m-d-yy") returns "1-13-05"
' FormatDateToString(cDate("October 19, 1962"), "m-d-yy") returns "10-19-62"
' FormatDateToString(now, "yyyymmddhh24miss") returns "20050330121404"
' Formatdatetostring(#2003/04/05 14:13:15#, "yyyymmddhh24miss") returns "20030405141315"
' Formatdatetostring(#2003/04/05 14:13:15#, "yyyymmddhhmiss") returns "20030405021315"
Function FormatDateToString(pDtmDateTime, pStrDateFomat)
'Verify pDtmDateTime argument is Date data type
If Not isDate(pDtmDateTime) Then
Reporter.Filter = rfEnableAll
Call Reporter.ReportEvent(micFail, _
"FormatDateToString: parameter is not date type", _
"second parameter('" & cstr(pDtmDateTime) & "') is not date type")
Exit Function
End If

'Start replacing
Dim strDate
strDate = pStrDateFomat

If InStr(strDate, "yyyy") <> 0 Then
strDate = Replace(strDate, "yyyy", cStr(Year(pDtmDateTime)), 1, -1, vbTextCompare)
End If

Dim strBuff
If InStr(strDate, "hh24") <> 0 Then
If Hour(pDtmDateTime) >= 10 Then
strBuff = cStr(Hour(pDtmDateTime))
Else
strBuff = "0" & Right(cStr(Hour(pDtmDateTime)), 1)
End If
strDate = Replace(strDate, "hh24", strBuff, 1, -1, vbTextCompare)
End If

If InStr(strDate, "hh") <> 0 Then
If Hour(pDtmDateTime) >= 12 Then
strBuff = Hour(pDtmDateTime) - 12
Else
strBuff = Hour(pDtmDateTime)
End If

If strBuff >= 10 Then
strBuff = cStr(strBuff)
Else
strBuff = "0" & Right(cStr(strBuff), 1)
End If

strDate = Replace(strDate, "hh", strBuff, 1, -1, vbTextCompare)
End If

If InStr(strDate, "yy") <> 0 Then
strDate = Replace(strDate, "yy", Right(cStr(Year(pDtmDateTime)), 2), 1, -1, vbTextCompare)
End If

If InStr(strDate, "mm") <> 0 Then
If Month(pDtmDateTime) >= 10 Then
strBuff = cStr(Month(pDtmDateTime))
Else
strBuff = "0" & Right(cStr(Month(pDtmDateTime)), 1)
End If
strDate = Replace(strDate, "mm", strBuff, 1, -1, vbTextCompare)
End If

If InStr(strDate, "mi") <> 0 Then
If Minute(pDtmDateTime) >= 10 Then
strBuff = cStr(Minute(pDtmDateTime))
Else
strBuff = "0" & Right(cStr(Minute(pDtmDateTime)), 1)
End If
strDate = Replace(strDate, "mi", strBuff, 1, -1, vbTextCompare)
End If

If InStr(strDate, "dd") <> 0 Then
If Day(pDtmDateTime) >= 10 Then
strBuff = cStr(Day(pDtmDateTime))
Else
strBuff = "0" & Right(cStr(Day(pDtmDateTime)), 1)
End If
strDate = Replace(strDate, "dd", strBuff, 1, -1, vbTextCompare)
End If

If InStr(strDate, "ss") <> 0 Then
If Second(pDtmDateTime) >= 10 Then
strBuff = cStr(Second(pDtmDateTime))
Else
strBuff = "0" & Right(cStr(Second(pDtmDateTime)), 1)
End If
strDate = Replace(strDate, "ss", strBuff, 1, -1, vbTextCompare)
End If

If InStr(strDate, "d") <> 0 Then
strDate = Replace(strDate, "d", cStr(Day(pDtmDateTime)), 1, -1, vbTextCompare)
End If

If InStr(strDate, "m") <> 0 Then
strDate = Replace(strDate, "m", cStr(Month(pDtmDateTime)), 1, -1, vbTextCompare)
End If

FormatDateToString = strDate

End Function

'USAGE
' msgbox RegularExpressionFormat( "Project*General .Information (Stakeholder)" )
Function RegularExpressionFormat(pStrValue)
Dim strValue_
strValue_ = replace(pStrValue, "(", "\(")
strValue_ = replace(strValue_ , ")", "\)")
strValue_ = replace(strValue_ , ".", "\.")
strValue_ = replace(strValue_ , "*", "\*")
RegularExpressionFormat = strValue_
End Function

' CaptureWindowImage
'
' Description
' This function create a folder for saving images of window ( for one time)
' This function captures a current window image as a png file when called.
' The image is stored in CAPTURED_WINDOW_IMAGE_PATH folder with timestamp
' May be this function needs to be added to a part of functions which has micFail of Reporter object such as :
' When Click_Link can not click the specified link
' When Verify_WebTable_Cell command identifys the specified cell does not exist.
' HISTORY
' 06/16/2006 Jun Changed the file name format that time stamp comes first and page name follows, because you can use Windows Picture and Fax View by keying right and left and can pursuit images in a order by occurence.
'
' Usage
' Call CaptureWindowImage("This is a message")
Function CaptureWindowImage(pStrMessage)

If Not CAPTURE_WINDOW_IMAGE_ENABLE Then
Call REPORT_MSG2("CaptureWindowImage function skipped", "CaptureWindowImage function skipped. If you want to enable this function, make CAPTURE_WINDOW_IMAGE_ENABLE = True in properties.vbs")
Exit Function
End If

Reporter.Filter = rfDisableAll
If Not Browser("hwnd:=" & hWindow).Exist Then
Reporter.Filter = rfEnableAll
Call Reporter.ReportEvent(micDone, _
"CaptureWindowImage could not capture a window image", _
"CaptureWindowImage could not capture a window image because a window handle '" & hWindow & "' was not valid")
Exit Function
End If

Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists(CAPTURED_WINDOW_IMAGE_PATH) Then
fso.CreateFolder(CAPTURED_WINDOW_IMAGE_PATH)
Reporter.Filter = rfEnableAll
Call Reporter.ReportEvent(micDone, _
"CaptureWindowImage created a folder", _
"CaptureWindowImage created a folder as '" & CAPTURED_WINDOW_IMAGE_PATH & "'")
Reporter.Filter = rfDisableAll
End If

'Look for files which are older than 1 week old and delete them.
Dim objFolder
Set objFolder = fso.GetFolder(CAPTURED_WINDOW_IMAGE_PATH)
Dim objFiles
Set objFiles = objFolder.Files
Dim objFile
Dim blnNeedToDelete
blnNeedToDelete = false
For Each objFile in objFiles
If DateDiff("d", objFile.DateCreated, Date) > 7 Then
blnNeedToDelete = True
objFile.Delete
End If
Next

If blnNeedToDelete Then
Call REPORT_MSG2("CaptureWindowImage deleted all old files", "CaptureWindowImage deleted all old files in '" & CAPTURED_WINDOW_IMAGE_PATH & "'")
End If

Set fso = Nothing
Set objFolder = Nothing
Set objFiles = Nothing
Set objFile = Nothing

Dim pageTitle, fileName, fileFullPath
pageTitle = Browser("hwnd:=" & hWindow).Page("title:=" & page_title).GetROProperty("Title")
pageTitle = Replace(pageTitle, "/", "_")
pageTitle = Replace(pageTitle, "\", "_")
pageTitle = Replace(pageTitle, ":", "_")
pageTitle = Replace(pageTitle, "*", "_")
pageTitle = Replace(pageTitle, "?", "_")
pageTitle = Replace(pageTitle, "<", "_")
pageTitle = Replace(pageTitle, ">", "_")
pageTitle = Replace(pageTitle, "|", "_")
pageTitle = Replace(pageTitle, Chr(34), "_")
pageTitle = Replace(pageTitle, " ", "_")
fileName = FormatDateToString(Now(), "yymmddhh24miss") & "_" & pageTitle & ".png"
fileFullPath = CAPTURED_WINDOW_IMAGE_PATH & "\" & fileName

Call Browser("hwnd:=" & hWindow).CaptureBitmap(fileFullPath, true)

Reporter.Filter = rfEnableAll
Call Reporter.ReportEvent(micDone, _
pageTitle & " captured", _
"CaptureWindowImage captured " & pageTitle & " page at " & vbCRLF & _
fileFullPath & "in " & HOST_MACHINE_NAME & vbCRLF & _
"Message is '" & pStrMessage & "' " & vbCRLF & _
"\\" & HOST_MACHINE_NAME & "\CapturedWindowImage\" & fileName)

End Function ' End Of CaptureWindowImage Function



'
'RETURN
' array of String
'
' USAGE
' SeparateToken("All Template Types;Work Request;Change Request" , ";") -> Array("All Template Types", "Work Request", "Change Request")
Function SeparateToken(pStrLine, pStrToken)
Dim strings_()
Dim numberOfToken
Dim seekPosition_

numberOfToken = 0
seekPosition_ = 1
Do
Dim nextPositionFound_
ReDim Preserve strings_(numberOfToken )
nextPositionFound_ = Instr(seekPosition_, pStrLine, pStrToken, vbTextCompare)
If nextPositionFound_ = 0 Then
strings_(numberOfToken ) = mid(pStrLine, seekPosition_, len(pStrLine) )
Exit Do
End if
strings_(numberOfToken ) = mid(pStrLine, seekPosition_, nextPositionFound_- seekPosition_)
seekPosition_ = nextPositionFound_ + 1
numberOfToken = numberOfToken + 1
Loop
SeparateToken = strings_
End Function



'External functions
'RETURN
' the number of characters.
'PARAMETERS
' Application name
' Key name
' Defalut value
' Returned value
' Size
' File name
Extern.Declare micInteger,"GetPrivateProfileString", "kernel32.dll","GetPrivateProfileStringA", _
micString, _
micString, _
micString, _
micString+micByRef, _
micInteger, _
micString

'This function counts number of processes, not windows.
'For instance, Launching IE and java scripts in the IE page pop up another page, count of process would still be 1.
Function Count_Processes(sStrProcessName)
Dim objSWbemServices, colSWbemObjectSet
Set objSWbemServices = GetObject("winmgmts:")
Set colSWbemObjectSet = objSWbemServices.ExecQuery("SELECT * FROM Win32_Process Where Name = '"& sStrProcessName &"'")
Count_Processes = colSWbemObjectSet.Count
End Function




'This functions are used to report messages to the test results. These messages are used for improved
' readability of test results report
Function REPORT_MSG(msg)
Reporter.Filter = rfEnableAll
Call Reporter.ReportEvent(micDone, functionHierarchyLevel.generateBufForReporter() & msg, msg)
End Function

'This should be used since there are a lot of Reporter.filter control.
Function REPORT_MSG2(reportStepName, details)
Reporter.Filter = rfEnableAll
Call Reporter.ReportEvent(micDone, functionHierarchyLevel.generateBufForReporter() & reportStepName, details)
End Function

Function REPORT_PASS(reportStepName, details)
Reporter.Filter = rfEnableAll
Call Reporter.ReportEvent(micPass, functionHierarchyLevel.generateBufForReporter() & reportStepName, details)
End Function


Function REPORT_FAILURE(msg)
Reporter.Filter = rfEnableAll
Reporter.ReportEvent micFail, functionHierarchyLevel.generateBufForReporter() & msg, msg
Call CaptureWindowImage(msg)
End Function

'This should be used since there are a lot of Reporter.filter control.
Function REPORT_FAILURE2(reportStepName, details)
Reporter.Filter = rfEnableAll
Call Reporter.ReportEvent(micFail, functionHierarchyLevel.generateBufForReporter() & reportStepName, details)
Call CaptureWindowImage(details)
End Function

Function REPORT_FAILURE_NO_IMAGE(reportStepName, details)
Reporter.Filter = rfEnableAll
Call Reporter.ReportEvent(micFail, functionHierarchyLevel.generateBufForReporter() & reportStepName, details)
End Function

' This function write a failure on QTP reports if the bug number is still a open bug.
' Once a bug whose number is used in this functioin as an argument is closed,:
' 1. Add the bug number to a file named FixedBugList.lst
' 2. DO NOT need to change ANYTHING in your test script.
'
' //depot/qa_main/ATSDGuide/TestSuite/configure/FixedBugList.lst
'
' USAGE
' Call REPORT_FAILURE_DUE_TO_KNOWN_ISSUE("11111", "xxx is a bug", True)
' Call REPORT_FAILURE_DUE_TO_KNOWN_ISSUE("22222", "xxx is a bug", True)
' Call REPORT_FAILURE_DUE_TO_KNOWN_ISSUE("33333", "xxx is a bug", True)
' Call REPORT_FAILURE_DUE_TO_KNOWN_ISSUE("11111", "xxx is a bug", True)
Dim aryFixedBugNumbers
aryFixedBugNumbers = null
Function REPORT_FAILURE_DUE_TO_KNOWN_ISSUE(pStrBugNumber, pStrMessage, pBlnCaptureScreen)
Dim stillKnownIssue
stillKnownIssue = true

' Here is an external text file that has a list of fixed bug.
' Read the file, if the specified bug number found, then this does not report anytihing
If IsNull(aryFixedBugNumbers) Then
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")

Dim objTextStream
Set objTextStream= fso.OpenTextFile(ATSD_CONFIG_FOLDER & "\FixedBugList.lst")

Dim strTextStream
strTextStream = objTextStream.ReadAll
objTextStream.Close

aryFixedBugNumbers = split(strTextStream, vbNewLine)

Call REPORT_MSG2("Bug Numbers in FixedBugList.lst have been read into aryFixedBugNumbers", "Bug Numbers are: " & strTextStream)

Set fso = Nothing
End If

Dim fixedBugNumber
For Each fixedBugNumber in aryFixedBugNumbers
If Trim(fixedBugNumber) = pStrBugNumber Then
stillKnownIssue = False
Exit For
End If
Next

If stillKnownIssue Then
If pBlnCaptureScreen Then
Call REPORT_FAILURE2("KNOWN ISSUE:" & pStrBugNumber, "KNOWN ISSUE:" & pStrBugNumber & " " & pStrMessage)
Else
Call REPORT_FAILURE_NO_IMAGE("KNOWN ISSUE:" & pStrBugNumber, "KNOWN ISSUE:" & pStrBugNumber & " " & pStrMessage)
End If
Else
Call REPORT_MSG("This used to be a known issue(" & pStrBugNumber & ")")
End If

End Function

Function REPORT_WARNING(msg)
Reporter.Filter = rfEnableAll
Reporter.ReportEvent micWarning, functionHierarchyLevel.generateBufForReporter() & msg, msg
End Function

Function REPORT_WARNING2(reportStepName, details)
Reporter.Filter = rfEnableAll
Call Reporter.ReportEvent(micWarning, functionHierarchyLevel.generateBufForReporter() & reportStepName, details)
End Function

Function SCRIPT_BLOCK(msg)
REPORT_MSG("********SCRIPT_BLOCK********: " & msg)
End Function


'
Class FunctionHierarchyLevelController
Private functionHierarchyLevel_

Private Sub Class_Initialize()
functionHierarchyLevel_ = 0
End Sub

Public Function start(function_name)
functionHierarchyLevel_ = functionHierarchyLevel_ + 1
Call REPORT_MSG2(function_name & " function start", function_name & " funciton starts. calling level is " & functionHierarchyLevel_)
End Function

'end is defined and can not be used here, thus "fend"
Public Function fend(function_name)
Call REPORT_MSG2(function_name & " funciton end", function_name & " funciton ends. calling level is " & functionHierarchyLevel_)
functionHierarchyLevel_ = functionHierarchyLevel_ - 1
End Function

Public Function generateBufForReporter()
If functionHierarchyLevel_ = 0 Then
Exit Function
End If

Dim index_
Dim buffer_
buffer_ = ""
For index_ = 0 To functionHierarchyLevel_ - 1
buffer_ = buffer_ & "_"
Next

generateBufForReporter = buffer_ & functionHierarchyLevel_

End Function

Private Sub Class_Terminate()
functionHierarchyLevel_ = 0
End Sub

End Class

Public functionHierarchyLevel
Set functionHierarchyLevel = new FunctionHierarchyLevelController



Function FUNCTION_START(function_name)
REPORT_MSG(function_name)
End Function

Function FUNCTION_END(function_name)
REPORT_MSG("********FUNCTION_END********: " & function_name)
End Function

function REPORT_MESSAGE(msg)
Call REPORT_MSG(msg)
Call REPORT_WARNING("REPORT_MESSAGE function has been retired. Please update script to use REPORT_MSG function")
end function










'-----------------------------------------------------------------------------------------
' Workaround section
'-----------------------------------------------------------------------------------------


'Defect 36189 in Vantive
Function WorkaroundFor36189
If Browser("hwnd:=" & hWindow).Dialog("title:=Security Alert").WinButton("text:=&Yes").Exist(OBJECT_EXIST_TIME_OUT) Then
Browser("hwnd:=" & hWindow).Dialog("title:=Security Alert").WinButton("text:=&Yes").Click
Call REPORT_FAILURE("WorkaroundFor36189")
End If
End Function

'Defect 35453 in Vantive
Function WorkaroundFor35453
Call REPORT_FAILURE("WorkaroundFor35453: Move: inconsistent order of names.")
End Function

'Defect 36208(Version History shows wrong Modified By field.) in Vantive
Function WorkaroundFor36208
Call REPORT_FAILURE("WorkaroundFor36208: Version History shows wrong Modified By field.")
End Function


'Defect 36497(Dependency on objects does not work when Importer deletes the objects) in Vantive
Function WorkaroundFor36497
Call REPORT_FAILURE("WorkaroundFor36497: Dependency on objects does not work when Importer deletes the objects")
End Function

'Defect r35655 in Vantive
Function WorkaroundFor35655
If Browser("hwnd:=" & hWindow).Dialog("title:=Security Information").WinButton("text:=&Yes").Exist(OBJECT_EXIST_TIME_OUT) Then
Browser("hwnd:=" & hWindow).Dialog("title:=Security Information").WinButton("text:=&Yes").Click
End If
End Function

'Defect 39512 in QC
Function WorkaroundFor39512()
' workaround function:
' if dialog exists, clickYes, and fail script with message that includes bug number
If IFrameButton_Exists("Yes", 0) Then
Call Click_IFrameButton("Yes", 0)
Call REPORT_FAILURE("WorkaroundFor39512: Known issue. See bug # 39512. Everything else will fail from here onward.")
Else
Call REPORT_WARNING("Please remove this workaround when the bug is fixed.")
End If

End Function

'Workaround for the account owner in different order
Function WorkaroundFor40534
Call REPORT_MESSAGE("KNOWN PROBLEM: 40534")
Call REPORT_FAILURE("WorkaroundFor40534: Client Owners In Relationship Doesn't Appear To Any Particular Order, hence led failure in verifying table.")
End Function


' In 8.6, we have been introducing a new Flex T&E and as a transition we have 2 clicks to go to T&E instead of 1 click
Function Workaround_This_Has_To_Be_Replaced_After_Flex_implemented
Call REPORT_WARNING2("Workaround_This_Has_To_Be_Replaced_After_Flex_implemented", "Workaround_This_Has_To_Be_Replaced_After_Flex_implemented")
Call Click_Link("Time and Expenses", 0)
Call Click_Link("Time and Expenses", 0)
End Function


'========================================================================================
' This TB TL Configure Popup functions has been converted to editable fields by Venkat.... and submited by Ariff

Function Set_Values_In_TeamBuilder_Configure_Popup(val1, val2, val3, val4, val5, val6, val7, val8, val9)
Call Click_Link("Configure Search",0)
Call Set_Window(2)
Call Set_TextField("obj_SuitabilityConfiguration_jobsWeight", 0, val1)
Call Set_TextField("obj_SuitabilityConfiguration_qualificationsWeight", 0, val2)
Call Set_TextField("obj_SuitabilityConfiguration_availabilityWeight", 0, val3)
Call Set_TextField("obj_SuitabilityConfiguration_skillsWeight", 0, val4)
Call Set_TextField("obj_SuitabilityConfiguration_certificationsWeight", 0, val5)
Call Set_TextField("obj_SuitabilityConfiguration_knowledgeWeight", 0, val6)
Call Set_TextField("obj_SuitabilityConfiguration_overallThreshold", 0, val7)
Call Set_TextField("obj_SuitabilityConfiguration_availabilityThreshold", 0, val8)
Call Set_TextField("obj_SuitabilityConfiguration_qualificationsThreshold", 0, val9)
Call Click_Link("OK",0)
Call Set_Window(1)
End Function



Function Set_Values_In_TeamLocator_Configure_Popup(val1, val2, val3, val4, val5, val6, val7, val8, val9)
Call Click_Link("Configure Search",0)
Call Set_Window(2)
Call Set_TextField("obj_SuitabilityConfiguration_jobsWeight", 0, val1)
Call Set_TextField("obj_SuitabilityConfiguration_qualificationsWeight", 0, val2)
Call Set_TextField("obj_SuitabilityConfiguration_availabilityWeight", 0, val3)
Call Set_TextField("obj_SuitabilityConfiguration_skillsWeight", 0, val4)
Call Set_TextField("obj_SuitabilityConfiguration_certificationsWeight", 0, val5)
Call Set_TextField("obj_SuitabilityConfiguration_knowledgeWeight", 0, val6)
Call Set_TextField("obj_SuitabilityConfiguration_overallThreshold", 0, val7)
Call Set_TextField("obj_SuitabilityConfiguration_availabilityThreshold", 0, val8)
Call Set_TextField("obj_SuitabilityConfiguration_qualificationsThreshold", 0, val9)
Call Click_Link("OK",0)
Call Set_Window(1)
End Function
'========================================================================================
'03/10/2006, Max - date takes system date, but skips leading 0 (our app uses it)
function Get_Today()

Call REPORT_FAILURE_NO_IMAGE("Get_Today is DEPRECATED", _
"USE: 'FormatDateToString(now, ""mm/dd/yyyy"")' instead")

Dim Date_Array
Date_Array = split(date, "/")
If Len(Date_Array(0)) <2 Then
Date_Array(0) = "0" & Date_Array(0)
End If
If Len(Date_Array(1)) <2 Then
Date_Array(1) = "0" & Date_Array(1)
End If
Get_Today = Date_Array(0) & "/" & Date_Array(1) & "/" & Date_Array(2)
end function

' **************** Move Project Dates & Positions dates Updates TL specific Functions By venkat **********************************

Function GetMondayDate(RefDate)
Dim MyWeekDay, MondayDate
MyWeekDay = Weekday(RefDate,2) ' 1. Monday , 2. Tuesday, 3. Wednesday, 4. Thursday, 5. Friday, 6. Saturday, 7. Sunday
Select Case MyWeekDay
Case 1
MondayDate= RefDate
Case 2
MondayDate= DateAdd("d", -1, RefDate)
Case 3
MondayDate= DateAdd("d", -2, RefDate)
Case 4
MondayDate= DateAdd("d", -3, RefDate)
Case 5
MondayDate= DateAdd("d", -4, RefDate)
Case 6
MondayDate= DateAdd("d", -5, RefDate)
Case 7
MondayDate= DateAdd("d", -6, RefDate)
End Select
GetMondayDate = MondayDate
End Function

'Deprecated 04/27/2006 Jun
Function MoveProjectDate(ProName)
Dim MoveDate, AddDay
Call REPORT_FAILURE2("MoveProjectDate is DEPRECATED", _
"Due to a lack of explanation and too generic name: use changeProjectStartDateTo1stOfNextMonth function") 'Added by Jun

Call FUNCTION_START("Move Project Dates ....")
MoveDate = Date
MoveDate=DateAdd("m", 1 , MoveDate)
AddDay= Day(MoveDate)
MoveDate=DateAdd("d", -(AddDay-1) , MoveDate)
Call Open_Project(ProName)
Call Click_Link("Project Dates",0)
Call Set_TextField ("ixn_projectMoveDates_startDate",0,MoveDate)
Call Click_Link("Save and Close","0")
MoveProjectDate = MoveDate
Call FUNCTION_END("Move Project Dates ....")
End Function

'This function sets the 1st day of the next month
'If today is 04/27/2006, this sets 05/01/2006
Function changeProjectStartDateTo1stOfNextMonth(pStrProjectName)
Dim MoveDate, AddDay
Call FUNCTION_START("Move Project Dates ....")
MoveDate = Date
MoveDate=DateAdd("m", 1 , MoveDate)
AddDay= Day(MoveDate)
MoveDate=DateAdd("d", -(AddDay-1) , MoveDate)
Call Open_Project(pStrProjectName)
Call Click_Link("Project Dates",0)
Call Set_TextField ("ixn_projectMoveDates_startDate",0,MoveDate)
Call Click_Link("Save and Close","0")
changeProjectStartDateTo1stOfNextMonth = MoveDate
Call FUNCTION_END("Move Project Dates ....")
End Function


Function UpdatePositionDates(PosName, StartDay,PosDuration) 'StartDay, values are 'Existing Day to fwd Days -------->>> 1. for Monday , 2. Tuesday, 3. Wednesday, 4. Thursday, 5. Friday, 6. Saturday, 7. Sunday
'Existing Day to Bkwd Days ------>>> 0.for Sunday , -1 Saturday -2 Friday , -3 Thursday ,-4 Wednesday,-5 Tuesday
Dim PosMovStartDate, PosMovEndDate, AddDay
Call FUNCTION_START("Update Position Dates ....")
PosMovStartDate = Date
PosMovStartDate=DateAdd("m", 1 , PosMovStartDate)
AddDay= Day(PosMovStartDate)
PosMovStartDate=DateAdd("d", -(AddDay-1) , PosMovStartDate)
Call Click_Link(PosName, 0)
PosMovStartDate = DateAdd("d",15, PosMovStartDate)
PosMovStartDate = GetMondayDate(PosMovStartDate)
If StartDay <> 1 Then
PosMovStartDate = DateAdd("d", (StartDay-1), PosMovStartDate)
End If
PosMovEndDate = DateAdd("d", (PosDuration-1), PosMovStartDate)
Call Set_TextField("ixn_editPosition_startDate",0,PosMovStartDate )
Call Set_TextField("ixn_editPosition_endDate",0, PosMovEndDate )
Call Click_Link("Save and Close", 0)
If IFrameButton_Exists ("Yes",0) Then
Call Click_IFrameButton("Yes",0)
End if
If IFrameButton_Exists ("Yes",0) Then
Call Click_IFrameButton("Yes",0)
End if
Call FUNCTION_END("Update Position Dates ....")
End Function

Function GenerateFullName(pStrLastName, pStrFirstName)
GenerateFullName = pStrLastName & ", " & pStrFirstName
End Function


Function SetReplyTypeMouse()
Setting.WebPackage("ReplayType") = 2
End Function

Function SetReplyTypeEvent()
Setting.WebPackage("ReplayType") = 1
End Function

Function SetReplyType(pIntReplyType)
Setting.WebPackage("ReplayType") = pIntReplyType
End Function



' **************** Move Project Dates & Positions dates Updates TL specific Functions By venkat **********************************

'Option Explicit
'Call SendTabKey

Function SendTabKey()
Dim WshShell
set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "{TAB}"
set WshShell = Nothing
End Function

' *******************************************************************************************

Function Del_Browser_Cookies
Dim WshShell
set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "%(to)"
set WshShell = Nothing
Browser("hwnd:=" & hWindow).Dialog("text:= Internet Options").WinButton("text:= Delete Coo.*","Index:= 0").Click
Browser("hwnd:=" & hWindow).Dialog("text:= Internet Options").Dialog("text:= Delete Cookies").WinButton("text:= OK","Index:= 0").Click
Browser("hwnd:=" & hWindow).Dialog("text:= Internet Options").WinButton("text:= Delete &Files.*","Index:= 0").Click
Browser("hwnd:=" & hWindow).Dialog("text:= Internet Options").Dialog("text:= Delete Files").WinCheckBox("text:= &Delete all offline content","Index:= 0").Set "ON"
Browser("hwnd:=" & hWindow).Dialog("text:= Internet Options").Dialog("text:= Delete Files").WinButton("text:= OK","Index:= 0").Click
Browser("hwnd:=" & hWindow).Dialog("text:= Internet Options").WinButton("text:= OK","Index:= 0").Click
End Function

'End Of File



' ==============================================================================================================
' Functions to click Edit Links and Expand Image on all Object profile screens.........Venkat
' ==============================================================================================================

'HISTORY
' 2006/04/19 Jun: Overhauled Expand_Profile.
' Description
' 1. Get_WebTable_Cell
' It is not always possible to get a value in cell (1,3) through Get_WebTable_Cell.
' If the function fails, it causes a failure.
' but there is no need to get the cell value, all you need it the image object.
' 2. unnecessary Warnings
' 3. Move the function from Business.vbs to Utility.vbs
Function Expand_Profile(pStrProfileLabel)
Dim translated_name_

translated_name_ = Local_Text(pStrProfileLabel)

' ActualValue = "Expand"
Call Initiate_wHandle

'look for "index 0"

' The actual web table's index can be 0 or 1. Mostly 0 but 1 in a few case such as Projects pane in Client
If Not WebTable_Cell_Exsists(translated_name_, 0, 1, 3) Then
Call REPORT_FAILURE2("Expand_Profile: '" & pStrProfileLabel & "' toggle cell Not Found", "Expand_Profile could not find a toggle cell in WebTable('" & pStrProfileLabel & "', 0) translated to '" & translated_name_ & "'")
Expand_Profile = FAIL
Exit Function
End If

Dim objWebImage_

'If there is not critical error, then needs to look for "index 1".
If Browser("hwnd:=" & hWindow).Page("title:=" & page_title).WebTable("text:=" & translated_name_ & ".*","Index:=0").ChildItemCount(1, 3, "Image") > 0 Then

Set objWebImage_ = Browser("hwnd:=" & hWindow).Page("title:=" & page_title).WebTable("text:=" & translated_name_ & ".*","Index:=0").ChildItem(1, 3, "Image", 0)

If objWebImage_.Exist(OBJECT_EXIST_TIME_OUT) Then
If objWebImage_.GetROProperty("file name") = "wb-up.gif" Then
objWebImage_.Click
Sync_Page
Call REPORT_MSG2("Expand_Profile: '" & pStrProfileLabel & "' expaneded", "Expanded ' " & pStrProfileLabel & "' Profile frame successfully.")
Expand_Profile = PASS
Set objWebImage_ = Nothing
Exit Function
ElseIf objWebImage_.GetROProperty("file name") = "wb-dwn.gif" Then
Call REPORT_MSG2("Expand_Profile: the profile already expanded", "'" & pStrProfileLabel & "' Profile already expanded ...Hence avoiding clicking expand image.")
Expand_Profile = PASS
Set objWebImage_ = Nothing
Exit Function
End If
End If
End If

'look for index 1

' If "index 1" does not have cell or image, this function should fail because there is not "Index 2" supoped to have the image.
If Not WebTable_Cell_Exsists(translated_name_, 1, 1, 3) Then
Call REPORT_FAILURE2("Expand_Profile: '" & pStrProfileLabel & "' web table Not Found", "Expand_Profile could not find a toggle cell in WebTable('" & pStrProfileLabel & "', 1) translated to '" & translated_name_ & "'")
Expand_Profile = FAIL
Exit Function
End If

If Browser("hwnd:=" & hWindow).Page("title:=" & page_title).WebTable("text:=" & translated_name_ & ".*","Index:=1").ChildItemCount(1, 3, "Image") = 0 Then
Call REPORT_FAILURE2("Expand_Profile: '" & pStrProfileLabel & "' the toggle image Not Found", "Expand_Profile could not find a toggle cell in WebTable('" & pStrProfileLabel & "', 1) translated to '" & translated_name_ & "'")
Expand_Profile = FAIL
Exit Function
End If

Set objWebImage_ = Browser("hwnd:=" & hWindow).Page("title:=" & page_title).WebTable("text:=" & translated_name_ & ".*","Index:=1").ChildItem(1, 3, "Image", 0)

'If there is not a toggle image, then it is an error
If Not objWebImage_.Exist(OBJECT_EXIST_TIME_OUT) Then
Call REPORT_FAILURE2("Expand_Profile: '" & pStrProfileLabel & "' the toggle image Not Found", "Expand_Profile could not find a toggle cell in WebTable('" & pStrProfileLabel & "', 1) translated to '" & translated_name_ & "'")
Expand_Profile = FAIL
Set objWebImage_ = Nothing
Exit Function
End If

If objWebImage_.GetROProperty("file name") = "wb-up.gif" Then
objWebImage_.Click
Sync_Page
Call REPORT_MSG2("Expand_Profile: '" & pStrProfileLabel & "' expaneded", "Expanded ' " & pStrProfileLabel & "' Profile frame successfully.")
Expand_Profile = PASS
ElseIf objWebImage_.GetROProperty("file name") = "wb-dwn.gif" Then
Call REPORT_MSG2("Expand_Profile: the profile already expanded", "'" & pStrProfileLabel & "' Profile already expanded ...Hence avoiding clicking expand image.")
Else
Call REPORT_FAILURE2("Expand_Profile: toggle image not found", "Expand Image link not Found: WebTable name = '" & pStrProfileLabel & "' Image file name captured is ='" & strImageFileName_ & "' NOT wb-up.gif or wb-dwn.gif")
Expand_Profile = FAIL
End If

Set objWebImage_ = Nothing

End Function


Function Edit_Profile(text)
Dim WebLinkObj,index , LinkName , ActualValue_1,ActualValue_0
dim translated_name_, translated_Linkname_
translated_name_ = Local_Text(text)
Reporter.Filter = rfDisableAll

Call Initiate_wHandle ' 'added by Jun 20050830
LinkName = "Edit"
If text = "Tasks" then
linkName = "ViewEdit"
end if

translated_Linkname_ = Local_Text(linkName)
If WebTable_Exists(translated_name_, 1) Then
ActualValue_1 = Browser("hwnd:=" & hWindow).Page("title:=" & page_title).WebTable("text:="& translated_name_ & ".*", "Index:= 1").GetCellData (1,2)
'Get_WebTable_Cell(text, 1, 1, 2)
End If
If WebTable_Exists(translated_name_, 0) Then
ActualValue_0 = Browser("hwnd:=" & hWindow).Page("title:=" & page_title).WebTable("text:="& translated_name_ & ".*", "Index:= 0").GetCellData (1,2)
'Get_WebTable_Cell(text, 1, 1, 2)
End If

If Trim(ActualValue_1) = Trim(translated_Linkname_) Then
index = 1
Call REPORT_WARNING("Table Index is 1.")
elseif Trim(ActualValue_0) = Trim(translated_Linkname_) Then
index = 0
Call REPORT_WARNING("Table index is 0")
else
Call REPORT_FAILURE2("Edit_Profile", _
"WebTable Not Found or Link Name is Incorrect: WebTable name = '" & translated_name_ & "' WebTable index ='" & index & "' Link Name : '" & LinkName & "'")
Edit_Profile = FAIL
Reporter.Filter = rfEnableAll
Exit Function
End if

Set WebLinkObj =Browser("hwnd:=" & hWindow).Page("title:=" & page_title).WebTable("text:=" & translated_name_ & ".*","Index:=" & index).ChildItem(1, 2, "Link", 0)

WebLinkObj.Click
Sync_Page
Reporter.Filter = rfEnableAll
Reporter.ReportEvent micPass , _
"Edit_Profile", _
" Edit Profile '" & text & "' is successfull "
Edit_Profile = PASS
Set WebLinkObj = Nothing

End Function


'------------------------------------------------------------------------------------------------------------
' Wait & Synchronization Functions
'------------------------------------------------------------------------------------------------------------
'This is a special sync function with a page loaded.
Function WaitWhileTextIsShown (pStrTextToLookFor, pIntTimeOutSecond)
Dim FREQUNECY_SECOND_
FREQUNECY_SECOND_ = 2

Dim counter_
counter_ = 0

Do While Text_Exists(pStrTextToLookFor,0)
Wait FREQUNECY_SECOND_
counter_ = counter_ + 1
If counter_ * FREQUNECY_SECOND_ >= pIntTimeOutSecond Then
' Time out
Call REPORT_MSG2("TIME OUT: WaitWhileTextIsShown: '" & pStrTextToLookFor & "' still there", _
"WaitWhileTextIsShown time out because '" & pStrTextToLookFor & "' still there after waited for " & counter_ * FREQUNECY_SECOND_ & " second.")
Exit Function
End If
Loop

' The text is gone.
Call REPORT_MSG2("WaitWhileTextIsShown: '" & pStrTextToLookFor & "' Not Shown", _
"WaitWhileTextIsShown: exits because '" & pStrTextToLookFor & "' is not shown after waited for " & counter_ * FREQUNECY_SECOND_ & " second.")

End Function


'This is a special sync function with a page loaded.
'USAGE
' Call WaitWhileTextIsNotShown("Password:", 20) ' This waits at most 20 second
Function WaitWhileTextIsNotShown (pStrTextToLookFor, pIntTimeOutSecond)
Dim FREQUNECY_SECOND_
FREQUNECY_SECOND_ = 2

Call REPORT_WARNING("This should be deprecated: Use WaitUntilTextIsShown instead of WaitWhileTextIsNotShown")

Dim counter_
counter_ = 0

Do Until Text_Exists(pStrTextToLookFor,0)
Wait FREQUNECY_SECOND_
counter_ = counter_ + 1
If counter_ * FREQUNECY_SECOND_ >= pIntTimeOutSecond Then
' Time out
Call REPORT_MSG2("TIME OUT: WaitWhileTextIsNotShown: '" & pStrTextToLookFor & "' still Not Shown", _
"WaitWhileTextIsNotShown: time out because '" & pStrTextToLookFor & "' is not shown after waited for " & counter_ * FREQUNECY_SECOND_ & " second.")
Exit Function
End If
Loop

' The text is shown.
Call REPORT_MSG2("WaitWhileTextIsNotShown: '" & pStrTextToLookFor & "' Shown", _
"WaitWhileTextIsNotShown exits because '" & pStrTextToLookFor & "' shown after waited for " & counter_ * FREQUNECY_SECOND_ & " second.")

End Function



'This is a special sync function with a page loaded.
'USAGE
' Call WaitUntilTextIsShown("Password:", 20) ' This waits at most 20 second
Function WaitUntilTextIsShown (pStrTextToLookFor, pIntTimeOutSecond)
Dim FREQUNECY_SECOND_
FREQUNECY_SECOND_ = 2

Dim counter_
counter_ = 0

Do Until Text_Exists(pStrTextToLookFor,0)
Wait FREQUNECY_SECOND_
counter_ = counter_ + 1
If counter_ * FREQUNECY_SECOND_ >= pIntTimeOutSecond Then
' Time out
Call REPORT_MSG2("TIME OUT: WaitUntilTextIsShown: '" & pStrTextToLookFor & "' still Not Shown", _
"WaitUntilTextIsShown: time out because '" & pStrTextToLookFor & "' is not shown after waited for " & counter_ * FREQUNECY_SECOND_ & " second.")
Exit Function
End If
Loop

' The text is shown.
Call REPORT_MSG2("WaitUntilTextIsShown: '" & pStrTextToLookFor & "' Shown", _
"WaitUntilTextIsShown exits because '" & pStrTextToLookFor & "' shown after waited for " & counter_ * FREQUNECY_SECOND_ & " second.")

End Function

' This repeats clicking a specified link until another link is shown
' Example:
' a script wants to wait by repeating "Refresh" until a message in Collaboration arrives and shown.
Function RepeatClickUntilLinkShown(pStrLinkToRepeatClicking, pIntRepeatIntervalSecond, pStrLinkWaitFor, pIntTimeOutSecond)

If pIntRepeatIntervalSecond <= 0 Then
Call REPORT_FAILURE2("RepeatClickUntilLinkShown: pIntRepeatIntervalSecond is not valid", "RepeatClickUntilLinkShown: pIntRepeatIntervalSecond is not valid")
Exit Function
End If

Dim counter_
counter_ = 0

Do Until Link_Exists(pStrLinkWaitFor,0)
Wait pIntRepeatIntervalSecond
counter_ = counter_ + 1
Call Click_Link(pStrLinkToRepeatClicking, 0)
If counter_ * pIntRepeatIntervalSecond >= pIntTimeOutSecond Then
' Time out
Call REPORT_MSG2("TIME OUT: RepeatClickUntilLinkShown: '" & pStrLinkWaitFor & "' still Not Shown", _
"RepeatClickUntilLinkShown: time out because '" & pStrLinkWaitFor & "' is not shown after waited for " & counter_ * FREQUNECY_SECOND_ & " second.")
Exit Function
End If
Loop

' The text is shown.
Call REPORT_MSG2("RepeatClickUntilLinkShown: '" & pStrLinkWaitFor & "' Shown", _
"RepeatClickUntilLinkShown exits because '" & pStrLinkWaitFor & "' shown after waited for " & counter_ * FREQUNECY_SECOND_ & " second.")
End Function ' End of RepeatClickUntilLinkShown







'Mercury Support function
' http://kb-index.mercury.com/web/queries/KBAview.asp?Conceptid=32103&Product=AQT
'
function readIniFile(pStrIniFile, pStrSection, pStrKey)
Const ForReading = 1
Dim fso, f, ts, currSec, currVar, continueLooking, objDictionary
continueLooking = true
currSec = false
currVar = false
Set fso = CreateObject("Scripting.FileSystemObject")

set objDictionary = CreateObject("Scripting.Dictionary")
Set ts = fso.OpenTextFile(pStrIniFile)

Dim strTextStream
strTextStream = ts.ReadAll
ts.Close

Dim aryINIFileLines
aryINIFileLines = split(strTextStream, vbNewLine)

Dim intINIFileLineIndex

for intINIFileLineIndex = 0 to UBound(aryINIFileLines) - 1
if strComp(pStrSection, aryINIFileLines(intINIFileLineIndex)) = 0 then
currSec = true
end if

if currSec then
if strComp(pStrSection, aryINIFileLines(intINIFileLineIndex)) <> 0 and inStr(aryINIFileLines(intINIFileLineIndex),"]") < 1 and continueLooking then
if inStr(aryINIFileLines(intINIFileLineIndex),"=") > 0 then
Dim token
token = Split(aryINIFileLines(intINIFileLineIndex),"=")
objDictionary.Add token(0), token(1)
if objDictionary.Exists(pStrKey) then
readIniFile = token(1)
currVar = true
exit for
end if
end if
elseif strComp(pStrSection, aryINIFileLines(intINIFileLineIndex)) <> 0 and inStr(aryINIFileLines(intINIFileLineIndex),"]") > 0 then
continueLooking = false
end if
end if
next

if not currSec then
Call REPORT_MSG("readIniFile: SECTION_NOT_EXIST " & pStrSection)
readIniFile = ""
elseif not currVar then
Call REPORT_MSG("readIniFile: VARIABLE_NOT_EXIST " & pStrKey & " in " & pStrSection & " section" )
readIniFile = ""
end if

' Added 3 lines by Jun
Set ts = Nothing
Set objDictionary = Nothing
Set fso = Nothing
end function


'-----------------------------------------------------------------------------------------
' Dialog box section
'-----------------------------------------------------------------------------------------
'This function is to click Cancel button on file downloading dialog box.
'This takes care of both platform XP and 2000
'USAGE
' Call Click_DownloadImage("Export Table to PDF Format", 0)
' Click_CancelButtonOnFileDownloadDialog
'
' Call Click_DownloadImage("Export Table to CSV Format", 0)
' Click_CancelButtonOnFileDownloadDialog
'
Function Click_CancelButtonOnFileDownloadDialog()
functionHierarchyLevel.start("Click_CancelButtonOnFileDownloadDialog")

If Browser("hwnd:=" & hWindow).Dialog("title:=File Download").Exist(OBJECT_EXIST_TIME_OUT) Then
Browser("hwnd:=" & hWindow).Dialog("title:=File Download").WinButton("text:=Cancel", "index:=0").Click
' ElseIF Dialog("text:=File Download", "Location:=1", "nativeclass:=#32770").Exist(OBJECT_EXIST_TIME_OUT) Then
' Dialog("title:=File Download").Dialog("title:=File Download").WinButton("text:=Cancel", "index:=0").Click
Else
Dim ParentDialogDesc , ChildDialogDesc, WinButtonDesc
Set ParentDialogDesc = Description.Create()
ParentDialogDesc("text").Value = "File Download"
ParentDialogDesc("location").Value = "0"
ParentDialogDesc("nativeclass").Value = "#32770"

Set ChildDialogDesc = Description.Create()
ChildDialogDesc("text").Value = "File Download"
ChildDialogDesc("location").Value = "1"
ChildDialogDesc("nativeclass").Value = "#32770"

' Dialog(ParentDialogDesc).Dialog(ChildDialogDesc).WinButton("text:=Cancel", "index:=0").Click
Set ParentDialogDesc = Nothing
Set ChildDialogDesc = Nothing
Set WinButtonDesc = Description.Create()
WinButtonDesc("nativeclass").Value = "Button"
WinButtonDesc("text").Value = "Cancel"
'Click on the "Download" link to bring up a Windows dialog, then cancel it
Dialog(ParentDialogDesc).Dialog(ChildDialogDesc).WinButton(WinButtonDesc).Click

End If

functionHierarchyLevel.fend("Click_CancelButtonOnFileDownloadDialog")
End Function



'-----------------------------------------------------------------------------------------
' QTP Data Table section
'-----------------------------------------------------------------------------------------
'Verify_ExcelWorksheetsIdentical
' Function to compare two Excel sheets (this is created to verify all KPI vlaues) ........................Venkat 03-23-06
'
' HiSTORY
' 08/16/2006 Jun Moved and renamed Verify_DtSheets_Equal function to utility. This should not be in webBroser.vbs.
' Modified it to use Excel VBA. This way, you don't have to care of format. An Excel file is an Excel file.
Function Verify_ExcelWorksheetsIdentical(pStrExcelFile1Name, pIntExcelFile1WorksheetIndex, pStrExcelFile2Name, pIntExcelFile2WorksheetIndex)

'File existance check
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")

If Not fso.FileExists(pStrExcelFile1Name) Then
Call REPORT_FAILURE_NO_IMAGE("Verify_ExcelWorksheetsIdentical: File Not Found", _
"Verify_ExcelWorksheetsIdentical: Could not find '" & pStrExcelFile1Name & "'")
Verify_ExcelWorksheetsIdentical = FAIL
Set fso = Nothing
Exit Function
End If

If Not fso.FileExists(pStrExcelFile1Name) Then
Call REPORT_FAILURE_NO_IMAGE("Verify_ExcelWorksheetsIdentical: File Not Found", _
"Verify_ExcelWorksheetsIdentical: Could not find '" & pStrExcelFile2Name & "'")
Verify_ExcelWorksheetsIdentical = FAIL
Set fso = Nothing
Exit Function
End If

Set fso = Nothing

Dim anyFailure
anyFailure = False

Dim objExcel
Set objExcel = createobject("Excel.Application")
objExcel.Visible = true

Dim objWorkbook1, objWorkbook2
Set objWorkbook1 = objExcel.Workbooks.Open(pStrExcelFile1Name,, True)
Set objWorkbook2 = objExcel.Workbooks.Open(pStrExcelFile2Name,, True)

Dim objWorkSheet1, objWorkSheet2
Set objWorkSheet1 = objWorkbook1.Worksheets(pIntExcelFile1WorksheetIndex)
Set objWorkSheet2 = objWorkbook2.Worksheets(pIntExcelFile2WorksheetIndex)

Const xlCellTypeLastCell = 11

Dim intWorksheet1RowCount, intWorksheet1ColumnCount, intWorksheet2RowCount, intWorksheet2ColumnCount
intWorksheet1RowCount = objWorkSheet1.Cells.SpecialCells(xlCellTypeLastCell).Row
intWorksheet1ColumnCount = objWorkSheet1.Cells.SpecialCells(xlCellTypeLastCell).Column
intWorksheet2RowCount = objWorkSheet2.Cells.SpecialCells(xlCellTypeLastCell).Row
intWorksheet2ColumnCount = objWorkSheet2.Cells.SpecialCells(xlCellTypeLastCell).Column

'Verify row count and column count
If intWorksheet1RowCount <> intWorksheet2RowCount Then
Call REPORT_FAILURE_NO_IMAGE("Verify_ExcelWorksheetsIdentical: differnt row count", _
"Verify_ExcelWorksheetsIdentical: differnt row count. '" & _
pStrExcelFile1Name & "(" & pIntExcelFile1WorksheetIndex & ")' shows '" & intWorksheet1RowCount & "' and '" & _
pStrExcelFile2Name & "(" & pIntExcelFile2WorksheetIndex & ")' shows '" & intWorksheet2RowCount & "'")
anyFailure = True
End If
If intWorksheet1ColumnCount <> intWorksheet2ColumnCount Then
Call REPORT_FAILURE_NO_IMAGE("Verify_ExcelWorksheetsIdentical: differnt column count", _
"Verify_ExcelWorksheetsIdentical: differnt column count. '" & _
pStrExcelFile1Name & "(" & pIntExcelFile1WorksheetIndex & ")' shows '" & intWorksheet1ColumnCount & "' and '" & _
pStrExcelFile2Name & "(" & pIntExcelFile2WorksheetIndex & ")' shows '" & intWorksheet2ColumnCount & "'")
anyFailure = True
End If

Dim dataDifferencesCount
dataDifferencesCount = 0

Dim columnIndex, rowIndex

For rowIndex = 1 To intWorksheet1RowCount
For columnIndex = 1 To intWorksheet1ColumnCount
If Trim(objWorkSheet1.Cells(rowIndex, columnIndex).Value) = Trim(objWorkSheet2.Cells(rowIndex, columnIndex).Value) Then
Call REPORT_PASS("Verify_ExcelWorksheetsIdentical: (row=" & rowIndex & ", column=" & columnIndex & ") Verified", _
pStrExcelFile1Name & "(" & pIntExcelFile1WorksheetIndex & ")' shows '" & objWorkSheet1.Cells(rowIndex, columnIndex).Value & "' and '" & _
pStrExcelFile2Name & "(" & pIntExcelFile2WorksheetIndex & ")' shows '" & objWorkSheet2.Cells(rowIndex, columnIndex).Value & "'")
Else
dataDifferencesCount = dataDifferencesCount + 1
Call REPORT_FAILURE_NO_IMAGE("Verify_ExcelWorksheetsIdentical: data different (row=" & rowIndex & ", column=" & columnIndex & ")", _
"Verify_ExcelWorksheetsIdentical: detected data difference(row=" & rowIndex & ", column=" & columnIndex & ") '" & _
pStrExcelFile1Name & "(" & pIntExcelFile1WorksheetIndex & ")' shows '" & objWorkSheet1.Cells(rowIndex, columnIndex).Value & "' and '" & _
pStrExcelFile2Name & "(" & pIntExcelFile2WorksheetIndex & ")' shows '" & objWorkSheet2.Cells(rowIndex, columnIndex).Value & "'")
End If
Next
Next

If dataDifferencesCount = 0 And Not anyFailure Then
Call REPORT_PASS("Verify_ExcelWorksheetsIdentical Passed", _
pStrExcelFile1Name & "(" & pIntExcelFile1WorksheetIndex & ")' and '" & _
pStrExcelFile2Name & "(" & pIntExcelFile2WorksheetIndex & ")' are indentical")
Verify_ExcelWorksheetsIdentical = PASS
Else
Call REPORT_FAILURE_NO_IMAGE("Verify_ExcelWorksheetsIdentical: Failed with " & dataDifferencesCount & " data difference(s)", _
"Verify_ExcelWorksheetsIdentical: has detected " & dataDifferencesCount & " data difference(s)" & _
pStrExcelFile1Name & "(" & pIntExcelFile1WorksheetIndex & ")' and '" & _
pStrExcelFile2Name & "(" & pIntExcelFile2WorksheetIndex & ")' are not same")
Verify_ExcelWorksheetsIdentical = FAIL
End If


objExcel.Workbooks.close
Set objWorkbook1 = Nothing
Set objWorkbook2 = Nothing

Set objWorkSheet1 = Nothing
Set objWorkSheet2 = Nothing

objExcel.Quit
Set objExcel = Nothing


'------------------------------------------------
' Here is code that is implemented by using QTP data table.
' This has a limitation: the first row can not be verified

' Dim EXCEL_FILE1_, EXCEL_FILE2_
' EXCEL_FILE1_ = "ExcelFile1"
' EXCEL_FILE2_ = "ExcelFile2"
'
' Call DataTable.AddSheet(EXCEL_FILE1_)
' Call DataTable.AddSheet(EXCEL_FILE2_)
' Call DataTable.ImportSheet(pStrExcelFile1Name ,pIntExcelFile1WorksheetIndex , EXCEL_FILE1_)
' Call DataTable.ImportSheet(pStrExcelFile2Name ,pIntExcelFile2WorksheetIndex , EXCEL_FILE2_)
'
' 'Verify row count and column count
' If DataTable.GetSheet(EXCEL_FILE1_).GetRowCount <> DataTable.GetSheet(EXCEL_FILE2_).GetRowCount Then
' Call REPORT_FAILURE_NO_IMAGE("Verify_ExcelWorksheetsIdentical: differnt row count", _
' "Verify_ExcelWorksheetsIdentical: differnt row count. '" & _
' pStrExcelFile1Name & "(" & pIntExcelFile1WorksheetIndex & ")' shows '" & DataTable.GetSheet(EXCEL_FILE1_).GetRowCount & "' and '" & _
' pStrExcelFile2Name & "(" & pIntExcelFile2WorksheetIndex & ")' shows '" & DataTable.GetSheet(EXCEL_FILE2_).GetRowCount & "'")
' Verify_ExcelWorksheetsIdentical = FAIL
' Exit Function
' End If
' If DataTable.GetSheet(EXCEL_FILE1_).GetParameterCount <> DataTable.GetSheet(EXCEL_FILE2_).GetParameterCount Then
' Call REPORT_FAILURE_NO_IMAGE("Verify_ExcelWorksheetsIdentical: differnt column count", _
' "Verify_ExcelWorksheetsIdentical: differnt column count. '" & _
' pStrExcelFile1Name & "(" & pIntExcelFile1WorksheetIndex & ")' shows '" & DataTable.GetSheet(EXCEL_FILE1_).GetParameterCount & "' and '" & _
' pStrExcelFile2Name & "(" & pIntExcelFile2WorksheetIndex & ")' shows '" & DataTable.GetSheet(EXCEL_FILE2_).GetParameterCount & "'")
' Verify_ExcelWorksheetsIdentical = FAIL
' Exit Function
' End If
'
'
' Dim dataDifferencesCount
' dataDifferencesCount = 0
'
' Dim columnIndex, rowIndex
'
' For rowIndex = 1 To DataTable.GetSheet(EXCEL_FILE1_).GetRowCount
' Call DataTable.SetCurrentRow(rowIndex)
' For columnIndex = 1 To DataTable.GetSheet(EXCEL_FILE1_).GetParameterCount
' If Trim(DataTable.Value(columnIndex, EXCEL_FILE1_)) = Trim(DataTable.Value(columnIndex, EXCEL_FILE2_)) Then
' Call REPORT_PASS("Verify_ExcelWorksheetsIdentical: (row=" & rowIndex & ", column=" & columnIndex & ") Verified", _
' pStrExcelFile1Name & "(" & pIntExcelFile1WorksheetIndex & ")' shows '" & DataTable.Value(columnIndex, EXCEL_FILE1_) & "' and '" & _
' pStrExcelFile2Name & "(" & pIntExcelFile2WorksheetIndex & ")' shows '" & DataTable.Value(columnIndex, EXCEL_FILE2_) & "'")
' Else
' dataDifferencesCount = dataDifferencesCount + 1
' Call REPORT_FAILURE_NO_IMAGE("Verify_ExcelWorksheetsIdentical: data different (row=" & rowIndex & ", column=" & columnIndex & ")", _
' "Verify_ExcelWorksheetsIdentical: detected data difference(row=" & rowIndex & ", column=" & columnIndex & ") '" & _
' pStrExcelFile1Name & "(" & pIntExcelFile1WorksheetIndex & ")' shows '" & DataTable.Value(columnIndex, EXCEL_FILE1_) & "' and '" & _
' pStrExcelFile2Name & "(" & pIntExcelFile2WorksheetIndex & ")' shows '" & DataTable.Value(columnIndex, EXCEL_FILE2_) & "'")
' End If
' Next
' Next
'
' If dataDifferencesCount = 0 Then
' Call REPORT_PASS("Verify_ExcelWorksheetsIdentical Passed", _
' pStrExcelFile1Name & "(" & pIntExcelFile1WorksheetIndex & ")' and '" & _
' pStrExcelFile2Name & "(" & pIntExcelFile2WorksheetIndex & ")' are indentical")
' Verify_ExcelWorksheetsIdentical = PASS
' Else
' Call REPORT_FAILURE_NO_IMAGE("Verify_ExcelWorksheetsIdentical: Failed with " & dataDifferencesCount & " data difference(s)", _
' "Verify_ExcelWorksheetsIdentical: has detected " & dataDifferencesCount & " data difference(s)" & _
' pStrExcelFile1Name & "(" & pIntExcelFile1WorksheetIndex & ")' and '" & _
' pStrExcelFile2Name & "(" & pIntExcelFile2WorksheetIndex & ")' are not same")
' Verify_ExcelWorksheetsIdentical = FAIL
' End If

End Function


'-----------------------------------------------------------------------------------------
' ATSD Temp Folder section
'-----------------------------------------------------------------------------------------
Function CreateATSDTempFolder()
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists(ATSD_TEMP_FOLDER) Then
fso.CreateFolder(ATSD_TEMP_FOLDER)
Reporter.Filter = rfEnableAll
Call Reporter.ReportEvent(micDone, _
"DeleteOldATSDTempFolder created a folder", _
"DeleteOldATSDTempFolder created a folder as '" & ATSD_TEMP_FOLDER & "'")
End If

Set fso = Nothing

End Function

Function DeleteOldATSDTempFolder()

Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")

'Look for files which are older than days old specified in ATSD_TEMP_FOLDER_DELETE_DAY and delete them.
Dim objFolder
Set objFolder = fso.GetFolder(ATSD_TEMP_FOLDER)
Dim objFiles
Set objFiles = objFolder.Files
Dim objFile
Dim blnNeedToDelete
blnNeedToDelete = false
For Each objFile in objFiles
If DateDiff("d", objFile.DateCreated, Date) > ATSD_TEMP_FOLDER_DELETE_DAY Then
blnNeedToDelete = True
objFile.Delete
End If
Next

If blnNeedToDelete Then
Call REPORT_MSG2("DeleteOldATSDTempFolder deleted all old files", "DeleteOldATSDTempFolder deleted all old files in '" & ATSD_TEMP_FOLDER & "'")
End If

Set fso = Nothing
Set objFolder = Nothing
Set objFiles = Nothing
Set objFile = Nothing

End Function

Function DeleteFile(pStrFile1Name)
'File existance check
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")

If Not fso.FileExists(pStrExcelFile1Name) Then
Call REPORT_FAILURE_NO_IMAGE("DeleteFile: File Not Found", _
"DeleteFile: Could not find '" & pStrExcelFile1Name & "'")
DeleteFile = FAIL
Set fso = Nothing
Exit Function
End If

fso.DeleteFile(pStrFile1Name)

Set fso = Nothing

End Function


Function File_Exist(filename)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
File_Exist = fso.FileExists(filename)
Set fso = Nothing
End Function

Function Verify_File_Exist(filename)
If File_Exist(filename) Then
Reporter.Filter = rfEnableAll
Reporter.ReportEvent micPass , _
"Verify_File_Exist", _
"File found: File name = '" & filename & "'"
Verify_File_Exist = PASS
Else
Reporter.Filter = rfEnableAll
Reporter.ReportEvent micFail, _
"Verify_File_Exist", _
"File Not Found: File name = '" & filename & "'"
Verify_File_Exist = FAIL
End If
End Function

Function Verify_File_NotFound(filename)
If File_Exist(filename) Then
Reporter.Filter = rfEnableAll
Reporter.ReportEvent micFail , _
"Verify_File_NotFound", _
"File found: File name = '" & filename & "'"
Verify_File_NotFound= FAIL
Else
Reporter.Filter = rfEnableAll
Reporter.ReportEvent micPass, _
"Verify_File_NotFound", _
"File Not Found: File name = '" & filename & "'"
Verify_File_NotFound= PASS
End If
End Function

Function Folder_Exist(folderName)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
Folder_Exist = fso.FolderExists(folderName)
Set fso = Nothing
End Function

Function DeleteFolder(pStrFolderName)
'Folder existance check
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")

If Not fso.FolderExists(pStrFolderName) Then
Call REPORT_FAILURE_NO_IMAGE("DeleteFolder: Folder Not Found", _
"DeleteFolder: Could not find '" & pStrFolderName & "'")
DeleteFolder = FAIL
Set fso = Nothing
Exit Function
End If

fso.DeleteFolder(pStrFolderName)

Set fso = Nothing

End Function

Function Verify_Folder_Exist(folderName)
If Folder_Exist(folderName) Then
Reporter.Filter = rfEnableAll
Reporter.ReportEvent micPass , _
"Verify_Folder_Exist", _
"Folder found: Folder name = '" & folderName & "'"
Verify_Folder_Exist = PASS
Else
Reporter.Filter = rfEnableAll
Reporter.ReportEvent micFail, _
"Verify_Folder_Exist", _
"Folder Not Found: Folder name = '" & folderName & "'"
Verify_Folder_Exist = FAIL
End If
End Function

Function Verify_Folder_NotFound(folderName)
If Folder_Exist(folderName) Then
Reporter.Filter = rfEnableAll
Reporter.ReportEvent micFail , _
"Verify_Folder_NotFound", _
"Folder found: Folder name = '" & folderName & "'"
Verify_Folder_NotFound= FAIL
Else
Reporter.Filter = rfEnableAll
Reporter.ReportEvent micPass, _
"Verify_Folder_NotFound", _
"Folder Not Found: Folder name = '" & folderName & "'"
Verify_Folder_NotFound= PASS
End If
End Function



'If pStrCommandPromptTitle is set, then use it.
'If not, use windir environmental variable
Function WaitWhileCommandPromptShown(pStrCommandPromptTitle)

Dim strTargetCommandPromptTitle_

If IsNull(pStrCommandPromptTitle) or pStrCommandPromptTitle = "" Then
'Get a title of command prompt window from environment variable
Dim oShell_, oWshProcessEnv_
Set oShell_ = CreateObject("WScript.Shell")
Set oWshProcessEnv_ = oShell_.Environment("process")

Dim strWinDir_
strWinDir_ = oWshProcessEnv_("windir")

Set oWshProcessEnv_ = Nothing
Set oShell_ = Nothing

'command prompt title string has to be escaped by \
' "C:\\WINDOWS\\system32\\cmd\.exe" ' If you use Windows XP
' "C:\\WINNT\\system32\\cmd\.exe" ' If you use Windows 2000
strTargetCommandPromptTitle_ = Replace(strWinDir_, "\", "\\") & "\\system32\\cmd\.exe"
Else
strTargetCommandPromptTitle_ = Replace(pStrCommandPromptTitle, "\", "\\")
End If

' need a solution to handle MS-DOS windows, line below does not work
Reporter.Filter = rfDisableAll
While Window("regexpwndtitle:=" & strTargetCommandPromptTitle_).Exist(WINDOW_EXIST_TIME_OUT)
Call wait(3)
Wend
End Function

Function OpenOldHTMLTAndE()
Dim url
'Max, 05/18: added "classic" since this is how you get to old T&E now
url = CORE_APPLICATION_URL & "?urlVer=3&task=classicTimeAndExpense"

Call Open_URL(url)

Set_Window 1

If Link_Exists(" Entry", 0) Then
Call Click_Link (" Entry", 0)
End if

OpenOldHTMLTAndE = PASS
End Function

'Call Set_Picker_Recipients("Select Recipients", 0, Array("chung, buu", "chung, gigi"))
'Call Set_Picker_Recipients("Select Recipients", 1, Array("Maranyan, Zemfira", "Olson, Mishelle"))

' Set_Picker_Recipients
' DESCRIPTION
' This function will set the recipients in a request in To (Unrestricted), To (Restricted), and CC
'
'PARAMETERS
' pStrPickerImageName --> either Select Recipients, or Select CC Recipients
' pIntIndex --> for To (Unrestricted), use Select Recipients with index 0, and for To (Restricted) use 1.
'
'Usage
' To set users in To (Unrestricted):
' Call Set_Picker_Recipients("Select Recipients", 0, Array("chung, buu", "face, smiley"))
'
' To set users in To (Restricted):
' Call Set_Picker_Recipients("Select Recipients", 1, Array("Toor, Sharan", "owner, resource"))
'
' To set users in CC:
' Call Set_Picker_Recipients("Select CC Recipients", 0, Array("Toor, Sharan", "owner, resource"))

Function Set_Picker_Recipients(pStrPickerImageName, pIntIndex, pArryRecipients)

Dim filterName

If Click_Image(pStrPickerImageName, pIntIndex) <> PASS then
Set_Picker_Recipients = FAIL
Call CaptureWindowImage("Set_Picker_Recipients Couldn't click image '" & pStrPickerImageName & "'")
Exit Function
End If

'Have to think about "All Project Owners"
If pStrPickerImageName = "Select CC Recipients" Then
filterName = "Active Users"
Else
filterName = "All Resource Pool Owners"
If not ComboBoxItem_Exists_ByDataName("ixn_pickMultiUser_filterEntry", 0, filterName) Then
filterName = "All Project Owners"
End If
End If

If Set_ComboBoxItem_ByName ("ixn_pickMultiUser_filterEntry", 0, filterName) = PASS Then
Call Click_Link("Find", 0)
If Link_Exists ("Show All", 0) Then
Call Click_Link ("Show All", 0)
End If
Call Click_DataLinks(pArryRecipients)
Call Click_Link("OK", 0)
Set_Picker_Recipients = PASS
Else
Set_Picker_Recipients = FAIL
End If

End Function 'The End Of Set_Picker_Recipients Function


'added by Alex 6/25/2007
' example: Checking_Free_Space_on_Hard_Drive (20, "c") -checks that free space on c: is more then 20 GB
' example: Checking_Free_Space_on_Hard_Drive (7.25, "D")
' function submits error:
' -if free space is less then minimum
' -if drive is other then hard drive
' -if drive is absent
' returns "PASS" or "FAIL"
Function Checking_Free_Space_on_Hard_Drive (pFreeSpaceMinimum, pHardDriveLetter)

Dim objFileSystem, objDriverSet, objHardDrive, objHardDriveInformation,_
FreeSpaceOnHardDriveInBytes, FreeSpaceOnHardDriveInGBs, doesDriveExist, HardDriveType

pHardDriveLetter=UCase(pHardDriveLetter)

Set objFileSystem = CreateObject("Scripting.FileSystemObject")
Set objDriverSet = objFileSystem.Drives

doesDriveExist=false
For Each objHardDrive in objDriverSet
If (pHardDriveLetter = objHardDrive.DriveLetter)Then
doesDriveExist=true
Exit For
End If
Next
If doesDriveExist=false Then
Call REPORT_FAILURE_NO_IMAGE("Checking free space on hard drive.", "Drive " & pHardDriveLetter & ": is not found!")
Checking_Free_Space_on_Hard_Drive = "FAIL"
Exit Function
End If

Set objHardDriveInformation = objFileSystem.GetDrive(pHardDriveLetter)
HardDriveType=objHardDriveInformation.DriveType
If (HardDriveType<>2) Then
Call REPORT_FAILURE_NO_IMAGE("Checking free space on hard drive.", pHardDriveLetter & ": is not hard drive!")
Checking_Free_Space_on_Hard_Drive = "FAIL"
Exit Function
End If

FreeSpaceOnHardDriveInBytes=objHardDriveInformation.FreeSpace
FreeSpaceOnHardDriveInGBs=Round(FreeSpaceOnHardDriveInBytes/(1024*1024*1024), 2)
If (FreeSpaceOnHardDriveInGBs < pFreeSpaceMinimum) Then
Call REPORT_FAILURE_NO_IMAGE("Checking free space on hard drive.", _
"Free space on " & pHardDriveLetter & ": is" & FreeSpaceOnHardDriveInGBs & "GB." & vbCr & "Must be more then " &pFreeSpaceMinimum & "GB")
Checking_Free_Space_on_Hard_Drive = "FAIL"
Exit Function
End If

Call REPORT_MSG2("Checking free space on hard drive.", _
"Free space on " & pHardDriveLetter & ": is" & FreeSpaceOnHardDriveInGBs & "GB." & vbCr & "Minimum free space is " & pFreeSpaceMinimum & "GB")
Checking_Free_Space_on_Hard_Drive = "PASS"

End Function