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:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,499 @@
|
||||
var webTimeout = 4;
|
||||
var loginTimeout = 5;
|
||||
var gameTimeout = 10;
|
||||
|
||||
var target = UIATarget.localTarget();
|
||||
var webView = target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0];
|
||||
var app = target.frontMostApp();
|
||||
var window = app.mainWindow();
|
||||
var innerWindow = window.scrollViews();
|
||||
|
||||
//Initial screen elements
|
||||
var wheel = target.frontMostApp().mainWindow().pickers()[0].wheels()[0]; //picker wheel
|
||||
var loginButton = target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"];
|
||||
var aboutButtoniPad = target.frontMostApp().mainWindow().scrollViews()[0].buttons()[4]; //for iPad
|
||||
var nameField = target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0];
|
||||
var passwordField = target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0];
|
||||
|
||||
function login(username, password)
|
||||
{
|
||||
if (loginButton.isValid())
|
||||
{
|
||||
UIALogger.logMessage("Setting username as '" + username + "'");
|
||||
innerWindow[0].textFields()[0].setValue(username);
|
||||
UIALogger.logMessage("Setting password as '" + password + "'");
|
||||
innerWindow[0].secureTextFields()[0].setValue(password);
|
||||
loginButton.tap();
|
||||
}
|
||||
}
|
||||
|
||||
function handleCookieConstraint(wv)
|
||||
{
|
||||
if (wv.staticTexts()["The site is currently offline for maintenance and upgrades. Please check back soon!"].isValid())
|
||||
{
|
||||
wv.secureTextFields()[0].tap();
|
||||
app.keyboard().typeString("rewards");
|
||||
wv.buttons()["O"].tap();
|
||||
}
|
||||
}
|
||||
|
||||
function verifyWebViewStaticText(textToVerify)
|
||||
{
|
||||
var wv = target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0];
|
||||
handleCookieConstraint(wv);
|
||||
|
||||
if (wv.staticTexts()[textToVerify].isValid())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function verifyWebViewLink(textToVerify)
|
||||
{
|
||||
var wv = target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0];
|
||||
handleCookieConstraint(wv);
|
||||
|
||||
if (wv.links()[textToVerify].isValid())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function startTest(testName)
|
||||
{
|
||||
UIALogger.logStart(testName);
|
||||
UIALogger.logMessage("##teamcity[testStarted name='" + testName + "']");
|
||||
}
|
||||
|
||||
function failTest(testName, message, details)
|
||||
{
|
||||
if (!testName)
|
||||
{
|
||||
UIALogger.logMessage("ERROR: Test name not provided!");
|
||||
return;
|
||||
}
|
||||
if (!details)
|
||||
details = "No additional details provided.";
|
||||
if (!message)
|
||||
message = testName + "failed for unspecified reason.";
|
||||
|
||||
UIALogger.logFail(testName);
|
||||
UIALogger.logMessage("##teamcity[testFailed name='" + testName + "' message='" + message + "' details='" + details +"']");
|
||||
UIALogger.logMessage("##teamcity[testFinished name='" + testName + "']");
|
||||
}
|
||||
|
||||
function passTest(testName)
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
UIALogger.logMessage("##teamcity[testFinished name='" + testName + "']");
|
||||
}
|
||||
|
||||
function resetVars()
|
||||
{
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
}
|
||||
|
||||
|
||||
//UIALogger.logMessage("Version: " + window.scrollViews()[0].staticTexts()[4].label());
|
||||
|
||||
var versionNumber = window.scrollViews()[0].staticTexts()[4].label();
|
||||
// Start test suite for this version
|
||||
UIALogger.logMessage("##teamcity[testSuiteStarted name='Smoke Test for v" + versionNumber + "']");
|
||||
|
||||
|
||||
// Select the test environment (GT1)
|
||||
wheel.selectValue("http://www.gametest1.pizzaboxer.fun/");
|
||||
UIALogger.logMessage("Test Environment: " + wheel.value());
|
||||
|
||||
|
||||
var testName = "Open About Page";
|
||||
startTest(testName);
|
||||
aboutButtoniPad.tap();
|
||||
var navBar = app.navigationBar();
|
||||
|
||||
if (navBar.name() == "About")
|
||||
passTest(testName);
|
||||
else
|
||||
failTest(testName, "About Page failed to open.");
|
||||
|
||||
// Close About page
|
||||
testName = "Close About Page";
|
||||
startTest(testName);
|
||||
navBar.buttons()["Close"].tap()
|
||||
target.delay(1);
|
||||
|
||||
if (window.scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
passTest(testName);
|
||||
else
|
||||
failTest(testName, "About Page failed to close.");
|
||||
|
||||
|
||||
|
||||
/*****************************************/
|
||||
/* Begin Login Test */
|
||||
|
||||
// Attempt to login to the game
|
||||
testName = "Login Test";
|
||||
startTest(testName);
|
||||
|
||||
login("mobiletest", "hackproof12");
|
||||
target.delay(loginTimeout);
|
||||
|
||||
if (!window.scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
passTest(testName);
|
||||
else
|
||||
failTest(testName, "Game failed to log in.");
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
/*****************************************/
|
||||
/* Begin Catalog Page Test */
|
||||
|
||||
// Open the Catalog page
|
||||
testName = "Open Catalog Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Catalog"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest
|
||||
(testName, "Failed to open Catalog screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewLink("Catalog"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Catalog web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
/* End Catalog Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Inventory Page Test */
|
||||
|
||||
// Open the Inventory page
|
||||
testName = "Open Inventory Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Inventory"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Inventory screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewStaticText("Character Customizer"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Inventory web page.");
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Inventory Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Builders Club Page Test */
|
||||
|
||||
// Open the Builders Club page
|
||||
testName = "Open Builders Club Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Builders Club"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Builders Club screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewStaticText("UPGRADE"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Builders Club web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Builders Club Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Profile Page Test */
|
||||
|
||||
// Open the Inventory page
|
||||
testName = "Open Profile Page";
|
||||
startTest(testName);
|
||||
|
||||
// Why is this button named 'Crossroads'?
|
||||
// Good question!
|
||||
window.buttons()["Crossroads"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Profile screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewStaticText("Your Profile"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Profile web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Profile Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Messages Page Test */
|
||||
|
||||
// Open the Messages page
|
||||
testName = "Open Messages Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Messages"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Messages screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewStaticText("Inbox"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Messages web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Messages Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Groups Page Test */
|
||||
|
||||
// Open the Groups page
|
||||
testName = "Open Groups Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Groups"].tap();
|
||||
target.delay(5);
|
||||
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Groups screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewStaticText("Only Builders Club Members can create a new group. Receive all of the benefits of Builders Club by signing up"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Groups web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Groups Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Game Launching Test */
|
||||
// We verify a game has launched by the presence of the keyboard -
|
||||
// if the launch was successful, we should be able to tap the Chat button,
|
||||
// which opens the keyboard
|
||||
|
||||
testName = "Game Launching";
|
||||
startTest(testName);
|
||||
|
||||
// Launch game - 81501804 is 'Test Place'
|
||||
window.textFields()[2].setValue("81501804");
|
||||
window.buttons()["Place Launch"].tap();
|
||||
|
||||
cnt = 0;
|
||||
while (cnt <= gameTimeout)
|
||||
{
|
||||
// Tap where the Chat button should be
|
||||
window.images()[0].images()[0].tapWithOptions({tapOffset:{x:0.12, y:0.03}});
|
||||
|
||||
if (app.keyboard().isValid())
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= gameTimeout)
|
||||
failTest(testName, "Game failed to launch - keyboard did not open.")
|
||||
|
||||
//Waiting 25 sec for game to launch
|
||||
//target.delay(25);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
//Type a verification message
|
||||
target.delay(1);
|
||||
target.frontMostApp().keyboard().typeString("The test is over.\n");
|
||||
target.delay(5);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
UIALogger.logMessage("##teamcity[testSuiteFinished name='Smoke Test for v" + versionNumber + "']");
|
||||
@@ -0,0 +1,499 @@
|
||||
var webTimeout = 4;
|
||||
var loginTimeout = 5;
|
||||
var gameTimeout = 10;
|
||||
|
||||
var target = UIATarget.localTarget();
|
||||
var webView = target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0];
|
||||
var app = target.frontMostApp();
|
||||
var window = app.mainWindow();
|
||||
var innerWindow = window.scrollViews();
|
||||
|
||||
//Initial screen elements
|
||||
var wheel = target.frontMostApp().mainWindow().pickers()[0].wheels()[0]; //picker wheel
|
||||
var loginButton = target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"];
|
||||
var aboutButtoniPad = target.frontMostApp().mainWindow().scrollViews()[0].buttons()[4]; //for iPad
|
||||
var nameField = target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0];
|
||||
var passwordField = target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0];
|
||||
|
||||
function login(username, password)
|
||||
{
|
||||
if (loginButton.isValid())
|
||||
{
|
||||
UIALogger.logMessage("Setting username as '" + username + "'");
|
||||
innerWindow[0].textFields()[0].setValue(username);
|
||||
UIALogger.logMessage("Setting password as '" + password + "'");
|
||||
innerWindow[0].secureTextFields()[0].setValue(password);
|
||||
loginButton.tap();
|
||||
}
|
||||
}
|
||||
|
||||
function handleCookieConstraint(wv)
|
||||
{
|
||||
if (wv.staticTexts()["The site is currently offline for maintenance and upgrades. Please check back soon!"].isValid())
|
||||
{
|
||||
wv.secureTextFields()[0].tap();
|
||||
app.keyboard().typeString("rewards");
|
||||
wv.buttons()["O"].tap();
|
||||
}
|
||||
}
|
||||
|
||||
function verifyWebViewStaticText(textToVerify)
|
||||
{
|
||||
var wv = target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0];
|
||||
handleCookieConstraint(wv);
|
||||
|
||||
if (wv.staticTexts()[textToVerify].isValid())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function verifyWebViewLink(textToVerify)
|
||||
{
|
||||
var wv = target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0];
|
||||
handleCookieConstraint(wv);
|
||||
|
||||
if (wv.links()[textToVerify].isValid())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function startTest(testName)
|
||||
{
|
||||
UIALogger.logStart(testName);
|
||||
UIALogger.logMessage("##teamcity[testStarted name='" + testName + "']");
|
||||
}
|
||||
|
||||
function failTest(testName, message, details)
|
||||
{
|
||||
if (!testName)
|
||||
{
|
||||
UIALogger.logMessage("ERROR: Test name not provided!");
|
||||
return;
|
||||
}
|
||||
if (!details)
|
||||
details = "No additional details provided.";
|
||||
if (!message)
|
||||
message = testName + "failed for unspecified reason.";
|
||||
|
||||
UIALogger.logFail(testName);
|
||||
UIALogger.logMessage("##teamcity[testFailed name='" + testName + "' message='" + message + "' details='" + details +"']");
|
||||
UIALogger.logMessage("##teamcity[testFinished name='" + testName + "']");
|
||||
}
|
||||
|
||||
function passTest(testName)
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
UIALogger.logMessage("##teamcity[testFinished name='" + testName + "']");
|
||||
}
|
||||
|
||||
function resetVars()
|
||||
{
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
}
|
||||
|
||||
|
||||
//UIALogger.logMessage("Version: " + window.scrollViews()[0].staticTexts()[4].label());
|
||||
|
||||
var versionNumber = window.scrollViews()[0].staticTexts()[4].label();
|
||||
// Start test suite for this version
|
||||
UIALogger.logMessage("##teamcity[testSuiteStarted name='Smoke Test for v" + versionNumber + "']");
|
||||
|
||||
|
||||
// Select the test environment (GT1)
|
||||
wheel.selectValue("http://www.gametest2.pizzaboxer.fun/");
|
||||
UIALogger.logMessage("Test Environment: " + wheel.value());
|
||||
|
||||
|
||||
var testName = "Open About Page";
|
||||
startTest(testName);
|
||||
aboutButtoniPad.tap();
|
||||
var navBar = app.navigationBar();
|
||||
|
||||
if (navBar.name() == "About")
|
||||
passTest(testName);
|
||||
else
|
||||
failTest(testName, "About Page failed to open.");
|
||||
|
||||
// Close About page
|
||||
testName = "Close About Page";
|
||||
startTest(testName);
|
||||
navBar.buttons()["Close"].tap()
|
||||
target.delay(1);
|
||||
|
||||
if (window.scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
passTest(testName);
|
||||
else
|
||||
failTest(testName, "About Page failed to close.");
|
||||
|
||||
|
||||
|
||||
/*****************************************/
|
||||
/* Begin Login Test */
|
||||
|
||||
// Attempt to login to the game
|
||||
testName = "Login Test";
|
||||
startTest(testName);
|
||||
|
||||
login("mobiletest", "hackproof12");
|
||||
target.delay(loginTimeout);
|
||||
|
||||
if (!window.scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
passTest(testName);
|
||||
else
|
||||
failTest(testName, "Game failed to log in.");
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
/*****************************************/
|
||||
/* Begin Catalog Page Test */
|
||||
|
||||
// Open the Catalog page
|
||||
testName = "Open Catalog Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Catalog"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest
|
||||
(testName, "Failed to open Catalog screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewLink("Catalog"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Catalog web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
/* End Catalog Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Inventory Page Test */
|
||||
|
||||
// Open the Inventory page
|
||||
testName = "Open Inventory Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Inventory"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Inventory screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewStaticText("Character Customizer"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Inventory web page.");
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Inventory Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Builders Club Page Test */
|
||||
|
||||
// Open the Builders Club page
|
||||
testName = "Open Builders Club Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Builders Club"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Builders Club screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewStaticText("UPGRADE"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Builders Club web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Builders Club Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Profile Page Test */
|
||||
|
||||
// Open the Inventory page
|
||||
testName = "Open Profile Page";
|
||||
startTest(testName);
|
||||
|
||||
// Why is this button named 'Crossroads'?
|
||||
// Good question!
|
||||
window.buttons()["Crossroads"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Profile screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewStaticText("Your Profile"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Profile web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Profile Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Messages Page Test */
|
||||
|
||||
// Open the Messages page
|
||||
testName = "Open Messages Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Messages"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Messages screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewStaticText("Inbox"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Messages web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Messages Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Groups Page Test */
|
||||
|
||||
// Open the Groups page
|
||||
testName = "Open Groups Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Groups"].tap();
|
||||
target.delay(5);
|
||||
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Groups screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewStaticText("Only Builders Club Members can create a new group. Receive all of the benefits of Builders Club by signing up"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Groups web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Groups Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Game Launching Test */
|
||||
// We verify a game has launched by the presence of the keyboard -
|
||||
// if the launch was successful, we should be able to tap the Chat button,
|
||||
// which opens the keyboard
|
||||
|
||||
testName = "Game Launching";
|
||||
startTest(testName);
|
||||
|
||||
// Launch game - 70353322 is 'Test Place'
|
||||
window.textFields()[2].setValue("70353322");
|
||||
window.buttons()["Place Launch"].tap();
|
||||
|
||||
cnt = 0;
|
||||
while (cnt <= gameTimeout)
|
||||
{
|
||||
// Tap where the Chat button should be
|
||||
window.images()[0].images()[0].tapWithOptions({tapOffset:{x:0.12, y:0.03}});
|
||||
|
||||
if (app.keyboard().isValid())
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= gameTimeout)
|
||||
failTest(testName, "Game failed to launch - keyboard did not open.")
|
||||
|
||||
//Waiting 25 sec for game to launch
|
||||
//target.delay(25);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
//Type a verification message
|
||||
target.delay(1);
|
||||
target.frontMostApp().keyboard().typeString("The test is over.\n");
|
||||
target.delay(5);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
UIALogger.logMessage("##teamcity[testSuiteFinished name='Smoke Test for v" + versionNumber + "']");
|
||||
@@ -0,0 +1,501 @@
|
||||
var webTimeout = 4;
|
||||
var loginTimeout = 5;
|
||||
var gameTimeout = 10;
|
||||
|
||||
var target = UIATarget.localTarget();
|
||||
var webView = target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0];
|
||||
var app = target.frontMostApp();
|
||||
var window = app.mainWindow();
|
||||
var innerWindow = window.scrollViews();
|
||||
|
||||
//Initial screen elements
|
||||
var wheel = target.frontMostApp().mainWindow().pickers()[0].wheels()[0]; //picker wheel
|
||||
var loginButton = target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"];
|
||||
var aboutButtoniPad = target.frontMostApp().mainWindow().scrollViews()[0].buttons()[4]; //for iPad
|
||||
var nameField = target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0];
|
||||
var passwordField = target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0];
|
||||
|
||||
function login(username, password)
|
||||
{
|
||||
if (loginButton.isValid())
|
||||
{
|
||||
UIALogger.logMessage("Setting username as '" + username + "'");
|
||||
innerWindow[0].textFields()[0].setValue(username);
|
||||
UIALogger.logMessage("Setting password as '" + password + "'");
|
||||
innerWindow[0].secureTextFields()[0].setValue(password);
|
||||
loginButton.tap();
|
||||
}
|
||||
}
|
||||
|
||||
function handleCookieConstraint(wv)
|
||||
{
|
||||
if (wv.staticTexts()["The site is currently offline for maintenance and upgrades. Please check back soon!"].isValid())
|
||||
{
|
||||
wv.secureTextFields()[0].tap();
|
||||
app.keyboard().typeString("rewards");
|
||||
wv.buttons()["O"].tap();
|
||||
}
|
||||
}
|
||||
|
||||
function verifyWebViewStaticText(textToVerify)
|
||||
{
|
||||
var wv = target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0];
|
||||
handleCookieConstraint(wv);
|
||||
|
||||
if (wv.staticTexts()[textToVerify].isValid())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function verifyWebViewLink(textToVerify)
|
||||
{
|
||||
var wv = target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0];
|
||||
handleCookieConstraint(wv);
|
||||
|
||||
if (wv.links()[textToVerify].isValid())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function startTest(testName)
|
||||
{
|
||||
UIALogger.logStart(testName);
|
||||
UIALogger.logMessage("##teamcity[testStarted name='" + testName + "']");
|
||||
}
|
||||
|
||||
function failTest(testName, message, details)
|
||||
{
|
||||
if (!testName)
|
||||
{
|
||||
UIALogger.logMessage("ERROR: Test name not provided!");
|
||||
return;
|
||||
}
|
||||
if (!details)
|
||||
details = "No additional details provided.";
|
||||
if (!message)
|
||||
message = testName + "failed for unspecified reason.";
|
||||
|
||||
UIALogger.logFail(testName);
|
||||
UIALogger.logMessage("##teamcity[testFailed name='" + testName + "' message='" + message + "' details='" + details +"']");
|
||||
UIALogger.logMessage("##teamcity[testFinished name='" + testName + "']");
|
||||
}
|
||||
|
||||
function passTest(testName)
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
UIALogger.logMessage("##teamcity[testFinished name='" + testName + "']");
|
||||
}
|
||||
|
||||
function resetVars()
|
||||
{
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
}
|
||||
|
||||
|
||||
//UIALogger.logMessage("Version: " + window.scrollViews()[0].staticTexts()[4].label());
|
||||
|
||||
var versionNumber = window.scrollViews()[0].staticTexts()[4].label();
|
||||
// Start test suite for this version
|
||||
UIALogger.logMessage("##teamcity[testSuiteStarted name='Smoke Test for v" + versionNumber + "']");
|
||||
|
||||
|
||||
// Select the test environment (GT1)
|
||||
wheel.selectValue("http://www.watrbx.wtf/");
|
||||
UIALogger.logMessage("Test Environment: " + wheel.value());
|
||||
|
||||
|
||||
var testName = "Open About Page";
|
||||
startTest(testName);
|
||||
aboutButtoniPad.tap();
|
||||
var navBar = app.navigationBar();
|
||||
|
||||
if (navBar.name() == "About")
|
||||
passTest(testName);
|
||||
else
|
||||
failTest(testName, "About Page failed to open.");
|
||||
|
||||
// Close About page
|
||||
testName = "Close About Page";
|
||||
startTest(testName);
|
||||
navBar.buttons()["Close"].tap()
|
||||
target.delay(1);
|
||||
|
||||
if (window.scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
passTest(testName);
|
||||
else
|
||||
failTest(testName, "About Page failed to close.");
|
||||
|
||||
|
||||
|
||||
/*****************************************/
|
||||
/* Begin Login Test */
|
||||
|
||||
// Attempt to login to the game
|
||||
testName = "Login Test";
|
||||
startTest(testName);
|
||||
|
||||
login("usertest01", "hackproof");
|
||||
target.delay(loginTimeout);
|
||||
|
||||
if (!window.scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
passTest(testName);
|
||||
else
|
||||
failTest(testName, "Game failed to log in.");
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
/*****************************************/
|
||||
/* Begin Catalog Page Test */
|
||||
|
||||
// Open the Catalog page
|
||||
testName = "Open Catalog Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Catalog"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest
|
||||
(testName, "Failed to open Catalog screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewLink("Catalog"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Catalog web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
/* End Catalog Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Inventory Page Test */
|
||||
|
||||
// Open the Inventory page
|
||||
testName = "Open Inventory Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Inventory"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Inventory screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewStaticText("Character Customizer"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Inventory web page.");
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Inventory Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Builders Club Page Test */
|
||||
|
||||
// Open the Builders Club page
|
||||
testName = "Open Builders Club Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Builders Club"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Builders Club screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewStaticText("UPGRADE"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Builders Club web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Builders Club Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Profile Page Test */
|
||||
|
||||
// Open the Inventory page
|
||||
testName = "Open Profile Page";
|
||||
startTest(testName);
|
||||
|
||||
// Why is this button named 'Crossroads'?
|
||||
// Good question!
|
||||
window.buttons()["Crossroads"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Profile screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewStaticText("Your Profile"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Profile web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Profile Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Messages Page Test */
|
||||
|
||||
// Open the Messages page
|
||||
testName = "Open Messages Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Messages"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Messages screen.");
|
||||
|
||||
//target.logElementTree();
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewLink("Inbox"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Messages web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Messages Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Groups Page Test */
|
||||
|
||||
// Open the Groups page
|
||||
testName = "Open Groups Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Groups"].tap();
|
||||
target.delay(5);
|
||||
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Groups screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewStaticText("Join a Group"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Groups web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Groups Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Game Launching Test */
|
||||
// We verify a game has launched by the presence of the keyboard -
|
||||
// if the launch was successful, we should be able to tap the Chat button,
|
||||
// which opens the keyboard
|
||||
|
||||
testName = "Game Launching";
|
||||
startTest(testName);
|
||||
|
||||
// Launch game - 122235601 is 'Test Place #1'
|
||||
window.textFields()[2].setValue("122235601");
|
||||
window.buttons()["Place Launch"].tap();
|
||||
|
||||
cnt = 0;
|
||||
while (cnt <= gameTimeout)
|
||||
{
|
||||
// Tap where the Chat button should be
|
||||
window.images()[0].images()[0].tapWithOptions({tapOffset:{x:0.12, y:0.03}});
|
||||
|
||||
if (app.keyboard().isValid())
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= gameTimeout)
|
||||
failTest(testName, "Game failed to launch - keyboard did not open.")
|
||||
|
||||
//Waiting 25 sec for game to launch
|
||||
//target.delay(25);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
//Type a verification message
|
||||
target.delay(1);
|
||||
target.frontMostApp().keyboard().typeString("The test is over.\n");
|
||||
target.delay(5);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
UIALogger.logMessage("##teamcity[testSuiteFinished name='Smoke Test for v" + versionNumber + "']");
|
||||
@@ -0,0 +1,504 @@
|
||||
var webTimeout = 4;
|
||||
var loginTimeout = 5;
|
||||
var gameTimeout = 10;
|
||||
|
||||
var target = UIATarget.localTarget();
|
||||
var webView = target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0];
|
||||
var app = target.frontMostApp();
|
||||
var window = app.mainWindow();
|
||||
var innerWindow = window.scrollViews();
|
||||
|
||||
//Initial screen elements
|
||||
var wheel = target.frontMostApp().mainWindow().pickers()[0].wheels()[0]; //picker wheel
|
||||
var loginButton = target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"];
|
||||
var aboutButtoniPad = target.frontMostApp().mainWindow().scrollViews()[0].buttons()[4]; //for iPad
|
||||
var nameField = target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0];
|
||||
var passwordField = target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0];
|
||||
|
||||
function login(username, password)
|
||||
{
|
||||
if (loginButton.isValid())
|
||||
{
|
||||
UIALogger.logMessage("Setting username as '" + username + "'");
|
||||
innerWindow[0].textFields()[0].setValue(username);
|
||||
UIALogger.logMessage("Setting password as '" + password + "'");
|
||||
innerWindow[0].secureTextFields()[0].setValue(password);
|
||||
loginButton.tap();
|
||||
}
|
||||
}
|
||||
|
||||
function handleCookieConstraint(wv)
|
||||
{
|
||||
if (wv.staticTexts()["The site is currently offline for maintenance and upgrades. Please check back soon!"].isValid())
|
||||
{
|
||||
wv.secureTextFields()[0].tap();
|
||||
app.keyboard().typeString("rewards");
|
||||
wv.buttons()["O"].tap();
|
||||
}
|
||||
}
|
||||
|
||||
function verifyWebViewStaticText(textToVerify)
|
||||
{
|
||||
var wv = target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0];
|
||||
handleCookieConstraint(wv);
|
||||
|
||||
if (wv.staticTexts()[textToVerify].isValid())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function verifyWebViewLink(textToVerify)
|
||||
{
|
||||
var wv = target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0];
|
||||
handleCookieConstraint(wv);
|
||||
|
||||
if (wv.links()[textToVerify].isValid())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function startTest(testName)
|
||||
{
|
||||
UIALogger.logStart(testName);
|
||||
UIALogger.logMessage("##teamcity[testStarted name='" + testName + "']");
|
||||
}
|
||||
|
||||
function failTest(testName, message, details)
|
||||
{
|
||||
if (!testName)
|
||||
{
|
||||
UIALogger.logMessage("ERROR: Test name not provided!");
|
||||
return;
|
||||
}
|
||||
if (!details)
|
||||
details = "No additional details provided.";
|
||||
if (!message)
|
||||
message = testName + "failed for unspecified reason.";
|
||||
|
||||
UIALogger.logFail(testName);
|
||||
UIALogger.logMessage("##teamcity[testFailed name='" + testName + "' message='" + message + "' details='" + details +"']");
|
||||
UIALogger.logMessage("##teamcity[testFinished name='" + testName + "']");
|
||||
}
|
||||
|
||||
function passTest(testName)
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
UIALogger.logMessage("##teamcity[testFinished name='" + testName + "']");
|
||||
}
|
||||
|
||||
function resetVars()
|
||||
{
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//UIALogger.logMessage("Version: " + window.scrollViews()[0].staticTexts()[4].label());
|
||||
|
||||
var versionNumber = window.scrollViews()[0].staticTexts()[4].label();
|
||||
// Start test suite for this version
|
||||
UIALogger.logMessage("##teamcity[testSuiteStarted name='Smoke Test for v" + versionNumber + "']");
|
||||
|
||||
|
||||
// Select the test environment (GT1)
|
||||
wheel.selectValue("http://www.sitetest1.pizzaboxer.fun/");
|
||||
UIALogger.logMessage("Test Environment: " + wheel.value());
|
||||
|
||||
|
||||
var testName = "Open About Page";
|
||||
startTest(testName);
|
||||
aboutButtoniPad.tap();
|
||||
var navBar = app.navigationBar();
|
||||
|
||||
if (navBar.name() == "About")
|
||||
passTest(testName);
|
||||
else
|
||||
failTest(testName, "About Page failed to open.");
|
||||
|
||||
// Close About page
|
||||
testName = "Close About Page";
|
||||
startTest(testName);
|
||||
navBar.buttons()["Close"].tap()
|
||||
target.delay(1);
|
||||
|
||||
if (window.scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
passTest(testName);
|
||||
else
|
||||
failTest(testName, "About Page failed to close.");
|
||||
|
||||
|
||||
|
||||
/*****************************************/
|
||||
/* Begin Login Test */
|
||||
|
||||
// Attempt to login to the game
|
||||
testName = "Login Test";
|
||||
startTest(testName);
|
||||
|
||||
login("mobiletest", "hackproof12");
|
||||
target.delay(loginTimeout);
|
||||
|
||||
if (!window.scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
passTest(testName);
|
||||
else
|
||||
failTest(testName, "Game failed to log in.");
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
/*****************************************/
|
||||
/* Begin Catalog Page Test */
|
||||
|
||||
// Open the Catalog page
|
||||
testName = "Open Catalog Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Catalog"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest
|
||||
(testName, "Failed to open Catalog screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewLink("Catalog"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Catalog web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
/* End Catalog Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Inventory Page Test */
|
||||
|
||||
// Open the Inventory page
|
||||
testName = "Open Inventory Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Inventory"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Inventory screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewStaticText("Character Customizer"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Inventory web page.");
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Inventory Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Builders Club Page Test */
|
||||
|
||||
// Open the Builders Club page
|
||||
testName = "Open Builders Club Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Builders Club"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Builders Club screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewStaticText("UPGRADE"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Builders Club web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Builders Club Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Profile Page Test */
|
||||
|
||||
// Open the Inventory page
|
||||
testName = "Open Profile Page";
|
||||
startTest(testName);
|
||||
|
||||
// Why is this button named 'Crossroads'?
|
||||
// Good question!
|
||||
window.buttons()["Crossroads"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Profile screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewStaticText("Your Profile"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Profile web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Profile Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Messages Page Test */
|
||||
|
||||
// Open the Messages page
|
||||
testName = "Open Messages Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Messages"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Messages screen.");
|
||||
|
||||
target.logElementTree();
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewStaticText("Inbox"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Messages web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Messages Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Groups Page Test */
|
||||
|
||||
// Open the Groups page
|
||||
testName = "Open Groups Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Groups"].tap();
|
||||
target.delay(5);
|
||||
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Groups screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewStaticText("Only Builders Club Members can create a new group. Receive all of the benefits of Builders Club by signing up"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Groups web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Groups Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Game Launching Test */
|
||||
// We verify a game has launched by the presence of the keyboard -
|
||||
// if the launch was successful, we should be able to tap the Chat button,
|
||||
// which opens the keyboard
|
||||
|
||||
testName = "Game Launching";
|
||||
startTest(testName);
|
||||
|
||||
// Launch game - 162747816 is 'mobiletest Place'
|
||||
window.textFields()[2].setValue("162747816");
|
||||
window.buttons()["Place Launch"].tap();
|
||||
|
||||
cnt = 0;
|
||||
while (cnt <= gameTimeout)
|
||||
{
|
||||
// Tap where the Chat button should be
|
||||
window.images()[0].images()[0].tapWithOptions({tapOffset:{x:0.12, y:0.03}});
|
||||
|
||||
if (app.keyboard().isValid())
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= gameTimeout)
|
||||
failTest(testName, "Game failed to launch - keyboard did not open.")
|
||||
|
||||
//Waiting 25 sec for game to launch
|
||||
//target.delay(25);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
//Type a verification message
|
||||
target.delay(1);
|
||||
target.frontMostApp().keyboard().typeString("The test is over.\n");
|
||||
target.delay(5);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
UIALogger.logMessage("##teamcity[testSuiteFinished name='Smoke Test for v" + versionNumber + "']");
|
||||
@@ -0,0 +1,499 @@
|
||||
var webTimeout = 4;
|
||||
var loginTimeout = 5;
|
||||
var gameTimeout = 10;
|
||||
|
||||
var target = UIATarget.localTarget();
|
||||
var webView = target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0];
|
||||
var app = target.frontMostApp();
|
||||
var window = app.mainWindow();
|
||||
var innerWindow = window.scrollViews();
|
||||
|
||||
//Initial screen elements
|
||||
var wheel = target.frontMostApp().mainWindow().pickers()[0].wheels()[0]; //picker wheel
|
||||
var loginButton = target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"];
|
||||
var aboutButtoniPad = target.frontMostApp().mainWindow().scrollViews()[0].buttons()[4]; //for iPad
|
||||
var nameField = target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0];
|
||||
var passwordField = target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0];
|
||||
|
||||
function login(username, password)
|
||||
{
|
||||
if (loginButton.isValid())
|
||||
{
|
||||
UIALogger.logMessage("Setting username as '" + username + "'");
|
||||
innerWindow[0].textFields()[0].setValue(username);
|
||||
UIALogger.logMessage("Setting password as '" + password + "'");
|
||||
innerWindow[0].secureTextFields()[0].setValue(password);
|
||||
loginButton.tap();
|
||||
}
|
||||
}
|
||||
|
||||
function handleCookieConstraint(wv)
|
||||
{
|
||||
if (wv.staticTexts()["The site is currently offline for maintenance and upgrades. Please check back soon!"].isValid())
|
||||
{
|
||||
wv.secureTextFields()[0].tap();
|
||||
app.keyboard().typeString("rewards");
|
||||
wv.buttons()["O"].tap();
|
||||
}
|
||||
}
|
||||
|
||||
function verifyWebViewStaticText(textToVerify)
|
||||
{
|
||||
var wv = target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0];
|
||||
handleCookieConstraint(wv);
|
||||
|
||||
if (wv.staticTexts()[textToVerify].isValid())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function verifyWebViewLink(textToVerify)
|
||||
{
|
||||
var wv = target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0];
|
||||
handleCookieConstraint(wv);
|
||||
|
||||
if (wv.links()[textToVerify].isValid())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function startTest(testName)
|
||||
{
|
||||
UIALogger.logStart(testName);
|
||||
UIALogger.logMessage("##teamcity[testStarted name='" + testName + "']");
|
||||
}
|
||||
|
||||
function failTest(testName, message, details)
|
||||
{
|
||||
if (!testName)
|
||||
{
|
||||
UIALogger.logMessage("ERROR: Test name not provided!");
|
||||
return;
|
||||
}
|
||||
if (!details)
|
||||
details = "No additional details provided.";
|
||||
if (!message)
|
||||
message = testName + "failed for unspecified reason.";
|
||||
|
||||
UIALogger.logFail(testName);
|
||||
UIALogger.logMessage("##teamcity[testFailed name='" + testName + "' message='" + message + "' details='" + details +"']");
|
||||
UIALogger.logMessage("##teamcity[testFinished name='" + testName + "']");
|
||||
}
|
||||
|
||||
function passTest(testName)
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
UIALogger.logMessage("##teamcity[testFinished name='" + testName + "']");
|
||||
}
|
||||
|
||||
function resetVars()
|
||||
{
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
}
|
||||
|
||||
|
||||
//UIALogger.logMessage("Version: " + window.scrollViews()[0].staticTexts()[4].label());
|
||||
|
||||
var versionNumber = window.scrollViews()[0].staticTexts()[4].label();
|
||||
// Start test suite for this version
|
||||
UIALogger.logMessage("##teamcity[testSuiteStarted name='Smoke Test for v" + versionNumber + "']");
|
||||
|
||||
|
||||
// Select the test environment (GT1)
|
||||
wheel.selectValue("http://www.sitetest2.pizzaboxer.fun/");
|
||||
UIALogger.logMessage("Test Environment: " + wheel.value());
|
||||
|
||||
|
||||
var testName = "Open About Page";
|
||||
startTest(testName);
|
||||
aboutButtoniPad.tap();
|
||||
var navBar = app.navigationBar();
|
||||
|
||||
if (navBar.name() == "About")
|
||||
passTest(testName);
|
||||
else
|
||||
failTest(testName, "About Page failed to open.");
|
||||
|
||||
// Close About page
|
||||
testName = "Close About Page";
|
||||
startTest(testName);
|
||||
navBar.buttons()["Close"].tap()
|
||||
target.delay(1);
|
||||
|
||||
if (window.scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
passTest(testName);
|
||||
else
|
||||
failTest(testName, "About Page failed to close.");
|
||||
|
||||
|
||||
|
||||
/*****************************************/
|
||||
/* Begin Login Test */
|
||||
|
||||
// Attempt to login to the game
|
||||
testName = "Login Test";
|
||||
startTest(testName);
|
||||
|
||||
login("mobiletest", "hackproof12");
|
||||
target.delay(loginTimeout);
|
||||
|
||||
if (!window.scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
passTest(testName);
|
||||
else
|
||||
failTest(testName, "Game failed to log in.");
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
/*****************************************/
|
||||
/* Begin Catalog Page Test */
|
||||
|
||||
// Open the Catalog page
|
||||
testName = "Open Catalog Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Catalog"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest
|
||||
(testName, "Failed to open Catalog screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewLink("Catalog"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Catalog web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
/* End Catalog Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Inventory Page Test */
|
||||
|
||||
// Open the Inventory page
|
||||
testName = "Open Inventory Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Inventory"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Inventory screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewStaticText("Character Customizer"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Inventory web page.");
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Inventory Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Builders Club Page Test */
|
||||
|
||||
// Open the Builders Club page
|
||||
testName = "Open Builders Club Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Builders Club"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Builders Club screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewStaticText("UPGRADE"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Builders Club web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Builders Club Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Profile Page Test */
|
||||
|
||||
// Open the Inventory page
|
||||
testName = "Open Profile Page";
|
||||
startTest(testName);
|
||||
|
||||
// Why is this button named 'Crossroads'?
|
||||
// Good question!
|
||||
window.buttons()["Crossroads"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Profile screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewStaticText("Your Profile"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Profile web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Profile Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Messages Page Test */
|
||||
|
||||
// Open the Messages page
|
||||
testName = "Open Messages Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Messages"].tap();
|
||||
target.delay(5);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Messages screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewStaticText("Inbox"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Messages web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Messages Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Groups Page Test */
|
||||
|
||||
// Open the Groups page
|
||||
testName = "Open Groups Page";
|
||||
startTest(testName);
|
||||
|
||||
window.buttons()["Groups"].tap();
|
||||
target.delay(5);
|
||||
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
if (!app.toolbar().buttons()["gridNavigation"].isValid())
|
||||
failTest(testName, "Failed to open Groups screen.");
|
||||
|
||||
var cnt = 0;
|
||||
while (cnt <= webTimeout)
|
||||
{
|
||||
if (verifyWebViewStaticText("Only Builders Club Members can create a new group. Receive all of the benefits of Builders Club by signing up"))
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= webTimeout)
|
||||
failTest(testName, "Failed to load Groups web page.");
|
||||
|
||||
|
||||
// Return to grid screen
|
||||
app.toolbar().buttons()["gridNavigation"].tap();
|
||||
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
|
||||
/* End Groups Page Test */
|
||||
/*****************************************/
|
||||
/* Begin Game Launching Test */
|
||||
// We verify a game has launched by the presence of the keyboard -
|
||||
// if the launch was successful, we should be able to tap the Chat button,
|
||||
// which opens the keyboard
|
||||
|
||||
testName = "Game Launching";
|
||||
startTest(testName);
|
||||
|
||||
// Launch game - 92786801 is 'mobiletest's Place
|
||||
window.textFields()[2].setValue("92786801");
|
||||
window.buttons()["Place Launch"].tap();
|
||||
|
||||
cnt = 0;
|
||||
while (cnt <= gameTimeout)
|
||||
{
|
||||
// Tap where the Chat button should be
|
||||
window.images()[0].images()[0].tapWithOptions({tapOffset:{x:0.12, y:0.03}});
|
||||
|
||||
if (app.keyboard().isValid())
|
||||
{
|
||||
passTest(testName);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt >= gameTimeout)
|
||||
failTest(testName, "Game failed to launch - keyboard did not open.")
|
||||
|
||||
//Waiting 25 sec for game to launch
|
||||
//target.delay(25);
|
||||
|
||||
target = UIATarget.localTarget();
|
||||
app = target.frontMostApp();
|
||||
window = app.mainWindow();
|
||||
webView = window.scrollViews()[0].webViews()[0];
|
||||
innerWindow = window.scrollViews();
|
||||
|
||||
|
||||
//Type a verification message
|
||||
target.delay(1);
|
||||
target.frontMostApp().keyboard().typeString("The test is over.\n");
|
||||
target.delay(5);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
UIALogger.logMessage("##teamcity[testSuiteFinished name='Smoke Test for v" + versionNumber + "']");
|
||||
@@ -0,0 +1,322 @@
|
||||
//Script for testing basic Roblox iOS App fuctionality on iPad on GT2 (CI build)
|
||||
|
||||
|
||||
var target = UIATarget.localTarget();
|
||||
|
||||
var app = target.frontMostApp();
|
||||
|
||||
var window = app.mainWindow();
|
||||
|
||||
|
||||
//Initial screen elements
|
||||
|
||||
var loginButton = target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"];
|
||||
|
||||
var aboutButtoniPad = target.frontMostApp().mainWindow().scrollViews()[0].buttons()[4] //for iPad
|
||||
|
||||
var nameField = target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0];
|
||||
|
||||
var passwordField = target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0];
|
||||
var webTimeout = 20;
|
||||
var loginTimeout = 15;
|
||||
|
||||
//-=FUNCTIONS=-
|
||||
|
||||
|
||||
//Login Function
|
||||
|
||||
function login(username, password)
|
||||
{
|
||||
if (loginButton.isValid())
|
||||
{
|
||||
UIALogger.logMessage("Setting username as '" + username + "'");
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0].setValue(username);
|
||||
UIALogger.logMessage("Setting password as '" + password + "'");
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0].setValue(password);
|
||||
loginButton.tap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-=TESTING SCRIPT=-
|
||||
|
||||
|
||||
//Create elements log:
|
||||
target.logElementTree();
|
||||
|
||||
|
||||
//Go to About Screen:
|
||||
var testName = "About Screen test"
|
||||
UIALogger.logStart(testName);
|
||||
aboutButtoniPad.tap(); //works for iPad
|
||||
|
||||
|
||||
//Verifying that 'About' screen is working
|
||||
var barname = target.frontMostApp().navigationBar().name();
|
||||
|
||||
|
||||
if (barname == "About")
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//returning to the main screen
|
||||
var testName = "Back to main screen";
|
||||
UIALogger.logStart(testName);
|
||||
target.frontMostApp().navigationBar().leftButton().tap();
|
||||
target.delay(5);
|
||||
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Normal login attempt
|
||||
|
||||
//Start logging
|
||||
var testName = "Normal login test";
|
||||
login ("mobiletest","hackproof12");
|
||||
|
||||
target.delay(loginTimeout);
|
||||
|
||||
//if login screen is still active
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logFail(testName); //then test failed
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logPass(testName); //otherwise test passed (app switched to another screen)
|
||||
}
|
||||
|
||||
|
||||
//=====
|
||||
|
||||
//Go to Catalog page
|
||||
var testName = "Go to Catalog Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Catalog"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
//Go to Inventory page
|
||||
var testName = "Go to Inventory Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Inventory"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
|
||||
//Go to BC page
|
||||
var testName = "Go to Builders Club Page";
|
||||
target.frontMostApp().mainWindow().buttons()[5].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
|
||||
//Go to Profile page
|
||||
var testName = "Go to Profile Page";
|
||||
//target.frontMostApp().mainWindow().buttons()["Profile"].tap();// normal
|
||||
|
||||
target.frontMostApp().mainWindow().buttons()["Crossroads"].tap();//workaround for iPad only
|
||||
|
||||
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].staticTexts()["Your Profile"].isValid())
|
||||
|
||||
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
|
||||
//Go to Messages page
|
||||
var testName = "Go to Messages Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Messages"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
//Go to Games page
|
||||
var testName = "Go to Games Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Games"].tap();
|
||||
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].staticTexts()["Popular"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//////-inserted
|
||||
|
||||
// Open Featured Games
|
||||
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].elements()[2].tap();
|
||||
target.frontMostApp().mainWindow().popover().tableViews()["Empty list"].cells()["Featured"].tap();
|
||||
|
||||
target.delay(5);
|
||||
|
||||
//Select place "Test Place #1"
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].links()["Test Place #1"].images()[0].tap(); //ipad on gt2
|
||||
|
||||
target.delay(5);
|
||||
|
||||
//Launch game
|
||||
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].links()["Play"].tap();
|
||||
|
||||
|
||||
//Waiting 15 sec for game to launch
|
||||
target.delay(15);
|
||||
|
||||
|
||||
//Verifying that game is running (Keyboard pops up after pressing chat button)
|
||||
|
||||
var testName = "Game launched";
|
||||
|
||||
target.frontMostApp().mainWindow().images()[0].images()[0].tapWithOptions({tapOffset:{x:0.12, y:0.03}});//Press Chat button, keyboard should pop up
|
||||
|
||||
|
||||
//Verify that keyboard pops up, so the game is running
|
||||
if (target.frontMostApp().keyboard().isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Type something
|
||||
|
||||
|
||||
target.delay(1);
|
||||
|
||||
target.frontMostApp().keyboard().typeString("Test is over\n");
|
||||
|
||||
target.delay(5);
|
||||
@@ -0,0 +1,331 @@
|
||||
//Script for testing basic Roblox iOS App fuctionality on iPad on GT1 (internal build)
|
||||
|
||||
|
||||
var target = UIATarget.localTarget();
|
||||
|
||||
var app = target.frontMostApp();
|
||||
|
||||
var window = app.mainWindow();
|
||||
|
||||
|
||||
//Initial screen elements
|
||||
|
||||
var wheel = target.frontMostApp().mainWindow().pickers()[0].wheels()[0]; //picker wheel
|
||||
|
||||
var loginButton = target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"];
|
||||
|
||||
var aboutButtoniPad = target.frontMostApp().mainWindow().scrollViews()[0].buttons()[4] //for iPad
|
||||
|
||||
var nameField = target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0];
|
||||
|
||||
var passwordField = target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0];
|
||||
var webTimeout = 20;
|
||||
var loginTimeout = 15;
|
||||
|
||||
//-=FUNCTIONS=-
|
||||
|
||||
|
||||
//Login Function
|
||||
|
||||
function login(username, password)
|
||||
{
|
||||
if (loginButton.isValid())
|
||||
{
|
||||
UIALogger.logMessage("Setting username as '" + username + "'");
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0].setValue(username);
|
||||
UIALogger.logMessage("Setting password as '" + password + "'");
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0].setValue(password);
|
||||
loginButton.tap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-=TESTING SCRIPT=-
|
||||
|
||||
|
||||
//Create elements log:
|
||||
target.logElementTree();
|
||||
|
||||
//Select test environment
|
||||
|
||||
wheel.selectValue("http://www.gametest1.pizzaboxer.fun/"); //selecting test environment
|
||||
|
||||
UIALogger.logMessage("Test Environment: " + wheel.value()); //log current selected environment
|
||||
|
||||
|
||||
//Go to About Screen:
|
||||
var testName = "About Screen test"
|
||||
UIALogger.logStart(testName);
|
||||
aboutButtoniPad.tap(); //works for iPad
|
||||
|
||||
|
||||
//Verifying that 'About' screen is working
|
||||
var barname = target.frontMostApp().navigationBar().name();
|
||||
|
||||
|
||||
if (barname == "About")
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//returning to the main screen
|
||||
var testName = "Back to main screen";
|
||||
UIALogger.logStart(testName);
|
||||
target.frontMostApp().navigationBar().leftButton().tap();
|
||||
target.delay(1);
|
||||
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Normal login attempt
|
||||
|
||||
//Start logging
|
||||
var testName = "Normal login test";
|
||||
login ("mobiletest","hackproof12");
|
||||
|
||||
target.delay(loginTimeout);
|
||||
|
||||
//if login screen is still active
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logFail(testName); //then test failed
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logPass(testName); //otherwise test passed (app switched to another screen)
|
||||
}
|
||||
|
||||
|
||||
//=====
|
||||
|
||||
//Go to Catalog page
|
||||
var testName = "Go to Catalog Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Catalog"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
//Go to Inventory page
|
||||
var testName = "Go to Inventory Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Inventory"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
|
||||
//Go to BC page
|
||||
var testName = "Go to Builders Club Page";
|
||||
target.frontMostApp().mainWindow().buttons()[5].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
|
||||
//Go to Profile page
|
||||
var testName = "Go to Profile Page";
|
||||
//target.frontMostApp().mainWindow().buttons()["Profile"].tap();// normal
|
||||
|
||||
target.frontMostApp().mainWindow().buttons()["Crossroads"].tap();//workaround for iPad only
|
||||
|
||||
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].staticTexts()["Your Profile"].isValid())
|
||||
|
||||
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
|
||||
//Go to Messages page
|
||||
var testName = "Go to Messages Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Messages"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
//Go to Games page
|
||||
var testName = "Go to Games Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Games"].tap();
|
||||
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].staticTexts()["Popular"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Launch Test Place #1 via textbox launcher (internal build only)
|
||||
|
||||
target.frontMostApp().mainWindow().textFields()[2].setValue("81501804"); //select Test Place #1 on GT1
|
||||
target.frontMostApp().mainWindow().buttons()["Place Launch"].tap(); //launch game
|
||||
|
||||
|
||||
|
||||
//Waiting 25 sec for game to launch
|
||||
target.delay(25);
|
||||
|
||||
|
||||
//Verifying that game is running (Keyboard pops up after pressing chat button)
|
||||
|
||||
var testName = "Game launched";
|
||||
|
||||
target.frontMostApp().mainWindow().images()[0].images()[0].tapWithOptions({tapOffset:{x:0.12, y:0.03}});//Press Chat button, keyboard should pop up
|
||||
|
||||
|
||||
//Verify that keyboard pops up, so the game is running
|
||||
if (target.frontMostApp().keyboard().isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Type something
|
||||
|
||||
|
||||
target.delay(1);
|
||||
|
||||
target.frontMostApp().keyboard().typeString("Test is over\n");
|
||||
|
||||
target.delay(5);
|
||||
@@ -0,0 +1,330 @@
|
||||
//Script for testing basic Roblox iOS App fuctionality on iPad on GT2 (internal build)
|
||||
|
||||
|
||||
var target = UIATarget.localTarget();
|
||||
|
||||
var app = target.frontMostApp();
|
||||
|
||||
var window = app.mainWindow();
|
||||
|
||||
|
||||
//Initial screen elements
|
||||
|
||||
var wheel = target.frontMostApp().mainWindow().pickers()[0].wheels()[0]; //picker wheel
|
||||
|
||||
var loginButton = target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"];
|
||||
|
||||
var aboutButtoniPad = target.frontMostApp().mainWindow().scrollViews()[0].buttons()[4] //for iPad
|
||||
|
||||
var nameField = target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0];
|
||||
|
||||
var passwordField = target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0];
|
||||
var webTimeout = 20;
|
||||
var loginTimeout = 15;
|
||||
|
||||
//-=FUNCTIONS=-
|
||||
|
||||
|
||||
//Login Function
|
||||
|
||||
function login(username, password)
|
||||
{
|
||||
if (loginButton.isValid())
|
||||
{
|
||||
UIALogger.logMessage("Setting username as '" + username + "'");
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0].setValue(username);
|
||||
UIALogger.logMessage("Setting password as '" + password + "'");
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0].setValue(password);
|
||||
loginButton.tap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-=TESTING SCRIPT=-
|
||||
|
||||
|
||||
//Create elements log:
|
||||
target.logElementTree();
|
||||
|
||||
//Select test environment
|
||||
|
||||
wheel.selectValue("http://www.gametest2.pizzaboxer.fun/"); //selecting test environment
|
||||
|
||||
UIALogger.logMessage("Test Environment: " + wheel.value()); //log current selected environment
|
||||
|
||||
|
||||
//Go to About Screen:
|
||||
var testName = "About Screen test"
|
||||
UIALogger.logStart(testName);
|
||||
aboutButtoniPad.tap(); //works for iPad
|
||||
|
||||
|
||||
//Verifying that 'About' screen is working
|
||||
var barname = target.frontMostApp().navigationBar().name();
|
||||
|
||||
|
||||
if (barname == "About")
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//returning to the main screen
|
||||
var testName = "Back to main screen";
|
||||
UIALogger.logStart(testName);
|
||||
target.frontMostApp().navigationBar().leftButton().tap();
|
||||
target.delay(1);
|
||||
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Normal login attempt
|
||||
|
||||
//Start logging
|
||||
var testName = "Normal login test";
|
||||
login ("mobiletest","hackproof12");
|
||||
|
||||
target.delay(loginTimeout);
|
||||
|
||||
//if login screen is still active
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logFail(testName); //then test failed
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logPass(testName); //otherwise test passed (app switched to another screen)
|
||||
}
|
||||
|
||||
|
||||
//=====
|
||||
|
||||
//Go to Catalog page
|
||||
var testName = "Go to Catalog Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Catalog"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
//Go to Inventory page
|
||||
var testName = "Go to Inventory Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Inventory"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
|
||||
//Go to BC page
|
||||
var testName = "Go to Builders Club Page";
|
||||
target.frontMostApp().mainWindow().buttons()[5].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
|
||||
//Go to Profile page
|
||||
var testName = "Go to Profile Page";
|
||||
//target.frontMostApp().mainWindow().buttons()["Profile"].tap();// normal
|
||||
|
||||
target.frontMostApp().mainWindow().buttons()["Crossroads"].tap();//workaround for iPad only
|
||||
|
||||
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].staticTexts()["Your Profile"].isValid())
|
||||
|
||||
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
|
||||
//Go to Messages page
|
||||
var testName = "Go to Messages Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Messages"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
//Go to Games page
|
||||
var testName = "Go to Games Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Games"].tap();
|
||||
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].staticTexts()["Popular"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Launch Test Place #1 via textbox launcher (internal build only)
|
||||
|
||||
target.frontMostApp().mainWindow().textFields()[2].setValue("70383209"); //select Test Place #1 on GT2
|
||||
target.frontMostApp().mainWindow().buttons()["Place Launch"].tap(); //launch game
|
||||
|
||||
|
||||
//Waiting 25 sec for game to launch
|
||||
target.delay(25);
|
||||
|
||||
|
||||
//Verifying that game is running (Keyboard pops up after pressing chat button)
|
||||
|
||||
var testName = "Game launched";
|
||||
|
||||
target.frontMostApp().mainWindow().images()[0].images()[0].tapWithOptions({tapOffset:{x:0.12, y:0.03}});//Press Chat button, keyboard should pop up
|
||||
|
||||
|
||||
//Verify that keyboard pops up, so the game is running
|
||||
if (target.frontMostApp().keyboard().isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Type something
|
||||
|
||||
|
||||
target.delay(1);
|
||||
|
||||
target.frontMostApp().keyboard().typeString("Test is over\n");
|
||||
|
||||
target.delay(5);
|
||||
@@ -0,0 +1,331 @@
|
||||
//Script for testing basic Roblox iOS App fuctionality on iPad on Production (internal build)
|
||||
|
||||
|
||||
var target = UIATarget.localTarget();
|
||||
|
||||
var app = target.frontMostApp();
|
||||
|
||||
var window = app.mainWindow();
|
||||
|
||||
|
||||
//Initial screen elements
|
||||
|
||||
var wheel = target.frontMostApp().mainWindow().pickers()[0].wheels()[0]; //picker wheel
|
||||
|
||||
var loginButton = target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"];
|
||||
|
||||
var aboutButtoniPad = target.frontMostApp().mainWindow().scrollViews()[0].buttons()[4] //for iPad
|
||||
|
||||
var nameField = target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0];
|
||||
|
||||
var passwordField = target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0];
|
||||
var webTimeout = 20;
|
||||
var loginTimeout = 15;
|
||||
|
||||
//-=FUNCTIONS=-
|
||||
|
||||
|
||||
//Login Function
|
||||
|
||||
function login(username, password)
|
||||
{
|
||||
if (loginButton.isValid())
|
||||
{
|
||||
UIALogger.logMessage("Setting username as '" + username + "'");
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0].setValue(username);
|
||||
UIALogger.logMessage("Setting password as '" + password + "'");
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0].setValue(password);
|
||||
loginButton.tap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-=TESTING SCRIPT=-
|
||||
|
||||
|
||||
//Create elements log:
|
||||
target.logElementTree();
|
||||
|
||||
//Select test environment
|
||||
|
||||
wheel.selectValue("http://www.watrbx.wtf/"); //selecting test environment
|
||||
|
||||
UIALogger.logMessage("Test Environment: " + wheel.value()); //log current selected environment
|
||||
|
||||
|
||||
//Go to About Screen:
|
||||
var testName = "About Screen test"
|
||||
UIALogger.logStart(testName);
|
||||
aboutButtoniPad.tap(); //works for iPad
|
||||
|
||||
|
||||
//Verifying that 'About' screen is working
|
||||
var barname = target.frontMostApp().navigationBar().name();
|
||||
|
||||
|
||||
if (barname == "About")
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//returning to the main screen
|
||||
var testName = "Back to main screen";
|
||||
UIALogger.logStart(testName);
|
||||
target.frontMostApp().navigationBar().leftButton().tap();
|
||||
target.delay(5);
|
||||
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Normal login attempt
|
||||
|
||||
//Start logging
|
||||
var testName = "Normal login test";
|
||||
login ("usertest01","hackproof");
|
||||
|
||||
target.delay(loginTimeout);
|
||||
|
||||
//if login screen is still active
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logFail(testName); //then test failed
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logPass(testName); //otherwise test passed (app switched to another screen)
|
||||
}
|
||||
|
||||
|
||||
//=====
|
||||
|
||||
//Go to Catalog page
|
||||
var testName = "Go to Catalog Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Catalog"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
//Go to Inventory page
|
||||
var testName = "Go to Inventory Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Inventory"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
|
||||
//Go to BC page
|
||||
var testName = "Go to Builders Club Page";
|
||||
target.frontMostApp().mainWindow().buttons()[5].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
|
||||
//Go to Profile page
|
||||
var testName = "Go to Profile Page";
|
||||
//target.frontMostApp().mainWindow().buttons()["Profile"].tap();// normal
|
||||
|
||||
target.frontMostApp().mainWindow().buttons()["Crossroads"].tap();//workaround for iPad only
|
||||
|
||||
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].staticTexts()["Your Profile"].isValid())
|
||||
|
||||
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
|
||||
//Go to Messages page
|
||||
var testName = "Go to Messages Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Messages"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
//Go to Games page
|
||||
var testName = "Go to Games Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Games"].tap();
|
||||
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].staticTexts()["Top Rated"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Launch Test Place #1 via textbox launcher (internal build only)
|
||||
|
||||
target.frontMostApp().mainWindow().textFields()[2].setValue("122235601"); //select Test Place #1 on Prod
|
||||
target.frontMostApp().mainWindow().buttons()["Place Launch"].tap(); //launch game
|
||||
|
||||
|
||||
//Waiting 25 sec for game to launch
|
||||
target.delay(25);
|
||||
|
||||
|
||||
//Verifying that game is running (Keyboard pops up after pressing chat button)
|
||||
|
||||
var testName = "Game launched";
|
||||
|
||||
target.frontMostApp().mainWindow().images()[0].images()[0].tapWithOptions({tapOffset:{x:0.12, y:0.03}});//Press Chat button, keyboard should pop up
|
||||
|
||||
|
||||
//Verify that keyboard pops up, so the game is running
|
||||
if (target.frontMostApp().keyboard().isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Type something
|
||||
|
||||
|
||||
target.delay(1);
|
||||
|
||||
target.frontMostApp().keyboard().typeString("Test is over\n");
|
||||
|
||||
target.delay(5);
|
||||
@@ -0,0 +1,300 @@
|
||||
//Script for testing basic Roblox iOS App fuctionality on iPhone/iPod Touch on GT2 (CI build)
|
||||
|
||||
|
||||
var target = UIATarget.localTarget();
|
||||
|
||||
var app = target.frontMostApp();
|
||||
|
||||
var window = app.mainWindow();
|
||||
|
||||
|
||||
//Initial screen elements
|
||||
|
||||
var loginButton = target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"];
|
||||
|
||||
var aboutButton = target.frontMostApp().mainWindow().scrollViews()[0].buttons()[3];
|
||||
|
||||
var nameField = target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0];
|
||||
|
||||
var passwordField = target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0];
|
||||
var webTimeout = 20;
|
||||
var loginTimeout = 15;
|
||||
|
||||
|
||||
//-=FUNCTIONS=-
|
||||
|
||||
|
||||
//Login Function
|
||||
|
||||
function login(username, password)
|
||||
{
|
||||
if (loginButton.isValid())
|
||||
{
|
||||
UIALogger.logMessage("Setting username as '" + username + "'");
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0].setValue(username);
|
||||
UIALogger.logMessage("Setting password as '" + password + "'");
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0].setValue(password);
|
||||
loginButton.tap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-=TESTING SCRIPT=-
|
||||
|
||||
|
||||
//Create elements log:
|
||||
target.logElementTree();
|
||||
|
||||
|
||||
//Go to About Screen:
|
||||
var testName = "About Screen test"
|
||||
UIALogger.logStart(testName);
|
||||
aboutButton.tap(); //works for ipod
|
||||
|
||||
|
||||
//Verifying that 'About' screen is working
|
||||
var barname = target.frontMostApp().navigationBar().name();
|
||||
|
||||
if (barname == "About")
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//returning to the main screen
|
||||
var testName = "Back to main screen";
|
||||
UIALogger.logStart(testName);
|
||||
target.frontMostApp().navigationBar().leftButton().tap();
|
||||
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Normal login attempt
|
||||
|
||||
//Start logging
|
||||
var testName = "Normal login test";
|
||||
login ("mobiletest","hackproof12");
|
||||
|
||||
target.delay(loginTimeout);
|
||||
|
||||
//if login screen is still active
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logFail(testName); //then test failed
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logPass(testName); //otherwise test passed (app switched to another screen)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//=====
|
||||
|
||||
//Go to Catalog page
|
||||
var testName = "Go to Catalog Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Catalog"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
//Go to Inventory page
|
||||
var testName = "Go to Inventory Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Inventory"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
|
||||
//Go to BC page
|
||||
var testName = "Go to Builders Club Page";
|
||||
target.frontMostApp().mainWindow().buttons()[5].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
|
||||
//Go to Profile page
|
||||
var testName = "Go to Profile Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Profile"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].staticTexts()["My status:"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
|
||||
//Go to Messages page
|
||||
var testName = "Go to Messages Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Messages"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
//Go to Games page
|
||||
var testName = "Go to Games Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Games"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].staticTexts()["Featured Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Show all games ("See more")
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].links()[0].tap();
|
||||
|
||||
target.delay(5);
|
||||
|
||||
//Launch "Sound Replication" place
|
||||
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].links()["\nSound Replication Test\n"].tap();
|
||||
|
||||
//Waiting 15 sec for game to launch
|
||||
target.delay(25);
|
||||
|
||||
//Verifying that game is running (keyboard pops up after pressing chat button)
|
||||
var testName = "Game launched";
|
||||
target.frontMostApp().mainWindow().images()[0].images()[1].tapWithOptions({tapOffset:{x:0.23, y:0.06}}); //open chat (works!)
|
||||
target.delay(1);
|
||||
|
||||
//Check if keyboard is active
|
||||
if (target.frontMostApp().keyboard().isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Type something
|
||||
|
||||
|
||||
target.delay(1);
|
||||
|
||||
target.frontMostApp().keyboard().typeString("Test is over\n");
|
||||
|
||||
target.delay(5);
|
||||
@@ -0,0 +1,318 @@
|
||||
//Script for testing basic Roblox iOS App fuctionality on iPhone/iPod Touch on GT1 (internal build)
|
||||
|
||||
|
||||
var target = UIATarget.localTarget();
|
||||
|
||||
var app = target.frontMostApp();
|
||||
|
||||
var window = app.mainWindow();
|
||||
|
||||
|
||||
//Initial screen elements
|
||||
|
||||
var wheel = target.frontMostApp().mainWindow().scrollViews()[0].pickers()[0].wheels()[0]; //picker wheel
|
||||
|
||||
var loginButton = target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"];
|
||||
|
||||
var aboutButton = target.frontMostApp().mainWindow().scrollViews()[0].buttons()[3];
|
||||
|
||||
var nameField = target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0];
|
||||
|
||||
var passwordField = target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0];
|
||||
var webTimeout = 20;
|
||||
var loginTimeout = 15;
|
||||
|
||||
//-=FUNCTIONS=-
|
||||
|
||||
|
||||
//Login Function
|
||||
|
||||
function login(username, password)
|
||||
{
|
||||
if (loginButton.isValid())
|
||||
{
|
||||
UIALogger.logMessage("Setting username as '" + username + "'");
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0].setValue(username);
|
||||
UIALogger.logMessage("Setting password as '" + password + "'");
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0].setValue(password);
|
||||
loginButton.tap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-=TESTING SCRIPT=-
|
||||
|
||||
|
||||
//Create elements log:
|
||||
target.logElementTree();
|
||||
|
||||
|
||||
//Select test environment
|
||||
|
||||
wheel.selectValue("http://m.gametest1.pizzaboxer.fun/"); //selecting test environment
|
||||
|
||||
UIALogger.logMessage("Test Environment: " + wheel.value()); //log current selected environment
|
||||
|
||||
|
||||
|
||||
//Go to About Screen:
|
||||
var testName = "About Screen test"
|
||||
UIALogger.logStart(testName);
|
||||
aboutButton.tap(); //works for ipod
|
||||
|
||||
|
||||
//Verifying that 'About' screen is working
|
||||
var barname = target.frontMostApp().navigationBar().name();
|
||||
|
||||
if (barname == "About")
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//returning to the main screen
|
||||
var testName = "Back to main screen";
|
||||
UIALogger.logStart(testName);
|
||||
target.frontMostApp().navigationBar().leftButton().tap();
|
||||
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Normal login attempt
|
||||
|
||||
//Start logging
|
||||
var testName = "Normal login test";
|
||||
login ("mobiletest","hackproof12");
|
||||
|
||||
target.delay(loginTimeout);
|
||||
|
||||
//if login screen is still active
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logFail(testName); //then test failed
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logPass(testName); //otherwise test passed (app switched to another screen)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//=====
|
||||
|
||||
//Go to Catalog page
|
||||
var testName = "Go to Catalog Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Catalog"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
//Go to Inventory page
|
||||
var testName = "Go to Inventory Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Inventory"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
|
||||
//Go to BC page
|
||||
var testName = "Go to Builders Club Page";
|
||||
target.frontMostApp().mainWindow().buttons()[5].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
|
||||
//Go to Profile page
|
||||
var testName = "Go to Profile Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Profile"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].staticTexts()["My status:"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
|
||||
//Go to Messages page
|
||||
var testName = "Go to Messages Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Messages"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
//Go to Games page
|
||||
var testName = "Go to Games Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Games"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].staticTexts()["Popular"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Launching game via ID field
|
||||
target.frontMostApp().mainWindow().textFields()[3].setValue("81501804"); //select Test Place #1 on GT1
|
||||
target.frontMostApp().keyboard().typeString("\n"); //hit Enter on a keyboard to launch game
|
||||
|
||||
//Waiting 25 sec for game to launch
|
||||
target.delay(25);
|
||||
|
||||
//Verifying that game is running (keyboard pops up after pressing chat button)
|
||||
var testName = "Game launched";
|
||||
target.frontMostApp().mainWindow().images()[0].images()[1].tapWithOptions({tapOffset:{x:0.23, y:0.06}}); //open chat (works!)
|
||||
target.delay(10);
|
||||
|
||||
//Check if keyboard is active
|
||||
if (target.frontMostApp().keyboard().isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Type something
|
||||
|
||||
|
||||
target.delay(1);
|
||||
|
||||
target.frontMostApp().keyboard().typeString("Test is over\n");
|
||||
|
||||
target.delay(5);
|
||||
@@ -0,0 +1,319 @@
|
||||
//Script for testing basic Roblox iOS App fuctionality on iPhone/iPod Touch on GT2 (internal build)
|
||||
|
||||
|
||||
var target = UIATarget.localTarget();
|
||||
|
||||
var app = target.frontMostApp();
|
||||
|
||||
var window = app.mainWindow();
|
||||
|
||||
|
||||
//Initial screen elements
|
||||
|
||||
var wheel = target.frontMostApp().mainWindow().scrollViews()[0].pickers()[0].wheels()[0]; //picker wheel
|
||||
|
||||
var loginButton = target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"];
|
||||
|
||||
var aboutButton = target.frontMostApp().mainWindow().scrollViews()[0].buttons()[3];
|
||||
|
||||
var nameField = target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0];
|
||||
|
||||
var passwordField = target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0];
|
||||
var webTimeout = 20;
|
||||
var loginTimeout = 15;
|
||||
|
||||
|
||||
//-=FUNCTIONS=-
|
||||
|
||||
|
||||
//Login Function
|
||||
|
||||
function login(username, password)
|
||||
{
|
||||
if (loginButton.isValid())
|
||||
{
|
||||
UIALogger.logMessage("Setting username as '" + username + "'");
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0].setValue(username);
|
||||
UIALogger.logMessage("Setting password as '" + password + "'");
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0].setValue(password);
|
||||
loginButton.tap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-=TESTING SCRIPT=-
|
||||
|
||||
|
||||
//Create elements log:
|
||||
target.logElementTree();
|
||||
|
||||
|
||||
//Select test environment
|
||||
|
||||
wheel.selectValue("http://m.gametest2.pizzaboxer.fun/"); //selecting test environment
|
||||
|
||||
UIALogger.logMessage("Test Environment: " + wheel.value()); //log current selected environment
|
||||
|
||||
|
||||
|
||||
//Go to About Screen:
|
||||
var testName = "About Screen test"
|
||||
UIALogger.logStart(testName);
|
||||
aboutButton.tap(); //works for ipod
|
||||
|
||||
|
||||
//Verifying that 'About' screen is working
|
||||
var barname = target.frontMostApp().navigationBar().name();
|
||||
|
||||
if (barname == "About")
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//returning to the main screen
|
||||
var testName = "Back to main screen";
|
||||
UIALogger.logStart(testName);
|
||||
target.frontMostApp().navigationBar().leftButton().tap();
|
||||
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Normal login attempt
|
||||
|
||||
//Start logging
|
||||
var testName = "Normal login test";
|
||||
login ("mobiletest","hackproof12");
|
||||
|
||||
target.delay(loginTimeout);
|
||||
|
||||
//if login screen is still active
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logFail(testName); //then test failed
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logPass(testName); //otherwise test passed (app switched to another screen)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//=====
|
||||
|
||||
//Go to Catalog page
|
||||
var testName = "Go to Catalog Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Catalog"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
//Go to Inventory page
|
||||
var testName = "Go to Inventory Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Inventory"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
|
||||
//Go to BC page
|
||||
var testName = "Go to Builders Club Page";
|
||||
target.frontMostApp().mainWindow().buttons()[5].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
|
||||
//Go to Profile page
|
||||
var testName = "Go to Profile Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Profile"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].staticTexts()["My status:"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
|
||||
//Go to Messages page
|
||||
var testName = "Go to Messages Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Messages"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
//Go to Games page
|
||||
var testName = "Go to Games Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Games"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].staticTexts()["Featured Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Launching game via ID field
|
||||
target.frontMostApp().mainWindow().textFields()[3].setValue("70383209"); //select Test Place #1 on GT2
|
||||
target.frontMostApp().keyboard().typeString("\n"); //hit Enter on a keyboard to launch game
|
||||
|
||||
|
||||
//Waiting 25 sec for game to launch
|
||||
target.delay(25);
|
||||
|
||||
//Verifying that game is running (keyboard pops up after pressing chat button)
|
||||
var testName = "Game launched";
|
||||
target.frontMostApp().mainWindow().images()[0].images()[1].tapWithOptions({tapOffset:{x:0.23, y:0.06}}); //open chat (works!)
|
||||
target.delay(1);
|
||||
|
||||
//Check if keyboard is active
|
||||
if (target.frontMostApp().keyboard().isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Type something
|
||||
|
||||
|
||||
target.delay(1);
|
||||
|
||||
target.frontMostApp().keyboard().typeString("Test is over\n");
|
||||
|
||||
target.delay(5);
|
||||
@@ -0,0 +1,320 @@
|
||||
|
||||
//Script for testing basic Roblox iOS App fuctionality on iPhone/iPod Touch on Prod (internal build)
|
||||
|
||||
|
||||
var target = UIATarget.localTarget();
|
||||
|
||||
var app = target.frontMostApp();
|
||||
|
||||
var window = app.mainWindow();
|
||||
|
||||
|
||||
//Initial screen elements
|
||||
|
||||
var wheel = target.frontMostApp().mainWindow().scrollViews()[0].pickers()[0].wheels()[0]; //picker wheel
|
||||
|
||||
var loginButton = target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"];
|
||||
|
||||
var aboutButton = target.frontMostApp().mainWindow().scrollViews()[0].buttons()[3];
|
||||
|
||||
var nameField = target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0];
|
||||
|
||||
var passwordField = target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0];
|
||||
var webTimeout = 20;
|
||||
var loginTimeout = 15;
|
||||
|
||||
|
||||
//-=FUNCTIONS=-
|
||||
|
||||
|
||||
//Login Function
|
||||
|
||||
function login(username, password)
|
||||
{
|
||||
if (loginButton.isValid())
|
||||
{
|
||||
UIALogger.logMessage("Setting username as '" + username + "'");
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0].setValue(username);
|
||||
UIALogger.logMessage("Setting password as '" + password + "'");
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0].setValue(password);
|
||||
loginButton.tap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-=TESTING SCRIPT=-
|
||||
|
||||
|
||||
//Create elements log:
|
||||
target.logElementTree();
|
||||
|
||||
|
||||
//Select test environment
|
||||
|
||||
wheel.selectValue("http://m.watrbx.wtf/"); //selecting test environment
|
||||
|
||||
UIALogger.logMessage("Test Environment: " + wheel.value()); //log current selected environment
|
||||
|
||||
|
||||
|
||||
//Go to About Screen:
|
||||
var testName = "About Screen test"
|
||||
UIALogger.logStart(testName);
|
||||
aboutButton.tap(); //works for ipod
|
||||
|
||||
|
||||
//Verifying that 'About' screen is working
|
||||
var barname = target.frontMostApp().navigationBar().name();
|
||||
|
||||
if (barname == "About")
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//returning to the main screen
|
||||
var testName = "Back to main screen";
|
||||
UIALogger.logStart(testName);
|
||||
target.frontMostApp().navigationBar().leftButton().tap();
|
||||
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Normal login attempt
|
||||
|
||||
//Start logging
|
||||
var testName = "Normal login test";
|
||||
login ("usertest01","hackproof");
|
||||
|
||||
target.delay(loginTimeout);
|
||||
|
||||
//if login screen is still active
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logFail(testName); //then test failed
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logPass(testName); //otherwise test passed (app switched to another screen)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//=====
|
||||
|
||||
//Go to Catalog page
|
||||
var testName = "Go to Catalog Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Catalog"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
//Go to Inventory page
|
||||
var testName = "Go to Inventory Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Inventory"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
|
||||
//Go to BC page
|
||||
var testName = "Go to Builders Club Page";
|
||||
target.frontMostApp().mainWindow().buttons()[5].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
|
||||
//Go to Profile page
|
||||
var testName = "Go to Profile Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Profile"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].staticTexts()["My status:"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
|
||||
//Go to Messages page
|
||||
var testName = "Go to Messages Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Messages"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().toolbar().buttons()["gridNavigation"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
//Go to Games page
|
||||
var testName = "Go to Games Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Games"].tap();
|
||||
//Validate
|
||||
target.delay(webTimeout);
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].staticTexts()["Featured Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Go back to the Main Page
|
||||
var testName = "Go to Main Page";
|
||||
target.frontMostApp().toolbar().buttons()["gridNavigation"].tap();
|
||||
//Validate
|
||||
if (target.frontMostApp().mainWindow().buttons()["Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Launching game via ID field
|
||||
target.frontMostApp().mainWindow().textFields()[3].setValue("122235601"); //select Test Place #1 on GT1
|
||||
target.frontMostApp().keyboard().typeString("\n"); //hit Enter on a keyboard to launch game
|
||||
|
||||
//Waiting 35 sec for game to launch
|
||||
target.delay(35);
|
||||
|
||||
//Verifying that game is running (keyboard pops up after pressing chat button)
|
||||
var testName = "Game launched";
|
||||
target.frontMostApp().mainWindow().images()[0].images()[1].tapWithOptions({tapOffset:{x:0.25, y:0.03}}); //open chat (works!)
|
||||
target.delay(1);
|
||||
|
||||
//Check if keyboard is active
|
||||
if (target.frontMostApp().keyboard().isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Type something
|
||||
|
||||
|
||||
target.delay(1);
|
||||
|
||||
target.frontMostApp().keyboard().typeString("Test is over\n");
|
||||
|
||||
target.delay(5);
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
//Script for testing game launching on iPad on GT1 (inernal build)
|
||||
|
||||
|
||||
var target = UIATarget.localTarget();
|
||||
|
||||
var app = target.frontMostApp();
|
||||
|
||||
var window = app.mainWindow();
|
||||
|
||||
|
||||
//Initial screen elements
|
||||
|
||||
var wheel = target.frontMostApp().mainWindow().pickers()[0].wheels()[0]; //picker wheel
|
||||
|
||||
var loginButton = target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"];
|
||||
|
||||
var aboutButtoniPad = target.frontMostApp().mainWindow().scrollViews()[0].buttons()[4] //for iPad
|
||||
|
||||
var nameField = target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0];
|
||||
|
||||
var passwordField = target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0];
|
||||
|
||||
|
||||
//-=FUNCTIONS=-
|
||||
|
||||
|
||||
//Login Function
|
||||
|
||||
function login(username, password)
|
||||
{
|
||||
if (loginButton.isValid())
|
||||
{
|
||||
UIALogger.logMessage("Setting username as '" + username + "'");
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0].setValue(username);
|
||||
UIALogger.logMessage("Setting password as '" + password + "'");
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0].setValue(password);
|
||||
loginButton.tap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-=TESTING SCRIPT=-
|
||||
|
||||
|
||||
//Create elements log:
|
||||
target.logElementTree();
|
||||
|
||||
//Select test environment
|
||||
|
||||
wheel.selectValue("http://www.gametest1.pizzaboxer.fun/"); //selecting test environment
|
||||
|
||||
UIALogger.logMessage("Test Environment: " + wheel.value()); //log current selected environment
|
||||
|
||||
//Normal login attempt
|
||||
|
||||
//Start logging
|
||||
var testName = "Normal login test";
|
||||
login ("mobiletest","hackproof12");
|
||||
|
||||
target.delay(5);
|
||||
|
||||
//if login screen is still active
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logFail(testName); //then test failed
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logPass(testName); //otherwise test passed (app switched to another screen)
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Go to Games page
|
||||
var testName = "Go to Games Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Games"].tap();
|
||||
|
||||
//Validate
|
||||
target.delay(5);
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].staticTexts()["Popular"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//////-inserted
|
||||
|
||||
// Open Featured Games
|
||||
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].elements()[2].tap();
|
||||
target.frontMostApp().mainWindow().popover().tableViews()["Empty list"].cells()["Featured"].tap();
|
||||
|
||||
target.delay(5);
|
||||
|
||||
//Select place "Test Place #1"
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].links()["Test Place #1"].images()[0].tap();
|
||||
|
||||
target.delay(5);
|
||||
|
||||
//Launch game
|
||||
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].links()["Play"].tap();
|
||||
|
||||
|
||||
//Waiting 15 sec for game to launch
|
||||
target.delay(15);
|
||||
|
||||
|
||||
//Verifying that game is running (Keyboard pops up after pressing chat button)
|
||||
|
||||
var testName = "Game launched";
|
||||
|
||||
target.frontMostApp().mainWindow().images()[0].images()[0].tapWithOptions({tapOffset:{x:0.12, y:0.03}});//Press Chat button, keyboard should pop up
|
||||
|
||||
|
||||
//Verify that keyboard pops up, so the game is running
|
||||
if (target.frontMostApp().keyboard().isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Type something
|
||||
|
||||
|
||||
target.delay(1);
|
||||
|
||||
target.frontMostApp().keyboard().typeString("Test is over\n");
|
||||
|
||||
target.delay(5);
|
||||
@@ -0,0 +1,143 @@
|
||||
//Script for testing game launching on iPad on GT2 (inernal build)
|
||||
|
||||
|
||||
var target = UIATarget.localTarget();
|
||||
|
||||
var app = target.frontMostApp();
|
||||
|
||||
var window = app.mainWindow();
|
||||
|
||||
|
||||
//Initial screen elements
|
||||
|
||||
var wheel = target.frontMostApp().mainWindow().pickers()[0].wheels()[0]; //picker wheel
|
||||
|
||||
var loginButton = target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"];
|
||||
|
||||
var aboutButtoniPad = target.frontMostApp().mainWindow().scrollViews()[0].buttons()[4] //for iPad
|
||||
|
||||
var nameField = target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0];
|
||||
|
||||
var passwordField = target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0];
|
||||
|
||||
|
||||
//-=FUNCTIONS=-
|
||||
|
||||
|
||||
//Login Function
|
||||
|
||||
function login(username, password)
|
||||
{
|
||||
if (loginButton.isValid())
|
||||
{
|
||||
UIALogger.logMessage("Setting username as '" + username + "'");
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0].setValue(username);
|
||||
UIALogger.logMessage("Setting password as '" + password + "'");
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0].setValue(password);
|
||||
loginButton.tap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-=TESTING SCRIPT=-
|
||||
|
||||
|
||||
//Create elements log:
|
||||
target.logElementTree();
|
||||
|
||||
//Select test environment
|
||||
|
||||
wheel.selectValue("http://www.gametest2.pizzaboxer.fun/"); //selecting test environment
|
||||
|
||||
UIALogger.logMessage("Test Environment: " + wheel.value()); //log current selected environment
|
||||
|
||||
//Normal login attempt
|
||||
|
||||
//Start logging
|
||||
var testName = "Normal login test";
|
||||
login ("mobiletest","hackproof12");
|
||||
|
||||
target.delay(5);
|
||||
|
||||
//if login screen is still active
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logFail(testName); //then test failed
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logPass(testName); //otherwise test passed (app switched to another screen)
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Go to Games page
|
||||
var testName = "Go to Games Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Games"].tap();
|
||||
|
||||
//Validate
|
||||
target.delay(5);
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].staticTexts()["Popular"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//////-inserted
|
||||
|
||||
// Open Featured Games
|
||||
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].elements()[2].tap();
|
||||
target.frontMostApp().mainWindow().popover().tableViews()["Empty list"].cells()["Featured"].tap();
|
||||
|
||||
target.delay(5);
|
||||
|
||||
//Select place "Test Place #1"
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].links()["Test Place #1"].images()[0].tap();
|
||||
|
||||
target.delay(5);
|
||||
|
||||
//Launch game
|
||||
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].links()["Play"].tap();
|
||||
|
||||
|
||||
//Waiting 15 sec for game to launch
|
||||
target.delay(15);
|
||||
|
||||
|
||||
//Verifying that game is running (Keyboard pops up after pressing chat button)
|
||||
|
||||
var testName = "Game launched";
|
||||
|
||||
target.frontMostApp().mainWindow().images()[0].images()[0].tapWithOptions({tapOffset:{x:0.12, y:0.03}});//Press Chat button, keyboard should pop up
|
||||
|
||||
|
||||
//Verify that keyboard pops up, so the game is running
|
||||
if (target.frontMostApp().keyboard().isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Type something
|
||||
|
||||
|
||||
target.delay(1);
|
||||
|
||||
target.frontMostApp().keyboard().typeString("Test is over\n");
|
||||
|
||||
target.delay(5);
|
||||
@@ -0,0 +1,127 @@
|
||||
//iPod game launching and verification on GT1 (internal build)
|
||||
|
||||
|
||||
var target = UIATarget.localTarget();
|
||||
|
||||
var app = target.frontMostApp();
|
||||
|
||||
var window = app.mainWindow();
|
||||
|
||||
//Initial screen elements
|
||||
|
||||
|
||||
var wheel = target.frontMostApp().mainWindow().scrollViews()[0].pickers()[0].wheels()[0]; //picker wheel
|
||||
|
||||
var loginButton = target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"];
|
||||
|
||||
var aboutButton = target.frontMostApp().mainWindow().scrollViews()[0].buttons()[3];
|
||||
|
||||
var nameField = target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0];
|
||||
|
||||
var passwordField = target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0];
|
||||
|
||||
|
||||
|
||||
//-=FUNCTIONS=-
|
||||
|
||||
|
||||
//Login Function
|
||||
|
||||
function login(username, password)
|
||||
{
|
||||
if (loginButton.isValid())
|
||||
{
|
||||
UIALogger.logMessage("Setting username as '" + username + "'");
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0].setValue(username);
|
||||
UIALogger.logMessage("Setting password as '" + password + "'");
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0].setValue(password);
|
||||
loginButton.tap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-=TESTING SCRIPT=-
|
||||
|
||||
|
||||
//Create elements log:
|
||||
target.logElementTree();
|
||||
|
||||
|
||||
//Select test environment
|
||||
wheel.selectValue("http://m.gametest1.pizzaboxer.fun/"); //selecting test environment
|
||||
UIALogger.logMessage("Test Environment: " + wheel.value()); //log current selected environment
|
||||
|
||||
|
||||
|
||||
//Normal login attempt
|
||||
|
||||
//Start logging
|
||||
var testName = "Normal login test";
|
||||
login ("mobiletest","hackproof12");
|
||||
|
||||
target.delay(5);
|
||||
|
||||
//if login screen is still active
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logFail(testName); //then test failed
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logPass(testName); //otherwise test passed (app switched to another screen)
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
//Go to Games page
|
||||
var testName = "Go to Games Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Games"].tap();
|
||||
//Validate
|
||||
target.delay(3);
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].staticTexts()["Featured Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Show all games ("See more")
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].links()[0].tap();
|
||||
|
||||
target.delay(1);
|
||||
|
||||
//Launch "Test Place #1"
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].links()["\nTest Place #1\n"].tap();
|
||||
|
||||
//Waiting 10 sec for game to launch
|
||||
target.delay(15);
|
||||
|
||||
//Verifying that game is running (keyboard pops up after pressing chat button)
|
||||
var testName = "Game launched";
|
||||
target.frontMostApp().mainWindow().images()[0].images()[1].tapWithOptions({tapOffset:{x:0.23, y:0.06}}); //open chat (works!)
|
||||
target.delay(1);
|
||||
|
||||
//Check if keyboard is active
|
||||
if (target.frontMostApp().keyboard().isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Type something
|
||||
|
||||
|
||||
target.delay(1);
|
||||
|
||||
target.frontMostApp().keyboard().typeString("Test is over\n");
|
||||
|
||||
target.delay(5);
|
||||
@@ -0,0 +1,127 @@
|
||||
//iPod game launching and verification on GT2 (internal build)
|
||||
|
||||
|
||||
var target = UIATarget.localTarget();
|
||||
|
||||
var app = target.frontMostApp();
|
||||
|
||||
var window = app.mainWindow();
|
||||
|
||||
//Initial screen elements
|
||||
|
||||
|
||||
var wheel = target.frontMostApp().mainWindow().scrollViews()[0].pickers()[0].wheels()[0]; //picker wheel
|
||||
|
||||
var loginButton = target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"];
|
||||
|
||||
var aboutButton = target.frontMostApp().mainWindow().scrollViews()[0].buttons()[3];
|
||||
|
||||
var nameField = target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0];
|
||||
|
||||
var passwordField = target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0];
|
||||
|
||||
|
||||
|
||||
//-=FUNCTIONS=-
|
||||
|
||||
|
||||
//Login Function
|
||||
|
||||
function login(username, password)
|
||||
{
|
||||
if (loginButton.isValid())
|
||||
{
|
||||
UIALogger.logMessage("Setting username as '" + username + "'");
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0].setValue(username);
|
||||
UIALogger.logMessage("Setting password as '" + password + "'");
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0].setValue(password);
|
||||
loginButton.tap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-=TESTING SCRIPT=-
|
||||
|
||||
|
||||
//Create elements log:
|
||||
target.logElementTree();
|
||||
|
||||
|
||||
//Select test environment
|
||||
wheel.selectValue("http://m.gametest2.pizzaboxer.fun/"); //selecting test environment
|
||||
UIALogger.logMessage("Test Environment: " + wheel.value()); //log current selected environment
|
||||
|
||||
|
||||
|
||||
//Normal login attempt
|
||||
|
||||
//Start logging
|
||||
var testName = "Normal login test";
|
||||
login ("mobiletest","hackproof12");
|
||||
|
||||
target.delay(5);
|
||||
|
||||
//if login screen is still active
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
|
||||
{
|
||||
UIALogger.logFail(testName); //then test failed
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logPass(testName); //otherwise test passed (app switched to another screen)
|
||||
}
|
||||
|
||||
//====
|
||||
|
||||
//Go to Games page
|
||||
var testName = "Go to Games Page";
|
||||
target.frontMostApp().mainWindow().buttons()["Games"].tap();
|
||||
//Validate
|
||||
target.delay(3);
|
||||
if (target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].staticTexts()["Featured Games"].isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Show all games ("See more")
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].links()[0].tap();
|
||||
|
||||
target.delay(1);
|
||||
|
||||
//Launch "Sound Replication" place
|
||||
target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].links()["\nSound Replication Test\n"].tap();
|
||||
|
||||
//Waiting 10 sec for game to launch
|
||||
target.delay(15);
|
||||
|
||||
//Verifying that game is running (keyboard pops up after pressing chat button)
|
||||
var testName = "Game launched";
|
||||
target.frontMostApp().mainWindow().images()[0].images()[1].tapWithOptions({tapOffset:{x:0.23, y:0.06}}); //open chat (works!)
|
||||
target.delay(1);
|
||||
|
||||
//Check if keyboard is active
|
||||
if (target.frontMostApp().keyboard().isValid())
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIALogger.logFail(testName);
|
||||
}
|
||||
|
||||
//Type something
|
||||
|
||||
|
||||
target.delay(1);
|
||||
|
||||
target.frontMostApp().keyboard().typeString("Test is over\n");
|
||||
|
||||
target.delay(5);
|
||||
@@ -0,0 +1,113 @@
|
||||
var webTimeout = 2;
|
||||
var loginTimeout = 15;
|
||||
|
||||
var target = UIATarget.localTarget();
|
||||
var webView = target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0];
|
||||
var app = target.frontMostApp();
|
||||
var window = app.mainWindow();
|
||||
var innerWindow = window.scrollViews();
|
||||
|
||||
//Initial screen elements
|
||||
var wheel = target.frontMostApp().mainWindow().pickers()[0].wheels()[0]; //picker wheel
|
||||
var loginButton = target.frontMostApp().mainWindow().scrollViews()[0].staticTexts()["Login"];
|
||||
var aboutButtoniPad = target.frontMostApp().mainWindow().scrollViews()[0].buttons()[4]; //for iPad
|
||||
var nameField = target.frontMostApp().mainWindow().scrollViews()[0].textFields()[0];
|
||||
var passwordField = target.frontMostApp().mainWindow().scrollViews()[0].secureTextFields()[0];
|
||||
|
||||
function login(username, password)
|
||||
{
|
||||
if (loginButton.isValid())
|
||||
{
|
||||
UIALogger.logMessage("Setting username as '" + username + "'");
|
||||
innerWindow[0].textFields()[0].setValue(username);
|
||||
UIALogger.logMessage("Setting password as '" + password + "'");
|
||||
innerWindow[0].secureTextFields()[0].setValue(password);
|
||||
loginButton.tap()
|
||||
}
|
||||
}
|
||||
|
||||
function verifyWebViewStaticText(webView, textToVerify)
|
||||
{
|
||||
if (webView.staticTexts()[textToVerify].isValid())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function startTest(testName)
|
||||
{
|
||||
UIALogger.logStart(testName);
|
||||
UIALogger.logMessage("##teamcity[testStarted name='" + testName + "']");
|
||||
}
|
||||
|
||||
function failTest(testName, message, details)
|
||||
{
|
||||
if (!testName)
|
||||
{
|
||||
UIALogger.logMessage("ERROR: Test name not provided!");
|
||||
return;
|
||||
}
|
||||
if (!details)
|
||||
details = "No additional details provided.";
|
||||
if (!message)
|
||||
message = testName + "failed for unspecified reason.";
|
||||
|
||||
UIALogger.logFail(testName);
|
||||
UIALogger.logMessage("##teamcity[testFailed name='" + testName + "' message='" + message + "' details='" + details +"']");
|
||||
UIALogger.logMessage("##teamcity[testFinished name='" + testName + "']");
|
||||
}
|
||||
|
||||
function passTest(testName)
|
||||
{
|
||||
UIALogger.logPass(testName);
|
||||
UIALogger.logMessage("##teamcity[testFinished name='" + testName + "']");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Select the test environment (GT1)
|
||||
wheel.selectValue("http://www.gametest1.pizzaboxer.fun/");
|
||||
UIALogger.logMessage("Test Environment: " + wheel.value());
|
||||
|
||||
startTest("Open About Page");
|
||||
aboutButtoniPad.tap();
|
||||
var navBar = app.navigationBar();
|
||||
|
||||
if (navBar.name() == "About")
|
||||
passTest("Open About Page");
|
||||
else
|
||||
failTest("About Page", "About Page failed to open.");
|
||||
|
||||
// Close About page
|
||||
startTest("Close About Page");
|
||||
navBar.buttons()["Close"].tap()
|
||||
target.delay(1);
|
||||
|
||||
if (window.scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
passTest("Close About Page");
|
||||
else
|
||||
failTest("Close About Page", "About Page failed to close.");
|
||||
|
||||
|
||||
|
||||
// Attempt to login to the game
|
||||
startTest("Login Test");
|
||||
|
||||
login("mobiletest", "hackproof12");
|
||||
target.delay(loginTimeout);
|
||||
|
||||
if (!window.scrollViews()[0].staticTexts()["Login"].isValid())
|
||||
passTest("Login Test");
|
||||
else
|
||||
failTest("Login Test", "Game failed to log in.");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user