extreme slowness: uses 45 seconds to fill one form
See original GitHub issueWhat 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:
- Created 6 years ago
- Comments:10 (1 by maintainers)
Top GitHub Comments
Ok, I see the issue
@fatso83 you are using implcit waits
and wide locators. When you use
[name=xx]
locator, likeCodeceptJS 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.
{ css: '[name=firstName]' }
to specify the locator typeyou can also change implicit timeouts dynamically with
defineTimeout
so you can turn implicit waits on and offUsing 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” } },