@@ -19,6 +19,7 @@ CodeceptJS uniquely combines both styles. You can freely mix `I.*` actions with
1919``` js
2020// Import element functions
2121import { element , eachElement , expectElement } from ' codeceptjs/els'
22+ import { expect } from ' chai'
2223
2324Scenario (' checkout flow' , async ({ I }) => {
2425 // Use I.* for navigation and high-level actions
@@ -28,7 +29,7 @@ Scenario('checkout flow', async ({ I }) => {
2829 // Use element-based for detailed validation
2930 await element (' .cart-summary' , async cart => {
3031 const total = await cart .getAttribute (' data-total' )
31- assert greaterThan ( total, 0 )
32+ expect ( parseFloat ( total)). to . be . above ( 0 )
3233 })
3334
3435 // Continue with I.* actions
@@ -259,6 +260,7 @@ Execute a function on the first matching element.
259260
260261``` js
261262import { element } from ' codeceptjs/els'
263+ import { expect } from ' chai'
262264
263265// Basic usage
264266await element (' .submit-button' , async btn => {
@@ -271,7 +273,7 @@ await element(
271273 ' .submit-button' ,
272274 async btn => {
273275 const enabled = await btn .isEnabled ()
274- assert . ok (enabled, ' Button should be enabled ' )
276+ expect (enabled). to . be . true
275277 }
276278)
277279
@@ -374,6 +376,7 @@ await expectAllElements('a', async link => {
374376
375377``` js
376378import { element , eachElement } from ' codeceptjs/els'
379+ import { expect } from ' chai'
377380
378381Scenario (' validate form fields' , async ({ I }) => {
379382 I .amOnPage (' /register' )
@@ -391,7 +394,7 @@ Scenario('validate form fields', async ({ I }) => {
391394 await element (' #email' , async input => {
392395 await input .type (' test@example.com' )
393396 const value = await input .getValue ()
394- assert . include (value, ' @' )
397+ expect (value). to . include (' @' )
395398 })
396399
397400 I .click (' Submit' )
@@ -444,6 +447,7 @@ Scenario('wait for dynamic content', async ({ I }) => {
444447
445448``` js
446449import { element , eachElement } from ' codeceptjs/els'
450+ import { expect } from ' chai'
447451
448452Scenario (' calculate cart total' , async ({ I }) => {
449453 I .amOnPage (' /cart' )
@@ -461,7 +465,7 @@ Scenario('calculate cart total', async ({ I }) => {
461465 await element (' .cart-total' , async totalEl => {
462466 const displayedTotal = await totalEl .getText ()
463467 const displayedValue = parseFloat (displayedTotal .replace (' $' , ' ' ))
464- assert . equal (displayedValue, total, ' Cart total mismatch ' )
468+ expect (displayedValue). to . equal (total)
465469 })
466470})
467471```
@@ -470,6 +474,7 @@ Scenario('calculate cart total', async ({ I }) => {
470474
471475``` js
472476import { element , eachElement , expectAnyElement } from ' codeceptjs/els'
477+ import { expect } from ' chai'
473478
474479Scenario (' filter products by price' , async ({ I }) => {
475480 I .amOnPage (' /products' )
@@ -480,7 +485,7 @@ Scenario('filter products by price', async ({ I }) => {
480485 const priceEl = await product .$ (' .price' )
481486 const priceText = await priceEl .getText ()
482487 const price = parseFloat (priceText .replace (' $' , ' ' ))
483- assert lessThan (price, 100 , ' Product should be under $ 100' )
488+ expect (price). to . be . below ( 100 )
484489 })
485490
486491 // Check at least one product exists
0 commit comments