@@ -213,3 +213,87 @@ test("modal", async ({ page }) => {
213213 await modal . getByRole ( "button" , { label : "Close" } ) . first ( ) . click ( ) ;
214214 await expect ( modal ) . not . toBeVisible ( ) ;
215215} ) ;
216+
217+ test ( "table action buttons - edit_url and delete_url" , async ( { page } ) => {
218+ await page . goto ( `${ BASE } /documentation.sql?component=table` ) ;
219+ const tableSection = page . locator ( ".table-responsive" , {
220+ has : page . getByRole ( "cell" , { name : "PharmaCo" } ) ,
221+ } ) ;
222+
223+ const editButton = tableSection . getByTitle ( "Edit" ) . first ( ) ;
224+ await expect ( editButton ) . toBeVisible ( ) ;
225+ await expect ( editButton ) . toHaveAttribute ( "href" , / a c t i o n = e d i t & u p d a t e _ i d = \d + / ) ;
226+
227+ const deleteButton = tableSection . getByTitle ( "Delete" ) . first ( ) ;
228+ await expect ( deleteButton ) . toBeVisible ( ) ;
229+ await expect ( deleteButton ) . toHaveAttribute (
230+ "href" ,
231+ / a c t i o n = d e l e t e & d e l e t e _ i d = \d + / ,
232+ ) ;
233+ } ) ;
234+
235+ test ( "table action buttons - custom_actions" , async ( { page } ) => {
236+ await page . goto ( `${ BASE } /documentation.sql?component=table` ) ;
237+ const tableSection = page . locator ( ".table-responsive" , {
238+ has : page . getByRole ( "cell" , { name : "PharmaCo" } ) ,
239+ } ) ;
240+
241+ const historyButton = tableSection
242+ . getByTitle ( "View Standard History" )
243+ . first ( ) ;
244+ await expect ( historyButton ) . toBeVisible ( ) ;
245+ await expect ( historyButton ) . toHaveAttribute (
246+ "href" ,
247+ / a c t i o n = h i s t o r y & s t a n d a r d _ i d = \d + / ,
248+ ) ;
249+ } ) ;
250+
251+ test ( "table action buttons - _sqlpage_actions" , async ( { page } ) => {
252+ await page . goto ( `${ BASE } /documentation.sql?component=table` ) ;
253+ const tableSection = page . locator ( ".table-responsive" , {
254+ has : page . getByRole ( "cell" , { name : "PharmaCo" } ) ,
255+ } ) ;
256+
257+ const pdfButtons = tableSection . getByTitle ( "View Presentation" ) ;
258+ await expect ( pdfButtons . first ( ) ) . toBeVisible ( ) ;
259+ await expect ( pdfButtons ) . toHaveCount ( 3 ) ;
260+
261+ const firstPdfButton = pdfButtons . first ( ) ;
262+ await expect ( firstPdfButton ) . toHaveAttribute (
263+ "href" ,
264+ "https://sql-page.com/pgconf/2024-sqlpage-badass.pdf" ,
265+ ) ;
266+
267+ const setInUseButton = tableSection . getByTitle ( "Set In Use" ) ;
268+ await expect ( setInUseButton ) . toBeVisible ( ) ;
269+ await expect ( setInUseButton ) . toHaveAttribute (
270+ "href" ,
271+ / a c t i o n = s e t _ i n _ u s e & s t a n d a r d _ i d = 3 2 / ,
272+ ) ;
273+
274+ const retireButton = tableSection . getByTitle ( "Retire Standard" ) ;
275+ await expect ( retireButton ) . toBeVisible ( ) ;
276+ await expect ( retireButton ) . toHaveAttribute (
277+ "href" ,
278+ / a c t i o n = r e t i r e & s t a n d a r d _ i d = 3 3 / ,
279+ ) ;
280+ } ) ;
281+
282+ test ( "table action buttons - disabled action" , async ( { page } ) => {
283+ await page . goto ( `${ BASE } /documentation.sql?component=table` ) ;
284+ const tableSection = page . locator ( ".table-responsive" , {
285+ has : page . getByRole ( "cell" , { name : "PharmaCo" } ) ,
286+ } ) ;
287+
288+ const viewPresentationButtons = tableSection . getByTitle ( "View Presentation" ) ;
289+ await expect ( viewPresentationButtons ) . toHaveCount ( 3 ) ;
290+
291+ const actionColumnButtons = tableSection . locator (
292+ "td._col_Action a[data-action='Action']" ,
293+ ) ;
294+ await expect ( actionColumnButtons ) . toHaveCount ( 3 ) ;
295+
296+ const emptyActionButton = actionColumnButtons . last ( ) ;
297+ await expect ( emptyActionButton ) . toHaveAttribute ( "href" , "null" ) ;
298+ await expect ( emptyActionButton ) . toHaveAttribute ( "title" , "Action" ) ;
299+ } ) ;
0 commit comments