Skip to content

Commit 44b44a9

Browse files
committed
fix e2e
1 parent 47fe2fb commit 44b44a9

File tree

4 files changed

+30
-13
lines changed

4 files changed

+30
-13
lines changed

apps/remix-ide-e2e/src/commands/assistantAddContext.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,34 @@ function selectCtx(browser: NightwatchBrowser, ctx: string, done: VoidFunction)
1717
browser
1818
.waitForElementVisible('*[data-id="remix-ai-assistant"]')
1919
.waitForElementVisible('*[data-id="composer-ai-add-context"]')
20-
.click('*[data-id="composer-ai-add-context"]')
21-
.waitForElementVisible('*[data-id="currentFile-context-option"]')
20+
.click({
21+
locateStrategy: 'xpath',
22+
selector: '//*[@data-id="composer-ai-add-context"]'
23+
})
24+
.click({
25+
locateStrategy: 'xpath',
26+
selector: '//*[@data-id="currentFile-context-option"]'
27+
})
28+
.pause()
2229
.perform(async ()=> {
2330
switch (ctx) {
2431
case 'currentFile':
25-
browser.click('*[data-id="currentFile-context-option"]');
32+
browser.click({
33+
locateStrategy: 'xpath',
34+
selector: '//*[@data-id="currentFile-context-option"]'
35+
});
2636
break;
2737
case 'workspace':
28-
browser.click('*[data-id="workspace-context-option"]');
38+
browser.click({
39+
locateStrategy: 'xpath',
40+
selector: '//*[@data-id="workspace-context-option"]'
41+
});
2942
break;
3043
case 'openedFiles':
31-
browser.click('*[data-id="allOpenedFiles-context-option"]');
44+
browser.click({
45+
locateStrategy: 'xpath',
46+
selector: '//*[@data-id="allOpenedFiles-context-option"]'
47+
});
3248
break;
3349
default:
3450
break;

apps/remix-ide-e2e/src/tests/ai_panel.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ module.exports = {
2424
// Conversation starter button with data id 'explain-editor' doesn't exist anymore
2525
'Should explain the contract #group1': function (browser: NightwatchBrowser) {
2626
browser
27-
.waitForElementVisible('*[data-id="remix-ai-assistant-suggestion-Explain-what-a-modifier-is"]')
28-
.click('*[data-id="remix-ai-assistant-suggestion-Explain-what-a-modifier-is"]')
27+
.clickLaunchIcon('remixaiassistant')
28+
.waitForElementVisible('*[data-id="remix-ai-assistant-starter-0"]')
29+
.click('*[data-id="remix-ai-assistant-starter-0"]')
2930
.waitForElementVisible('*[data-id="remix-ai-assistant"]')
3031
.waitForElementVisible({
3132
locateStrategy: 'xpath',

libs/remix-ui/remix-ai-assistant/src/components/chat.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ export const ChatHistoryComponent: React.FC<ChatHistoryComponentProps> = ({
3939
RemixAI provides you personalized guidance as you build. It can break down concepts,
4040
answer questions about blockchain technology and assist you with your smart contracts.
4141
</p>
42-
{DEFAULT_SUGGESTIONS.map(s => (
42+
{DEFAULT_SUGGESTIONS.map((s, index) => (
4343
<button
4444
key={s}
45-
data-id={`remix-ai-assistant-suggestion-${s.replace(/\s+/g, '-')}`}
45+
data-id={`remix-ai-assistant-starter-${index}`}
4646
className="btn btn-secondary mb-2 w-100 text-left"
4747
onClick={() => sendPrompt(s)}
4848
>

libs/remix-ui/remix-ai-assistant/src/components/prompt.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export const PromptArea: React.FC<PromptAreaProps> = ({
7878
setShowContextOptions(false)
7979
}}
8080
/>
81-
<label className="form-check-label custom-control-label" htmlFor="ctx-current">
81+
<label className="form-check-label custom-control-label" data-id="currentFile-context-option" htmlFor="ctx-current">
8282
Current file
8383
</label>
8484
</div>
@@ -94,7 +94,7 @@ export const PromptArea: React.FC<PromptAreaProps> = ({
9494
setShowContextOptions(false)
9595
}}
9696
/>
97-
<label className="form-check-label custom-control-label" htmlFor="ctx-opened">
97+
<label className="form-check-label custom-control-label" data-id="allOpenedFiles-context-option" htmlFor="ctx-opened">
9898
All opened files
9999
</label>
100100
</div>
@@ -110,7 +110,7 @@ export const PromptArea: React.FC<PromptAreaProps> = ({
110110
setShowContextOptions(false)
111111
}}
112112
/>
113-
<label className="form-check-label custom-control-label" htmlFor="ctx-workspace">
113+
<label className="form-check-label custom-control-label" data-id="workspace-context-option" htmlFor="ctx-workspace">
114114
Workspace
115115
</label>
116116
</div>
@@ -126,7 +126,7 @@ export const PromptArea: React.FC<PromptAreaProps> = ({
126126
data-id="composer-ai-add-context"
127127
className="btn btn-dark btn-sm text-secondary"
128128
>
129-
Add context&nbsp;
129+
Add context
130130
</button>
131131

132132
<button

0 commit comments

Comments
 (0)