File tree Expand file tree Collapse file tree 2 files changed +68
-0
lines changed
packages/amazonq/test/e2e_new/amazonq Expand file tree Collapse file tree 2 files changed +68
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*!
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { WebviewView , By } from 'vscode-extension-tester'
6
+
7
+ /**
8
+ * Clicks the tools to get to the MCP server overlay
9
+ * @param webviewView The WebviewView instance
10
+ * @returns Promise<boolean> True if tools button was found and clicked, false otherwise
11
+ */
12
+ export async function clickRulesButton ( webviewView : WebviewView ) : Promise < void > {
13
+ const buttons = await webviewView . findElements (
14
+ By . css ( '.mynah-button.mynah-button-secondary.fill-state-always.status-clear.mynah-ui-clickable-item' )
15
+ )
16
+ for ( const button of buttons ) {
17
+ const span = await button . findElement ( By . css ( 'span' ) )
18
+ const text = await span . getText ( )
19
+ if ( text === 'Rules' ) {
20
+ await button . click ( )
21
+ return
22
+ }
23
+ }
24
+ throw new Error ( 'Rules button not found' )
25
+ }
Original file line number Diff line number Diff line change
1
+ /*!
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import '../utils/setup'
6
+ import { WebviewView } from 'vscode-extension-tester'
7
+ import { closeAllTabs } from '../utils/cleanupUtils'
8
+ import { testContext } from '../utils/testContext'
9
+ import { clickRulesButton } from '../helpers/rulesHelper'
10
+ import { sleep } from '../utils/generalUtils'
11
+
12
+ describe ( 'Amazon Q Rules Functionality' , function ( ) {
13
+ // this timeout is the general timeout for the entire test suite
14
+ this . timeout ( 150000 )
15
+ let webviewView : WebviewView
16
+
17
+ before ( async function ( ) {
18
+ webviewView = testContext . webviewView
19
+ } )
20
+
21
+ after ( async function ( ) {
22
+ await closeAllTabs ( webviewView )
23
+ } )
24
+
25
+ afterEach ( async ( ) => { } )
26
+
27
+ it ( 'Rules Test' , async ( ) => {
28
+ /**
29
+ * TODO abstractions
30
+ *
31
+ * click the rules button DONE
32
+ * list all the possible rules (disappearing overlay again UGH)
33
+ * check and uncheck a rule
34
+ * click create new rule
35
+ * enter rule name
36
+ * click create rule
37
+ * click cancel rule
38
+ */
39
+ await clickRulesButton ( webviewView )
40
+
41
+ await sleep ( 5000 )
42
+ } )
43
+ } )
You can’t perform that action at this time.
0 commit comments