-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return Promise issues #2979
Comments
I would like to add I am having similar, inconsistent, behavior with this error. In my scenario, this error only occurs when running all the tests together, and so far has only occurred when the previous test case results in an error that's being addressed in this thread. Current Behaivor:Occasionally, when running all tests, I will get the following error
In my before(() => {
cy.viewport('macbook-15');
cy.visit(Routes().dashboardBaseUrl);
cy.get('input[name=email]').type(Accounts().activeIncidentEmail);
cy.get('input[name=password]')
.type(Accounts().activeIncidentPw)
.type('{enter}');
}); I have not overwritten visit nor viewport anywhere in any test case. This never happens when running a single test case by itself, but happens somewhat infrequently when running all tests. |
@Dan195 Are you using any custom commands anywhere within your test suite? |
Yes I am. None should be overwriting original commands. Am I missing
unintended side effects by utilizing them?
…On Tue, Jan 29, 2019 at 11:19 AM Jennifer Shehane ***@***.***> wrote:
@Dan195 <https://github.com/Dan195> Are you using any custom commands
anywhere within your test suite?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2979 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ArXNr1CldqA6SKefm5oUXrcokT6BlmY3ks5vIIK0gaJpZM4ZdssH>
.
|
Could you provide the code within your custom commands? |
**Edited by @jennifer-shehane at request of @Dan195 (revision history deleted) Removed custom command code due to sensitive data**
|
Yeah, I'm not seeing anything from the examples provided that could be causing the error you provided unfortunately. You'd likely have to simplify the code some to find the smallest reproducible example that causes the error. |
Unfortunately we have to close this issue as there is not enough information to reproduce the problem. Please comment in this issue with a reproducible example and we will reopen the issue. 🙏 |
I've got the same error.
The part getting the error in the test look like: cy.someCustomCommand(arg);
cy.get('.modal button.btn').click(); In the script in Cypress.Commands.add('someCustomCommand', function(arg) {
cy.window().should( (win) => {
var someObject = win.someWindowObject;
expect(someObject).to.not.be.undefined;
}).then(() => {
cy.log("Arg: " + arg);
});
} We see this error sometimes but not always. I hope it's helpful for debugging the issue. |
@wataruoguchi There must be some information missing from what is provided above. The error indicates the |
@jennifer-shehane Oddly, I don't see any |
@CJ-Lab7 This error looks to be coming from your own application code. In the error, you can see it is coming from (http://127.0.0.1:32792/js/lims.50c0b27d.js:1) - this is your application's file. Click on the error with DevTools open to see more information about the error. |
I just merged some unrelated changes into a new test branch, ran npm i, and the |
Unfortunately there is still not enough information to reproduce the problem. Please comment in this issue with a reproducible example and we will reopen the issue. 🙏 |
I got the same error on the first describe('C T', () => {
before(() => {
cy.on('uncaught:exception', (err, runnable) => {
if (err.match(/Uncaught Error: ResizeObserver loop limit exceeded/))
return false
})
})
beforeEach(() => {
cy.server()
cy.fixture('c/all.json').as('fxAllC')
cy.route('**/T**').as('data')
cy.route('GET',
'**/C/T?dateFrom=**',
'@fxAllC').as('fullData')
cy.route('POST', '**/Search').as('search')
cy.login()
cy.visit('/c')
cy.wait('@fullData', { timeout: 20000, })
})
it('Text search', () => {
cy.contains('h1', 'Count')
cy.get('.ct-search .aff input').type('leader')
cy.wait('@search')
cy.get('.aff-item').first().click()
cy.get('.ct-search .aff input').type('11111111111111')
cy.wait('@search')
cy.get('.aff-item').should('not.exist')
cy.get('.ct-search .aff input').type('{enter}')
cy.get('.aff .aff-selected-item').should((items) => {
expect(items).to.have.length(2)
expect(items.eq(1)).to.contain('Leader 1')
expect(items.eq(0)).to.contain('11111111111111')
})
})
}) Also I have commands Cypress.Commands.add('app', () => {
cy.window().should('have.property', '$app')
return cy.window().its('$app')
})
Cypress.Commands.add('login', () => {
return api.login('User', '123456')
}) |
I see a similar issue, which occurs randomly when running a certain test: // all(...) creates it(...) permutations with different viewports and languages
all(
`${testProduct.name} can be found through navigation, sorting and filtering`,
topCategoryPageUrl,
({ viewport, t }) => {
assertBreadcrumbs(2, viewport);
cy.get(`header h1`).should('exist');
// Navigate to sub-category
cy.get(el('CategoryList'))
.find(
`${el('CategoryListItem')} a[href$="${
testProduct.subCategory
}"]:visible`
)
.click();
cy.location('href').should('include', testProduct.subCategory);
cy.get(el('ProductListing', 'category', testProduct.subCategory)).as(
'productList'
);
if (viewport !== 'mobile') {
cy.get('@productList')
.find(el('PanelHeader'))
.contains(t('category', 'products.title'));
}
cy.get('@productList')
.get(el('ProductCard'))
.its('length')
.should('be.gte', 2);
// Sorting
cy.get(el('SortOrderDropdown')).click();
cy.get(
`${el('SortOrderDropdown')} ${el('DropdownOption', 'value', 'price:asc')}`
).click();
assertRouteLoad();
const productPricesSelector = `${el(
'ProductListing',
'category',
testProduct.subCategory
)} ${el('ProductCard')} ${el('PriceLabel')}`;
assertSorted({
selector: productPricesSelector,
parser: val => currency(val).value,
});
cy.get(el('SortOrderDropdown')).click();
cy.get(
`${el('SortOrderDropdown')} ${el(
'DropdownOption',
'value',
'price:desc'
)}`
).click();
assertRouteLoad();
assertSorted({
selector: productPricesSelector,
parser: val => currency(val).value,
comparator: (a, b) => b - a,
});
// ... more test code
}
);
// Some helper functions used in the above test code
export function assertRouteLoad() {
cy.get(el('RouteLoader'), {
timeout: Cypress.config('pageLoadTimeout'),
}).should('exist');
cy.get(el('RouteLoader'), {
timeout: Cypress.config('pageLoadTimeout'),
}).should('not.exist');
}
export function assertSorted({
selector,
timeout = Cypress.config('pageLoadTimeout'),
parser = val => val,
comparator = (a, b) => a - b,
}) {
const startTime = Date.now();
return new Cypress.Promise((resolve, reject) => {
(function poll() {
cy.get(selector).then(elements => {
const values = elements
.toArray()
.map(element => parser(element.innerText));
const sortedValues = values.slice().sort(comparator);
const isSorted = equal(values, sortedValues);
if (isSorted) {
expect(values).to.eql(sortedValues);
resolve(values);
return;
}
if (startTime + timeout < Date.now()) {
expect(values).to.eql(sortedValues);
reject();
return;
}
setTimeout(poll, 500);
});
})();
});
}
// el(...) is a helper function that generates selector strings As can be seen in the test code, |
Do you use the |
Why did this issue get closed? There does not seem to be a resolution |
@jennifer-shehane How can I solve this issues?
The text was updated successfully, but these errors were encountered: