Category : automated-tests

I need to run a loop through multiple elements having the same CSS selector and return true if the element.text() matches with the string. If there is no match then return false at the end. I tried something like below but it didn’t work: getProfilePresentOrNot(profileName){ var flag=0; cy.get(‘li>div>div>span’).each(($el,index,$list)=>{ if($el.text().includes(profileName)) { flag=1; } }); return flag; ..

Read more

const {chromium} = require(‘playwright’); const {Severity} = require(‘jest-circus-allure-environments’) const expect = require(‘expect’); const { Severity } = require(‘allure-js-commons’); ///————–Test Cases —————-// test(‘length check ‘, async () => { @critical await page.goto(‘https://stackoverflow.com/’); await page.type(‘.js-search-field’, Array(500).join(‘x’)); console.log((await page.$eval(‘.js-search-field’, el => el.value)).length); }); Here is the code if I’m missing any import or anything do let me know, ..

Read more

I try to yield my boolean value outside my .then() scope, But it always keeps the value that I intialized it with.. This is what I tried: exampleFunc(){ Let isTrue = false; Cy.get(‘@YieldedLocator).then(($YieldedLocator) => { isTrue = true; cy.wrap(isTrue).as(‘isTrue’); }); ` cy.get(‘@isTrue’).then(($isTrue) => { cy.log($isTrue); }); } After debbugging the code I can see that ..

Read more

I want to assert that a specific ID exists in a list of elements, This is what I tried: assertSelectedIdMovedToAnotherList() { // selectedId yeilded from another function cy.get(@selectedId).then(($selectedId) => { cy.get(app .idListA).should(‘have.id’, $selectedId) }); } When I run this code in the test, I find the list but it compares only the first Id of ..

Read more

I am new to Automation testing with Selenium. For loading an element in DOM I am waiting upto 5 secs driver.wait(until.elementLocated(By.id(‘my-id’)), 5000); But apparently, it works locally and sometimes fails on jenkins. Is there a better way to do this implementation without increasing the timeout? Source: Ask Javascript..

Read more