mirror of
https://github.com/copyrighttxt/watrbx-game-engine.git
synced 2026-09-04 20:57:49 +00:00
GEEKING
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="RobloxAndroidTest" default="help">
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
It contains the path to the SDK. It should *NOT* be checked into
|
||||
Version Control Systems. -->
|
||||
<property file="local.properties" />
|
||||
|
||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||
'android' tool to add properties to it.
|
||||
This is the place to change some Ant specific build properties.
|
||||
Here are some properties you may want to change/update:
|
||||
|
||||
source.dir
|
||||
The name of the source directory. Default is 'src'.
|
||||
out.dir
|
||||
The name of the output directory. Default is 'bin'.
|
||||
|
||||
For other overridable properties, look at the beginning of the rules
|
||||
files in the SDK, at tools/ant/build.xml
|
||||
|
||||
Properties related to the SDK location or the project target should
|
||||
be updated using the 'android' tool with the 'update' action.
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems.
|
||||
|
||||
-->
|
||||
<property file="ant.properties" />
|
||||
|
||||
<!-- if sdk.dir was not set from one of the property file, then
|
||||
get it from the ANDROID_HOME env var.
|
||||
This must be done before we load project.properties since
|
||||
the proguard config can use sdk.dir -->
|
||||
<property environment="env" />
|
||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
||||
<isset property="env.ANDROID_HOME" />
|
||||
</condition>
|
||||
|
||||
<!-- The project.properties file is created and updated by the 'android'
|
||||
tool, as well as ADT.
|
||||
|
||||
This contains project specific properties such as project target, and library
|
||||
dependencies. Lower level build properties are stored in ant.properties
|
||||
(or in .classpath for Eclipse projects).
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems. -->
|
||||
<loadproperties srcFile="project.properties" />
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
<!--
|
||||
Import per project custom build rules if present at the root of the project.
|
||||
This is the place to put custom intermediary targets such as:
|
||||
-pre-build
|
||||
-pre-compile
|
||||
-post-compile (This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||
-post-package
|
||||
-post-build
|
||||
-pre-clean
|
||||
-->
|
||||
<import file="custom_rules.xml" optional="true" />
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: VERSION_TAG -->
|
||||
<import file="${sdk.dir}/tools/ant/uibuild.xml" />
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,10 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must *NOT* be checked into Version Control Systems,
|
||||
# as it contains information specific to your local configuration.
|
||||
|
||||
# location of the SDK. This is only used by Ant
|
||||
# For customization when using a Version Control System, please read the
|
||||
# header note.
|
||||
sdk.dir=/usr/local/android/sdk/sdk
|
||||
@@ -0,0 +1,14 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system edit
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
#
|
||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-19
|
||||
@@ -0,0 +1,133 @@
|
||||
package wtf.watrbx.tests;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.android.uiautomator.core.UiDevice;
|
||||
import com.android.uiautomator.core.UiObject;
|
||||
import com.android.uiautomator.core.UiObjectNotFoundException;
|
||||
import com.android.uiautomator.core.UiScrollable;
|
||||
import com.android.uiautomator.core.UiSelector;
|
||||
import com.android.uiautomator.testrunner.UiAutomatorTestCase;
|
||||
|
||||
/**
|
||||
* Created by mcritelli on 9/17/14.
|
||||
*/
|
||||
public class StandardLoginAndLaunchTest extends UiAutomatorTestCase {
|
||||
|
||||
// Open the app
|
||||
public void testOpenApp() throws UiObjectNotFoundException {
|
||||
// Return to the home screen
|
||||
getUiDevice().pressHome();
|
||||
|
||||
|
||||
// Press the App button
|
||||
UiObject applications = new UiObject(new UiSelector().description("Applications"));
|
||||
if (!applications.exists())
|
||||
applications = new UiObject(new UiSelector().description("Apps"));
|
||||
|
||||
applications.clickAndWaitForNewWindow();
|
||||
|
||||
// Get reference to app page
|
||||
UiScrollable appPage = new UiScrollable(new UiSelector().className("android.view.View").scrollable(true));
|
||||
|
||||
// Set scrolling direction
|
||||
appPage.setAsHorizontalList();
|
||||
|
||||
// Test to see if Roblox app is on this page
|
||||
UiObject robloxApp = appPage.getChildByText(new UiSelector().className(android.widget.TextView.class.getName()), "ROBLOX", true);
|
||||
|
||||
if (robloxApp.exists())
|
||||
robloxApp.clickAndWaitForNewWindow();
|
||||
}
|
||||
|
||||
public void testLogin() throws UiObjectNotFoundException {
|
||||
UiDevice device = getUiDevice();
|
||||
|
||||
UiObject spinnerEnvironemnt = new UiObject(new UiSelector().resourceId("wtf.watrbx.client:id/spinner_environment"));
|
||||
spinnerEnvironemnt.getChild(new UiSelector().resourceId("android:id/text1"));
|
||||
|
||||
String env = getParams().getString("environment", "www.gametest2.robloxlabs.com/");
|
||||
new UiScrollable(new UiSelector().scrollable(true)).scrollIntoView(new UiSelector().text(env));
|
||||
new UiObject(new UiSelector().text(env)).click();
|
||||
|
||||
String username = getParams().getString("username", "mobiletest");
|
||||
String password = getParams().getString("password", "hackproof12");
|
||||
|
||||
UiObject tvUsername = new UiObject(new UiSelector().resourceId("wtf.watrbx.client:id/username"));
|
||||
//UiObject tvUsername = new UiObject(new UiSelector().className("android.widget.EditText").index(1));
|
||||
tvUsername.setText(username);
|
||||
sleep(2000);
|
||||
// Press back button to close the keyboard
|
||||
device.pressBack();
|
||||
sleep(1000);
|
||||
UiObject tvPassword = new UiObject(new UiSelector().resourceId("wtf.watrbx.client:id/password"));
|
||||
//UiObject tvPassword = new UiObject(new UiSelector().className("android.widget.EditText").index(2));
|
||||
tvPassword.setText(password);
|
||||
device.pressBack();
|
||||
sleep(2000);
|
||||
|
||||
UiObject btnLogin = new UiObject(new UiSelector().resourceId("wtf.watrbx.client:id/login"));
|
||||
btnLogin.click();
|
||||
|
||||
// If we logged in properly, this TextView should exist
|
||||
UiObject usernameTextView = new UiObject(new UiSelector().resourceId("wtf.watrbx.client:id/username_textview"));
|
||||
assertTrue("Login successful?", usernameTextView.exists());
|
||||
}
|
||||
|
||||
// Open each WebView in the app and save a screenshot to our device
|
||||
public void testScreenshotAllWebViews() throws UiObjectNotFoundException {
|
||||
UiDevice device = getUiDevice();
|
||||
|
||||
OpenAndScreenshot(device, "wtf.watrbx.client:id/catalog", "catalog.png");
|
||||
|
||||
// Return to grid screen
|
||||
UiObject btnGrid = new UiObject(new UiSelector().resourceId("wtf.watrbx.client:id/webview_grid"));
|
||||
btnGrid.click();
|
||||
|
||||
OpenAndScreenshot(device, "wtf.watrbx.client:id/inventory", "inventory.png");
|
||||
btnGrid.click();
|
||||
|
||||
OpenAndScreenshot(device, "wtf.watrbx.client:id/builders_club", "builders_club.png");
|
||||
btnGrid.click();
|
||||
|
||||
OpenAndScreenshot(device, "wtf.watrbx.client:id/profile", "profile.png");
|
||||
btnGrid.click();
|
||||
|
||||
OpenAndScreenshot(device, "wtf.watrbx.client:id/messages", "messages.png");
|
||||
btnGrid.click();
|
||||
|
||||
OpenAndScreenshot(device, "wtf.watrbx.client:id/groups", "groups.png");
|
||||
btnGrid.click();
|
||||
}
|
||||
|
||||
public void OpenAndScreenshot(UiDevice device, String resourceId, String Filename) throws UiObjectNotFoundException
|
||||
{
|
||||
UiObject currentButton = new UiObject(new UiSelector().resourceId(resourceId));
|
||||
currentButton.click();
|
||||
sleep(5000);
|
||||
device.click(10, 10);
|
||||
sleep(1500);
|
||||
device.takeScreenshot(new File("/sdcard/roblox/" + Filename));
|
||||
}
|
||||
|
||||
public void testLaunchGame() throws UiObjectNotFoundException {
|
||||
UiDevice device = getUiDevice();
|
||||
|
||||
UiObject tvPlacedId = new UiObject(new UiSelector().resourceId("wtf.watrbx.client:id/editTextPlaceID"));
|
||||
tvPlacedId.setText("70381591");
|
||||
device.pressBack();
|
||||
|
||||
UiObject btnLaunchPlace = new UiObject(new UiSelector().resourceId("wtf.watrbx.client:id/buttonLaunchPlace"));
|
||||
btnLaunchPlace.click();
|
||||
|
||||
sleep(5000);
|
||||
|
||||
device.click(10,200);
|
||||
|
||||
// Click chat button
|
||||
sleep(15000);
|
||||
device.click(236, 30);
|
||||
new UiObject(new UiSelector().resourceId("wtf.watrbx.client:id/gl_edit_text")).setText("The test is complete.");
|
||||
device.click(2368,1205);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user