@@ -9,12 +9,13 @@ import {
99} from "@std/testing/bdd" ;
1010import {
1111 addCharm ,
12- assertAndSnapshot ,
1312 inspectCharm ,
1413 login ,
1514 sleep ,
15+ snapshot ,
1616 waitForSelectorWithText ,
1717} from "./utils.ts" ;
18+ import { assert } from "@std/assert" ;
1819
1920const TOOLSHED_API_URL = Deno . env . get ( "TOOLSHED_API_URL" ) ??
2021 "http://localhost:8000/" ;
@@ -48,34 +49,30 @@ describe("integration", () => {
4849 } ) ;
4950
5051 it ( "renders a new charm" , async ( ) => {
51- assertAndSnapshot ( page , "Page should be defined" ) ;
52- assertAndSnapshot ( testCharm , "Test charm should be defined" ) ;
52+ assert ( page , "Page should be defined" ) ;
53+ assert ( testCharm , "Test charm should be defined" ) ;
5354
5455 const anchor = await page ! . waitForSelector ( "nav a" ) ;
5556 const innerText = await anchor . innerText ( ) ;
56- assertAndSnapshot (
57+ assert (
5758 innerText === "common-knowledge" ,
5859 "Logged in and Common Knowledge title renders" ,
59- page ,
60- "logged_in_state" ,
6160 ) ;
6261
6362 await page ! . goto (
6463 `${ FRONTEND_URL } ${ testCharm ! . space } /${ testCharm ! . charmId } ` ,
6564 ) ;
66- console . log ( ` Waiting for charm to render` ) ;
65+ await snapshot ( page , " Waiting for charm to render" ) ;
6766
6867 await waitForSelectorWithText (
6968 page ! ,
7069 "a[aria-current='charm-title']" ,
7170 "Simple Value: 1" ,
7271 ) ;
73- console . log ( "Charm rendered." ) ;
74- await assertAndSnapshot (
72+ await snapshot ( page , "Charm rendered." ) ;
73+ assert (
7574 true ,
7675 "Charm rendered successfully" ,
77- page ,
78- "charm_rendered" ,
7976 ) ;
8077
8178 console . log ( "Clicking button" ) ;
@@ -88,41 +85,38 @@ describe("integration", () => {
8885 "div[aria-label='charm-content'] button" ,
8986 ) ;
9087 await button . click ( ) ;
91- await assertAndSnapshot ( true , "Button clicked" , page , "button_clicked ") ;
88+ assert ( true , "Button clicked" ) ;
9289
9390 console . log ( "Checking if title changed" ) ;
9491 await waitForSelectorWithText (
9592 page ! ,
9693 "a[aria-current='charm-title']" ,
9794 "Simple Value: 2" ,
9895 ) ;
99- console . log ( "Title changed" ) ;
100- await assertAndSnapshot (
96+ assert (
10197 true ,
10298 "Title changed successfully" ,
103- page ,
104- "title_changed" ,
10599 ) ;
106100
101+ await snapshot ( page , "Title changed" ) ;
102+
107103 console . log ( "Inspecting charm to verify updates propagated from browser." ) ;
108104 const charm = await inspectCharm (
109105 TOOLSHED_API_URL ,
110106 testCharm ! . space ,
111107 testCharm ! . charmId ,
112108 ) ;
113109 console . log ( "Charm:" , charm ) ;
114- assertAndSnapshot (
110+ assert (
115111 charm . includes ( "Simple Value: 2" ) ,
116112 "Charm updates propagated." ,
117- page ,
118- "updates_propagated" ,
119113 ) ;
120114 } ) ;
121115
122116 // Placeholder test ensuring browser can be used
123117 // across multiple tests (replace when we have more integration tests!)
124118 it ( "[placeholder]" , ( ) => {
125- assertAndSnapshot ( page , "Page should be defined" ) ;
126- assertAndSnapshot ( testCharm , "Test charm should be defined" ) ;
119+ assert ( page , "Page should be defined" ) ;
120+ assert ( testCharm , "Test charm should be defined" ) ;
127121 } ) ;
128122} ) ;
0 commit comments