I am trying to create a test case that selects some text in tinymce and than changes the style from paragraph to a heading. I have some code that almost works but it has to be run twice for it function. The following is an excerpt from the code that steps through each button on the first row of the toolbar menu. I am wondering why I need to run it twice. I can see the dropdown menu dropdown during the first hover and click but the format is not changed unless I run the code the second time.
b.frame(id:"content_ifr").p.select_text "to try"
b.table(:id => 'content_formatselect').hover
b.table(:id => 'content_formatselect').click
b.span(:title => 'Heading 1').hover
b.span(:title => 'Heading 1').click
#second time
b.table(:id => 'content_formatselect').hover
b.table(:id => 'content_formatselect').click
b.span(:title => 'Heading 1').hover
b.span(:title => 'Heading 1').click
The test is from the http://www.tinymce.com/tryit/full.php page.
Here is more of the code it is fairly basic at this point but it does work. I did change the span to an a tag but that did not affect the outcome.
require 'watir-webdriver'
require 'watir-webdriver/extensions/select_text'
#require 'test/unit'
b = Watir::Browser.new :firefox
b.goto "http://www.tinymce.com/tryit/full.php"
b.div(:id => 'main').wait_until_present
bodyy = b.textarea(:name => 'content').value
b.textarea(:value => /Feel free/).exists?
b.frame(id:"content_ifr").p.select_text "Feel free"
b.a(:title => 'Bold (Ctrl+B)').hover
b.a(:title => 'Bold (Ctrl+B)').click
b.a(:title => 'Italic (Ctrl+I)').hover
b.a(:title => 'Italic (Ctrl+I)').click
b.a(:title => 'Underline (Ctrl+U)').hover
b.a(:title => 'Underline (Ctrl+U)').click
b.a(:title => 'Strikethrough').hover
b.a(:title => 'Strikethrough').click
b.a(:title => 'Align Left').hover
b.a(:title => 'Align Left').click
b.a(:title => 'Align Center').hover
b.a(:title => 'Align Center').click
b.a(:title => 'Align Right').hover
b.a(:title => 'Align Right').click
b.a(:title => 'Align Full').hover
b.a(:title => 'Align Full').click
b.table(:id => 'content_styleselect').hover
b.table(:id => 'content_styleselect').click
b.a(:text => 'example2').hover
b.a(:text => 'example2').click
b.table(:id => 'content_styleselect').hover
b.table(:id => 'content_styleselect').click
b.a(:text => 'example1').hover
b.a(:text => 'example1').click
b.table(:id => 'content_styleselect').hover
b.table(:id => 'content_styleselect').click
b.a(:text => 'tablerow1').hover
b.a(:text => 'tablerow1').click
in c# to enter content into tinyMCE use :
yourWebDriver.ExecuteScript(string.Format("tinyMCE.getInstanceById('{0}').setContent('{1}');",yourWebElement.GetAttribute("id"), "hello world"));
Related
I'm having some problems with Paypal express in magento 2, I've migrated from magento 1, and now all is working, expect for paypal express.
I've debug paypal express and I get what I will post, for what I see the problem is maybe because o the prodcut prices are with tax included.
I've already acomplished to have the price without tax in checkout, but he always get the price with tax, what can I do? I've already disabled "Transfer cart line items".
The log is:
'AMT' => '16.70',
'CURRENCYCODE' => 'EUR',
'INVNUM' => '1000012787',
'SHIPPINGAMT' => '3.75',
'ITEMAMT' => '12.95',
'TAXAMT' => '2.42',
'BUSINESS' => 'rtr',
'NOTETEXT' => NULL,
'EMAIL' => 'info#test.pt',
'FIRSTNAME' => 'ertr',
'LASTNAME' => 'trt',
'MIDDLENAME' => NULL,
'SALUTATION' => NULL,
'SUFFIX' => NULL,
'COUNTRYCODE' => 'PT',
'STATE' => 'PR',
'CITY' => 'rt',
'STREET' => 'tr',
'ZIP' => '2335',
'PHONENUM' => 'rtrtrt',
'SHIPTOCOUNTRYCODE' => 'PT',
'SHIPTOSTATE' => 'PR',
'SHIPTOCITY' => 'rt',
'SHIPTOSTREET' => 'tr',
'SHIPTOZIP' => '2335',
'SHIPTOPHONENUM' => 'rtrtrt',
'SHIPTOSTREET2' => 'trt',
'STREET2' => 'trt',
'SHIPTONAME' => 'ertr trt',
'ADDROVERRIDE' => 1,
'METHOD' => 'SetExpressCheckout',
'VERSION' => '72.0',
'USER' => '****',
'PWD' => '****',
'SIGNATURE' => '****',
'BUTTONSOURCE' => 'Magento_Cart_Community',
'TIMESTAMP' => '2019-09-03T11:20:28Z',
'CORRELATIONID' => '403c3d4df0570',
'ACK' => 'Failure',
'VERSION' => '72.0',
'BUILD' => '53481737',
'L_ERRORCODE0' => '10413',
'L_SHORTMESSAGE0' => 'Transaction refused because of an invalid argument. See additional error messages for details.',
'L_LONGMESSAGE0' => 'The totals of the cart item amounts do not match order amounts.',
'L_SEVERITYCODE0' => 'Error',
Can anyone help me?
Best regards,
Leonel Nunes
I was working in Drupal 8 custom forms. I like to restrict or block user purchase date not more than 60 days
I tried with three methods. it wont work. Please help for me
I tried with jquery but style are afftected and format are also changed.
$form['product_info']['install_date'] = [
'#type' => 'date',
'#title' => $this->t('Date of Install *'),
'#default_value' => $this->store->get('install_date') ? $this->store->get(
'install_date') : "",
'#date_format' => "m/d/Y",
'#size' => 10,
//First method
'#minDate'=> '-60',
//second Method
'#datepicker_options' => array('minDate' => 0,),
//Third Method
' #attributes' => ('min' => \Drupal::service('date.formatter')->format(REQUEST_TIME, '-60', 'Y-m-d'),
),
// '#required' => TRUE,.
'#prefix' => '<div class="field-wrapper">',
'#suffix' => '</div>',
'#error_no_message' => TRUE,
];
I'm using Zend_Form_Element_Captcha like this:
$this->view->captcha = new Zend_Form_Element_Captcha('captcha', array(
'label' => 'Codice di controllo:',
'required' => true,
'captcha' => array(
'captcha' => 'Image',
'font' => APPLICATION_PATH . '/../public/default/fonts/arial.ttf',
'fontSize' => '22',
'wordLen' => 6,
'height' => '57',
'width' => '135',
'imgDir' => APPLICATION_PATH . '/../public/images/captcha',
'imgUrl' => Zend_Registry::get('URL') . 'public/images/captcha',
)
));
And i need my captcha image to display only small letters, not capital letters. Is that possible? Thank you!
If you don't want digits, you can try this:
$captcha = new Zend_Form_Element_Captcha(...);
$capcha_addapter = $captcha->getCaptcha();
$capcha_addapter->setUseNumbers(false); // No digit
$captcha->setCaptcha($capcha_addapter);
$this->view->captcha = $captcha;
If you don't want to use numbers, simply use the useNumbers option
$this->view->captcha = new Zend_Form_Element_Captcha('captcha', array(
'label' => 'Codice di controllo:',
'required' => true,
'captcha' => array(
'captcha' => 'Image',
'useNumbers' => false,
'font' => APPLICATION_PATH . '/../public/default/fonts/arial.ttf',
'fontSize' => '22',
'wordLen' => 6,
'height' => '57',
'width' => '135',
'imgDir' => APPLICATION_PATH . '/../public/images/captcha',
'imgUrl' => Zend_Registry::get('URL') . 'public/images/captcha',
)
));
As a general solution to setting the char list to be used in generating Captcha would be extending the Zend_Captcha_Image class and override the _generateWord protected method.
Hope it helps
When I am adding the below code the reload captcha work fine
In ZEND FORM:
$captcha = $this->createElement('captcha', 'captcha', array(
'required' => true,
'captcha' => array(
'captcha' => 'Image',
'font' => APPLICATION_PATH . '/../public/fonts/arial.ttf',
'fontSize' => '24',
'wordLen' => 5,
'height' => '50',
'width' => '150',
'imgDir' => APPLICATION_PATH.'/../public/captcha',
'imgUrl' => Zend_Controller_Front::getInstance()->getBaseUrl().'/captcha',
'dotNoiseLevel' => 50,
'lineNoiseLevel' => 5,
),
'description' => 'Refresh Captcha Image'
));
It worked fine But for captcha I want to use a refresh Image in place of "Refresh Captcha Image" statement.
Did you try to add an img / div tag as the description ??
'description' => '<img src="myimage.png">'
OR
'description' => '<div id="image"></div>'
Sinatra 1.2.6 / Haml 3.1.2 and Pony
I am getting "wrong number of arguments error (0 for 1)" which points to
sinatra/base.rb
def haml(template, options={}, locals={})
render :haml, template, options, locals
end
I am sending :html_body => (haml :html_email) to Pony
Any help would be very much appreciated!
M.
Your code seems to work in Sinatra 1.2.6, Haml 3.1.3 and Pony 1.3.
Although I would use haml(:test) instead of (haml :test)
test.rb:
require 'rubygems'
require 'sinatra'
require 'pony'
require 'haml'
set :views, Proc.new { root }
get '/send' do
options = {
:to => 'user#gmail.com',
:from => 'user#gmail.com',
:subject => 'Test',
:body => 'Test Text',
:html_body => (haml :test),
:via => :smtp,
:via_options => {
:address => 'smtp.gmail.com',
:port => 587,
:enable_starttls_auto => true,
:user_name => 'login',
:password => 'password',
:authentication => :plain,
:domain => 'HELO'
}
}
Pony.mail(options)
end
test.haml:
!!!
%html
%head
%meta{ :content => "text/html; charset=utf-8", :"http-equiv" => "Content-Type" }
%title Test
%body
%h1 Test
%p Test content