1- beforeAll ( async ( ) => {
2- await page . goto ( 'http://localhost:6969/context-page' )
3- } )
4-
51describe ( 'ContextPage' , ( ) => {
2+ beforeAll ( async ( ) => {
3+ await page . goto ( 'http://localhost:6969/context-page' )
4+ } )
5+
66 test ( 'is part of the client context' , async ( ) => {
77 const element = await page . $ ( '[data-page]' )
88 expect ( element ) . toBeTruthy ( )
@@ -73,17 +73,42 @@ describe('ContextPage', () => {
7373 expect ( element ) . toBeTruthy ( )
7474 } )
7575
76- test ( 'a custom event is triggered when the title changes' , async ( ) => {
77- await page . click ( 'button' )
78- await page . waitForSelector ( '[data-event-triggered]' )
79- const element = await page . $ ( '[data-event-triggered]' )
80- expect ( element ) . toBeTruthy ( )
81- } )
82-
8376 test ( 'the page reacts to a server function status' , async ( ) => {
84- await page . click ( '[status="401" ]' )
77+ await page . click ( '[data-request- status]' )
8578 await page . waitForSelector ( '[data-page-status="401"]' )
8679 const element = await page . $ ( '[data-page-status="401"]' )
8780 expect ( element ) . toBeTruthy ( )
8881 } )
8982} )
83+
84+ describe ( 'ContextPage updated' , ( ) => {
85+ beforeAll ( async ( ) => {
86+ await page . waitForSelector ( '[data-application-hydrated]' )
87+ await page . goto ( 'http://localhost:6969/context-page' )
88+ await page . click ( '[data-update-head]' )
89+ } )
90+
91+ test ( 'updates meta og:title' , async ( ) => {
92+ await page . waitForSelector ( 'meta[property="og:title"][content="Nullstack Tests Updated"]' )
93+ const element = await page . $ ( 'meta[property="og:title"][content="Nullstack Tests Updated"]' )
94+ expect ( element ) . toBeTruthy ( )
95+ } )
96+
97+ test ( 'updates meta og:description' , async ( ) => {
98+ await page . waitForSelector ( 'meta[property="og:description"][content="Nullstack tests page that tests the context page updated"]' )
99+ const element = await page . $ ( 'meta[property="og:description"][content="Nullstack tests page that tests the context page updated"]' )
100+ expect ( element ) . toBeTruthy ( )
101+ } )
102+
103+ test ( 'updates meta description' , async ( ) => {
104+ await page . waitForSelector ( 'meta[name="description"][content="Nullstack tests page that tests the context page updated"]' )
105+ const element = await page . $ ( 'meta[name="description"][content="Nullstack tests page that tests the context page updated"]' )
106+ expect ( element ) . toBeTruthy ( )
107+ } )
108+
109+ test ( 'a custom event is triggered when the title changes' , async ( ) => {
110+ await page . waitForSelector ( '[data-event-triggered]' )
111+ const element = await page . $ ( '[data-event-triggered]' )
112+ expect ( element ) . toBeTruthy ( )
113+ } )
114+ } )
0 commit comments