Skip to content

Commit

Permalink
#17 conflict resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
Sushil committed Apr 14, 2015
2 parents 9307e80 + e85c673 commit 2a31826
Show file tree
Hide file tree
Showing 31 changed files with 2,651 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/views/users/footer/footer.scala.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@(param: Any)
<nav>
<nav id="footer">
<div class="container-fluid" style="text-align: center; background: #E3E6E5; height: 50px; padding: 10px; margin-bottom: -60px;">
<p style="color: rgba(122, 27, 27, 1);">Copyright © Knoldus Software LLP, Inc. 2013</p>
</div>
Expand Down
25 changes: 20 additions & 5 deletions app/views/users/main.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@

<!-- Custom CSS -->
<link href="@routes.Assets.at("user/css/agency.css")" rel="stylesheet">

<!-- sticky sidebar CSS -->
<!-- Custom CSS -->
<link href="@routes.Assets.at("user/mycss/stickySidebar.css")" rel="stylesheet">
<!-- Custom Fonts -->
<link href="@routes.Assets.at("user/font-awesome/css/font-awesome.min.css")" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
Expand All @@ -26,10 +28,21 @@
<link href='https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700' rel='stylesheet' type='text/css'>
</head>
<body id="page-top" class="index">
<!-- Sticky Side Bar -->
<div id="sidebar">
<h6>Connect with Us</h6>
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://twitter.com/mycellwasstolen" data-via="mycellwasstolen" data-size="large">Tweet</a>
<script src="@routes.Assets.at("user/js/myscript/tweetWithCount.js")"></script>
<!-- Place this tag in your head or just before your close body tag. -->
<script src="https://apis.google.com/js/platform.js" async defer></script>
<!-- Place this tag where you want the share button to render. -->
<div class="g-plus" data-action="share" data-annotation="vertical-bubble" data-height="60" data-href="https://plus.google.com/111233132925524877427/about"></div>
</div>
<!-- Navigation bars -->
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header page-scroll">
<div class="navbar-header pagae-scroll">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
Expand Down Expand Up @@ -70,7 +83,6 @@
<div class="container" style="box-shadow: 10px 5px 5px 5px #C0B6B6;padding: 10px;">
<div class="row">
<div class="col-md-9">

<div id="myCarousel" class="carousel slide" style="margin-top: -125px;">
<div class="carousel-inner">
<div class="active item">
Expand Down Expand Up @@ -113,13 +125,13 @@ <h5 style="text-align: center; color: rgba(239, 0, 0, 1);display: inline; ">My c
</div></div>
</div>
<hr>

<div class="input-group" style="width: 250px;">
<input type="text" class="form-control" placeholder="Search for this site...">
<span class="input-group-btn">
<button class="btn btn-primary" type="button">Search</button>
</span>
</div><hr>
<<<<<<< HEAD
<img src="@routes.Assets.at("user/img/map.jpg")" alt="...">
<hr>
<!-- Render Twitter Feed Widget -->
Expand Down Expand Up @@ -182,7 +194,6 @@ <h5>For any further information write to us</h5><br>
</div>
</div>
</footer>

<!-- jQuery -->


Expand All @@ -205,5 +216,9 @@ <h5>For any further information write to us</h5><br>
$('#example').vTicker();
});
</script>
<!-- Sticky Side bar plugin -->
<script src="@routes.Assets.at("user/js/stickyMojo.js")"></script>
<!-- sticky Side bar initialization -->
<script src="@routes.Assets.at("user/js/myscript/stickySideInit.js")"></script>
</body>
</html>
3 changes: 3 additions & 0 deletions public/user/js/myscript/stickySideInit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/**
* Initializes the sticky side bar
*/
13 changes: 13 additions & 0 deletions public/user/js/myscript/tweetWithCount.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Contains script generated by twitter API
*/
!function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http'
: 'https';
if (!d.getElementById(id)) {
js = d.createElement(s);
js.id = id;
js.src = p + '://platform.twitter.com/widgets.js';
fjs.parentNode.insertBefore(js, fjs);
}
}(document, 'script', 'twitter-wjs');
142 changes: 142 additions & 0 deletions public/user/js/stickyMojo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
(function($) {
$.fn.extend({
stickyMojo: function(options) {

// Exit if there are no elements to avoid errors:
if (this.length === 0) {
return this;
}

var settings = $.extend({
'footerID': '',
'contentID': '',
'orientation': $(this).css('float'),
'offsetTop': 0
}, options);

var sticky = {
'el': $(this),
'stickyLeft': $(settings.contentID).outerWidth() + $(settings.contentID).offset.left,
'stickyTop2': $(this).offset().top,
'stickyHeight': $(this).outerHeight(true),
'contentHeight': $(settings.contentID).outerHeight(true),
'win': $(window),
'breakPoint': $(this).outerWidth(true) + $(settings.contentID).outerWidth(true),
'marg': parseInt($(this).css('margin-top'), 10)
};

var errors = checkSettings();
cacheElements();

return this.each(function() {
buildSticky();
});

function buildSticky() {
if (!errors.length) {
sticky.el.css('left', sticky.stickyLeft);

sticky.win.bind({
'load': stick,
'scroll': stick,
'resize': function() {
sticky.el.css('left', sticky.stickyLeft);
stick();
}
});
} else {
if (console && console.warn) {
console.warn(errors);
} else {
alert(errors);
}
}
}

// Caches the footer and content elements into jquery objects
function cacheElements() {
settings.footerID = $(settings.footerID);
settings.contentID = $(settings.contentID);
}

// Calcualtes the limits top and bottom limits for the sidebar
function calculateLimits() {
return {
limit: settings.footerID.offset().top - sticky.stickyHeight,
windowTop: sticky.win.scrollTop(),
stickyTop: sticky.stickyTop2 - sticky.marg
}
}

// Sets sidebar to fixed position
function setFixedSidebar() {
sticky.el.css({
position: 'fixed',
top: settings.offsetTop+'px'
});
}

// Determines the sidebar orientation and sets margins accordingly
function checkOrientation() {
if (settings.orientation === "left") {
settings.contentID.css('margin-left', sticky.el.outerWidth(true));
} else {
sticky.el.css('margin-left', settings.contentID.outerWidth(true));
}
}

// sets sidebar to a static positioned element
function setStaticSidebar() {
sticky.el.css({
'position': 'static',
'margin-left': '0px'
});
settings.contentID.css('margin-left', '0px');
}

// initiated to stop the sidebar from intersecting the footer
function setLimitedSidebar(diff) {
sticky.el.css({
top: diff
});
}

//determines whether sidebar should stick and applies appropriate settings to make it stick
function stick() {
var tops = calculateLimits();
var hitBreakPoint = tops.stickyTop < tops.windowTop + settings.offsetTop && (sticky.win.width() >= sticky.breakPoint);
if (hitBreakPoint) {
setFixedSidebar();
checkOrientation();
} else {
setStaticSidebar();
}
if (tops.limit < tops.windowTop) {
var diff = tops.limit - tops.windowTop;
setLimitedSidebar(diff);
}
}

// verifies that all settings are correct
function checkSettings() {
var errors = [];
for (var key in settings) {
if (!settings[key]) {
errors.push(settings[key]);
}
}
ieVersion() && errors.push("NO IE 7");
return errors;
}

function ieVersion() {
if(document.querySelector) {
return false;
}
else {
return true;
}
}
}
});
})(jQuery);
11 changes: 11 additions & 0 deletions public/user/mycss/stickySidebar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@CHARSET "UTF-8";

#sidebar {
float: left;
width: 150px;
height: 300px;
border: 0px solid #000;
position: fixed;
z-index:1;
margin-top:150px;
}
9 changes: 9 additions & 0 deletions stickySidebar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@CHARSET "UTF-8";
#sidebar {
width: 120px;
background-color: #ccc;
min-height: 200px;
margin: 10px 0 15px 0; /*controls the cutoff of the top and bottom limitations*/
padding: 15px 10px;
float: left; /* float right for a right aligned sidebar */
}
60 changes: 60 additions & 0 deletions test/automation/ApprovingUserRequestTest.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package automation

import scala.slick.driver.PostgresDriver.simple._
import org.specs2.mutable.Specification
import play.api.test.WithServer
import play.api.libs.ws.WS
import play.api.test.Helpers._
import play.api.test.Helpers.await
import play.api.test.TestServer
import play.api.test.WithServer
import utils.Connection
import java.util.concurrent.TimeUnit
import org.openqa.selenium.support.ui.Select
import play.api.test.FakeApplication
import org.openqa.selenium.firefox.FirefoxDriver
import org.openqa.selenium.By
import org.openqa.selenium.WebElement

class ApprovingUserRequestTest extends Specification {
val port = 19001
val baseUrl = "http://localhost:19001"

"Approving a request" in {
running(TestServer(port, FakeApplication(additionalConfiguration = inMemoryDatabase())), HTMLUNIT) { browser =>
val driver = new FirefoxDriver
driver.manage().window().maximize()
driver.get(baseUrl + "/login")
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS)
driver.findElementById("email").sendKeys("test")
driver.findElementById("password").sendKeys("test")
driver.findElementByCssSelector(".btn.btn-primary").click
driver.findElementById("menuItem").click
driver.findElementById("brandForm").click
driver.findElementById("name").sendKeys("nokia")
driver.findElementByCssSelector(".btn.btn-primary").click
driver.findElementByCssSelector(".panel-title").getText.contains("Brand successfully added")
driver.findElementById("menuItem").click
driver.findElementById("createMobileModel").click
new Select(driver.findElementById("brandName")).selectByVisibleText("nokia")
driver.findElementById("modelName").sendKeys("Asha 200")
driver.findElementByCssSelector(".btn.btn-primary").click
driver.findElementById("stolenPhone").click
driver.findElementById("userName").sendKeys("manish")
new Select(driver.findElementById("brandId")).selectByVisibleText("nokia")
new Select(driver.findElementById("mobileModelId")).selectByVisibleText("Asha 200")
driver.findElementById("email").sendKeys("[email protected]")
driver.findElementById("imeiMeid").sendKeys("123456789012347")
driver.executeScript("""document.getElementById("purchaseDate").value="03/03/2014";""")
driver.findElementById("contactNo").sendKeys("+91 1234567890")
driver.findElementById("description").sendKeys("selenium test desc")
driver.findElementById("fileUpload").sendKeys("/home/knoldus/Pictures/selenium.png")
driver.findElementByCssSelector(".btn.btn-primary").click
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS)
driver.findElementById("menuItem").click
driver.findElementById("listOfRequest").click
driver.findElementById("approve").click
driver.findElementByCssSelector("BODY").getText().contains("Mobile has been approved successfully!")
}
}
}
37 changes: 37 additions & 0 deletions test/automation/BrandInsertionTest.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package automation

import scala.slick.driver.PostgresDriver.simple._
import org.specs2.mutable.Specification
import play.api.test.WithServer
import play.api.libs.ws.WS
import play.api.test.Helpers._
import play.api.test.Helpers.await
import play.api.test.TestServer
import play.api.test.WithServer
import utils.Connection
import java.util.concurrent.TimeUnit
import org.openqa.selenium.support.ui.Select
import play.api.test.FakeApplication
import org.openqa.selenium.firefox.FirefoxDriver
import org.openqa.selenium.By
import org.openqa.selenium.WebElement

class BrandInsertionTest extends Specification {
val port = 19001
val baseUrl = "http://localhost:19001"

"Testing Add Mobile Brand" in {
running(TestServer(port), FIREFOX) { browser =>
browser.webDriver.manage().window().maximize()
browser.goTo(baseUrl + "/login")
browser.$("#email").text("test")
browser.$("#password").text("test")
browser.$(".btn.btn-primary").click
browser.$("#menuItem").click
browser.$("#brandForm").click
browser.$("#name").text("nokia")
browser.$(".btn.btn-primary").click
browser.$(".alert.alert-dismissable.alert-success").getText() must contain("Brand successfully added")
}
}
}
Loading

0 comments on commit 2a31826

Please sign in to comment.