@@ -20,77 +20,13 @@ import org.junit.jupiter.api.BeforeEach
2020import org.junit.jupiter.api.Test
2121import org.kodein.di.DI
2222import org.kodein.di.bindSingleton
23+ import software.aws.toolkits.jetbrains.uitests.chatTests.transformHappyPathScript
2324import java.io.File
2425import java.nio.file.Path
2526import java.nio.file.Paths
2627
2728class TransformChatTest {
2829
29- private val transformHappyPathScript = """
30- const puppeteer = require('puppeteer');
31- async function testNavigation() {
32- const browser = await puppeteer.connect({
33- browserURL: "http://localhost:9222"
34- })
35- try {
36- const pages = await browser.pages()
37- for (const page of pages) {
38- const contents = await page.evaluate(el => el.innerHTML, await page.$(':root'))
39- const element = await page.$('.mynah-chat-prompt-input')
40- await page.type('.mynah-chat-prompt-input', '/transform')
41- await page.keyboard.press('Enter')
42-
43- await page.waitForSelector('.mynah-chat-item-form-items-container', {
44- timeout: 5000
45- })
46- const formInputs = await page.$$('.mynah-form-input-wrapper')
47-
48- const moduleLabel = await formInputs[0].evaluate(
49- element => element.querySelector('.mynah-ui-form-item-mandatory-title').textContent
50- )
51- console.log('Module selection label:', moduleLabel)
52-
53- const versionLabel = await formInputs[1].evaluate(
54- element => element.querySelector('.mynah-ui-form-item-mandatory-title').textContent
55- )
56- console.log('Version selection label:', versionLabel)
57-
58- await page.evaluate(() => {
59- const button = document.querySelector('button[action-id="codetransform-input-confirm"]')
60- button.click()
61- })
62-
63- const skipTestsForm = await page.waitForSelector('button[action-id="codetransform-input-confirm-skip-tests"]', {
64- timeout: 5000
65- })
66- console.log('Skip tests form appeared:', skipTestsForm !== null)
67-
68- await page.evaluate(() => {
69- const button = document.querySelector('button[action-id="codetransform-input-confirm-skip-tests"]')
70- button.click()
71- })
72-
73- const oneOrMultipleDiffsForm = await page.waitForSelector('button[action-id="codetransform-input-confirm-one-or-multiple-diffs"]', {
74- timeout: 5000
75- })
76- console.log('One or multiple diffs form appeared:', oneOrMultipleDiffsForm !== null)
77-
78- await page.evaluate(() => {
79- const button = document.querySelector('button[action-id="codetransform-input-confirm-one-or-multiple-diffs"]')
80- button.click()
81- })
82-
83- const errorMessage = await page.waitForSelector('text/Sorry, I couldn\'t run the Maven clean install command', {
84- timeout: 5000
85- })
86- console.log('Error message:', await errorMessage.evaluate(el => el.textContent))
87- }
88- } finally {
89- await browser.close()
90- }
91- }
92- testNavigation().catch(console.error)""" .trimIndent()
93-
9430 init {
9531 di = DI {
9632 extend(di)
0 commit comments