Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,24 @@ jobs:
verbose: true
file: ./coverage/${{ matrix.package }}/lcov.info
token: ${{ secrets.CODECOV_TOKEN }}

e2e:
needs: lint-commits
name: test E2E
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
env:
NODE_OPTIONS: '--max-old-space-size=8192'
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- name: E2E Tests
uses: coactions/setup-xvfb@v1
with:
run: npm run test:ui
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"testE2E": "npm run testE2E -w packages/ --if-present",
"test:ui:prepare": "./node_modules/.bin/extest get-vscode -s ~/.vscode-test-resources -n && extest get-chromedriver -s ~/.vscode-test-resources -n",
"test:ui:install": "cd packages/amazonq && npm run package 2>&1 | grep -o 'VSIX Version: [^ ]*' | cut -d' ' -f3 | xargs -I{} bash -c 'cd ../../ && ./node_modules/.bin/extest install-vsix -f amazon-q-vscode-{}.vsix -e packages/amazonq/test/e2e_new/amazonq/resources -s ~/.vscode-test-resources'",
"test:ui:run": "npm run testCompile && ./node_modules/.bin/extest run-tests -s ~/.vscode-test-resources -e packages/amazonq/test/e2e_new/amazonq/resources packages/amazonq/dist/test/e2e_new/amazonq/tests/*.test.js 2>&1 | tee packages/amazonq/test/e2e_new/amazonq/logs/ui_e2e_testlog_$(date +%Y%m%d_%H%M%S).log",
"test:ui:run": "npm run testCompile && ./node_modules/.bin/extest run-tests -s ~/.vscode-test-resources -e packages/amazonq/test/e2e_new/amazonq/resources packages/amazonq/dist/test/e2e_new/amazonq/tests/*.test.js",
"test:ui": "npm run test:ui:prepare && npm run test:ui:install && npm run test:ui:run",
"testInteg": "npm run testInteg -w packages/ --if-present",
"package": "npm run package -w packages/toolkit -w packages/amazonq",
Expand Down
24 changes: 21 additions & 3 deletions packages/amazonq/test/e2e_new/amazonq/utils/authUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import { Workbench, By, WebviewView } from 'vscode-extension-tester'
import { findItemByText, sleep, waitForElements } from './generalUtils'
import { Workbench, By, WebviewView, ModalDialog } from 'vscode-extension-tester'
import { findItemByText, printElementHTML, sleep, waitForElements } from './generalUtils'
import { testContext } from './testContext'
import { until } from 'selenium-webdriver'

/* Completes the entire Amazon Q login flow

Expand Down Expand Up @@ -43,14 +44,31 @@ export async function signInToAmazonQ(): Promise<void> {
await UrlContinue.click()

console.log('Waiting for manual authentication...')
await webviewView.switchBack()
const driver = workbench.getDriver()
console.log('THIS WORKED 1')
const modalWnd = By.className('monaco-dialog-box')
console.log('THIS WORKED 2')
await driver.wait(until.elementLocated(modalWnd), 10_000)
console.log('THIS WORKED 3')
const dialog = new ModalDialog()
console.log('THIS WORKED 4')
await dialog.pushButton('Open')
console.log('THIS WORKED 5')
await sleep(12000)
console.log('Manual authentication should be done')
await webviewView.switchBack()

console.log('THIS WORKED 6')
const editorView = workbench.getEditorView()
console.log('THIS WORKED 7')
await editorView.closeAllEditors()
console.log('THIS WORKED 8')
webviewView = new WebviewView()
console.log('THIS WORKED 9')
await webviewView.switchToFrame()
console.log('THIS WORKED 10')
const body = webviewView.findElement(By.css('body'))
await printElementHTML(body)

testContext.workbench = workbench
testContext.webviewView = webviewView
Expand Down
2 changes: 2 additions & 0 deletions packages/amazonq/test/e2e_new/amazonq/utils/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ before(async function () {
console.log('You have 60 seconds to complete this step\n\n')
await signInToAmazonQ()
const webviewView = testContext.webviewView
console.log('THIS WORKED 13')
await closeAllTabs(webviewView)
console.log('THIS WORKED 14')
})
Loading