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

update version all dependencies, migrate to async #17

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

crbernal
Copy link
Contributor

  • Packages -> update version of dependencies & delete sync
  • Update to async all the functions

Copy link
Member

@irikuo irikuo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the tests I've only mentioned in one of them what I see weird (using await where it looks to me like it's not needed) but, it's present in most of them.

The other thing that I'm very curious about is if the $(selector) is async, but I've seen now in the docs (https://webdriver.io/docs/api/element/$) that it is :) Interesting!

@@ -21,5 +21,5 @@ export default (action, type, selector) => {

checkIfElementExists(selector2);

$(selector2)[method]();
await selector2[method]();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this one correct? Souldn't it be await $(selector2)[method](); like it used to be?

@@ -5,22 +5,22 @@
* @param {String} element Element selector
* @param {String} element Element selector
*/
module.exports = (previousElement, element) => {
module.exports = (previousElement, element) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be async as well, right? Also, why is this export different than the rest of actions?


var value = await $(previousElement)[command]();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-relevant, but we should avoid var :)

Copy link
Contributor Author

@crbernal crbernal Mar 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I'm going to replace all the var!

@@ -9,7 +9,7 @@ import setInputField from './setInputField';
*/
module.exports = (method, element) => {

var date = Date.now().toString();
var date = await Date.now().toString();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? Date is synchronous in JS, did you have any problem that forced you to do this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we could replace var :P

@@ -8,7 +8,7 @@ import setInputField from "./setInputField";
*/
module.exports = (method, element) => {

var date = Date.now().toString();
var date = await Date.now().toString();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as in the previous file :)

@@ -38,8 +38,8 @@ export default (elementType, selector, falseCase) => {
}

if (boolFalseCase) {
expect(text).toBe('');
await expect(text).toBe('');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a question here... and I see it repeats in other texts. text is a value that you obtain from an await already on line 32. As far as I know, expect().toBe() is a synchronous check, as you already have the value you want to check. It would be different if it was something like

await expect($(selector)[command]()).toBe('');

because then that line has some asynchronous stuff going on. But if the async "wait" happened already, I don't think you need it. Unless I'm missing something about the framework 🤔

@@ -36,9 +36,9 @@ export default (elementType, selector, falseCase, expectedText) => {
* The text of the element
* @type {String}
*/
const elem = $(selector);
const elem = await $(selector);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen this a couple of times... Is this requested by the framework? I mean, are the selectors supposed to be asynchronous? Or are just the methods called on the resulting elem from the selector the ones that are async?

@@ -106,7 +106,7 @@ exports.config = {
baseUrl: 'http://localhost:3000/#/login',
//
// Default timeout for all waitFor* commands.
waitforTimeout: 19000,
waitforTimeout: 99999,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure we want this in the default boilerplate? Shouldn't this be something that we override per project in case it's needed, but should be a reasonable number? Honestly more that 20 seconds shouldn't be the "normal" for the tests to blow, right? And you can always override the value on a per-project basis in case it's needed, no? What do you think?

'./node_modules/qustodio-itui/src/steps/when.js',
'./node_modules/qustodio-itui/src/steps/then.js',
require: [
'./src/steps/**/*.feature',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one I don't fully understand it. We're removing the steps (why?) and setting the path where we expect to find the features... That should be a responsibility of the project using itui, but not prescriptive from itui directly, no? Maybe there's some other intent here that I'm not seeing, just asking to uderstand here :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants