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
embed expect-webdriverio in framework adapters #5335
Conversation
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.
LGTM
@mgrybyk seems like some issue with the typings:
|
Let me take a look |
@christian-bromann this one webdriverio/expect-webdriverio@a4f7a7a broke everything. Have to partially revert it and all the errors in the current PR will gone |
Can you specify what broke? It seem to work just fine without the change from this PR. |
@christian-bromann webdriverio/expect-webdriverio@a4f7a7a#diff-045247205377646525c5096c7eed6582L67-R67 We can't use My local project fails to compile with latest expect-webdriverio as well |
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.
Looking good!
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.
Didn't see the comments before I approved
There are still some Jasmine errors which should be fixeable in this PR I assume:
|
On it :) |
Feel free to push directly on this branch. Thanks! |
Two issues here, on in expect-webdriverio, another one here. Working on PR for expect-webdriverio |
@mgrybyk I will make a release for |
@christian-bromann some unit tests are failing, not related to types now, so we are good :) |
unit test failures are legit, looking into it. |
The issue here seems related to what I'm seeing when webdriverio is used via Appium. It fires exceptions of "expect is not a function". |
@mikerusso-tsi until we release this patch please add |
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.
Let's merge?
Thanks for the help @mgrybyk , releasing it now. |
Thanks for your reply, @christian-bromann, I added it to the tsconfig.json of my appium client but still see the error. Pardon my ignorance on this, but, does appium make use of one of your framework adapters? I simply have an appium client in a node-based javascript file and am not making use of jasmine, mocha, or cucumber. Should expect-webdriverio be available in such case? I tried installing expect-webdriverio to the project and requiring it, but to no avail. When using appium, is the WDIO testrunner invoked (which is the piece that is said to include expect-webdriverio)? Thank you! |
@mikerusso-tsi if you use |
Thank you, Christian. The instructions do not seem suitable when coming from an appium test environment. First of all, I don't have a wdio.conf.js file, I think because I did not start with the npx instruction that you normally use to create a webdriverio project. Nevertheless, I tried just adding it into my folder with the appium test specs, as well as installing expect-webdriverio into my project, but 'expect' is still not available to me. Here's my wdio.conf.js:
?
exports.config = {
beforeSession() {
require('expect-webdriverio');
}
};
I very much appreciate your time!
Mike
Mike Russo
Senior Software Engineer
TSI Incorporated
Oconomowoc, WI
Tel: 262.354.6139
mike.russo@tsi.com
www.tsi.com<http://www.tsi.com>
…________________________________
From: Christian Bromann <notifications@github.com>
Sent: Friday, May 1, 2020 6:30 PM
To: webdriverio/webdriverio
Cc: Russo, Mike; Mention
Subject: Re: [webdriverio/webdriverio] embed expect-webdriverio in framework adapters (#5335)
Warning: This email originated outside of TSI. Do not respond, click links or open attachments unless you recognize the sender and know the content to be safe.
@mikerusso-tsi<https://github.com/mikerusso-tsi> if you use expect-webdriverio without the testrunner you need to import it as described here https://www.npmjs.com/package/expect-webdriverio#usage
-
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#5335 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/APMCUATUOATV262U5JELNPTRPNLRBANCNFSM4MSXWEPQ>.
This e-mail or the documents accompanying this e-mail contain information that may be confidential and/or privileged.
It may also be prohibited from disclosure under applicable law. The information is intended to be for the use of the
individual or entity named on this transmission. If you are not the intended recipient, be aware that any disclosure,
copying, distribution or use of the contents of this information is without authorization and is prohibited. If you
have received this e-mail in error, please notify us immediately so that we can take action to correct the problem.
|
@mikerusso-tsi just require the package anywhere before you first use it |
Well, there still appears to be a higher-level problem. Although 'expect' is now defined, when used it throws the exception 'browser' is not defined. For instance,
?node_modules/expect-webdriverio/lib/matchers/element/toBeDisplayed.js:7:5
Which is this:
return browser.call(async () => {
const result = await utils_1.executeCommandBe.call(this, received, async (el) => {
try {
return el.isDisplayed();
}
catch (_a) {
return false;
}
}, options);
return result;
});
By the way, I am not testing a browser app but rather an Android Cordova app, which internally uses a Chrome webview. Again, this is via Appium.
?
Thank you!
Mike
…________________________________
From: Christian Bromann <notifications@github.com>
Sent: Monday, May 4, 2020 12:17 PM
To: webdriverio/webdriverio
Cc: Russo, Mike; Mention
Subject: Re: [webdriverio/webdriverio] embed expect-webdriverio in framework adapters (#5335)
Warning: This email originated outside of TSI. Do not respond, click links or open attachments unless you recognize the sender and know the content to be safe.
@mikerusso-tsi<https://github.com/mikerusso-tsi> just require the package anywhere before you first use it
-
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#5335 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/APMCUAS6TRCAWYOZULHRQLLRP32AZANCNFSM4MSXWEPQ>.
This e-mail or the documents accompanying this e-mail contain information that may be confidential and/or privileged.
It may also be prohibited from disclosure under applicable law. The information is intended to be for the use of the
individual or entity named on this transmission. If you are not the intended recipient, be aware that any disclosure,
copying, distribution or use of the contents of this information is without authorization and is prohibited. If you
have received this e-mail in error, please notify us immediately so that we can take action to correct the problem.
|
oh, ok. I assumed it would be possible to use it without the testrunner but apparently you can only use it with that. |
Well that's disappointing! So it looks like expect-webdriverio is relying on this 'browser' object and 'browser' is somehow provided by the testrunner, is that how you see it? Can you suggest any other way to provide the browser object from Appium?
Or, can you suggest any other means of using expect-webdriverio with Appium? E.g., via the mocha framework? Was expect-webdriverio built by forking expect (for Jest) and adapting it for webdriverio?
Thanks again for you help!
Mike
…________________________________
From: Christian Bromann <notifications@github.com>
Sent: Monday, May 4, 2020 3:12 PM
To: webdriverio/webdriverio
Cc: Russo, Mike; Mention
Subject: Re: [webdriverio/webdriverio] embed expect-webdriverio in framework adapters (#5335)
Warning: This email originated outside of TSI. Do not respond, click links or open attachments unless you recognize the sender and know the content to be safe.
oh, ok. I assumed it would be possible to use it without the testrunner but apparently you can only use it with that.
-
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#5335 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/APMCUAXLK6PQERUTSUZGUWTRP4OUVANCNFSM4MSXWEPQ>.
This e-mail or the documents accompanying this e-mail contain information that may be confidential and/or privileged.
It may also be prohibited from disclosure under applicable law. The information is intended to be for the use of the
individual or entity named on this transmission. If you are not the intended recipient, be aware that any disclosure,
copying, distribution or use of the contents of this information is without authorization and is prohibited. If you
have received this e-mail in error, please notify us immediately so that we can take action to correct the problem.
|
You can use the library with Appium. You just need to run WebdriverIO with the testrunner. You could also try to set browser as global: global.browser = await remote({...})
await expect(browser).toHaveTitle() |
Christian,
I didn't like the thought of running the WebDriverIO testrunner, so I tried the global.browser idea and THAT DID IT!!! Such a relief!
And such a simple fix, of course. I was so close, having tried assigning the result of remote() to 'browser' but didn't think of the global context to make it available deep down in expect-webdriverio.
Thanks for putting up with all of my questions!?
Mike
…________________________________
From: Christian Bromann <notifications@github.com>
Sent: Wednesday, May 6, 2020 10:03 AM
To: webdriverio/webdriverio
Cc: Russo, Mike; Mention
Subject: Re: [webdriverio/webdriverio] embed expect-webdriverio in framework adapters (#5335)
Warning: This email originated outside of TSI. Do not respond, click links or open attachments unless you recognize the sender and know the content to be safe.
Or, can you suggest any other means of using expect-webdriverio with Appium?
You can use the library with Appium. You just need to run WebdriverIO with the testrunner. You could also try to set browser as global:
global.browser = await remote({...})
await expect(browser).toHaveTitle()
-
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#5335 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/APMCUASFQGFTYQDECY4GFGTRQF34JANCNFSM4MSXWEPQ>.
This e-mail or the documents accompanying this e-mail contain information that may be confidential and/or privileged.
It may also be prohibited from disclosure under applicable law. The information is intended to be for the use of the
individual or entity named on this transmission. If you are not the intended recipient, be aware that any disclosure,
copying, distribution or use of the contents of this information is without authorization and is prohibited. If you
have received this e-mail in error, please notify us immediately so that we can take action to correct the problem.
|
Proposed changes
See issue #5326. We have to embed
expect-webdriverio
typings into the framework typings so that it will be available automatically.Types of changes
Checklist
Further comments
n/a
Reviewers: @webdriverio/project-committers