-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Wrong type definition for 'match' - removes 'string', should be 'RegExp' #2578
Comments
Looks like we have the type annotation wrong. This is part of chai and is documented to only accept a RegExp. This follows the String.prototype.match signature. For matching a substring, you can use cy.wrap('hello world').should('include', 'wolrd') |
Sure I used contain, but it should be corrected non the less.
…---------- Původní zpráva ----------
Od: Chris Breiding
Datum: 9. 10. 2018 v 18:49:30
Předmět: Re: [cypress-io/cypress] 'match' requires its argument be a
'RegExp' (#2578)
Looks like we have the type annotation wrong
(https://github.com/cypress-io/cypress/blob/develop/cli/types/index.d.ts#L2491)
.
This is part of chai and is documented to only accept a RegExp
(https://www.chaijs.com/api/bdd/#method_match). This follows the String.
prototype.match signature
(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match)
.
For matching a substring, you can use include instead:
<span>cy</span>.<span>wrap</span>(<span><span>'</span>hello world<span>'</span></span>).<span>should</span>(<span><span>'</span>include<span>'</span></span>, <span><span>'</span>wolrd<span>'</span></span>)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
(#2578 (comment)),
or mute the thread
(https://github.com/notifications/unsubscribe-auth/AB6Lhu4f08VIL3PlMlNzLxa4X77fCRWuks5ujNMzgaJpZM4XSe9u)
.
|
Hi I am learning Cypress and new to it just wanted to know how can I achieve the Following it('finds the Submit Button and Submits it', function(){
cy.get('input[type="submit"]').should('have.css','font-family').and('match','inherit')
cy.get('input[type="submit"]').click().then((submitobj)=>{
//cy.get(obj).should('have.value')
expect(submitobj).to.have.value('LOGIN')
})
}) |
Either use |
@Akxe I am still unable to make it work could you please give an example or something. my requirement is like to match something with the url? eg. |
@Manishku99251 This annotation for using cypress is correct - |
The code for this is done in cypress-io/cypress#3787, but has yet to be released. |
Released in |
Current behaviour:
'match' requires its argument be a 'RegExp'. You passed 'https://example.com'.
Desired behaviour:
Since in type anotation is as fallow:
I would assume it would take string. Since it is
match
I thought it would use String.match function...Steps to reproduce:
Versions
Cypress: 3.1.0
OS: Windows 10
Browser: Chrome 69.x.x
The text was updated successfully, but these errors were encountered: