Allow to launch one WD session per suite #147
Conversation
/cc @j0tunn |
1 similar comment
@@ -73,6 +73,9 @@ browsers: | |||
* `debug` (CLI: `--debug`, env: `GEMINI_DEBUG`) – включить отладочный вывод в терминал. | |||
* `parallelLimit` – число браузеров запускаемых `Gemini` параллельно. | |||
По умолчанию запускаются все, но иногда (например, при использовании облачных сервисов вроде Sauce Labs) это число необходимо контролировать. | |||
* `sessionMode` — позволяет указать, как именно запускать новые сессии WebDriver: | |||
- `perBrowser` (по умолчанию) — запуск одной сессии для каждого браузера. Эта сессия будет переиспользована для всех наборов. | |||
- `perSuite` — запуск 1 сессия в каждом браузере для каждого набора. Сессия будет закрыта как только набор протестирован. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
запуск одной сессии
bec1d32
to
332a54f
Compare
1 similar comment
* @param {String} id | ||
*/ | ||
BasicPool.prototype.finalizeBrowsers = function(id) { | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Почему бы не так?
module.exports = _.assign(BasicPool.prototype, {
/**
* @param {String} id
* @returns {Promise.<Browser>}
*/
getBrowser: function(id) {
},
/**
* @param {Browser} browser
* @returns {Promise}
*/
freeBrowser: function(browser) {
},
/**
* @param {String} id
*/
finalizeBrowsers: function(id) {
}
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можно и так, но у меня tern
с таким вариантом лучше работает.
ac02eca
to
63c9661
Compare
}) | ||
.then(function() { | ||
return browser.captureFullscreenImage(); | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Может тут тоже забиндить эти 2 метода?
}) | ||
.then(function() { | ||
return _this.browserPool.freeBrowser(browser); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут вроде тоже можно 3 then'a набиндить
63c9661
to
2f9776e
Compare
🆙 |
.then(function() { | ||
return session.runHook(suite.afterHook); | ||
}) | ||
.then(function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а тут не надо это делать в fin
?
Есть предложение сделать |
2f9776e
to
f6e7cab
Compare
sessionMode option added which allows to switch between perBrowser (1 session for browser, current behavior) and perSuite (1 session for each suite). To support both old and new behavior along with parallelLimit setting, browser launcher was replaced with 3 pool classes. New browser is requested from pool before each suite. `Pool` class is the most simple variant of the pool which just opens and closes session every time it requested. `LimitedPool` wraps another pool and enforces the limit on the number of currently open sessions. It is used when parallelLimit is set. In perBrowser mode, limited or unlimited pool will be wrapped in CachingPool which allows to share a session between multiple suites. As long as calibration is needed to be performed only once for each browser id, it was moved to separate Calibrator class. This allows to perform only once for each browser even in perSuite mode.
Changes Unknown when pulling f6e7cab on feature/session-per-suite into * on master*. |
2 similar comments
Changes Unknown when pulling f6e7cab on feature/session-per-suite into * on master*. |
Changes Unknown when pulling f6e7cab on feature/session-per-suite into * on master*. |
f6e7cab
to
34aac8c
Compare
Changes Unknown when pulling 34aac8c on feature/session-per-suite into * on master*. |
🆗 |
Allow to launch one WD session per suite
sessionMode option added which allows to switch between
perBrowser (1 session for browser, current behavior) and
perSuite (1 session for each suite).
To support both old and new behavior along with parallelLimit
setting, browser launcher was replaced with 3 pool classes.
New browser is requested from pool before each suite.
In perSuite mode, one of the following classes will be used:
In perBrowser mode, limited or unlimited pool will be wrapped
in CachingPool which allows to share a session between multiple
suites.
As long as calibration is needed to be performed only once for
each browser id, it was moved to separate Calibrator class. This
allows to perform only once for each browser even in perSuite mode.