This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cy.server() | |
cy.route({ | |
url: '/users?approved=true', | |
status: 200, | |
response: 'fixture:empty.user.json' | |
}).as('approved') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await cy.server(); | |
await cy.route({ | |
method: 'POST', | |
url: 'users', | |
response: {name: 'mocked user'} | |
}); | |
await cy.addUser(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cy.server(); | |
cy.route(url:'POST', response:'/users').as(alias:'addUser'); | |
cy.wait(alias:'@addUser').should((xhr) => { | |
expect(xhr.responseBody).to.include('name') | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cy.server(); | |
cy.route(url:'POST', response:'/users').as(alias:'addUser'); | |
cy.wait(alias:'@addUser').should((xhr) => { | |
expect(xhr.responseBody.name).to.eq('name') | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cy.server(); | |
cy.route(url:'POST', response:'/users').as(alias:'addUser'); | |
cy.wait(alias:'@addUser').should((xhr) => { | |
expect(xhr.responseBody.name).to.eq('name') | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'cypress-file-upload'; | |
Cypress.Commands.add('uploadFile', (fileName, input, mime) => { | |
cy.fixture(fileName).then(fileContent => { | |
cy.get(input).upload( | |
{ fileContent, fileName, mimeType: mime }, | |
{ subjectType: 'input' },); | |
}); | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cy.server() | |
cy.route({ | |
method: 'POST', | |
url: '/authenticate?' | |
}).as('loginApi') | |
cy.wait('@loginApi').its('status').should('eq', 200).then(() => { | |
cy.url().should('include', '/home') | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var moment = require("moment"); | |
pm.environment.set('start', moment().add(30, 'minutes').format('YYYY-MM-DD HH:mm:00')); | |
///or | |
pm.environment.set('end', moment().add(45, 'minutes').toISOString()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean scrollPageDown() { | |
JavascriptExecutor executor = (JavascriptExecutor)driver; | |
executor.executeScript("window.scrollBy(0,250)"); | |
boolean scrollResult = (boolean) executor.executeScript { | |
"var scrollBefore = $(window).scrollTop();" + | |
"window.scrollTop(scrollBefore, document.body.scrollHeight);" + | |
"return $(window).scrollTop() > scrollBefore;"}; | |
return scrollResult; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pm.test("responce contains billing_type", function () { | |
pm.expect(jsonData.billing_type).to.eql("check"); | |
}); |
NewerOlder