@@ -8,6 +8,7 @@ import {RowTableAction} from '../summary/types';
88import {
99 AsyncReplicationTemplates ,
1010 NewSqlDropdownMenu ,
11+ TablesTemplates ,
1112 TemplateCategory ,
1213} from './models/NewSqlDropdownMenu' ;
1314import { QueryEditor , QueryTabs } from './models/QueryEditor' ;
@@ -26,6 +27,60 @@ test.describe('Query Templates', () => {
2627 await tenantPage . goto ( pageQueryParams ) ;
2728 } ) ;
2829
30+ test ( 'Update table template should not run successfully' , async ( { page} ) => {
31+ const newSqlDropdown = new NewSqlDropdownMenu ( page ) ;
32+ const queryEditor = new QueryEditor ( page ) ;
33+
34+ // Open dropdown and select Update table template
35+ await newSqlDropdown . clickNewSqlButton ( ) ;
36+ await newSqlDropdown . hoverCategory ( TemplateCategory . Tables ) ;
37+ await newSqlDropdown . selectTemplate ( TablesTemplates . UpdateTable ) ;
38+
39+ // Try to run the query
40+ await queryEditor . clickRunButton ( ) ;
41+
42+ // Verify that execution fails
43+ try {
44+ await queryEditor . waitForStatus ( 'Failed' ) ;
45+ // If we reach here, the test passed because execution failed as expected
46+ } catch ( error ) {
47+ throw new Error ( 'Update table template should not have executed successfully' ) ;
48+ }
49+ } ) ;
50+
51+ test ( 'Create row table template should handle both success and failure cases' , async ( {
52+ page,
53+ } ) => {
54+ const newSqlDropdown = new NewSqlDropdownMenu ( page ) ;
55+ const queryEditor = new QueryEditor ( page ) ;
56+
57+ // Open dropdown and select Create row table template
58+ await newSqlDropdown . clickNewSqlButton ( ) ;
59+ await newSqlDropdown . hoverCategory ( TemplateCategory . Tables ) ;
60+ await newSqlDropdown . selectTemplate ( TablesTemplates . CreateRowTable ) ;
61+
62+ // Try to run the query
63+ await queryEditor . clickRunButton ( ) ;
64+
65+ try {
66+ // Wait for either Completed or Failed status
67+ const status = await queryEditor . getExecutionStatus ( ) ;
68+
69+ if ( status === 'Failed' ) {
70+ // If failed, verify it's the expected "path exists" error
71+ const errorMessage = await queryEditor . getErrorMessage ( ) ;
72+ expect ( errorMessage ) . toContain ( 'path exist, request accepts it' ) ;
73+ } else {
74+ // If not failed, verify it completed successfully
75+ expect ( status ) . toBe ( 'Completed' ) ;
76+ }
77+ } catch ( error ) {
78+ throw new Error (
79+ 'Query execution neither completed successfully nor failed with expected error' ,
80+ ) ;
81+ }
82+ } ) ;
83+
2984 test ( 'Unsaved changes modal appears when switching between templates' , async ( { page} ) => {
3085 const objectSummary = new ObjectSummary ( page ) ;
3186 const unsavedChangesModal = new UnsavedChangesModal ( page ) ;
0 commit comments