public API_WebScarab()
		{
			config("WebScarab", "WebScarab 2010-08-20", "webscarab-one-20100820-1632.jar");			
    		Install_Uri = "http://dawes.za.net/rogan/webscarab/webscarab-one-20100820-1632.jar".uri();    		    		
    		WebScarab_Jar = Install_Dir.pathCombine(Install_File);
    		InputSimulator = new API_InputSimulator();   
    		install();
		}
示例#2
0
    	public string loginAsTestUser()
    	{
    		string testUserName = "******";
    		string testPassword = "******";
    		
    		var inputSimulator = new API_InputSimulator();
    		var form = openForm();    	
			
			//get Gui and click on the "User details" link
			
    		var wpfGui = form.control("WPF_GUI",true);
    		var o2TwitterApi = wpfGui.Tag;
    		Assert.That(o2TwitterApi.typeName() == "O2TwitterAPI","wpfGui tag object was not of type O2TwitterAPI");
    		Assert.That(o2TwitterApi.prop("IsLoggedIn").str() == "False" , "We should be logged out at this stage");
    		
    		var link = ((List<WPF.Button>)wpfGui.prop("Links")).name("User details");
    		Assert.That(link.notNull(),"Could not get the requested link object");    		
    		    		
    		inputSimulator.mouse_MoveTo_Wpf(link).click();    		
    		form.sleep(1000);
    		
    		// get the winFormPanel
    		var winFormPanel = (Panel)wpfGui.prop("WinFormPanel");
    		Assert.That(winFormPanel.notNull(), "Could not get the WinFormPanel control from the WinGui");
    		
    		// Populate username and password textboxes
    		var textBoxes = winFormPanel.controls<TextBox>(true);    		
    		TextBox usernameTextBox = null;
    		TextBox passwordTextBox = null;
    		foreach(var textBox in textBoxes)
    		{
    			if (textBox.Tag.str() == "username")
    			 	usernameTextBox = textBox;    				
    			if (textBox.Tag.str() == "password")
    				passwordTextBox = textBox;
    		}
    		Assert.That(usernameTextBox.notNull(), "Could not get the username TextBox");
    		Assert.That(passwordTextBox.notNull(), "Could not get the password TextBox");
    		
    		inputSimulator.mouse_MoveTo(usernameTextBox);
    		usernameTextBox.set_Text(testUserName);
    		inputSimulator.mouse_MoveTo(passwordTextBox);
    		passwordTextBox.set_Text(testPassword);    		
    		
    		//get the login button
    		var LoginButton = winFormPanel.button("Login");
    		inputSimulator.mouse_MoveTo(LoginButton);
    		inputSimulator.mouse_Click();
    		form.sleep(500);
    		Application.DoEvents();
    		form.sleep(3000);
    		Assert.That(o2TwitterApi.prop("IsLoggedIn").str() == "True" , "We should be logged in at this stage");
    		closeForm(form);
    		return "ok";
    	}
    	public string writeText()
    	{
    		var dynamicText = "this is a Dynamic Text";
    		
 			var form = openForm();
 			var inputSimulator = new API_InputSimulator();
 			 			
 			inputSimulator.mouse_MoveTo(form);
 			inputSimulator.mouse_Click();
			inputSimulator.text_Send(dynamicText); 			
			var richTextBox = form.controls<RichTextBox>();
			
			Application.DoEvents();
			form.sleep(500);
			var currentText = richTextBox.get_Text();
			"current Text: {0}".info(currentText);
			Assert.That (currentText == dynamicText, "currentText != dynamicText: {0} != {1}".format(currentText,dynamicText)); 			
 			form.sleep(1000); 			 			
 			closeForm(form);
 			
			
			return "ok";    								  
    	}