@@ -8,6 +8,7 @@ import {RowTableAction} from '../summary/types';
8
8
import {
9
9
AsyncReplicationTemplates ,
10
10
NewSqlDropdownMenu ,
11
+ TablesTemplates ,
11
12
TemplateCategory ,
12
13
} from './models/NewSqlDropdownMenu' ;
13
14
import { QueryEditor , QueryTabs } from './models/QueryEditor' ;
@@ -26,6 +27,61 @@ test.describe('Query Templates', () => {
26
27
await tenantPage . goto ( pageQueryParams ) ;
27
28
} ) ;
28
29
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
+ await page . waitForTimeout ( 500 ) ;
65
+
66
+ try {
67
+ // Wait for either Completed or Failed status
68
+ const status = await queryEditor . getExecutionStatus ( ) ;
69
+
70
+ if ( status === 'Failed' ) {
71
+ // If failed, verify it's the expected "path exists" error
72
+ const errorMessage = await queryEditor . getErrorMessage ( ) ;
73
+ expect ( errorMessage ) . toContain ( 'path exist, request accepts it' ) ;
74
+ } else {
75
+ // If not failed, verify it completed successfully
76
+ expect ( status ) . toBe ( 'Completed' ) ;
77
+ }
78
+ } catch ( error ) {
79
+ throw new Error (
80
+ 'Query execution neither completed successfully nor failed with expected error' ,
81
+ ) ;
82
+ }
83
+ } ) ;
84
+
29
85
test ( 'Unsaved changes modal appears when switching between templates' , async ( { page} ) => {
30
86
const objectSummary = new ObjectSummary ( page ) ;
31
87
const unsavedChangesModal = new UnsavedChangesModal ( page ) ;
0 commit comments