- WebdriverIO - Discussion
- WebdriverIO - Useful Resources
- WebdriverIO - Quick Guide
- Generate HTML reports from Allure
- Execute Tests with Mocha Options
- Running Tests from command-line parameters
- WebdriverIO - Data Driven Testing
- WebdriverIO - Running Tests in Parallel
- WebdriverIO - Waits
- WebdriverIO - JavaScript Executor
- WebdriverIO - Capturing Screenshots
- WebdriverIO - Debugging Code
- WebdriverIO - Alerts
- WebdriverIO - Scrolling Operations
- WebdriverIO - Multiple Windows/Tabs
- Chai Assertions on webelements
- WebdriverIO - Handling Radio Buttons
- WebdriverIO - Cookies
- WebdriverIO - Double Click
- WebdriverIO - Drag & Drop
- WebdriverIO - Frames
- WebdriverIO - Hidden Elements
- Handling Child Windows/Pop ups
- WebdriverIO - Mouse Operations
- Handling Checkboxes & Dropdowns
- WebdriverIO - Browser Navigation Commands
- WebdriverIO - Handling Browser Size
- WebdriverIO - General Browser Commands
- WebdriverIO - Happy Path Flow
- Expect Statement for Assertions
- WebdriverIO - Name Locator
- WebdriverIO - Class Name Locator
- WebdriverIO - Tag Name Locator
- WebdriverIO - ID Locator
- WebdriverIO - Link Text Locator
- WebdriverIO - CSS Locator
- WebdriverIO - Xpath Locator
- WebdriverIO - Wdio.conf.js file
- WebdriverIO - VS Code Intellisense
- WebdriverIO - Configuration File generation
- Selenium Standalone Server Installation
- WebdriverIO - Mocha Installation
- WebdriverIO - Package.json
- WebdriverIO - VS Code Installation
- WebdriverIO - Installation of NPM
- WebdriverIO - Getting Started with NodeJS
- WebdriverIO - Architecture
- WebdriverIO - Prerequisite
- WebdriverIO - Introduction
- WebdriverIO - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
WebdriverIO - Expect Statement for Assertions
为了利用WebdriverIO作为自动化测试工具,我们需要有检查站,如果我们的测试已经过去或失败,将有助于我们结束。 网上衍生工具有各种说法,我们可以与它们一道核实试验是否成功验证了步骤。
总之,我们可以将测试的预期结果与实际结果进行比较。 如果两者都相似,则应通过测试,否则应失败。 可在浏览器、模拟物体或元件上使用网上接收器的预定发言。
我们必须增加一个名叫Chai的诺德JS图书馆。 Chai图书馆载有用于阿瑟尔的预计声明。
我们必须在我们的法典中增加以下声明,以实施《海泽》——
const e = require( chai ).expect
Assertions appped to browsers
这些说法如下:
toHaveUrl
它检查了浏览器是否打开了某一页。 The syntax is as follows -
expect(browser).toHaveUrl( https://www.tutorialspoint.com/index.htm )
toHaveUrlContaining
它检查了某一页的URL是否具有特殊价值。
Syntax>
The syntax is as follows -
expect(browser).toHaveUrlContaining( tutorialspoint )
toHaveUrl
它检查了该网页是否有特定名称。
Syntax>
The syntax is as follows -
expect(browser).toHaveTitle( Terms of Use - Tutorialspoint )
Assertions appped on elements
这些说法如下:
toBeDisplayed
它检查某一要素是否被展示。
Syntax>
The syntax is as follows -
const e = $( #loc ) expect(e).toBeDisplayed()
toExist
它检查是否存在一个要素。
Syntax>
The syntax is as follows -
const e = $( #loc ) expect(e).toExist()
toBePresent
它检查是否有一要素。
Syntax>
The syntax is as follows -
const e = $( #loc ) expect(e).toBePresent()
toBeExisting
这类似于极端主义。
toBeFocussed
它检查某一要素是否集中。
Syntax>
The syntax is as follows -
const e = $( #loc ) expect(e).toBeFocussed()
toHaveAttribute
它检查某一要素是否具有特殊价值。
Syntax>
The syntax is as follows -
const e = $( #loc ) expect(e).toHaveAttribute( name , search )
toHaveAttr
这类似于极端主义。
toHaveAttributeContaining
它检查某一要素是否含有特定价值。
Syntax>
The syntax is as follows -
const e = $( #loc ) expect(e).toHaveAttributeContaining( name , srch )
toHaveElementClass
它检查某一要素是否有特定类别的名称。
Syntax>
The syntax is as follows -
const e = $( #loc ) expect(e).toHaveElementClass( name , { message: Not available! , })
toHaveElementClassContaining
它检查了元件名称是否含有特殊价值。
Syntax>
The syntax is as follows -
const e = $( #loc ) expect(e).toHaveElementClassContaining( nam )
toHaveElementProperty
它检查某一要素是否具有特定财产。
Syntax>
The syntax is as follows -
const e = $( #loc ) expect(e).toHaveElementProperty( width , 15) //verify negative scenario expect(e).not.toHaveElementProperty( width , 20)
toHaveValue
它检查了投入部分是否具有特殊价值。
Syntax>
The syntax is as follows -
const e = $( #loc ) expect(e).toHaveValue( Selenium , { ignoreCase: false})
toHaveValueContaining
检查输入元件是否含有特定价值
Syntax>
The syntax is as follows -
const e = $( #loc ) expect(e).toHaveValueContaining( srch )
toBeCpckable
它检查一个元件是否可以点击。
Syntax>
The syntax is as follows -
const e = $( #loc ) expect(e).toBeCpckable()
toBeDisabled
它检查一个元素是否残疾。
Syntax>
The syntax is as follows -
const e = $( #loc ) expect(e).toBeDisabled() //verify negative scenario expect(e).not.toBeEnabled()
toBeEnabled
它检查一个要素是否具备。
Syntax>
The syntax is as follows -
const e = $( #loc ) expect(e).toBeEnabled()
toBeSelected
这与《公约》相同。
toBeChecked
这与《公约》相同。
toHaveHref
它检查一个环节是否有一个特别的联系目标。
Syntax>
The syntax is as follows -
const e = $( <a> ) expect(e).toHaveHref( https://www.tutorialspoint.com/index.htm )
toHaveLink
这与HaveHref相同。
toHaveHrefContaining
它检查一个环节是否包含一个特定的联系目标。
Syntax>
The syntax is as follows -
const e = $( <a> ) expect(e).toHaveHrefContaining( tutorialspoint.com )
toHaveLinkContaining
这与《黑雪》相同。
toHaveId
它检查某一要素是否具有特殊的归属价值。
Syntax>
The syntax is as follows -
const e = $( #loc ) expect(e).toHaveId( loc )
toHaveText
它检查某一要素是否具有特定案文。
Syntax>
The syntax is as follows -
const e = $( #loc ) expect(e).toHaveText( Learning WebdriverIO )
toHaveTextContaining
它检查某一要素是否包含特定案文。
Syntax>
The syntax is as follows -
const e = $( #loc ) expect(e).toHaveTextContaining( Learning WebdriverIO )
toBeDisplayedInViewpoint
它检查一个要素是否属于观点。
Syntax>
The syntax is as follows -
const e = $( #loc ) expect(e).toBeDisplayedInViewpoint()
Assertions appped to mock objects
申述如下:
toBeRequested
它检查的是是否打了一辆ck车。
Syntax>
The syntax is as follows -
const m = browser.mock( **/api/pst* ) expect(m).toBeRequested()
toBeRequestedTimes
它检查的是,一辆ck车是否需要一定次数的时间。
Syntax>
The syntax is as follows -
const m = browser.mock( **/api/pst* ) expect(m).toBeRequestedTimes(2)
首先,遵循题为“快车道”的一章第1至5段步骤。 IO:
Step 5——建立光谱档案。 关于如何安装这些装置的细节见题为“Mocha装置”的章节。
// test suite name describe( Tutorialspoint apppcation , function(){ //test case it( Assertion with expect , function(){ // launch url browser.url( https://www.tutorialspoint.com/about/about_careers.htm ) //identify element with pnk text then cpck $("=Terms of Use").cpck() browser.pause(1000) //verify page title with assertion expect(browser).toHaveTitleContaining( Terms of Use - Tuter ) }); });
档案——由指挥部存档。
npx wdio run wdio.conf.js
在题为“Wdio.conf.js案”的章节和题为“编造档案”的章节中详细讨论了如何建立汇编档案的细节。
以下屏幕将登在你的电脑上:
在指挥成功执行后,我们发现结果失败了1次。 由于预期:是“使用条件——地图和所收产品:产出是使用条件——地图。
此外,网络用户组织希望发言强调了案文中预期内容的部分:收到的案文不匹配。
Advertisements