How can I make testRigor find these inputs? - web-testing

I'm trying to make testRigor put some data into some inputs. The thing is that it has found some of them but some it has not found.
Here I'll post an image where I show you the INPUTS testRigor has found and not found.
How can I make it found the ones I marked in red? PLease, help me.
Thanks!!!
Here is the current code (I marked the lines with *** the found and not found):
login
click on the "arrow" on the left of "Notas Fiscais"
click "Compra de mercadoria"
click "Selecione um cadastro"
click "AWISE (AWISE SOLUÇÕES TECNOLÓGICAS LTDA)"
click "Informar custos adicionais"
generate by regex "[1-9]{6}", then enter into "Frete" and save as "Fretes"
generate by regex "[1-9]{6}", then enter into "Seguro" and save as "Seguros"
generate by regex "[1-9]{6}", then enter into "Outras Despesas" and save as "OutrasDespesas"
click "Continuar"
click "Selecione um produto"
click "eerenlkrwlfxr"
generate by regex "[1-9]{3}", then enter into the first input "1" and save as "quantidadeProdutos" ***FOUND***
generate by regex "[1-9]{5}", then enter into the second input "R$" and save as "custoProdutos" ***FOUND***
click "Selecione um produto"
enter "Gerar Nome Produto aquiiii" into "Pesquisar..."
click "Adicionar produto Gerar Nome Produto aquiiii"
generate by regex "[a-z]{10,18}", then enter into "Nome" and save as "produtoNomes"
generate by regex "[1-9]{2}", then enter into "Estoque mínimo" and save as "EstoqueMínimo"
click "Estoque"
generate by regex "[1-9]{2}", then enter into "Estoque" and save as "Estoque"
generate by regex "[1-9]{6}", then enter into "Código interno" and save as "CódigoInternoProduto"
click "Dados Fiscais"
click "Selecione um NCM"
enter "camisa" into "Pesquisar..."
click "61059000: Camisas de malha de outs.materias textei"
click "Precificação"
generate by regex "[1-3]{3}", then enter into "Custo Médio" and save as "CustosMédios"
generate by regex "[4-9]{3}", then enter into "Preço de venda" and save as "PreçosDeVenda"
click "Continuar"
click "Selecione um cadastro"
click "AWISE (AWISE SOLUÇÕES TECNOLÓGICAS LTDA)"
click "Adicionar Fornecedor"
click "Selecione um cadastro"
click "azlqceulwspp (mttcgndmbnznfy)"
click "Revisar"
click "Salvar"
generate by regex "[1-9]{3}", then enter into the fourth input "1" below "Qtd" and save as "quantidadeProdutos" ***NOT FOUND***
generate by regex "[1-9]{5}", then enter into the fifth input "R$" below "Vl. Un" and save as "custoProdutos" ***NOT FOUND***
generate by regex "[1-9]{3}", then enter into the sixth input "0,00" below "Desconto" and save as "custoProdutos" ***FOUND***
click "Continuar"
click "à vista"
click "entrada + parcelas"
enter "R$ 300,00" into "Missing translation \"financial.simplified_payments"
enter "2" into "Número de Parcelas"
click "Dinheiro" below the "Forma de pagamento"
click "Cartão de Crédito"
click "Continuar"
click "Continuar"
click "Salvar"
click "Precificar Produtos"
click "Nenhum produto selecionado"
click "Selecionar Todos"
click "Configurar Margem"
click "Configurar margem (%)" near the "Vendas Mercadorias Notas Fiscais Financeiro Ocorre"
enter "100" into "ember7979"
click "2 produtos selecionados"
click "Atualizar valor de venda de acordo com a margem co"
click "Nenhum produto selecionado"
click "Selecionar Todos"
click "Arredondar valor de venda"
click "Final 9,99"
click "Concluir"

In this case table-based references should be used:
enter "my data" into table at row containing stored value "my_generated_id" and column "Qtd"

Related

Quasar2 Vue3 Cypress q-popup-edit

I have the following vue template:
<template>
<q-item tag="label" v-ripple>
<q-popup-edit
v-model="model"
:cover="false"
fit
buttons
:validate="validate"
#before-show="modelProxy = model"
>
<template v-slot:title>
<div class="text-mono">
{{ name }}
</div>
</template>
<q-input
color="indigo"
v-model="modelProxy"
dense
autofocus
counter
:type="dataType ? dataType : 'text'"
:hint="hint"
:error="error"
:error-message="errorMessage"
/>
</q-popup-edit>
<q-item-section>
<q-item-label class="text-mono">{{ name }}</q-item-label>
<q-item-label v-if="offset && model && model.length > offset" caption
>...{{
model.substring(model.length - offset, model.length)
}}</q-item-label
>
<q-item-label v-else caption>{{ model }}</q-item-label>
</q-item-section>
</q-item>
</template>
I would like to perform E2E test using Cypress with the following code snippet:
it('Verify Edit Box from auto-generated page', () => {
cy.get('[data-test="popup-edit-setting-1"]').contains("Auto Generated Edit box");
cy.get('[data-test="popup-edit-setting-2"]').contains("Auto Generated Edit box (Number)");
cy.get('[data-test="popup-edit-setting-1"]').should("be.enabled"); // XXX
cy.get('[data-test="popup-edit-setting-1"]').focus().click().type("Hello");//.click("SET");
cy.get('[data-test="popup-edit-setting-1"]').find("label").should('have.value', 'Hello') // XXX
});
It stumbles on the XXX points.
#Fody's solution works but there is one minor issue. I have 2 popup edit box. One with normal string, another with only numeric. There are 2 test cases for the numeric popup editbox. One with invalid normal string entry and another with valid numbers. The problem is that at the end of the test, the numeric popup edit box does NOT return to display mode. It stays popup.
This is the way I would test q-popup-edit. I used a generic example, yours may differ in some details.
I aimed to test based on what a user sees rather than any internal class or internal properties.
The user story is:
the text to be edited has a "hand" pointer when hovered
click on it to change it from "display" mode to "edit" mode
the input is automatically focused, user can start typing
user enters some text
user clicks away and the input loses focus, goes back to "display" mode
// activate popup editor
const initialText = 'Click me'
cy.contains('div.cursor-pointer', initialText) // displayed initial text
.should('be.visible') // with hand cursor
.click()
// initial condition
cy.focused() // after click <input> should have focus
.as('input') // save a reference
.should('have.prop', 'tagName', 'INPUT') // verify it is the input
cy.get('#input')
.invoke('val')
.should('eq', initialText) // displayed text is also in the input
cy.contains('8').should('be.visible') // character count
// edit action
cy.get('#input')
.clear()
.type('test input')
cy.get('#input')
.invoke('val')
.should('eq', 'test input') // verify input
cy.contains('10').should('be.visible') // character count has changed
// back to display mode
cy.get('body').click() // go back to display mode
cy.contains('div.cursor-pointer', 'test input')
.should('be.visible')
.and('contain', 'test input') // verify display element
cy.contains('10').should('not.exist') // edit counter has gone
Notes
To start the edit, you need to identify the display-mode element. It's easiest if you have some unique text in the field, so try to arrange that in the page initial data.
If no unique text, look for a label or some other selectable element nearby then navigate to it.
If you add a data-cy attribute to the <q-popup-edit>, it will not exist in the DOM until the component enters edit-mode (so you can't use it in the initial click()).

Tinymce 4 - Add class to <p> tag that added automatically when press Enter Key

In Tinymce 4 editor, the p tag added automatically to new line when press Enter Key. As I want to add class "no-margin" to <p> tag to apply margin 0 to the <p> tag that added automatically when press Enter Key.
I have tried to add class to <p> tag when pressed Enter Key but its not working when set cursor at middle of content and press Enter Key.
ed.on('keyup', function(event) {
if(event.keyCode == 13) {
tinymce.each(ed.dom.select('p'), function(element) {
if(!jQ(element).next('p').length) {
ed.dom.addClass(element, 'no-margin');
}
});
}
});
Please suggest solution, thanks
Try to add this settings:
forced_root_block : 'p',
forced_root_block_attrs: { "class": "no-margin"},

Display text as popup

I want to show "Please go back and check the I am not a robot box" in pop up,how can I do it? this is in html page
This will display if captcha is not selected ( google captcha).
if(isset($_POST['g-recaptcha-response'])){
$captcha=$_POST['g-recaptcha-response'];
}
if(!$captcha){
echo '<h2>Please go back and check the I am not a robot box.</h2>';
exit;
}
Thank you in advance.
You can use the javascript alert box.
alert("Please go back and check the I am not a robot box.");
http://www.w3schools.com/js/js_popup.asp
If you'd rather have something nicer (And it's probably a better idea as an Alert box can be interpreted as an error) I'd go with a jquery popup, dialog works well, here's a quick look at how it's implemented in the code:
$('#dialog-confirm').dialog("option", "buttons", [
{
text: 'Please go back and check the I am not a robot box.',
click: function () { $("#dialog-confirm").dialog("close"); }
}
]); //end buttons
$('#dialog-confirm').dialog("open");
https://jqueryui.com/dialog/

Create tooltip after setting show hover is true

After setting setShowHover true, how do I create the tooltip? Right now it is a blank tooltip.
ListGridField exportField = new IconField(FIELD_EXPORT, REDO_ICON.jpg, EXPORT_CUSTOM_GROUP_HANDLER);
exportField.setShowHover(true);
Tried exportField.setPrompt("a tooltip message");, but this did not give every single icon a tooltip when i mouse over it.
This a picture showing the tooltip is blank when i hover over the blue-pointer button, the message "a tooltip message" only appear when I hover over the very top blue-pointer button. I want it to show a tooltip for every blue-pointer button.
Use exportField.setHoverCustomizer() to show a customized prompt message.
Try this one
ListGrid grid = new ListGrid();
grid.setCanHover(true);
grid.setShowHover(true);
...
exportField.setHoverCustomizer(new HoverCustomizer() {
#Override
public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
// you can customize the prompt and can get the values from current record also
return "a tooltip message";
}
});

if multiselect is.selected, find any select that hasClass of the selected.val() then enable that selected

How would I go about coding: if multiselect is.selected, find any select that hasClass of the selected.val() then enable that selected?
var countryChange = $(this).val();
if ($("#Countries option[value='"+countryChange+"']").is(":selected"))
{$(this).find($("#option").hasClass(countryChange)).prop("disabled",false);}
UPDATED:
$("#Solutions option." + countryChange).prop("disabled",false);
$("#Solutions").selectmenu("refresh");
But the above only works if the country in question is selected, not if others are selected, as it's in an array.