Commit b06a2017 authored by Drewdabb's avatar Drewdabb
Browse files

work from RTI library test

parent 7c779099
......@@ -14,7 +14,6 @@
EF5EF4241A9C09EF00679799 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EF5EF4231A9C09EF00679799 /* Images.xcassets */; };
EF5EF4271A9C09EF00679799 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = EF5EF4251A9C09EF00679799 /* LaunchScreen.xib */; };
EF5EF4331A9C09F000679799 /* headlessbrower_test1Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = EF5EF4321A9C09F000679799 /* headlessbrower_test1Tests.m */; };
EF8072851AA4C57A00D8FF6C /* WhatPage.js in Resources */ = {isa = PBXBuildFile; fileRef = EF8072841AA4C57A00D8FF6C /* WhatPage.js */; };
EF80728B1AA4CBFF00D8FF6C /* AddCollection.js in Resources */ = {isa = PBXBuildFile; fileRef = EF8072861AA4CBFF00D8FF6C /* AddCollection.js */; };
EF80728C1AA4CBFF00D8FF6C /* GetAvailableCollections.js in Resources */ = {isa = PBXBuildFile; fileRef = EF8072871AA4CBFF00D8FF6C /* GetAvailableCollections.js */; };
EF80728D1AA4CBFF00D8FF6C /* GetSelectedCollections.js in Resources */ = {isa = PBXBuildFile; fileRef = EF8072881AA4CBFF00D8FF6C /* GetSelectedCollections.js */; };
......@@ -26,6 +25,7 @@
EF8072991AA4D7A700D8FF6C /* FinishScan.js in Resources */ = {isa = PBXBuildFile; fileRef = EF8072961AA4D7A700D8FF6C /* FinishScan.js */; };
EF80729A1AA4D7A700D8FF6C /* GetScanned.js in Resources */ = {isa = PBXBuildFile; fileRef = EF8072971AA4D7A700D8FF6C /* GetScanned.js */; };
EF80729B1AA4D7A700D8FF6C /* ScanBarcode.js in Resources */ = {isa = PBXBuildFile; fileRef = EF8072981AA4D7A700D8FF6C /* ScanBarcode.js */; };
F918F8011AA4DF21009C108D /* WhatPage.js in Resources */ = {isa = PBXBuildFile; fileRef = F918F8001AA4DF21009C108D /* WhatPage.js */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
......@@ -52,7 +52,6 @@
EF5EF42C1A9C09F000679799 /* headlessbrower_test1Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = headlessbrower_test1Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
EF5EF4311A9C09F000679799 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
EF5EF4321A9C09F000679799 /* headlessbrower_test1Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = headlessbrower_test1Tests.m; sourceTree = "<group>"; };
EF8072841AA4C57A00D8FF6C /* WhatPage.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = WhatPage.js; path = ../../../../../../../../Desktop/headlessbrower_test1/headlessbrower_test1/WhatPage.js; sourceTree = BUILT_PRODUCTS_DIR; };
EF8072861AA4CBFF00D8FF6C /* AddCollection.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = AddCollection.js; sourceTree = "<group>"; };
EF8072871AA4CBFF00D8FF6C /* GetAvailableCollections.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = GetAvailableCollections.js; sourceTree = "<group>"; };
EF8072881AA4CBFF00D8FF6C /* GetSelectedCollections.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = GetSelectedCollections.js; sourceTree = "<group>"; };
......@@ -64,6 +63,7 @@
EF8072961AA4D7A700D8FF6C /* FinishScan.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = FinishScan.js; sourceTree = "<group>"; };
EF8072971AA4D7A700D8FF6C /* GetScanned.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = GetScanned.js; sourceTree = "<group>"; };
EF8072981AA4D7A700D8FF6C /* ScanBarcode.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = ScanBarcode.js; sourceTree = "<group>"; };
F918F8001AA4DF21009C108D /* WhatPage.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = WhatPage.js; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -105,6 +105,7 @@
EF5EF4151A9C09EF00679799 /* headlessbrower_test1 */ = {
isa = PBXGroup;
children = (
F918F8001AA4DF21009C108D /* WhatPage.js */,
EF8072961AA4D7A700D8FF6C /* FinishScan.js */,
EF8072971AA4D7A700D8FF6C /* GetScanned.js */,
EF8072981AA4D7A700D8FF6C /* ScanBarcode.js */,
......@@ -116,7 +117,6 @@
EF8072881AA4CBFF00D8FF6C /* GetSelectedCollections.js */,
EF8072891AA4CBFF00D8FF6C /* RemoveCollection.js */,
EF80728A1AA4CBFF00D8FF6C /* SaveSetup.js */,
EF8072841AA4C57A00D8FF6C /* WhatPage.js */,
EF5EF41A1A9C09EF00679799 /* AppDelegate.h */,
EF5EF41B1A9C09EF00679799 /* AppDelegate.m */,
EF5EF41D1A9C09EF00679799 /* ViewController.h */,
......@@ -247,9 +247,9 @@
EF8072991AA4D7A700D8FF6C /* FinishScan.js in Resources */,
EF80728D1AA4CBFF00D8FF6C /* GetSelectedCollections.js in Resources */,
EF8072931AA4D78F00D8FF6C /* GoToScan.js in Resources */,
F918F8011AA4DF21009C108D /* WhatPage.js in Resources */,
EF8072921AA4D78F00D8FF6C /* GetError.js in Resources */,
EF80729A1AA4D7A700D8FF6C /* GetScanned.js in Resources */,
EF8072851AA4C57A00D8FF6C /* WhatPage.js in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
......@@ -3,5 +3,5 @@
var btn = document.getElementById("singleRight");
el.selctedIndex = selectedAdd;
btn.click();
doTransfer1();
})();
\ 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, ",");
var msg = div.getElementsByTagName("td")[0].innerHTML.trim().replace(",", "-");
return msg.replace(/<br>/g, ",");
})();
\ No newline at end of file
(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 user = document.getElementById("UserID"); // User ID input
var pword = document.getElementById("Password"); // Password input
var loc = document.getElementById("LocationSelCtl"); // Location select
var type = document.getElementsByName("ScanType"); // Scan or Identify missing Radiobuttons
var inventory = document.getElementById("InventoryRadioBtn");
var missing = document.getElementById("IDMissingRadioBtn");
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
inventory.checked = true;
btn.click();
})();
\ No newline at end of file
......@@ -15,120 +15,177 @@
@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];
[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:@"http://192.168.1.131/rti/"]]];
// 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.
[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];
- (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
NSString *loginPath =
[[NSBundle mainBundle] pathForResource:@"Login" ofType:@"js"];
NSString *login = [NSString stringWithContentsOfFile:loginPath
encoding:NSUTF8StringEncoding
error:nil];
NSString *success = [webView stringByEvaluatingJavaScriptFromString:login];
} 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 %lu\n", (unsigned long)error.length);
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
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