Commit d0c4657d authored by Drewdabb's avatar Drewdabb
Browse files

Post-M8-LibraryTest

parent 7f8a5d87
......@@ -4,6 +4,6 @@
el.selctedIndex = selectedAdd; // Selected add is the index of selected collection
el.value = el.options[selectedAdd];
el.value = el.options[selectedAdd].value;
doTransfer1();
})();
\ No newline at end of file
(function() {
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";
getLocation();
GetLocation();
var loc = document.getElementById("LocationSelCtl"); // Location select
loc.selectedIndex = 1; // Make sure this is the Lewisburg branch
loc.selectedIndex = 2; // Make sure this is the Lewisburg branch
loc.value = loc.options[2].value;
inventory.checked = true;
btn.click();
doLogin();
})();
\ No newline at end of file
(function() {
var el = document.getElementById("CollectionList1");
var el = document.getElementById("CollectionList2");
var btn = document.getElementById("singleLeft");
el.selctedIndex = selectedRemove;
btn.click();
el.value = el.options[selectedRemove].value;
doTransfer2();
})();
\ No newline at end of file
......@@ -18,11 +18,14 @@ bool webview_loaded;
- (void)viewDidLoad {
[super viewDidLoad];
[self.test_view loadRequest:[NSURLRequest requestWithURL:
[self.test_view
loadRequest:[NSURLRequest
requestWithURL:
[NSURL URLWithString:@"http://192.168.1.131/rti/"]]];
// Test collection page on mac mini desktop
// [self.test_view loadRequest:[NSURLRequest requestWithURL: [NSURL URLWithString:@"file:///Users/plucseniordesign/Desktop/RTISetup.html"]]];
// [self.test_view loadRequest:[NSURLRequest requestWithURL: [NSURL
// URLWithString:@"file:///Users/plucseniordesign/Desktop/RTISetup.html"]]];
[self.test_view setDelegate:self];
}
......@@ -49,40 +52,87 @@ bool webview_loaded;
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 *getAvailablePath =
[[NSBundle mainBundle] pathForResource:@"GetAvailableCollections"
ofType:@"js"];
NSString *getAvailable =
[NSString stringWithContentsOfFile:getAvailablePath
encoding:NSUTF8StringEncoding
error:nil];
NSString *available = [webView stringByEvaluatingJavaScriptFromString:getAvailable];
UIAlertView *collectionAlert = [[UIAlertView alloc] initWithTitle:@"Collections Available" message:available delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
NSString *available =
[webView stringByEvaluatingJavaScriptFromString:getAvailable];
UIAlertView *collectionAlert =
[[UIAlertView alloc] initWithTitle:@"Collections Available"
message:available
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[collectionAlert show];
// Get selected collections
NSString *selectedPath = [[NSBundle mainBundle] pathForResource:@"GetSelectedCollections" ofType:@"js"];
NSString *selectedFunc = [NSString stringWithContentsOfFile:selectedPath encoding:NSUTF8StringEncoding error:nil];
NSString *selected = [webView stringByEvaluatingJavaScriptFromString:selectedFunc];
UIAlertView *selectedAlert = [[UIAlertView alloc] initWithTitle:@"Collections Selected" message:selected delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
NSString *selectedPath =
[[NSBundle mainBundle] pathForResource:@"GetSelectedCollections"
ofType:@"js"];
NSString *selectedFunc =
[NSString stringWithContentsOfFile:selectedPath
encoding:NSUTF8StringEncoding
error:nil];
NSString *selected =
[webView stringByEvaluatingJavaScriptFromString:selectedFunc];
UIAlertView *selectedAlert =
[[UIAlertView alloc] initWithTitle:@"Collections Selected"
message:selected
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[selectedAlert show];
} else if ([page isEqual:@"2"]) { // Scan Page
// Get scanned codes - Testing GetScanned
NSString *getScanPath = [[NSBundle mainBundle] pathForResource:@"GetScanned" ofType:@"js"];
NSString *getScan = [NSString stringWithContentsOfFile:getScanPath encoding:NSUTF8StringEncoding error:nil];
NSString *getScanPath =
[[NSBundle mainBundle] pathForResource:@"GetScanned" ofType:@"js"];
NSString *getScan = [NSString stringWithContentsOfFile:getScanPath
encoding:NSUTF8StringEncoding
error:nil];
NSString *scanned = [webView stringByEvaluatingJavaScriptFromString:getScan];
NSString *scanned =
[webView stringByEvaluatingJavaScriptFromString:getScan];
self.bookLog.text = scanned;
UIAlertView *previousScan = [[UIAlertView alloc] initWithTitle:@"Previous Scans" message:scanned delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
UIAlertView *previousScan =
[[UIAlertView alloc] initWithTitle:@"Previous Scans"
message:scanned
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[previousScan show];
} 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 *getErrorPath =
[[NSBundle mainBundle] pathForResource:@"GetError" ofType:@"js"];
NSString *getError = [NSString stringWithContentsOfFile:getErrorPath
encoding:NSUTF8StringEncoding
error:nil];
NSString *error = [webView stringByEvaluatingJavaScriptFromString:getError];
UIAlertView *errorAlert = [[UIAlertView alloc] initWithTitle:@"Error Encountered" message:error delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
// Continue - Testing GoToScan
NSString *goToScanPath =
[[NSBundle mainBundle] pathForResource:@"GoToScan" ofType:@"js"];
NSString *goToScan = [NSString stringWithContentsOfFile:goToScanPath
encoding:NSUTF8StringEncoding
error:nil];
[self.test_view stringByEvaluatingJavaScriptFromString:goToScan];
UIAlertView *errorAlert =
[[UIAlertView alloc] initWithTitle:@"Error Encountered"
message:error
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[errorAlert show];
}
}
......@@ -94,7 +144,8 @@ bool webview_loaded;
encoding:NSUTF8StringEncoding
error:nil];
NSString *page = [self.test_view stringByEvaluatingJavaScriptFromString:content];
NSString *page =
[self.test_view stringByEvaluatingJavaScriptFromString:content];
NSLog(@"PAGE NUMBER IS: %@\n", page);
if ([page isEqual:@"0"]) { // Login Page
......@@ -104,9 +155,14 @@ bool webview_loaded;
encoding:NSUTF8StringEncoding
error:nil];
NSString *success = [self.test_view stringByEvaluatingJavaScriptFromString:login];
NSString *success =
[self.test_view stringByEvaluatingJavaScriptFromString:login];
UIAlertView *loginAlert = [[UIAlertView alloc] initWithTitle:@"Logged In!" message:success delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
UIAlertView *loginAlert = [[UIAlertView alloc] initWithTitle:@"Logged In!"
message:success
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[loginAlert show];
}
}
......@@ -118,7 +174,8 @@ bool webview_loaded;
encoding:NSUTF8StringEncoding
error:nil];
NSString *page = [self.test_view stringByEvaluatingJavaScriptFromString:content];
NSString *page =
[self.test_view stringByEvaluatingJavaScriptFromString:content];
NSLog(@"PAGE NUMBER IS: %@\n", page);
if ([page isEqual:@"2"]) { // Scan Page
......@@ -127,16 +184,21 @@ bool webview_loaded;
NSString *barcode = self.barcodeField.text;
if (barcode.length != 14) {
UIAlertView *noBarcode = [[UIAlertView alloc] initWithTitle:@"Invalid Barcode" message:@"Barcode ain't 14 characters" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
UIAlertView *noBarcode =
[[UIAlertView alloc] initWithTitle:@"Invalid Barcode"
message:@"Barcode ain't 14 characters"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[noBarcode show];
}
else {
} else {
NSString *stringStart = @"var code = '";
NSString *stringEnd = @"';";
NSString *newString = [stringStart stringByAppendingString:barcode];
NSString *inputCode = [newString stringByAppendingString:stringEnd];
NSString *scanPath = [[NSBundle mainBundle] pathForResource:@"ScanBarcode" ofType:@"js"];
NSString *scanPath =
[[NSBundle mainBundle] pathForResource:@"ScanBarcode" ofType:@"js"];
NSString *scan = [NSString stringWithContentsOfFile:scanPath
encoding:NSUTF8StringEncoding
error:nil];
......@@ -144,22 +206,48 @@ bool webview_loaded;
[self.test_view stringByEvaluatingJavaScriptFromString:inputCode];
[self.test_view 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 =
[self.test_view stringByEvaluatingJavaScriptFromString:getScan];
self.bookLog.text = scanned;
UIAlertView *previousScan =
[[UIAlertView alloc] initWithTitle:@"Previous Scans"
message:scanned
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[previousScan show];
}
}
}
- (IBAction)continueOnError:(id)sender {
NSString *path =
[[NSBundle mainBundle] pathForResource:@"WhatPage" ofType:@"js"];
NSString *content = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
NSString *content = [NSString stringWithContentsOfFile:path
encoding:NSUTF8StringEncoding
error:nil];
NSString *page = [self.test_view stringByEvaluatingJavaScriptFromString:content];
NSString *page =
[self.test_view stringByEvaluatingJavaScriptFromString:content];
NSLog(@"PAGE NUMBER IS: %@\n", page);
if ([page isEqual:@"3"]) { // Error/Action Page
//Continue - Testing GoToScan
NSString *goToScanPath = [[NSBundle mainBundle] pathForResource:@"GoToScan" ofType:@"js"];
NSString *goToScan = [NSString stringWithContentsOfFile:goToScanPath encoding:NSUTF8StringEncoding error:nil];
// Continue - Testing GoToScan
NSString *goToScanPath =
[[NSBundle mainBundle] pathForResource:@"GoToScan" ofType:@"js"];
NSString *goToScan = [NSString stringWithContentsOfFile:goToScanPath
encoding:NSUTF8StringEncoding
error:nil];
[self.test_view stringByEvaluatingJavaScriptFromString:goToScan];
}
}
......@@ -171,7 +259,8 @@ bool webview_loaded;
encoding:NSUTF8StringEncoding
error:nil];
NSString *page = [self.test_view stringByEvaluatingJavaScriptFromString:content];
NSString *page =
[self.test_view stringByEvaluatingJavaScriptFromString:content];
NSLog(@"PAGE NUMBER IS: %@\n", page);
// Test FinishScan
......@@ -198,29 +287,75 @@ bool webview_loaded;
encoding:NSUTF8StringEncoding
error:nil];
NSString *page = [self.test_view stringByEvaluatingJavaScriptFromString:content];
NSString *page =
[self.test_view stringByEvaluatingJavaScriptFromString:content];
NSLog(@"PAGE NUMBER IS: %@\n", page);
if ([page isEqual:@"1"]) {
// Get selected collections
NSString *selectedPath =
[[NSBundle mainBundle] pathForResource:@"GetSelectedCollections"
ofType:@"js"];
NSString *selectedFunc =
[NSString stringWithContentsOfFile:selectedPath
encoding:NSUTF8StringEncoding
error:nil];
NSString *selected =
[self.test_view stringByEvaluatingJavaScriptFromString:selectedFunc];
UIAlertView *selectedAlert =
[[UIAlertView alloc] initWithTitle:@"Collections Selected"
message:selected
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[selectedAlert show];
// Testing AddCollection
NSString *addSelectedPath = [[NSBundle mainBundle] pathForResource:@"AddCollection" ofType:@"js"];
NSString *addSelected = [NSString stringWithContentsOfFile:addSelectedPath encoding:NSUTF8StringEncoding error:nil];
[self.test_view stringByEvaluatingJavaScriptFromString:@"var selectedAdd = 49;"];
NSString *add = [self.test_view stringByEvaluatingJavaScriptFromString:addSelected];
if ([add isEqual:nil]) {
NSLog(@"nil failed");
}
else {
NSLog(@"NOT NILL UNFAILED");
}
// Testing Save SetUp
NSString *saveSetupPath = [[NSBundle mainBundle] pathForResource:@"SaveSetup" ofType:@"js"];
NSString *saveSetup = [NSString stringWithContentsOfFile:saveSetupPath encoding:NSUTF8StringEncoding error:nil];
[self.test_view stringByEvaluatingJavaScriptFromString:saveSetup];
// NSString *addSelectedPath =
// [[NSBundle mainBundle] pathForResource:@"AddCollection"
// ofType:@"js"];
// NSString *addSelected =
// [NSString stringWithContentsOfFile:addSelectedPath
// encoding:NSUTF8StringEncoding
// error:nil];
//
// [self.test_view
// stringByEvaluatingJavaScriptFromString:@"var selectedAdd = 49;"];
// NSString *add =
// [self.test_view
// stringByEvaluatingJavaScriptFromString:addSelected];
//
// if ([add isEqual:nil]) {
// NSLog(@"nil failed");
// } else {
// NSLog(@"NOT NILL UNFAILED");
// }
// Testing RemoveCollection
// NSString *removeSelectedPath =
// [[NSBundle mainBundle] pathForResource:@"RemoveCollection"
// ofType:@"js"];
// NSString *removeSelected =
// [NSString stringWithContentsOfFile:removeSelectedPath
// encoding:NSUTF8StringEncoding
// error:nil];
//
// [self.test_view
// stringByEvaluatingJavaScriptFromString:@"var selectedRemove =
// 0;"];
// NSString *remove =
// [self.test_view
// stringByEvaluatingJavaScriptFromString:removeSelected];
// // Testing Save SetUp
// NSString *saveSetupPath =
// [[NSBundle mainBundle] pathForResource:@"SaveSetup" ofType:@"js"];
// NSString *saveSetup =
// [NSString stringWithContentsOfFile:saveSetupPath
// encoding:NSUTF8StringEncoding
// error:nil];
//
// [self.test_view stringByEvaluatingJavaScriptFromString:saveSetup];
}
}
......
Supports Markdown
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