<table class="table table-condensed table-bordered" cellspacing="0" cellpadding="4" rules="all" border="1" id="MainContent_gviewProduct" style="color:#333333;border-collapse:collapse;">
<caption align="Top">
<table width="100%" class="gridtitle"><tbody><tr><td class="text_Title">Product Details</td></tr></tbody></table>
</caption><tbody><tr style="color:White;background-color:#008D7A;font-weight:bold;">
<th scope="col">Product Name</th><th scope="col">Product Code</th><th scope="col">Product UOM</th><th scope="col">Pack Size</th><th scope="col">RSP/MRP</th><th scope="col">Batch/MRP</th><th scope="col" style="width:150px;">Requested Price</th><th scope="col" style="width:150px;">Sale Qty in Packs</th><th scope="col" style="width:150px;">Remark</th>
</tr><tr style="color:#333333;background-color:#F7F6F3;">
<td>
<span id="MainContent_gviewProduct_lblSelectedProdName_0">2T</span>
</td><td>
<span id="MainContent_gviewProduct_lblSelectedProdCode_0">1010068</span>
</td><td>
<span id="MainContent_gviewProduct_lblSelectedProdUOM_0">Ltr</span>
</td><td>
<span id="MainContent_gviewProduct_lblPackSize_0">210.00</span>
</td><td>
<span id="MainContent_gviewProduct_lblRSP_0">222.00</span>
</td><td>
<span id="MainContent_gviewProduct_lblBatchPrice_0">220.00</span>
</td><td>
<input name="ctl00$MainContent$gviewProduct$ctl02$txtRequestPrice" type="text" maxlength="10" id="MainContent_gviewProduct_txtRequestPrice_0" oncopy="return false" onpaste="return false" oncut="return false" onkeyup="return checkDec(this);" onkeypress="return funDecNum(event);" style="width:75px;">
<br>
<span id="MainContent_gviewProduct_rextxtRequestPrice_0" style="visibility:hidden;">Provide Valid Requested Price!</span>
</td><td>
<input name="ctl00$MainContent$gviewProduct$ctl02$txtRequestQty" type="text" maxlength="5" id="MainContent_gviewProduct_txtRequestQty_0" oncopy="return false" onpaste="return false" oncut="return false" onkeyup="return funOnlyNum(this);" onkeypress="return funOnlyNum(event);" style="width:75px;">
<br>
<span id="MainContent_gviewProduct_rextxtRequestQty_0" style="visibility:hidden;">Provide Valid Sale Qty!</span>
</td><td>
<input name="ctl00$MainContent$gviewProduct$ctl02$txtRemark" type="text" maxlength="50" id="MainContent_gviewProduct_txtRemark_0" oncopy="return false" onpaste="return false" oncut="return false" style="width:150px;">
<br>
<span id="MainContent_gviewProduct_rextxtRemark_0" style="visibility:hidden;">Provide proper Remarks</span>
</td>
</tr>
</tbody></table>
i want a code in c# for getting the discounted price. In the screenshot ,under product details we have RSP/MRP. So the requested price that needs to be entered should always be greater then or equal to 50% of RSP/MRP. i am using POM framework. so i need to create a page object for the shown page and apply the logic in the pageobject and call the method from my test class.
While creating automation test cases you should not be creating a method for calculating the discount applied by your application or in fact any other business logic handled by the application.
Instead, you should have separate test cases with boundary values of prices and quantity for which you should know the expected values of discounts that will be applied.
If there is some change later in the logic for giving discount in your application then your test cases should fail as expected and then you will then update the expected result values in your test suite.
Related
I have a serious problem with data list I HATE IT so much. I have a list of data that displays cart items in a table.. basic right?
Sure, but not for data list! its like data list says I MUST DESTROY YOU. The data list does not show any items that I should display!
Here are some screenshots that will let you understand my issue here.
So basically the items are displayed in VS, but in the web application it doesn't.
PLEASE HELP :(
Here is the code:
<div class="container-sm cart-page">
<table>
<tr>
<th>المنتج</th>
<th>الكمية</th>
<th>السعر الفرعي</th>
</tr>
<asp:DataList ID="DataList1" runat="server" RepeatColumns="1" RepeatLayout="Flow">
<ItemTemplate>
<tr>
<td>
<div class="cart-info">
<img src="http://bestjquery.com/tutorial/product-grid/demo8/images/img-1.jpg" alt="camera">
<div>
<p>Camera 211</p>
<small>السعر: 50 ر.س.</small>
<br>
حذف
</div>
</div>
</td>
<td>
<input type="number" value="1" min="1" max="10"></td>
<td>50 ر.س.</td>
</tr>
</ItemTemplate>
</asp:DataList>
</table>
<div class="total-price">
<table>
<tr>
<td class="titles">السعر الفرعي</td>
<td>150 ر.س.</td>
</tr>
<tr>
<td class="titles">VAT</td>
<td>22.50 ر.س.</td>
</tr>
<tr>
<td class="titles">المجموع</td>
<td>172.50 ر.س.</td>
</tr>
<tr>
<td>
<a href="store.aspx">
<button type="submit" class="btn btn-primary btn-continue-shopping">إكمال التسوق</button>
</a>
</td>
<td>
<a href="checkout.aspx">
<button type="submit" class="btn btn-primary btn-checkout">إكمال الدفع</button>
</a>
</td>
</tr>
</table>
</div>
</div>
You need to set the DataSource property with some list or table of data.
Here is a link to the MSDN article: https://learn.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.basedatalist.datasource?view=netframework-4.8#System_Web_UI_WebControls_BaseDataList_DataSource
What is your data source? Are you using a database?
If you do not have a database you can mockup a dataset in XML, JSON, or CSV and then deserialize into your code.
I believe that you can bind anything that implements IList.
Needed some assistance,
Please look at the picture below, as you can see, When I click the input which has calender, the calender pop up inside the table and it generates a scroll bar which I have to scroll down to see the bottom calender, how do I make sure it is send to front which will show the entire calender outside that table ?
Thanks!
Calender CSS: https://github.com/benitolopez/hotel-datepicker/tree/master/dist
<div class="col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-shopping-cart"></i> Shopping cart</h4>
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<td class="text-center"></td>
<td class="text-center">Image</td>
<td class="text-left">Product Name</td>
<td class="text-left">Rental Period</td>
<td class="text-left">Rental Rate</td>
<td class="text-left">Deposit Amount</td>
<td class="text-right">Total</td>
</tr>
</thead>
<tbody>
<tr>
<td class="text-center"><p></p><button type="button" data-toggle="tooltip" title="Remove" class="btn btn-danger" onClick=""><i class="fa fa-times-circle"></i></button></td>
<td class="text-center"><img width="60px" src="image/demo/shop/product/E4.jpg" alt="Xitefun Causal Wear Fancy Shoes" title="Xitefun Causal Wear Fancy Shoes" class="img-thumbnail"></td>
<td class="text-left">Emasa rumas gacem</td>
<td class="text-left"><div class="input-group btn-block" style="min-width: 100px;">
<form method="POST" action="checkout.html">
<input type="text" name="input-id" id="input-id" value="" class="form-control">
</form>
<span class="input-group-btn">
<button type="submit" data-toggle="tooltip" title="Update" class="btn btn-primary"><i class="fa fa-refresh"></i></button>
</span></div></td>
<td class="text-right">$114.35</td>
<td class="text-right">$114.35</td>
<td class="text-right">$114.35</td>
</tr>
</tbody>
<tfoot>
<tr>
<td class="text-right" colspan="1"><strong>Meeting Location:</strong></td>
<td class="text-left" colspan="6">$93.73</td>
</tr>
<tr>
<td class="text-right" colspan="6"><strong>Total Amount Payable:</strong></td>
<td class="text-right">$121.85</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
Update:
I removed the "position" in the css of the calender and it now looks like this.
Everytime the calender pop up, the table will adjust/squeeze to fit the calender, how to make sure that calender just shows without changing the size of the table?
Thanks!
I am trying to figure out why the width of the input textbox on the 3rd column isnt spanning across the full width of the . I have set the width to px/% yet it still does not work. Here is a snippet of the code i have and how it is coming out.
What i am wanting the outcome to be is for the input text in the 3rd column to span entirely across that td
i guess you got that problem from the width you placed in the td and not in the entire column
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div>
<table class="table table-bordered">
<colgroup>
<col width=150px>
<col width=150px>
<col width=450px>
<col width=170px>
</colgroup>
<tr class="text-center">
<td><label for="">1</label></td>
<td><label for="">2</label></td>
<td><label for="">3</label></td>
<td><label for="">4</label></td>
</tr>
<tr>
<td><input type="text" class="form-control"></td>
<td><input type="text" class="form-control"></td>
<td><input type="search" class="form-control"></td>
<td><input type="text" class="form-control"></td>
</tr>
</table>
</div>
check this.
I send post request with body login=login&login:loginName={0}&login:password={1}&login:clientCode=&login:j_idt171=&javax.faces.ViewState=stateless
with help HttpWebRequest. Before that I was doing GET request, for getting JSESSIONID.
Web form looks like that:
<form id="login" name="login" method="post" action="/csologin/login.jsf">
<input type="hidden" name="login" value="login">
<div id="login:j_idt122" class="ui-messages ui-widget" aria-live="polite"></div><table border="0" cellpadding="2" cellspacing="0" width="580px">
<tbody>
<tr>
<td class="ecol1"><label id="login:j_idt125" class="ui-outputlabel ui-widget fbold" for="login:loginName">Username<span class="ui-outputlabel-rfi">*</span></label></td>
<td class="ecol2"><input id="login:loginName" name="login:loginName" type="text" autocomplete="off" size="40" class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all" role="textbox" aria-disabled="false" aria-readonly="false" aria-multiline="false"></td>
<td class="ecol3"><div id="login:j_idt126" aria-live="polite" class="ui-message"></div></td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="2" cellspacing="0" width="580px">
<tbody>
<tr>
<td class="ecol1"><label id="login:j_idt132" class="ui-outputlabel ui-widget fbold" for="login:password">Password<span class="ui-outputlabel-rfi">*</span></label></td>
<td class="ecol2"><input id="login:password" name="login:password" type="password" class="ui-inputfield ui-password ui-widget ui-state-default ui-corner-all ui-state-hover" autocomplete="off" size="40" role="textbox" aria-disabled="false" aria-readonly="false" aria-multiline="false"></td>
<td class="ecol3"><div id="login:j_idt133" aria-live="polite" class="ui-message"></div></td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="2" cellspacing="0" width="580px">
<tbody>
<tr>
<td class="ecol1"><label id="login:j_idt135" class="ui-outputlabel ui-widget fbold" for="login:clientCode">Client Code</label></td>
<td class="ecol2"><input id="login:clientCode" name="login:clientCode" type="text" maxlength="32" size="40" class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all" role="textbox" aria-disabled="false" aria-readonly="false" aria-multiline="false"></td>
<td class="ecol3"><div id="login:j_idt136" aria-live="polite" class="ui-message"></div></td>
</tr>
</tbody>
</table>
<br><div class="text-center">
<button id="login:j_idt139" name="login:j_idt139" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" onclick="barWaitDialog.show();" type="submit" role="button" aria-disabled="false"><span class="ui-button-text ui-c">Login</span></button>
<!-- <p:commandButton value="Clear" onclick="clearVisibleTextFields();" /> --><button id="login:j_idt141" name="login:j_idt141" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" onclick="PrimeFaces.ab({source:'login:j_idt141',oncomplete:function(xhr,status,args){clearVisibleTextFields();;}});return false;" type="submit" role="button" aria-disabled="false"><span class="ui-button-text ui-c">Clear</span></button><button id="login:j_idt142" name="login:j_idt142" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="submit" role="button" aria-disabled="false"><span class="ui-button-text ui-c">Cancel</span></button>
</div><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="stateless" autocomplete="off">
Not authenticated, it returns a redirect to login page. What am I doing wrong?
Basically, you didn't press the desired button. You need to include the name=value pair of the submit button you'd like to "press" programmatically. That's usually in the server side used to distinguish if a button was pressed and if so, which one.
There appear to be three submit buttons in the HTML form, simplified as below:
<button name="login:j_idt139" type="submit">Login</button>
<button name="login:j_idt141" type="submit">Clear</button>
<button name="login:j_idt142" type="submit">Cancel</button>
It appears that the JSF developer didn't give an explicit ID to those buttons, so an autogenerated ID is being used. This autogenerated ID depends on the position of the button component in the JSF component tree. So, if the JSF developer changes the view composition (adding/moving/removing components), then chances are that the final ID of the button in the HTML markup will also change. You'd need to alter your query string on that. The parameter login:j_idt171= in your query string likely needs to be changed to login:j_idt139=.
To make it more robust, you could try contacting the website admin/developer and ask to give those buttons an explicit ID as in <p:commandButton id="login">, so that you can always use the parameter login:login= without worrying about autogenerated IDs. If that's really not an option, then you'd basically need to use a HTML parser to find out the ID of the login button.
I want to copy the whole rows ,but checkbox unchecked when clicking add button.(in my code,
if I check FOC checkbox and when I click add,it copy rows with Foc check).
In asp.net,
<table id="tblitems" cellpadding="0" cellspacing="0" border="0" class="additemtb">
<tbody>
<tr>
<th>Item Name</th>
<th>Item Code</th>
<th>Unit Price</th>
<th>Qty</th>
<th>UOM</th>
<th>Amount</th>
<th>Minimal Order Qty</th>
<th>FOC</th>
<th></th>
</tr>
<tr>
<td style="width:190px;"></td>
<td>
<asp:TextBox ID="TxtBox_ItemCode" CssClass="classItemCode readonly" Columns="8" runat="server" ></asp:TextBox>
</td>
<td style="white-space:nowrap">
<input type="text" id="txtunitprice" name="txtunitprice" class="classUnitPrice number readonly" style="width:50px;" />
<input type="hidden" id="hidunitprice" name="hidunitprice" class="classUnitPrice2" />
<asp:Label ID="lblCurrency" runat="server" CssClass="classCurrency" />
<input type="hidden" id="hidcurrencyid" name="hidcurrencyid" class="classCurrencyID" />
</td>
<td>
<input type="text" id="txtqty" name="txtqty" class="classQty number decimaltextbox" style="width:50px" onkeyup="calculateAmount(this);" onblur="minamt(this);calculateAmount(this);" />
</td>
<td>
<asp:TextBox ID="TxtBox_UOM" CssClass="classUOM readonly" Columns="5" runat="server" ></asp:TextBox>
</td>
<td style="white-space:nowrap">
<asp:TextBox ID="TxtBox_Amount" CssClass="classAmount number readonly" Columns="8" runat="server"></asp:TextBox>
<asp:Label ID="Label1" runat="server" CssClass="classCurrency2" />
</td>
<td>
<input type="text" id="txtminorderqty" name="txtminorderqty" class="minorderqty number readonly" style="width:60px;background:none;border:none;font-weight:bold;color:Red;" />
</td>
<td style="width:1px">
<input type="checkbox" id="chkFOC" name="chkFOC" class="classFOC btnborder" onclick="calculateFOC(this);" />
<input type="hidden" name="hidFOC" id="hidFOC" class="classFOC2" value="false" />
</td>
<td style="width:90px;">
Copy
delete
add
</td>
</tr>
<tr>
<td colspan="4" class="darkgray">
<span class="classOverBudget chinese" >Purchase Order Amount is over limited budget.</span>
</td>
<td class="darkgray" style="text-align:right; font-weight:bold; white-space:nowrap">Total Amount</td>
<td class="darkgray" >
<asp:TextBox ID="txtTotalAmount" CssClass="classTotalAmount number readonly" Columns="8" runat="server" ></asp:TextBox>
<asp:Label ID="Label2" runat="server" CssClass="classCurrency3" />
</td>
<td colspan="3" class="darkgray"> </td>
</tr>
</tbody>
</table>
In Javascript,
function addRow(name, selected){
$(name).parent().parent().next('tr').find('.classFOC:checked').attr('checked', false);
$(name).parent().parent().clone().insertAfter($(name).parent().parent());
//adding remove function to next siblings
$(name).parent().parent().next('tr').find(".delete").attr('onclick', 'removeRow(this)');
selected = $(name).parent().parent().find(".mcdropdown input:hidden").val();
//list of textbox or inputs elements to be empties
$(name).parent().parent().next('tr').find("input").val('');
$(name).parent().parent().next('tr').find(".classCurrency").text('');
$(name).parent().parent().next('tr').find(".classCurrency2").text('');
$(".promotion-container").css("height", $("#left").innerHeight() - 42 + "px");
FormActionControl();
}
You seem to be saying that you can't uncheck the checkbox in a new row that is cloned from an existing row with a checked checkbox. I think that is probably because the line of your code that tries to do that is before the line that actually creates the new row. So simply switching the order of the first to lines in your function may fix it, however the code in the function is, well, pretty horrible and can be cleaned up a lot.
As far as I can tell your addRow() function is attempting to find the parent TR element that the clicked Add button belongs to, clone that row, and then uncheck any checkboxes in the new row and also set other fields in the new row to blank.
Something like the following might work - this is basically a cleaned up version of your code, except that:
the new row with the checkbox is created before trying to uncheck anything
everywhere you had $(name).parent().parent() I'm using a new variable $currentTR - not only is this more efficient it is 500% more readable
everywhere you had $(name).parent().parent().next('tr') you seem to be trying to access the newly added row, so why not keep a reference to that new row as soon as you create it? I've done so with the new variable $newTR.
So:
function addRow(name, selected){
var $currentTR = $(name).parent().parent(),
$newTR = $currentTR.clone();
$newTR.insertAfter($currentTR);
$newTR.find('.classFOC:checked').attr('checked', false);
//adding remove function to next siblings
$newTR.find(".delete").attr('onclick', 'removeRow(this)');
selected = $currentTR.find(".mcdropdown input:hidden").val();
//list of textbox or inputs elements to be emptied
$newTR.find("input").val('');
$newTR.find(".classCurrency, .classCurrency2").text('');
$(".promotion-container").css("height", $("#left").innerHeight() - 42 + "px");
FormActionControl();
}
By the way, using jQuery to set an inline onclick handler is not a good plan, but I think fixing that is outside the scope of what you seem to be asking.
Note also that your function has an argument called selected that is assigned a value in the function, but although that won't cause an error it also won't do anything useful because firstly JavaScript passes by value so that will not cause anything outside the function to change, and secondly you don't even pass that argument in when you call the function.