-
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
"type()" function execute more and more slowly. #8669
Comments
Does it happen with "simple" text field and and running type there for 400 times? Can you measure timings per command like we have done in https://www.cypress.io/blog/2020/05/22/where-does-the-test-spend-its-time/ |
With simple text, but running type only 36 times. elements like: <!-- antd input-->
<input data-v-602608bc="" placeholder="请输入Category名称" type="text" class="ant-input"> test code with: export function input(placeholder: string, text: string): void {
cy.get(`input[placeholder=${placeholder}]`)
.clear()
.type(text, { force: true });
} and <!-- antd form item-->
<div data-v-7e36b91e="" class="ant-row ant-form-item">
<div class="ant-col ant-form-item-label">
<label title="名称" class="ant-form-item-required">名称</label>
</div><div class="ant-col ant-form-item-control-wrapper">
<div class="ant-form-item-control">
<span class="ant-form-item-children">
<input data-v-7e36b91e="" type="text" class="ant-input">
</span>
</div>
</div> test code with: export function formInput(option: Cypress.FormOption) {
const { label: key, input: target } = option;
cy.get("label")
.contains(key)
.parent()
.parent()
.find("input")
.clear()
.type(target, { force: true });
}
in the beginning of test case, type text like: "Test_7ba81ee0_Category", spend less than 200ms and spend time more and more slowly in the ending of test case, type text like: "Test_fcdd1f6a_rc", spend more an 2 sec. |
I'm not able to reproduce this issue with the examples provided. The typing does not slow down over time. I suspect that there is something else involved in the slowdown that is a larger part of your app/tests. It may be a duplicate of this #6783 where XHRs are performed in between type that cause type to slow down over time. Examples I tried that showed no slowdown:
<html>
<body>
<input data-v-602608bc="" placeholder="请输入Category名称" type="text" class="ant-input">
</body>
</html>
it('test', () => {
cy.visit('index.html');
for (let i = 0; i < 300; i++) {
cy.get(`input[placeholder=请输入Category名称]`)
.clear()
.type('Test_7ba81ee0_Category', { force: true });
}
})
<html>
<body>
<div data-v-7e36b91e="" class="ant-row ant-form-item">
<div class="ant-col ant-form-item-label">
<label title="名称" class="ant-form-item-required">名称</label>
</div>
<div class="ant-col ant-form-item-control-wrapper">
<div class="ant-form-item-control">
<span class="ant-form-item-children">
<input data-v-7e36b91e="" type="text" class="ant-input">
</span>
</div>
</div>
</body>
</html>
it('test', () => {
cy.visit('index.html');
for (let i = 0; i < 300; i++) {
cy.get("label")
.contains('名称')
.parent()
.parent()
.find("input")
.clear()
.type('Test_7ba81ee0_Category', { force: true });
}
}) Right now there isn't to be enough information to reproduce the problem on our end. We'll have to close this issue until we can reproduce it. This does not mean that your issue is not happening - it just means that we do not have a path to move forward. Please comment in this issue with a reproducible example and we will consider reopening the issue. Here are some tips for providing a Short, Self Contained, Correct, Example and our own Troubleshooting Cypress guide. |
Current behavior
When run a long time test case, "type()" function execute more and more slowly.
In the being:
In the end:
Completed video:
TestResolveGroup.ts.mp4.zip
Desired behavior
Execute speed like beginning.
Versions
Cypress 5.1.0
MacOS 10.15.4
Chrome 85.0.4183.102
The text was updated successfully, but these errors were encountered: