Commit 7c779099 authored by Alex Moore's avatar Alex Moore

Jakes RTI Test

parent aa089a59
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:headlessbrower_test1.xcodeproj">
</FileRef>
</Workspace>
(function() {
var el = document.getElementById("CollectionList1");
var btn = document.getElementById("singleRight");
el.selctedIndex = selectedAdd;
btn.click();
})();
\ No newline at end of file
//
// AppDelegate.h
// headlessbrower_test1
//
// Created by PLUC SeniorDesign on 2/23/15.
// Copyright (c) 2015 PLUC SeniorDesign. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
//
// AppDelegate.m
// headlessbrower_test1
//
// Created by PLUC SeniorDesign on 2/23/15.
// Copyright (c) 2015 PLUC SeniorDesign. All rights reserved.
//
#import "AppDelegate.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6214" systemVersion="14A314h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2015 PLUC SeniorDesign. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="20" y="439" width="441" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="headlessbrower_test1" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="140" width="441" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="548" y="455"/>
</view>
</objects>
</document>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6254" systemVersion="14C109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<webView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PJD-sX-uSn">
<rect key="frame" x="139" y="2" width="322" height="595"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" constant="322" id="UkT-51-5Bj"/>
</constraints>
</webView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="PJD-sX-uSn" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="2Oe-QQ-8Ko"/>
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="PJD-sX-uSn" secondAttribute="bottom" constant="3" id="B70-9K-Lc4"/>
<constraint firstItem="PJD-sX-uSn" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="topMargin" constant="2" id="hrC-0D-WZz"/>
</constraints>
</view>
<connections>
<outlet property="test_view" destination="PJD-sX-uSn" id="G6l-DL-LPN"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>
(function() {
finishedScanning();
})();
\ No newline at end of file
(function() {
var el = document.getElementById("CollectionList1");
var opts = el.options;
var str = '{ "options" : [';
for (var i = 0; i < opts.length; i++) {
str += '{"value":"' + opts[i].value + '", '
+ '"text":"' + opts[i].innerHTML.trim() + '"}'
if (i + 1 != opts.length)
str += ",";
}
str += "]}";
return str;
})();
\ No newline at end of file
(function() {
var div = document.getElementById("ActionMessage");
var msg = div.getElementsByTagName("td")[0].trim().replace(",", "-");
return msg.replace(/<br>/g, ",");
})();
\ No newline at end of file
(function() {
// TODO: Possibly extra to get and be able to display previous 5 scans
// TODO: these previous five are in table
})();
\ No newline at end of file
(function() {
var el = document.getElementById("CollectionList2");
var opts = el.options;
var str = '{ "options" : [';
for (var i = 0; i < opts.length; i++) {
str += '{"value":"' + opts[i].value + '", '
+ '"text":"' + opts[i].innerHTML.trim() + '"}'
if (i + 1 != opts.length)
str += ",";
}
str += "]}";
return str;
})();
\ No newline at end of file
(function() {
// TODO: Believe this is what the continue button does
onContinue();
})();
\ No newline at end of file
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>PLUC.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
(function() {
var user = document.getElementById(); // User ID input
var pword = document.getElementById(); // Password input
var loc = document.getElementById(); // Location select
var type = document.getElementsByName(); // Scan or Identify missing Radiobuttons
var btn = document.getElementById(); // Login button
user.value = "circ_admin";
pword.value = "silver";
loc.selectedIndex = 1; // Make sure this is the Lewisburg branch
// TODO: Add select of radio button to be scan or identify missing items
btn.click();
})();
\ No newline at end of file
(function() {
var el = document.getElementById("CollectionList1");
var btn = document.getElementById("singleLeft");
el.selctedIndex = selectedRemove;
btn.click();
})();
\ No newline at end of file
(function() {
var overdue = document.getElementById("IgnoreOverdueFines");
var okBtn = document.getElementById("OkBtn");
overdue.checked = true;
okBtn.click();
})();
\ No newline at end of file
(function() {
var barcode = document.getElementById("BarcodeInput");
barcode.value = code;
// TODO: Think this is good enough to call function present
recordBarcode();
})();
\ No newline at end of file
//
// ViewController.h
// headlessbrower_test1
//
// Created by PLUC SeniorDesign on 2/23/15.
// Copyright (c) 2015 PLUC SeniorDesign. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController<UIWebViewDelegate>
@property (weak, nonatomic) IBOutlet UIWebView *test_view;
@end
//
// ViewController.m
// headlessbrower_test1
//
// Created by PLUC SeniorDesign on 2/23/15.
// Copyright (c) 2015 PLUC SeniorDesign. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
// [self.test_view loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.xkcd.com"]]];
[self.test_view loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"file:///Users/plucseniordesign/Desktop/RTISetup.html"]]];
//NSMutableURLRequest *rq = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]];
//[rq setValue:@"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/600.3.18 (KHTML, like Gecko) Version/8.0.3 Safari/600.3.18" forHTTPHeaderField:@"User-Agent"];
//[self.test_view loadRequest:rq];
[self.test_view setDelegate:self];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void)webViewDidFinishLoad:(UIWebView *)webView {
[webView stringByEvaluatingJavaScriptFromString:@"var test1 = 'Hello Pluto'"];
NSString *newHtml = [webView stringByEvaluatingJavaScriptFromString:@"test1"];
NSLog(@"%@\n", newHtml);
NSString *path = [[NSBundle mainBundle] pathForResource:@"WhatPage" ofType:@"js"];
NSString *content = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
NSString *page = [webView stringByEvaluatingJavaScriptFromString:content];
NSLog(@"PAGE NUMBER IS: %@\n", page);
if ([page isEqual: @"0"]) { // Login Page
// Do not have login function just yet
}
else if ([page isEqual: @"1"]) {// Setup Page
// Get collections available - Testing GetAvailableCollections
NSString *getAvailablePath = [[NSBundle mainBundle] pathForResource:@"GetAvailableCollections" ofType:@"js"];
NSString *getAvailable = [NSString stringWithContentsOfFile:getAvailablePath encoding:NSUTF8StringEncoding error:nil];
NSString *available = [webView stringByEvaluatingJavaScriptFromString:getAvailable];
//NSLog(@"%@\n", available);
// Add two collections - Testing AddCollection
NSString *addSelectedPath = [[NSBundle mainBundle] pathForResource:@"AddCollection" ofType:@"js"];
NSString *addSelected = [NSString stringWithContentsOfFile:addSelectedPath encoding:NSUTF8StringEncoding error:nil];
NSString *selected = [webView stringByEvaluatingJavaScriptFromString:@"var selectedAdd = 1;"];
NSString *add = [webView stringByEvaluatingJavaScriptFromString:addSelected];
if ([add isEqual:@"-1"]) {
NSLog(@"FAILED\n");
}
else {
NSLog(@"NOT FAILED\n");
}
selected = [webView stringByEvaluatingJavaScriptFromString:@"var selectedAdd = 2;"];
add = [webView stringByEvaluatingJavaScriptFromString:addSelected];
// Get all of the collections selected - Testing GetSelectedCollections
NSString *getSelectedPath = [[NSBundle mainBundle] pathForResource:@"GetSelectedCollections" ofType:@"js"];
NSString *getSelected = [NSString stringWithContentsOfFile:getSelectedPath encoding:NSUTF8StringEncoding error:nil];
NSString *currentSelected = [webView stringByEvaluatingJavaScriptFromString:getSelected];
NSLog(@"%@\n", currentSelected);
// Remove one collection selected - Testing RemoveCollection
NSString *removeSelectedPath = [[NSBundle mainBundle] pathForResource:@"RemoveCollection" ofType:@"js"];
NSString *removeSelected = [NSString stringWithContentsOfFile:removeSelectedPath encoding:NSUTF8StringEncoding error:nil];
NSString *selectedRemove = [webView stringByEvaluatingJavaScriptFromString:@"var selectedRemove = 1;"];
NSString *remove = [webView stringByEvaluatingJavaScriptFromString:removeSelected];
// Save setup configuration - Testing SaveSetup
NSString *saveSetupPath = [[NSBundle mainBundle] pathForResource:@"SaveSetup" ofType:@"js"];
NSString *saveSetup = [NSString stringWithContentsOfFile:saveSetupPath encoding:NSUTF8StringEncoding error:nil];
NSString *save = [webView stringByEvaluatingJavaScriptFromString:saveSetup];
}
else if ([page isEqual: @"2"]) { // Scan Page
// Scan in an input (arbitrary string of "1234567") - Testing ScanBarcode
NSString *scanPath = [[NSBundle mainBundle] pathForResource:@"ScanBarcode" ofType:@"js"];
NSString *scan = [NSString stringWithContentsOfFile:scanPath encoding:NSUTF8StringEncoding error:nil];
NSString *code = [webView stringByEvaluatingJavaScriptFromString:@"var code = '1234567';"];
NSString *scaned = [webView stringByEvaluatingJavaScriptFromString:scan];
// Get scanned codes - Testing GetScanned
NSString *getScanPath = [[NSBundle mainBundle] pathForResource:@"GetScanned" ofType:@"js"];
NSString *getScan = [NSString stringWithContentsOfFile:getScanPath encoding:NSUTF8StringEncoding error:nil];
NSString *scanned = [webView stringByEvaluatingJavaScriptFromString:getScan];
NSLog(@"Scanned codes: %@\n", scanned);
// Test FinishScan
NSString *finishPath = [[NSBundle mainBundle] pathForResource:@"FinishScan" ofType:@"js"];
NSString *finish = [NSString stringWithContentsOfFile:finishPath encoding:NSUTF8StringEncoding error:nil];
NSString *isFinished = [webView stringByEvaluatingJavaScriptFromString:finish];
if ([isFinished isEqual:@"-1"])
{}
else {
NSLog(@"FINISHED NOT FAILED\n");
}
}
else if([page isEqual: @"3"]) { // Error/Action Page
// Get the error - Testing GetError
NSString *getErrorPath = [[NSBundle mainBundle] pathForResource:@"GetError" ofType:@"js"];
NSString *getError = [NSString stringWithContentsOfFile:getErrorPath encoding:NSUTF8StringEncoding error:nil];
NSString *error = [webView stringByEvaluatingJavaScriptFromString:getError];
NSLog(@"Error is %@\n", error);
// Continue - Testing GoToScan
NSString *goToScanPath = [[NSBundle mainBundle] pathForResource:@"GoToScan" ofType:@"js"];
NSString *goToScan = [NSString stringWithContentsOfFile:goToScanPath encoding:NSUTF8StringEncoding error:nil];
NSString *toScan = [webView stringByEvaluatingJavaScriptFromString:goToScan];
}
}
@end
(function() {
var url = document.URL;
if (url.search("Login") != -1)
return 0;
else if (url.search("Setup") != -1)
return 1;
else if (url.search("Scan") != -1)
return 2;
else if (url.search("Action") != -1)
return 3;
else
return 4;
})();
\ No newline at end of file
//
// main.m
// headlessbrower_test1
//
// Created by PLUC SeniorDesign on 2/23/15.
// Copyright (c) 2015 PLUC SeniorDesign. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>PLUC.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
//
// headlessbrower_test1Tests.m
// headlessbrower_test1Tests
//
// Created by PLUC SeniorDesign on 2/23/15.
// Copyright (c) 2015 PLUC SeniorDesign. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
@interface headlessbrower_test1Tests : XCTestCase
@end
@implementation headlessbrower_test1Tests
- (void)setUp {
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
}
- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}
- (void)testExample {
// This is an example of a functional test case.
XCTAssert(YES, @"Pass");
}
- (void)testPerformanceExample {
// This is an example of a performance test case.
[self measureBlock:^{
// Put the code you want to measure the time of here.
}];
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment