Skip to content
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

Closed
JFRabbit opened this issue Sep 25, 2020 · 3 comments
Closed

"type()" function execute more and more slowly. #8669

JFRabbit opened this issue Sep 25, 2020 · 3 comments
Labels

Comments

@JFRabbit
Copy link

Current behavior

When run a long time test case, "type()" function execute more and more slowly.

In the being:

beginning

In the end:

ending

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

@bahmutov
Copy link
Contributor

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/

@bahmutov bahmutov added the stage: needs information Not enough info to reproduce the issue label Sep 25, 2020
@JFRabbit
Copy link
Author

JFRabbit commented Sep 27, 2020

@bahmutov

Does it happen with "simple" text field and and running type there for 400 times?

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 });
}

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/

in the beginning of test case, type text like: "Test_7ba81ee0_Category", spend less than 200ms

截屏2020-09-27 上午11 53 51

and spend time more and more slowly

in the ending of test case, type text like: "Test_fcdd1f6a_rc", spend more an 2 sec.
截屏2020-09-27 上午11 53 05

@jennifer-shehane
Copy link
Member

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:

index.html

<html>
<body>
  <input data-v-602608bc="" placeholder="请输入Category名称" type="text" class="ant-input">
</body>
</html>

spec.js

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 });
  }

})

index.html

<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>

spec.js

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.

@jennifer-shehane jennifer-shehane removed the stage: needs information Not enough info to reproduce the issue label Dec 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants