If/Else statement in Katalon Studio - katalon-studio

I'm try to do this statements but not successful. Can anyone help me. Thank you alot
if (WebUI.verifyTextPresent('Nhân viên hiện không rảnh trong khung giờ này', true) {
WebUI.waitForAlert(2)
WebUI.click(findTestObject('Page_Trang Qun L (1)/FailConfirm'))
WebUI.closeBrowser()
} else {
WebUI.waitForAlert(3)
WebUI.click(findTestObject('Page_Trang Qun L (1)/ThemButton'))
WebUI.waitForAlert(2)
WebUI.click(findTestObject('Page_Trang qun tr SkyAdmin/button_OK'))
WebUI.waitForAlert(2)
WebUI.closeBrowser()
}

The second parameter of the WebUI.verifyTextPresent() says if the first parameter is a regular expression.
See https://docs.katalon.com/display/KD/%5BWebUI%5D+Verify+Text+Present.
I do not speak your language, but the text doesn't seem like a regex.
Try changing WebUI.verifyTextPresent('Nhân viên hiện không rảnh trong khung giờ này', true) to WebUI.verifyTextPresent('Nhân viên hiện không rảnh trong khung giờ này', false).

Related

Error encoding UTF-8 in netbeans-13 with jdk 1.8

How can I fix this problem with netbeans13 in window10? I'm using JDK 1.8 also JRE I am learning web applications with java. The problem start is when I type ư (Vietnamese character) into the editor, it starts to convert in to ?. How can I fix this?
I tried to add -J-Dfile.encoding=UTF-8 to netbeans.conf, restart Netbeans, install again and again, but it seem not working.
<<script language = "JavaScript">
var Ten, Tuoi; // Khai bao 2 bien de luu ten va tuoi
Ten = prompt("Bạn hãy nhập vào tên ", "");
Tuoi = prompt("Bạn hãy nhập vào Tuổi : ", 20);
document.write("Chào bạn : <B> " + Ten + "</B>");
document.write("<BR>"); // Xuống dòng
document.write("Tuổi của bạn là : <U> " + Tuoi + "</U>");
//i can paste "Tuổi của bạn là :" but cant type tu?i c?a b?n là
enter image description here

php8.1 - Deprecated Functionality: DateTime()

We use the following code that worked perfectly on php7.4, but we get a deprecated error on php8.1. But how can we succesfully rewrite this for php8.1?
Error:
Deprecated Functionality: DateTime::__construct(): Passing null to parameter #1 ($datetime) of type string is deprecated
Current code:
$today = new \DateTime();$orderdate = new \DateTime($orders->getCreatedAt());
<?php if($orderdate->diff($today)->days > 14):?>
<?php endif;?>
You can no longer do this:
new \DateTime(null);
In your exact use case, I think that PHP has highlighted a bug in your code. If the order does not have a created at date, you'll populate the variable with the date/time when the script runs, which may not be what you want:
var_dump(new \DateTime('1985-12-31 15:00:00'));
var_dump(new \DateTime(''));
var_dump(new \DateTime(null));
object(DateTime)#1 (3) {
["date"]=>
string(26) "1985-12-31 15:00:00.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(16) "Europe/Amsterdam"
}
object(DateTime)#1 (3) {
["date"]=>
string(26) "2022-09-19 12:28:23.003960"
["timezone_type"]=>
int(3)
["timezone"]=>
string(16) "Europe/Amsterdam"
}
Deprecated: DateTime::__construct(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/67OFM on line 5
object(DateTime)#1 (3) {
["date"]=>
string(26) "2022-09-19 12:28:23.003987"
["timezone_type"]=>
int(3)
["timezone"]=>
string(16) "Europe/Amsterdam"
}
Demo
If you want to use DB information:
$orderdate = $orders->getCreatedAt()
? new \DateTime($orders->getCreatedAt())
: null;
If you want to default to "now", make it explicit so nobody wonders whether it's intentional:
$orderdate = $orders->getCreatedAt()
? new \DateTime($orders->getCreatedAt())
: new \DateTime();
Last but not least... Analyse if it makes sense from the business logic standpoint to have orders with no creation date. What does that mean?

How to print Arabic letters with thermal printer using Flutter esc_pos_printer library?

I'm using a printer: EPSON TM-m30
I'm currently using :
esc_pos_printer: ^4.0.3
esc_pos_utils: ^1.0.0
When I run this code
printDemoReceipt(NetworkPrinter printer) async {
printer.text('ا ب ت ث ج ح خ د ذ ر ز س ش ص ض ف ق ك ل م ن ه و ي');
printer.feed(2);
printer.cut();
printer.disconnect();
}
It causes this error
[ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Invalid argument (string): Contains invalid characters.: "ا ب ت ث ج ح خ د ذ ر ز س ش ص ض ف ق ك ل م ن ه و ي"
_UnicodeSubsetEncoder.convert (dart:convert/ascii.dart:88:9)
Did anyone fix this issue?
Thank you.
Actually I have the same issue and I believe for now the only solution is to create a PDF then covert it to an image and then you can print it.
Try to
import 'dart:convert' show utf8;
printDemoReceipt(NetworkPrinter printer) async {
final arabicText = utf8.encode('ا ب ت ث ج ح خ د ذ ر ز س ش ص ض ف ق ك ل م ن ه و ي');
printer.textEncoded(arabicText);
printer.feed(2);
printer.cut();
printer.disconnect();
}
You have to find the character table for your printer and write the corresponding commands to let the printer know that you are printing multi byte characters such as Arabic characters. In my case, I was using sunmi printer and the only thing that worked for me was finding its character table and I wrote the commands and it worked very well. Here's a picture of what they said in the documentation.
enter image description here
And this is what I did and it worked perfectly
const utf8Encoder = Utf8Encoder();
final encodedStr = utf8Encoder.convert(invoice.description);
bytes += generator.textEncoded(Uint8List.fromList([
...[0x1C, 0x26, 0x1C, 0x43, 0xFF],
...encodedStr
]));

jasper reports - msg function not accepting more than 4 parameters including pattern

So it seems i can't create a string from properties file with more than 3 parameters plus the pattern:
msg(str("lifeletter."+$P{COD_DOC}+".message"),$P{PR_YEAR},$P{MODULE_NAME},$F{benefit_value},$F{accumulated_value})
I get this error:
The method msg(String, Object, Object, Object) in the type JREvaluator is not applicable for the arguments (String, String, String, String, String)
value = msg(str("lifeletter."+((java.lang.String)parameter_COD_DOC.getValue())+".message"),((java.lang.String)parameter_PR_YEAR.getValue()),((java.lang.String)parameter_MODULE_NAME.getValue()),((java.lang.String)field_benefit_value.getValue()),((java.lang.String)field_accumulated_value.getValue())); //$JR_EXPR_ID=10$
If i remove the last param(accumulated_value {3}) it will work
here is the .properties file entry:
letter.product.message = Caro Cliente, Vimos pela presente informar que, em {0} , foi atribuida participação nos resultados ao seu {1} no valor de {2}. \
Desta forma, o valor acumulado atual da participação nos resultados é de {3}.
I solved this by using the java class MessageFormat:
new MessageFormat(str("pattern")).format(new Object[]{"value 1","value 2", "value 3","value 4"})

Cucumber, Rspec: unicode symbols in output

I wonder if it is possible to make Cucumber output matching errors in Russian instead of this:
Сценарий: Успешное добавление кгиги # features/books/add_book.feature:12
Если я добавил книгу # features/step_definitions/books_steps.rb:3
То я должен увидеть добавленную книгу # features/step_definitions/books_steps.rb:15
expected there to be content "\320\235\320\260\320\267\320\262\320\260\320\275
\320\270\320\265 \320\272\320\275\320\270\320\263\320\270" in "\320\236\321\210\320\270\320
\261\320\272\320\260 502!\n...
Where "\320\235\320\260\320\267\320\262\320\260\320\275" is a Russian word. It may be a feature of Rspec. Any Ideas would be great.
Adding
$KCODE='u'
to my features/support/env.rb helped a little:
А должен увидеть сообщение о том, что пароль неверен
expected there to be content "Неверный прол\321\214"
This solution is only for 1.8.7 – in 1.9.3
# encoding: utf-8
works just fine