- Cypress - Discussion
- Cypress - Useful Resources
- Cypress - Quick Guide
- Cypress - GitHub
- Cypress - Plugins
- Cypress - Reports
- Cypress - Configuration of JSON File
- Cypress - Hooks
- Cypress - Environment Variables
- Cypress - Fixtures
- Cypress - Custom Commands
- Cypress - Debugging
- Cypress - Screenshots and Videos
- Cypress - Dashboards
- Cypress - Prompt Pop-up Window
- Cypress - Data Driven Testing
- Cypress - File Upload
- Cypress - Get and Post
- Cypress - Cookies
- Cypress - Mouse Actions
- Cypress - Web Tables
- Cypress - Frames
- Cypress - Hidden Elements
- Cypress - Child Windows
- Cypress - Alerts
- Cypress - Dropdown
- Cypress - Tabs
- Cypress - Checkbox
- Cypress - jQuery
- Cypress - Working with XHR
- Cypress - Asynchronous Behavior
- Cypress - Text Verification
- Cypress - Assertions
- Cypress - Locators
- Cypress - Aliases
- Cypress - Variables
- Cypress - Basic Commands
- Cypress - Supported Browsers
- Cypress - Build First Test
- Cypress - Test Runner
- Cypress - Architecture and Environment Setup
- Cypress - Introduction
- Cypress - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Cypress - Assertions
飓风从Mocha、Chai等各种图书馆获得的不止一种说法。 这种说法是明确和暗含的。
Imppcit Assertions
如果断言适用于从母公司在链条下获得的物体,则称为默示主张。 民众的含蓄说法包括......和/或应当。
这些指挥不能单独使用。 一般来说,当我们必须核实对某一物体的多次检查时,就使用了这些检查。
让我们以以下实例说明默示的断言:
// test suite describe( Tutorialspoint , function () { it( Scenario 1 , function (){ // test step to launch a URL cy.visit("https://www.tutorialspoint.com/videotutorials/index.php") // assertion to vapdate count of sub-elements and class attribute value cy.get( .toc chapters ).find( p ).should( have.length ,5) .and( have.class , dropdown ) }); });
产出如下:
产出记录显示,有两种说法,有线索和指挥。
Exppcit Assertions
如果主张直接适用于物体,则称为明确主张。 民众的明确主张包括主张/怀疑。
明确声称的指挥如下:
// test suite describe( Tutorialspoint , function () { // it function to identify test it( Scenario 1 , function (){ // test step to launch a URL cy.visit("https://accounts.google.com") // identify element cy.get( h1#headingText ).find( span ).then(function(e){ const t = e.text() // assertion expect expect(t).to.contains( Sign ) }) }) })
产出如下:
产出记录显示,直接适用于预期指挥的物体。
Cypress has Default Assertions which are internally handled and do not require to be invoked specifically.
实例很少:
cy.visit () - Expects the page to show the content with 200 status Code.
cy.request () - Expects that the small services to be available and sent a response.
cy.contains () - Expects the web elements with its nature to be available in DOM.
cy.get () - Expects the web elements to be available in DOM.
.find () - Expects the web elements to be available in DOM.
类型()——要求网络要素转向一个有能力的国家。
.cpck () - Expects the web elements to goable state.
. . . . . . . . - 现有专题的网络要素财产的前景。
Other Cypress assertions
其他的“旋风”说法如下:
length
它检查了从前线指挥中获取的内容。
例如,
cy.get( #txt-fld ).should( have.length ,5)
value
它检查了网站内容是否具有一定价值。
例如,
cy.get( #txt-fld ).should( have.length ,5)
value
它检查了网站内容是否具有一定价值。
例如,
cy.get( #txt-fld ).should( have.value , Cypress )
class
它检查网站内容是否具有某种类别。
例如,
cy.get( #txt-fld ).should( have.class , txt )
contain
它检查了网站内容是否具有某种文本。
例如,
cy.get( #txt-fld ).should( contain , Cypress )
visible
它检查网站内容是否明显。
例如,
cy.get( #txt-fld ).should( be.visible )
exist
它检查网站内容是否可在文件目标模型中查阅。
例如,
cy.get( #txt-fld ).should( not.exist );
css
它检查网络元素是否拥有某种财产。
例如,
cy.get( #txt-fld ).should( have.css , display , block );Advertisements