@@ -3,157 +3,42 @@ import { test, expect } from '../src/fixtures';
33test . describe . configure ( { mode : 'serial' } ) ;
44
55test . describe ( 'ServiceNow IDP - E2E Tests' , ( ) => {
6- const appName = 'foundry-sample-servicenow-idp' ;
7-
8- const expectedWorkflows = [
9- 'ServiceNow to IDP policy rules synchronizer' ,
10- 'Initialize or Reset checkpoint-LatestSysUpdatedOn' ,
11- ] ;
12-
13- const expectedFunctionName = 'servicenowToIdpPolicyRulesTransformer' ;
14- const expectedFunctionHandler = 'get_table_data_transform_rules' ;
15-
16- test ( 'should verify workflows exist in Fusion SOAR' , async ( { workflowsPage } ) => {
6+ test ( 'should verify ServiceNow API integration action is available in workflow builder' , async ( { workflowsPage } ) => {
177 // This app requires ServiceNow API credentials which we don't have in E2E tests
18- // The test verifies the workflows are deployed and visible in Fusion SOAR
19- // Workflows won't be functional without real ServiceNow CMDB access
8+ // We disable workflow provisioning on install to avoid credential validation
9+ // Instead, we verify the API integration action is available in the workflow builder
2010 await workflowsPage . navigateToWorkflows ( ) ;
11+ await workflowsPage . createNewWorkflow ( ) ;
2112
22- for ( const workflowName of expectedWorkflows ) {
23- await workflowsPage . verifyWorkflowExists ( workflowName ) ;
24- console . log ( `✓ Workflow found: ${ workflowName } ` ) ;
25- }
26- } ) ;
27-
28- test ( 'should verify function and handler exist' , async ( { page } ) => {
29- // Navigate to Functions page via menu
30- await page . goto ( '/foundry/home' ) ;
31- await page . waitForLoadState ( 'networkidle' ) ;
32-
33- // Open hamburger menu
34- const menuButton = page . getByRole ( 'button' , { name : 'Menu' } ) ;
35- await menuButton . click ( ) ;
36- await page . waitForLoadState ( 'networkidle' ) ;
37-
38- // Navigate to Functions
39- const fusionSoarButton = page . getByRole ( 'button' , { name : 'Fusion SOAR' } ) ;
40- await fusionSoarButton . click ( ) ;
41- await page . waitForTimeout ( 500 ) ;
42-
43- const functionsLink = page . getByRole ( 'link' , { name : 'Functions' } ) ;
44- await functionsLink . click ( ) ;
45- await page . waitForLoadState ( 'networkidle' ) ;
46-
47- // Verify Functions page loaded
48- await expect ( page . getByRole ( 'heading' , { name : / f u n c t i o n / i } ) ) . toBeVisible ( { timeout : 10000 } ) ;
49- console . log ( '✓ Functions page loaded' ) ;
50-
51- // Search for the function
52- const searchButton = page . getByRole ( 'button' , { name : / s e a r c h f u n c t i o n / i } ) ;
53- await searchButton . click ( ) ;
54-
55- const searchBox = page . getByRole ( 'searchbox' )
56- . or ( page . locator ( 'input[type="search"]' ) )
57- . or ( page . locator ( 'input[placeholder*="Search"]' ) ) ;
58-
59- await searchBox . fill ( expectedFunctionName ) ;
60- await page . keyboard . press ( 'Enter' ) ;
61- await page . waitForLoadState ( 'networkidle' ) ;
62-
63- // Verify function exists
64- const functionLink = page . getByRole ( 'link' , { name : new RegExp ( expectedFunctionName , 'i' ) } ) ;
65- await expect ( functionLink ) . toBeVisible ( { timeout : 5000 } ) ;
66- console . log ( `✓ Function found: ${ expectedFunctionName } ` ) ;
67-
68- // Open the function to see handlers
69- await functionLink . click ( ) ;
70- await page . waitForLoadState ( 'networkidle' ) ;
71-
72- // Verify handler exists in the function details
73- const handlerText = page . getByText ( new RegExp ( expectedFunctionHandler , 'i' ) ) ;
74- await expect ( handlerText ) . toBeVisible ( { timeout : 5000 } ) ;
75- console . log ( `✓ Function handler found: ${ expectedFunctionHandler } ` ) ;
76- } ) ;
77-
78- test ( 'should verify collections exist' , async ( { page } ) => {
79- // Navigate to Collections page via menu
80- await page . goto ( '/foundry/home' ) ;
81- await page . waitForLoadState ( 'networkidle' ) ;
82-
83- // Open hamburger menu
84- const menuButton = page . getByRole ( 'button' , { name : 'Menu' } ) ;
85- await menuButton . click ( ) ;
86- await page . waitForLoadState ( 'networkidle' ) ;
87-
88- // Navigate to Collections
89- const fusionSoarButton = page . getByRole ( 'button' , { name : 'Fusion SOAR' } ) ;
90- await fusionSoarButton . click ( ) ;
91- await page . waitForTimeout ( 500 ) ;
92-
93- const collectionsLink = page . getByRole ( 'link' , { name : 'Collections' } ) ;
94- await collectionsLink . click ( ) ;
95- await page . waitForLoadState ( 'networkidle' ) ;
96-
97- // Verify Collections page loaded
98- await expect ( page . getByRole ( 'heading' , { name : / c o l l e c t i o n / i } ) ) . toBeVisible ( { timeout : 10000 } ) ;
99- console . log ( '✓ Collections page loaded' ) ;
100-
101- // Search for the collection
102- const searchButton = page . getByRole ( 'button' , { name : / s e a r c h c o l l e c t i o n / i } ) ;
103- await searchButton . click ( ) ;
104-
105- const searchBox = page . getByRole ( 'searchbox' )
106- . or ( page . locator ( 'input[type="search"]' ) )
107- . or ( page . locator ( 'input[placeholder*="Search"]' ) ) ;
108-
109- await searchBox . fill ( 'servicenow_idp_app_state' ) ;
110- await page . keyboard . press ( 'Enter' ) ;
111- await page . waitForLoadState ( 'networkidle' ) ;
112-
113- // Verify collection exists
114- const collectionLink = page . getByRole ( 'link' , { name : / s e r v i c e n o w _ i d p _ a p p _ s t a t e / i } ) ;
115- await expect ( collectionLink ) . toBeVisible ( { timeout : 5000 } ) ;
116- console . log ( '✓ Collection found: servicenow_idp_app_state' ) ;
117- } ) ;
118-
119- test ( 'should verify API integration exists' , async ( { page } ) => {
120- // Navigate to API Integrations page via menu
121- await page . goto ( '/foundry/home' ) ;
122- await page . waitForLoadState ( 'networkidle' ) ;
13+ // Select "On demand" trigger
14+ const onDemandTrigger = workflowsPage . page . getByText ( 'On demand' ) . first ( ) ;
15+ await onDemandTrigger . click ( ) ;
12316
124- // Open hamburger menu
125- const menuButton = page . getByRole ( 'button' , { name : 'Menu' } ) ;
126- await menuButton . click ( ) ;
127- await page . waitForLoadState ( 'networkidle' ) ;
17+ const nextButton = workflowsPage . page . getByRole ( 'button' , { name : 'Next' } ) ;
18+ await nextButton . click ( ) ;
12819
129- // Navigate to API Integrations
130- const fusionSoarButton = page . getByRole ( 'button' , { name : 'Fusion SOAR' } ) ;
131- await fusionSoarButton . click ( ) ;
132- await page . waitForTimeout ( 500 ) ;
20+ await workflowsPage . page . waitForLoadState ( 'networkidle' ) ;
21+ await workflowsPage . page . getByText ( 'Add next' ) . waitFor ( { state : 'visible' , timeout : 10000 } ) ;
13322
134- const apiIntegrationsLink = page . getByRole ( 'link' , { name : / A P I i n t e g r a t i o n / i } ) ;
135- await apiIntegrationsLink . click ( ) ;
136- await page . waitForLoadState ( 'networkidle' ) ;
23+ // Click "Add action" button
24+ const addNextMenu = workflowsPage . page . getByTestId ( 'add-next-menu-container' ) ;
25+ const addActionButton = addNextMenu . getByTestId ( 'context-menu-seq-action-button' ) ;
26+ await addActionButton . click ( ) ;
13727
138- // Verify API Integrations page loaded
139- await expect ( page . getByRole ( 'heading' , { name : / A P I i n t e g r a t i o n / i } ) ) . toBeVisible ( { timeout : 10000 } ) ;
140- console . log ( '✓ API Integrations page loaded' ) ;
28+ await workflowsPage . page . waitForLoadState ( 'networkidle' ) ;
14129
142- // Search for the API integration
143- const searchButton = page . getByRole ( 'button' , { name : / s e a r c h . * i n t e g r a t i o n / i } ) ;
144- await searchButton . click ( ) ;
30+ // Search for the ServiceNow API integration action
31+ const searchBox = workflowsPage . page . getByRole ( 'searchbox' ) . or ( workflowsPage . page . getByPlaceholder ( / s e a r c h / i ) ) ;
32+ await searchBox . fill ( 'service now cmdb table api' ) ;
14533
146- const searchBox = page . getByRole ( 'searchbox' )
147- . or ( page . locator ( 'input[type="search"]' ) )
148- . or ( page . locator ( 'input[placeholder*="Search"]' ) ) ;
34+ await workflowsPage . page . getByText ( 'This may take a few moments' ) . waitFor ( { state : 'hidden' , timeout : 30000 } ) ;
35+ await workflowsPage . page . waitForLoadState ( 'networkidle' ) ;
14936
150- await searchBox . fill ( 'service now cmdb' ) ;
151- await page . keyboard . press ( 'Enter' ) ;
152- await page . waitForLoadState ( 'networkidle' ) ;
37+ // Verify the action is visible
38+ const actionElement = workflowsPage . page . getByText ( 'service now cmdb table api' , { exact : false } ) ;
39+ await expect ( actionElement ) . toBeVisible ( { timeout : 10000 } ) ;
40+ console . log ( '✓ API integration action available: service now cmdb table api' ) ;
15341
154- // Verify API integration exists
155- const apiIntegrationLink = page . getByRole ( 'link' , { name : / s e r v i c e n o w c m d b / i } ) ;
156- await expect ( apiIntegrationLink ) . toBeVisible ( { timeout : 5000 } ) ;
157- console . log ( '✓ API Integration found: service now cmdb' ) ;
42+ console . log ( 'ServiceNow API integration verified successfully' ) ;
15843 } ) ;
15944} ) ;
0 commit comments