diff --git a/.vscode/launch.json b/.vscode/launch.json index 2506014c71..669e566005 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,14 +1,41 @@ { "version": "0.2.0", "configurations": [ + { + "type": "chrome", + "request": "attach", + "name": "Attach to Chrome", + "port": 9222, + "webRoot": "${workspaceFolder}" + }, + { + "name": "LSP Server", + "type": "node", + "request": "launch", + "args": [ + "${workspaceFolder}/Composer/packages/tools/language-servers/language-generation/demo/src/server.ts" + ], + "runtimeArgs": [ + "--nolazy", + "-r", + "${workspaceFolder}/Composer/node_modules/ts-node/register" + ], + "sourceMaps": true, + "cwd": "${workspaceFolder}/Composer/packages/tools/language-servers/language-generation/demo/src", + "protocol": "inspector", + }, { "type": "node", "request": "launch", "name": "Server: Launch", - "args": ["./build/server.js"], + "args": [ + "./build/server.js" + ], "preLaunchTask": "server: build", "restart": true, - "outFiles": ["./build/*"], + "outFiles": [ + "./build/*" + ], "envFile": "${workspaceFolder}/Composer/packages/server/.env", "outputCapture": "std", "cwd": "${workspaceFolder}/Composer/packages/server" @@ -20,8 +47,14 @@ "name": "Jest Debug", "program": "${workspaceRoot}/Composer/node_modules/jest/bin/jest", "stopOnEntry": false, - "args": ["--runInBand", "--env=jsdom", "--config=jest.config.js"], - "runtimeArgs": ["--inspect-brk"], + "args": [ + "--runInBand", + "--env=jsdom", + "--config=jest.config.js" + ], + "runtimeArgs": [ + "--inspect-brk" + ], "cwd": "${workspaceRoot}/Composer/packages/server", "sourceMaps": true, "console": "integratedTerminal" diff --git a/Composer/cypress/integration/Breadcrumb.spec.ts b/Composer/cypress/integration/Breadcrumb.spec.ts index 8c647ee409..63adecd879 100644 --- a/Composer/cypress/integration/Breadcrumb.spec.ts +++ b/Composer/cypress/integration/Breadcrumb.spec.ts @@ -13,7 +13,8 @@ context('breadcrumb', () => { }); function hasBreadcrumbItems(cy: Cypress.cy, items: (string | RegExp)[]) { - cy.findByTestId('Breadcrumb') + cy.get('[data-testid="Breadcrumb"]') + .last() .get('li') .should($li => { items.forEach((item, idx) => { @@ -37,21 +38,21 @@ context('breadcrumb', () => { cy.findByText('__TestTodoSample.Main').click(); }); - hasBreadcrumbItems(cy, ['__TestTodoSample']); + hasBreadcrumbItems(cy, ['__TestTodoSample.Main']); }); it('can show event name in breadcrumb', () => { cy.findByTestId('ProjectTree').within(() => { cy.findByText('AddToDo').click(); - cy.findByText('Dialog started (BeginDialog)').click(); + cy.findByText('Dialog started').click(); }); - hasBreadcrumbItems(cy, ['AddToDo', 'Dialog started (BeginDialog)']); + hasBreadcrumbItems(cy, ['AddToDo', 'Dialog started']); }); it('can show action name in breadcrumb', () => { cy.findByTestId('ProjectTree').within(() => { - cy.findByText('Greeting (ConversationUpdate)').click(); + cy.findByText('Greeting').click(); }); // Click on an action @@ -61,6 +62,6 @@ context('breadcrumb', () => { }); }); - hasBreadcrumbItems(cy, ['__TestTodoSample.Main', 'Greeting (ConversationUpdate)', 'Send a response']); + hasBreadcrumbItems(cy, ['__TestTodoSample.Main', 'Greeting', 'Send a response']); }); }); diff --git a/Composer/cypress/integration/CreateNewBot.spec.ts b/Composer/cypress/integration/CreateNewBot.spec.ts index a02d28cc9a..4841f3cde7 100644 --- a/Composer/cypress/integration/CreateNewBot.spec.ts +++ b/Composer/cypress/integration/CreateNewBot.spec.ts @@ -23,9 +23,9 @@ context('Creating a new bot', () => { cy.findByTestId('Create from template').click(); cy.findByTestId('TodoSample').click(); cy.findByTestId('NextStepButton').click(); - cy.findByTestId('NewDialogName').type('{selectall}__TestNewProject{enter}'); + cy.findByTestId('NewDialogName').type('{selectall}__TestNewProject2{enter}'); cy.findByTestId('ProjectTree').within(() => { - cy.findByText('__TestNewProject.Main').should('exist'); + cy.findByText('__TestNewProject2.Main').should('exist'); cy.findByText('AddToDo').should('exist'); cy.findByText('ClearToDos').should('exist'); cy.findByText('DeleteToDo').should('exist'); diff --git a/Composer/cypress/integration/NotificationPage.spec.ts b/Composer/cypress/integration/NotificationPage.spec.ts index 7a3d9fe657..0f98c58149 100644 --- a/Composer/cypress/integration/NotificationPage.spec.ts +++ b/Composer/cypress/integration/NotificationPage.spec.ts @@ -5,6 +5,7 @@ context('Notification Page', () => { beforeEach(() => { cy.visit(Cypress.env('COMPOSER_URL')); cy.createBot('TodoSample'); + cy.visitPage('Notifications'); }); it('can show lg syntax error ', () => { diff --git a/Composer/cypress/integration/VisualDesigner.spec.ts b/Composer/cypress/integration/VisualDesigner.spec.ts index 7ecdabfaa2..eb6ee33041 100644 --- a/Composer/cypress/integration/VisualDesigner.spec.ts +++ b/Composer/cypress/integration/VisualDesigner.spec.ts @@ -2,12 +2,9 @@ // Licensed under the MIT License. context('Visual Designer', () => { - before(() => { + beforeEach(() => { cy.visit(Cypress.env('COMPOSER_URL')); cy.createBot('TodoSample'); - }); - - beforeEach(() => { // Return to Main.dialog cy.findByTestId('ProjectTree').within(() => { cy.findByText('__TestTodoSample.Main').click(); @@ -16,11 +13,11 @@ context('Visual Designer', () => { it('can find Visual Designer default trigger in container', () => { cy.findByTestId('ProjectTree').within(() => { - cy.findByText('Greeting (ConversationUpdate)').click(); + cy.findByText('Greeting').click(); }); cy.withinEditor('VisualEditor', () => { - cy.findByText('Trigger').should('exist'); + cy.findByText('ConversationUpdate activity').should('exist'); }); }); }); diff --git a/Composer/cypress/support/commands.ts b/Composer/cypress/support/commands.ts index de5939e41f..60b0e246d9 100644 --- a/Composer/cypress/support/commands.ts +++ b/Composer/cypress/support/commands.ts @@ -23,4 +23,10 @@ Cypress.Commands.add('withinEditor', (editorName, cb) => { Cypress.Commands.add('visitPage', page => { cy.findByTestId(`LeftNav-CommandBarButton${page}`).click(); + cy.wait(3000); +}); + +Cypress.on('uncaught:exception', (err, runnable) => { + console.log('uncaught exception', err); + return false; }); diff --git a/Composer/jest.config.js b/Composer/jest.config.js index 32b10b6b50..da2165fe69 100644 --- a/Composer/jest.config.js +++ b/Composer/jest.config.js @@ -41,5 +41,6 @@ module.exports = { '/packages/extensions/visual-designer', '/packages/lib/code-editor', '/packages/lib/shared', + '/packages/tools/language-servers/language-generation', ], }; diff --git a/Composer/package.json b/Composer/package.json index 742387b7b8..52a879a14e 100644 --- a/Composer/package.json +++ b/Composer/package.json @@ -13,16 +13,20 @@ "packages/extensions", "packages/extensions/*", "packages/lib", - "packages/lib/*" + "packages/lib/*", + "packages/tools", + "packages/tools/language-servers", + "packages/tools/language-servers/*" ], "scripts": { "build": "node scripts/begin.js && yarn build:prod", - "build:prod": "yarn build:lib && yarn build:extensions && yarn build:server && yarn build:client", - "build:dev": "yarn build:lib && yarn build:extensions", + "build:prod": "yarn build:dev && yarn build:server && yarn build:client", + "build:dev": "yarn build:tools && yarn build:lib && yarn build:extensions", "build:lib": "yarn workspace @bfc/libs build:all", "build:extensions": "yarn workspace @bfc/extensions build:all", "build:server": "yarn workspace @bfc/server build", "build:client": "yarn workspace @bfc/client build", + "build:tools": "yarn workspace @bfc/tools build:all", "start": "cross-env NODE_ENV=production PORT=3000 yarn start:server", "startall": "concurrently --kill-others-on-fail \"npm:runtime\" \"npm:start\"", "start:dev": "concurrently \"npm:start:client\" \"npm:start:server:dev\"", @@ -34,7 +38,7 @@ "test:coverage": "yarn test --coverage --no-cache --reporters=default", "test:integration": "cypress run --browser chrome", "test:integration:open": "cypress open", - "test:integration:clean": "rimraf TestBots/*", + "test:integration:clean": "rimraf ../MyBots/__Test*", "lint": "wsrun --exclude-missing --collect-logs --report lint", "lint:fix": "wsrun --exclude-missing --collect-logs --report lint:fix", "typecheck": "concurrently --kill-others-on-fail \"npm:typecheck:*\"", diff --git a/Composer/packages/client/config/webpack.config.js b/Composer/packages/client/config/webpack.config.js index 0a98e430f2..f56da750fe 100644 --- a/Composer/packages/client/config/webpack.config.js +++ b/Composer/packages/client/config/webpack.config.js @@ -228,6 +228,10 @@ module.exports = function(webpackEnv) { // `web` extension prefixes have been added for better support // for React Native Web. extensions: paths.moduleFileExtensions.map(ext => `.${ext}`), + alias: { + // Support lsp code editor + vscode: require.resolve('monaco-languageclient/lib/vscode-compatibility'), + }, plugins: [ // Adds support for installing with Plug'n'Play, leading to faster installs and adding // guards against forgotten dependencies and such. @@ -402,7 +406,7 @@ module.exports = function(webpackEnv) { plugins: [ new MonacoWebpackPlugin({ // available options are documented at https://github.com/Microsoft/monaco-editor-webpack-plugin#options - languages: ['markdown', 'botbuilderlg', 'json'], + languages: ['markdown', 'json'], }), // Generates an `index.html` file with the