I am constructing an array of Vuetify 'chips' that can have data dragged from one to the other:
<v-container id="endgrid" style="max-width: 300px; position: relative;">
<v-row v-for="(row,r) in endGrid">
<v-chip size="x-large"
v-for="(chip,c) in row"
:key="chip.name"
draggable="true"
#drop="drop($event)"
#dragover="allowDrop($event)"
#dragstart="drag($event)"
:id=idString(1,r,c)
> {{ chip.name }} </v-chip>
</v-row>
</v-container>
and it works as expected. But during the document creation I am getting this warning (in the debug console) for every one (of 25) chip creations:
[Vue warn]: Invalid prop: type check failed for prop "draggable". Expected Boolean, got String with value "true".
at <VChip size="x-large" key=43 draggable="true" ... >
I'm sure the correct syntax for draggable is with a string, not a Boolean. Although if I remove the quotes, the warnings still appear - but the code still works.
I'm concerned that
this may be hiding something else wrong in my code
even if not, those warnings appearing in a browser's debug console don't look good!
Since it may be relevant, the data used to construct the grid looks like this:
onBeforeMount(() => {
var index = 1;
for (var i = 0; i < 5; i++)
{
endGrid[i] = [];
for (var j = 0; j < 5; j++)
{
endGrid[i][j] = {
"name" : i*10+j,
"id" : index,
"row" : i,
"col" : j,
"list": 'end'
};
++index;
}
}
});
You need to bind draggable first in order to pass boolean:
:draggable="true"
Writing steps for UI testing using karate framework
so basically svg button, have to click then the URL in the new tab for further functionality processing
how to handle that ?
i tried below code
def secure_url = mouse("#root > section > section > main > div > div > div.ant-table-wrapper > div > div > div > div > div > table > tbody > tr:nth-child(1) > td:nth-child(7) > span > button > svg").click()
and verified the secure_url value using
print secure_url
it prints com.intuit.karate.driver.DriverMouse#664e5dee
but Expected is URL
Most Karate methods will return an Element object on which you have to call more methods. Please spend some time to read the docs: https://github.com/intuit/karate/tree/master/karate-core#chaining
* def elem = locate('#some-id')
* def url = elem.attribute('href')
I am trying to sett upp some simple verification in our demoshop.
It works until clicking the "genomför köp" (make purchases) link is clicked.
The link markes as clicked (color change) but the proper actions are not performedand you stay on the same side.
if you add a debugline after the "await t.click('#purchase-button');" line you can click the link manualy, you can hover over the link so testcafe finds it. But for some reason tha click() dont work.
EDIT:1: the OS i am using is WIn10, running testcafe 1.8.2 under phpstorm 2019.3.3 and calling it with "testcafe chrome *.js"
Any help would be appreciated.
/Christoffer
Relevant code is below and the demoshop is open to use.
fixture`demoshop.resurs.com`
.page(https://demoshop.resurs.com);
test(
'Run: demoshop.resurs.com', async t => {
await t
.click('.home-shop-now')
.click('#root > div > main > div > div.container > div.products-container.mb-60 > div:nth-child(1) > a > img')
.click('#root > div > main > div > div > div.product-detail__container > div.product-detail__info-container > div.product-detail__add-to-cart > div > button')
.click('#root > div > main > div > span > header > div > div > div > span.shopping-bag-icon.clickable > div')
.click('#root > div > main > div > span > div > div > div > div.shopping-cart-container > a');
await t.switchToIframe('iframe');
await t.click('#purchase-button'); //This does not work properly
await t.expect(Selector('h2').innerText).contains('Tack för din order!');
}
);
I was able to reproduce the issue with TestCafe#1.8.2 but the test works as expected with TestCafe#1.8.4.
I recommend you update to the latest TestCafe version and apply changes provided by #DmitryOstashev:
import { Selector } from 'testcafe';
fixture`demoshop.resurs.com`
.page('https://demoshop.resurs.com');
test(
'Run: demoshop.resurs.com', async t => {
await t
.click('.home-shop-now')
.click('#root > div > main > div > div.container > div.products-container.mb-60 > div:nth-child(1) > a > img')
.click('#root > div > main > div > div > div.product-detail__container > div.product-detail__info-container > div.product-detail__add-to-cart > div > button')
.click('#root > div > main > div > span > header > div > div > div > span.shopping-bag-icon.clickable > div')
.click('#root > div > main > div > span > div > div > div > div.shopping-cart-container > a');
await t.switchToIframe('iframe');
await t.click('#purchase-button');
await t.switchToMainWindow();
await t.expect(Selector('h2').innerText).contains('Tack för din order!');
}
);
I am using BootstrapVue in my Vuejs project, I face a weired issue "Invalid prop" with b-table-simple componentinb-thead table helper I bind colspan with array length which always gives a number, and it works fine but it generates console warning message:
[Vue warn]: Invalid prop: custom validator check failed for prop "colspan".
found in
---> <BTh>
<BTr>
<BThead>
<BTableSimple>
<NationalTrends> at resources/js/components/trends/NationalTrends.vue
<Trends> at resources/js/components/trends/Trends.vue
<Root>
When I put number (4 or any other number) it works fine without generating the warning in the console.
Below is my code:
<template>
<div>
<b-table-simple hover small caption-top responsive striped>
<caption>Commodity Trends</caption>
<b-thead head-variant="light">
<b-tr>
<b-th>Commodity</b-th>
<b-th>Current Month</b-th>
<b-th :colspan="selected_periods.length">Previous Period</b-th>
<b-th :colspan="selected_periods.length">% Change From the Previous Period</b-th>
<b-th :colspan="selected_periods.length" class="text-center">Direction of Change</b-th>
</b-tr>
</div>
</template>
Please help, I spent one hour trying to figure out whats the problem but no luck......
Try to use like this:
:colspan="selected_periods.length > 0 ? selected_periods.length : 1"
Please check selected_periods.length against that custom validator (see bootstrap-vue source)
const digitsRx = /^\d+$/
// Parse a rowspan or colspan into a digit (or null if < 1 or NaN)
const parseSpan = val => {
val = parseInt(val, 10)
return digitsRx.test(String(val)) && val > 0 ? val : null
}
/* istanbul ignore next */
const spanValidator = val => isUndefinedOrNull(val) || parseSpan(val) > 0
export const isUndefined = val => val === undefined
export const isNull = val => val === null
export const isUndefinedOrNull = val => isUndefined(val) || isNull(val)
I managed to remove the warning by adding a default value if null (which will not happen in my code) as below:
<b-th :colspan="selected_periods.length || 4">Previous Period</b-th>
<b-th :colspan="selected_periods.length || 4">% Change From the Previous Period</b-th>
<b-th :colspan="selected_periods.length || 4" class="text-center">Direction of Change</b-th>
I have a list of objects on my site that all have 'Add' buttons next to them. When the first 'Add' button is clicked, that object is added and the row disappears and is replaced by the next one down. The object name is the same. I want to .click() three times to add the first three objects in the list, before saving. How can I do this?
I'm aware of .click() to click a single object. I'm also aware of .click ({ multiple: true}) to click all the objects on the page. However, I want it to stop clicking after the third time.
Currently set to click multiple times to add all the objects in the list (which is incorrect):
cy.get('#FieldListDialog > div > table > tr > td > button.button.add-button')
.should('exist')
.click({ multiple: true });
To hammer click a button you can use this:
for(let n = 0; n < 10; n ++){
cy.get('#FieldListDialog > div > table > tr > td > button.button.add-button')
.click()
}
The multiple: true is used to click several elements, for example to click all buttons on the page.
If you need just a few clicks you could also go for this great solution:
cy.get("button").click().click().click()
.click().click().click().click().click()
.click().click()
In my opinion this syntax also gives a great sensation of what the user would be doing in this scenario.
The problem is with your selector. If you have n number of buttons, and you want to click all of them, then you need to match all the buttons, not just a single one. So look for a selector (e.g. a class unique to your Add button) that matches all of them.
You can then use .each() to iterate through them and break out of the loop when you reach a certain index:
cy.get('#your_selector_to_your_add_buttons')
.each(($el, $index) => {
if($index == 3){
return false;
}
cy.wrap($el).click()
} )
You just had to move your assertion after the click and said click until not exists
.click({ multiple: true })
.should('not.exist');```
you could use lodash
https://lodash.com/docs/4.17.15#times
import { times } from 'lodash'
times(2, () => {
cy.get('#FieldListDialog > div > table > tr > td > button.button.add-button')
.click()
})
You could also do like this:
Cypress._.times(10, () => {
cy.get('#FieldListDialog > div > table > tr > td > button.button.add-button').click()
})
The best way I could find to do this was by using the Wait for a number of milliseconds or wait for an aliased resource to resolve before moving on to the next command.
cy.get('#FieldListDialog > div > table > tr > td > button.button.add-button')
.should('exist')
.click();
cy.wait(500)
cy.get('#FieldListDialog > div > table > tr > td > button.button.add-button')
.should('exist')
.click();
cy.wait(500)
cy.get('#FieldListDialog > div > table > tr > td > button.button.add-button')
.should('exist')
.click();
Following the comments by Kamran Eyyubov and monikapatelIT, I was able to come up with the following to simulate a button mash, using the Lodash library that cypress exposes.
// Fetch a reference outside the loop so it can be referenced inside the
// loop.
cy.get('#submit-button')
.as('submitButton');
// Simulate a button mash. Click the button 10 times.
Cypress._.times(10, function () {
cy.get('#submitButton')
// The submit button is disabled on the first click, so
// force is set to TRUE to prevent the test from failing
// due to clicking a disabled element.
.click({force: true});
});
// option 1
cy.get('button')
.dblclick()
// option 2
cy.get('button')
.click({ multiple: true })
I did and command
Cypress.Commands.add('MultiClick',(element:string,times: number) => {
for(let n = 0; n < times; n ++){
cy.get(element).click({ force: true })
}
})
and then use it
cy.MultiClick('[data-cy=qty-product]',2)