question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

extreme slowness: uses 45 seconds to fill one form

See original GitHub issue

What are you trying to achieve?

Fill one page with a form in a reasonable amount of time.

What do you get instead?

The form filling proceeds extremely slowly. Filling the form takes about 45-50 seconds. The test that fills out input fields pauses for 5-10 seconds between each field, and then suddenly speeds up for the last few fields. See this video.

Needless to say, this page works quickly/fast when filling the page using my keyboard.

I suspect that it is somehow related to Javascript (perhaps onchange validation triggers), since the login page fillout (no validation) goes quickly until the click handler is touched, but as the script runs in the fast Chrome engine it shouldn’t matter. When running the login procedure that fills in username and password it proceeds quickly (except for a long delay after clicking the login button).

Another hint it might have something to do with JS is observing the output when running with --steps, as you can see the time does not change between the filling out steps, even though it in practice actually takes 5-10 seconds between each step. It is if everything is one big blocking operation. Then it is like running executeScript changes this, as time jumps from 13:35:20 to 13:36:14 in what is in reality just a second or two.

Console output from running codeceptjs run -c tests/acceptance/codecept.conf.js "--steps" (The first part is just a log in script that runs before the test)

Patient administration --
 I can add a new patient
 • I am on page "/login"
 • I fill field "username", "root"
 • I fill field "password", "dx er en doc in a box"
 • I see "LOGG INN"
 • I see element in d o m "[name=loginBtn]"
 • I click "loginBtn"
 • I wait 1
 • I dont see "LOGG INN"
   this is a test
 • I am on page "/encounter/new"
   starting to fill fields at Fri Jun 23 2017 13:35:20 GMT+0200 (CEST)
 • I fill field "[name=nationalId]", "13097335557"
   filled Fri Jun 23 2017 13:35:20 GMT+0200 (CEST)
 • I fill field "[name=age]", "63"
   filled Fri Jun 23 2017 13:35:20 GMT+0200 (CEST)
 • I fill field "[name=gender]", "63"
   filled Fri Jun 23 2017 13:35:20 GMT+0200 (CEST)
 • I fill field "[name=firstName]", "Kalle"
   filled Fri Jun 23 2017 13:35:20 GMT+0200 (CEST)
 • I fill field "[name=lastName]", "Kalle"
   filled Fri Jun 23 2017 13:35:20 GMT+0200 (CEST)
 • I fill field "#priority", "2"
   filled Fri Jun 23 2017 13:35:20 GMT+0200 (CEST)
 • I fill field "#problem", "something fishy"
   Filling finished at Fri Jun 23 2017 13:35:20 GMT+0200 (CEST). Starting to click.
 • I click "#appdetailsheader button"
   click finished Fri Jun 23 2017 13:35:20 GMT+0200 (CEST)
 • I wait 1
 • I execute script function()
   new path: /patient/list/responsible, Fri Jun 23 2017 13:36:14 GMT+0200 (CEST)
 ✓ OK in 54159ms

Provide test source code if related

const assert = require('assert');

Feature('Patient administration');

Before(require('./login'));

Scenario('I can add a new patient', function *(I) {
  I.say('this is a test');
  I.amOnPage('/encounter/new');

  I.say(`starting to fill fields at ${Date()}`);
  I.fillField('[name=nationalId]', '13097335557');
  I.say(`filled ${Date()}`);
  I.fillField('[name=age]', '63'); // TODO: should be auto-filled from pnr
  I.say(`filled ${Date()}`);
  I.fillField('[name=gender]', 'M'); // TODO: should be auto-filled from pnr
  I.say(`filled ${Date()}`);
  I.fillField('[name=firstName]', 'Kalle'); 
  I.say(`filled ${Date()}`);
  I.fillField('[name=lastName]', 'Kalle'); 
  I.say(`filled ${Date()}`);
  I.fillField('#priority', '2'); 
  I.say(`filled ${Date()}`);
  I.fillField('#problem', 'something fishy'); 
  I.say(`Filling finished at ${Date()}. Starting to click.`);
  I.click('#appdetailsheader button');
  I.say(`click finished ${Date()}`);
  // takes about 30 seconds to get here

  I.wait(1);

  path = yield I.executeScript(()=>{
    return location.pathname;
  });
  I.say(`new path: ${path}, ${Date()}`);
  assert.notEqual(path, '/encounter/new');
});

Details

  • CodeceptJS version: 0.6.3
  • NodeJS Version: 8.0.0
  • Operating System: Ubuntu 16.04
  • WebDriverIO: 4.8.0
  • Configuration file:
exports.config = {
  'tests': './*_test.js',
  'timeout': 10000,
  'output': './output',
  'helpers': {
    'WebDriverIO' : {
      'browser': 'chrome',
      'desiredCapabilities': {
        'browserName': 'chrome',
        'chromeOptions': {
          'args': [
            'NOT-READY-headless',
            'disable-gpu'
          ]
        }
      },
      'windowSize': '320x568',
      'restart': false,
      'timeouts': {
        'script': 10000,
        'page load': 3000,
        'implicit' : 5000
      },
      'url': process.env['CODECEPT_METEOR'] || 'http://localhost:23450'
    }
  },
  'include': {
    'I': './steps_file.js'
  },
  'bootstrap': './server-setup-teardown.js',
  'teardown': './server-setup-teardown.js',
  'mocha': {},
  'name': 'MyApp acceptance tests',
  'windowSize': '320x568'
};

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
DavertMikcommented, Jul 5, 2017

Ok, I see the issue

@fatso83 you are using implcit waits

'implicit' : 5000

and wide locators. When you use [name=xx] locator, like

I.fillField('[name=firstName]', 'Kalle'); 

CodeceptJS does not understand that this is CSS. At first it tries to find a text field by its label, then by name, then tries standard locators. It’s 3 calls, but usually it doesn’t matter. However, in your config it will wait for 5 seconds in each unsuccessful case. So each call is stuck for 10 seconds at least.

What you can do.

  • Disable implicit waits. They are evil if used incorrectly. And in most cases they are.
  • or use strict locators, like { css: '[name=firstName]' } to specify the locator type

you can also change implicit timeouts dynamically with defineTimeout so you can turn implicit waits on and off

1reaction
bwaybanditcommented, Mar 16, 2018

Using NightmareJS 3.0.0 with codeceptJS and ran into this. I had to set “typeInterval” property in NightmareJS to -1. Might not be the same issue but i thought this might help someone else. All good points above though.

Example below: “helpers”: { “Nightmare”: { “url”: “https://access.dev.secureauth.com/246/users/sign_in”, “show”: true, “windowSize”: “1440x1024”, “waitforTimeout”: 1000, “typeInterval”: -1, “desiredCapabilities”: { “browserName”: “chrome”, “chromeOptions”: { “args”: “[‘start-maximized’]” } } }, “MyHelper”: { “require”: “./common/codeceptjsCommon.js” } },

Read more comments on GitHub >

github_iconTop Results From Across the Web

extreme slowness: uses 45 seconds to fill one form · Issue #570
The form filling proceeds extremely slowly. Filling the form takes about 45-50 seconds. The test that fills out input fields pauses for 5-10 ......
Read more >
How to Use the Effect Command in Minecraft
This /effect command uses a Name value of strength, a duration of 45 seconds, and an amplifier of 3. This will give the...
Read more >
Atrioventricular Block - StatPearls - NCBI Bookshelf - NIH
High-grade AV block is a form of second-degree (incomplete) heart block that can commonly be confused with third-degree (complete) heart block.
Read more >
Bradycardia - Symptoms and causes - Mayo Clinic
Bradycardia (brad-e-KAHR-dee-uh) is a slow heart rate. The hearts of adults at rest usually beat between 60 and 100 times a minute.
Read more >
How to Relieve Sciatica Pain in SECONDS - YouTube
Dr. Rowe shows how to get IMMEDIATE relief for sciatica pain... in as little as a few seconds !This step-by-step sciatica relief guide...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found