From 4f975ea9873ba5df4c6651e44b62199d74cfe5d8 Mon Sep 17 00:00:00 2001 From: zhixzhan Date: Fri, 16 Apr 2021 15:52:19 +0800 Subject: [PATCH 1/6] migrate e2e test with create bot v2 --- .../cypress/integration/Breadcrumb.spec.ts | 34 ++++------------- Composer/cypress/integration/LGPage.spec.ts | 9 +++-- Composer/cypress/integration/LUPage.spec.ts | 11 +++--- Composer/cypress/support/commands.d.ts | 6 +++ Composer/cypress/support/commands.ts | 37 +++++++++++++++++++ 5 files changed, 61 insertions(+), 36 deletions(-) diff --git a/Composer/cypress/integration/Breadcrumb.spec.ts b/Composer/cypress/integration/Breadcrumb.spec.ts index 9f7d373374..f5319731ad 100644 --- a/Composer/cypress/integration/Breadcrumb.spec.ts +++ b/Composer/cypress/integration/Breadcrumb.spec.ts @@ -3,12 +3,8 @@ context('breadcrumb', () => { beforeEach(() => { - cy.visit('/home'); - cy.createBot('TodoSample'); - - // Return to Main.dialog - cy.findByTestId('ProjectTree').within(() => { - cy.findAllByText('__TestTodoSample').last().click(); + cy.createBotV2('EmptySample', ({ id }) => { + cy.visit(`/bot/${id}`); }); }); @@ -23,30 +19,16 @@ context('breadcrumb', () => { }); } - it('can show dialog name in breadcrumb', () => { + it('can show dialog, trigger, action in breadcrumb', () => { // Should path = main dialog at first render - hasBreadcrumbItems(cy, ['__TestTodoSample']); + hasBreadcrumbItems(cy, ['__TestEmptySample']); - // Return to Main.dialog + // Click on an trigger cy.findByTestId('ProjectTree').within(() => { - cy.findAllByText('__TestTodoSample').last().click(); + cy.findAllByText('Greeting').last().click(); }); - hasBreadcrumbItems(cy, ['__TestTodoSample']); - }); - - it('can show dialog and trigger name in breadcrumb', () => { - cy.findByTestId('ProjectTree').within(() => { - cy.findByTestId('addtodo_Dialog started').click(); - }); - - hasBreadcrumbItems(cy, ['addtodo', 'Dialog started']); - }); - - it('can show action name in breadcrumb', () => { - cy.findByTestId('ProjectTree').within(() => { - cy.findByText('Greeting').click(); - }); + hasBreadcrumbItems(cy, ['__TestEmptySample', 'Greeting']); // Click on an action cy.withinEditor('VisualEditor', () => { @@ -55,6 +37,6 @@ context('breadcrumb', () => { }); }); - hasBreadcrumbItems(cy, ['__TestTodoSample', 'Greeting', 'Send a response']); + hasBreadcrumbItems(cy, ['__TestEmptySample', 'Greeting', 'Send a response']); }); }); diff --git a/Composer/cypress/integration/LGPage.spec.ts b/Composer/cypress/integration/LGPage.spec.ts index 64007d246a..41a79b63de 100644 --- a/Composer/cypress/integration/LGPage.spec.ts +++ b/Composer/cypress/integration/LGPage.spec.ts @@ -3,14 +3,15 @@ context('LG Page', () => { beforeEach(() => { - cy.visit('/home'); - cy.createBot('TodoSample'); + cy.createBotV2('EmptySample', ({ id }) => { + cy.visit(`/bot/${id}`); + }); }); it('can open language generation page', () => { cy.findByTestId('LeftNav-CommandBarButtonBot responses').click(); // left nav tree - cy.contains('TodoSample'); + cy.contains('__TestEmptySample'); cy.findByTestId('showcode').as('switchButton'); @@ -28,7 +29,7 @@ context('LG Page', () => { // nav to Main dialog cy.findByTestId('ProjectTree').within(() => { - cy.findAllByText('__TestTodoSample').last().click(); + cy.findAllByText('__TestEmptySample').last().click(); }); }); }); diff --git a/Composer/cypress/integration/LUPage.spec.ts b/Composer/cypress/integration/LUPage.spec.ts index eaada59c81..fe67002862 100644 --- a/Composer/cypress/integration/LUPage.spec.ts +++ b/Composer/cypress/integration/LUPage.spec.ts @@ -3,16 +3,15 @@ context('LU Page', () => { beforeEach(() => { - cy.visit('/home'); - cy.createBot('ToDoBotWithLuisSample'); + cy.createBotV2('EmptySample', ({ id }) => { + cy.visit(`/bot/${id}`); + }); }); it('can open language understanding page', () => { cy.findByTestId('LeftNav-CommandBarButtonUser input').click(); // left nav tree - cy.contains('__TestToDoBotWithLuisSample'); - - cy.findByTestId('showcode').should('not.exist'); + cy.contains('__TestEmptySample'); // by default it goes to table view cy.findByTestId('LUPage').findByTestId('table-view').should('exist'); @@ -22,7 +21,7 @@ context('LU Page', () => { // nav to ToDoBotWithLuisSample.main dialog cy.findByTestId('ProjectTree').within(() => { - cy.findAllByText('__TestToDoBotWithLuisSample').last().click('left'); + cy.findAllByText('__TestEmptySample').last().click(); }); cy.findByTestId('showcode').as('switchButton'); // goto edit-mode diff --git a/Composer/cypress/support/commands.d.ts b/Composer/cypress/support/commands.d.ts index 114eb84bc4..4271bdcec7 100644 --- a/Composer/cypress/support/commands.d.ts +++ b/Composer/cypress/support/commands.d.ts @@ -13,6 +13,12 @@ declare namespace Cypress { */ createBot(botId: string, botName?: string): void; + /** + * Creates a bot based on empty bot. + * @example cy.createBot('EmptySample', ()=> {}) + */ + createBotV2(botName: string, createdCallback: (bot: any) => void): void; + /** * Visits a page from the left nav bar using the page's testid * @example visitPage('Bot Responses'); diff --git a/Composer/cypress/support/commands.ts b/Composer/cypress/support/commands.ts index 4471ed8bd3..fcdaeab722 100644 --- a/Composer/cypress/support/commands.ts +++ b/Composer/cypress/support/commands.ts @@ -19,6 +19,43 @@ Cypress.Commands.add('createBot', (botId: string, botName?: string) => { }); }); +Cypress.Commands.add('createBotV2', (botName: string, callback: (bot: any) => void) => { + const params = { + description: '', + location: '', + name: `__Test${botName}`, + runtimeLanguage: 'dotnet', + runtimeType: 'webapp', + schemaUrl: '', + storageId: 'default', + templateId: '@microsoft/generator-bot-empty', + templateVersion: '1.0.0-rc3', + }; + + const pollingRequestBotStatus = (jobId: string, callback: (result: any) => void) => { + cy.wait(2000); + try { + cy.request('get', `/api/status/${jobId}`).then((res) => { + const { httpStatusCode, id, result } = res.body; + if (httpStatusCode !== 200) { + pollingRequestBotStatus(id, callback); + } else { + callback(result); + } + }); + } catch (error) { + pollingRequestBotStatus(jobId, callback); + } + }; + + cy.request('post', '/api/v2/projects', params).then((res) => { + const { jobId } = res.body; + // install package can take a long time. + cy.wait(20000); + pollingRequestBotStatus(jobId, (result) => callback(result)); + }); +}); + Cypress.Commands.add('withinEditor', (editorName, cb) => { cy.findByTestId(editorName).within(cb); }); From 8c0e711dd81556d08e5c9175171ef53a803ae842 Mon Sep 17 00:00:00 2001 From: zhixzhan Date: Mon, 19 Apr 2021 16:53:46 +0800 Subject: [PATCH 2/6] cache created bot from template --- .../cypress/integration/Breadcrumb.spec.ts | 8 +++--- Composer/cypress/integration/LGPage.spec.ts | 2 +- Composer/cypress/integration/LUPage.spec.ts | 2 +- Composer/cypress/support/commands.d.ts | 12 +++++++++ Composer/cypress/support/commands.ts | 26 ++++++++++++++++++- Composer/cypress/support/index.ts | 8 +++++- Composer/package.json | 1 + Composer/scripts/clean-e2e.js | 4 ++- 8 files changed, 54 insertions(+), 9 deletions(-) diff --git a/Composer/cypress/integration/Breadcrumb.spec.ts b/Composer/cypress/integration/Breadcrumb.spec.ts index f5319731ad..eda8797212 100644 --- a/Composer/cypress/integration/Breadcrumb.spec.ts +++ b/Composer/cypress/integration/Breadcrumb.spec.ts @@ -3,7 +3,7 @@ context('breadcrumb', () => { beforeEach(() => { - cy.createBotV2('EmptySample', ({ id }) => { + cy.createTestBot('EmptySample', ({ id }) => { cy.visit(`/bot/${id}`); }); }); @@ -21,14 +21,14 @@ context('breadcrumb', () => { it('can show dialog, trigger, action in breadcrumb', () => { // Should path = main dialog at first render - hasBreadcrumbItems(cy, ['__TestEmptySample']); + hasBreadcrumbItems(cy, ['TestBot_EmptySample']); // Click on an trigger cy.findByTestId('ProjectTree').within(() => { cy.findAllByText('Greeting').last().click(); }); - hasBreadcrumbItems(cy, ['__TestEmptySample', 'Greeting']); + hasBreadcrumbItems(cy, ['TestBot_EmptySample', 'Greeting']); // Click on an action cy.withinEditor('VisualEditor', () => { @@ -37,6 +37,6 @@ context('breadcrumb', () => { }); }); - hasBreadcrumbItems(cy, ['__TestEmptySample', 'Greeting', 'Send a response']); + hasBreadcrumbItems(cy, ['TestBot_EmptySample', 'Greeting', 'Send a response']); }); }); diff --git a/Composer/cypress/integration/LGPage.spec.ts b/Composer/cypress/integration/LGPage.spec.ts index 41a79b63de..3477135a35 100644 --- a/Composer/cypress/integration/LGPage.spec.ts +++ b/Composer/cypress/integration/LGPage.spec.ts @@ -3,7 +3,7 @@ context('LG Page', () => { beforeEach(() => { - cy.createBotV2('EmptySample', ({ id }) => { + cy.createTestBot('EmptySample', ({ id }) => { cy.visit(`/bot/${id}`); }); }); diff --git a/Composer/cypress/integration/LUPage.spec.ts b/Composer/cypress/integration/LUPage.spec.ts index fe67002862..5ea178132d 100644 --- a/Composer/cypress/integration/LUPage.spec.ts +++ b/Composer/cypress/integration/LUPage.spec.ts @@ -3,7 +3,7 @@ context('LU Page', () => { beforeEach(() => { - cy.createBotV2('EmptySample', ({ id }) => { + cy.createTestBot('EmptySample', ({ id }) => { cy.visit(`/bot/${id}`); }); }); diff --git a/Composer/cypress/support/commands.d.ts b/Composer/cypress/support/commands.d.ts index 4271bdcec7..ba60f9acf0 100644 --- a/Composer/cypress/support/commands.d.ts +++ b/Composer/cypress/support/commands.d.ts @@ -19,6 +19,18 @@ declare namespace Cypress { */ createBotV2(botName: string, createdCallback: (bot: any) => void): void; + /** + * Creates a bot based on empty bot. + * @example cy.createTemplateBot('EmptySample', ()=> {}) + */ + createTemplateBot(botName: string, createdCallback: (bot: any) => void): void; + + /** + * Creates a bot from above created template bot. + * @example cy.createTestBot('EmptySample', ()=> {}) + */ + createTestBot(botName: string, createdCallback: (bot: any) => void): void; + /** * Visits a page from the left nav bar using the page's testid * @example visitPage('Bot Responses'); diff --git a/Composer/cypress/support/commands.ts b/Composer/cypress/support/commands.ts index fcdaeab722..74614d3ccc 100644 --- a/Composer/cypress/support/commands.ts +++ b/Composer/cypress/support/commands.ts @@ -3,6 +3,8 @@ import '@testing-library/cypress/add-commands'; +let TemplateBotProjectId = ''; + Cypress.Commands.add('createBot', (botId: string, botName?: string) => { const name = `__Test${botName || botId}`; @@ -23,7 +25,7 @@ Cypress.Commands.add('createBotV2', (botName: string, callback: (bot: any) => vo const params = { description: '', location: '', - name: `__Test${botName}`, + name: botName, runtimeLanguage: 'dotnet', runtimeType: 'webapp', schemaUrl: '', @@ -56,6 +58,28 @@ Cypress.Commands.add('createBotV2', (botName: string, callback: (bot: any) => vo }); }); +Cypress.Commands.add('createTemplateBot', (botName: string, callback: (bot: any) => void) => { + cy.createBotV2(`TemplateBot_${botName}`, (bot) => { + TemplateBotProjectId = bot.id; + }); +}); + +Cypress.Commands.add('createTestBot', (botName: string, callback: (bot: any) => void) => { + const name = `TestBot_${botName}`; + + const params = { + description: '', + location: '/Users/yellowglue/Projects/BotFramework-Composer/MyBotsTest', + name, + storageId: 'default', + }; + + cy.request('post', `/api/projects/${TemplateBotProjectId}/project/saveAs`, params).then((res) => { + const bot = res.body; + callback(bot); + }); +}); + Cypress.Commands.add('withinEditor', (editorName, cb) => { cy.findByTestId(editorName).within(cb); }); diff --git a/Composer/cypress/support/index.ts b/Composer/cypress/support/index.ts index 03d376e369..a2a29ca1a7 100644 --- a/Composer/cypress/support/index.ts +++ b/Composer/cypress/support/index.ts @@ -3,6 +3,12 @@ import './commands'; +before(() => { + cy.createTemplateBot('EmptySample', ({ id }) => { + cy.visit(`/bot/${id}`); + }); +}); + beforeEach(() => { cy.exec('yarn test:integration:clean'); window.localStorage.setItem('composer:userSettings', JSON.stringify({ telemetry: { allowDataCollection: false } })); @@ -13,5 +19,5 @@ beforeEach(() => { after(() => { // eslint-disable-next-line cypress/no-unnecessary-waiting cy.wait(500); - cy.exec('yarn test:integration:clean'); + cy.exec('yarn test:integration:clean-all'); }); diff --git a/Composer/package.json b/Composer/package.json index 36836419d2..312c4062f2 100644 --- a/Composer/package.json +++ b/Composer/package.json @@ -73,6 +73,7 @@ "test:integration:start-server": "node scripts/e2e.js", "test:integration:open": "cypress open", "test:integration:clean": "node scripts/clean-e2e.js", + "test:integration:clean-all": "node scripts/clean-e2e.js --all", "lint": "wsrun --exclude-missing --collect-logs --report lint", "lint:ci": "wsrun --exclude-missing --collect-logs --report --no-prefix lint --format github-actions", "lint:fix": "wsrun --exclude-missing --collect-logs --report lint:fix", diff --git a/Composer/scripts/clean-e2e.js b/Composer/scripts/clean-e2e.js index b1ac4d1c61..02b7358bb4 100644 --- a/Composer/scripts/clean-e2e.js +++ b/Composer/scripts/clean-e2e.js @@ -13,9 +13,11 @@ const rootDir = path.resolve(__dirname, '..'); const BOTS_DIR = process.env.COMPOSER_BOTS_FOLDER || path.resolve(rootDir, 'cypress/__test_bots__'); const APP_DATA = process.env.COMPOSER_APP_DATA || path.resolve(rootDir, 'cypress/__e2e_data.json'); +const cleanAll = process.argv.indexOf('--all') !== -1; + function cleanup() { try { - rimraf.sync(BOTS_DIR); + rimraf.sync(path.join(BOTS_DIR, cleanAll ? '**' : 'TestBot_**')); } catch { // do nothing } From 13a47ede06a8068209ab062ea46fef84ae8375d5 Mon Sep 17 00:00:00 2001 From: zhixzhan Date: Mon, 19 Apr 2021 17:00:07 +0800 Subject: [PATCH 3/6] update --- Composer/cypress/integration/LGPage.spec.ts | 4 ++-- Composer/cypress/integration/LUPage.spec.ts | 4 ++-- Composer/cypress/support/index.ts | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Composer/cypress/integration/LGPage.spec.ts b/Composer/cypress/integration/LGPage.spec.ts index 3477135a35..3f7e3104ca 100644 --- a/Composer/cypress/integration/LGPage.spec.ts +++ b/Composer/cypress/integration/LGPage.spec.ts @@ -11,7 +11,7 @@ context('LG Page', () => { it('can open language generation page', () => { cy.findByTestId('LeftNav-CommandBarButtonBot responses').click(); // left nav tree - cy.contains('__TestEmptySample'); + cy.contains('TestBot_EmptySample'); cy.findByTestId('showcode').as('switchButton'); @@ -29,7 +29,7 @@ context('LG Page', () => { // nav to Main dialog cy.findByTestId('ProjectTree').within(() => { - cy.findAllByText('__TestEmptySample').last().click(); + cy.findAllByText('TestBot_EmptySample').last().click(); }); }); }); diff --git a/Composer/cypress/integration/LUPage.spec.ts b/Composer/cypress/integration/LUPage.spec.ts index 5ea178132d..ea77b53789 100644 --- a/Composer/cypress/integration/LUPage.spec.ts +++ b/Composer/cypress/integration/LUPage.spec.ts @@ -11,7 +11,7 @@ context('LU Page', () => { it('can open language understanding page', () => { cy.findByTestId('LeftNav-CommandBarButtonUser input').click(); // left nav tree - cy.contains('__TestEmptySample'); + cy.contains('TestBot_EmptySample'); // by default it goes to table view cy.findByTestId('LUPage').findByTestId('table-view').should('exist'); @@ -21,7 +21,7 @@ context('LU Page', () => { // nav to ToDoBotWithLuisSample.main dialog cy.findByTestId('ProjectTree').within(() => { - cy.findAllByText('__TestEmptySample').last().click(); + cy.findAllByText('TestBot_EmptySample').last().click(); }); cy.findByTestId('showcode').as('switchButton'); // goto edit-mode diff --git a/Composer/cypress/support/index.ts b/Composer/cypress/support/index.ts index a2a29ca1a7..78d470a187 100644 --- a/Composer/cypress/support/index.ts +++ b/Composer/cypress/support/index.ts @@ -4,6 +4,7 @@ import './commands'; before(() => { + cy.exec('yarn test:integration:clean-all'); cy.createTemplateBot('EmptySample', ({ id }) => { cy.visit(`/bot/${id}`); }); From e6e3151a54523d256c4f28b1f35caeea37855525 Mon Sep 17 00:00:00 2001 From: zhixzhan Date: Mon, 19 Apr 2021 17:24:10 +0800 Subject: [PATCH 4/6] update --- Composer/cypress/support/commands.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Composer/cypress/support/commands.ts b/Composer/cypress/support/commands.ts index 74614d3ccc..ce3a94cacd 100644 --- a/Composer/cypress/support/commands.ts +++ b/Composer/cypress/support/commands.ts @@ -69,14 +69,13 @@ Cypress.Commands.add('createTestBot', (botName: string, callback: (bot: any) => const params = { description: '', - location: '/Users/yellowglue/Projects/BotFramework-Composer/MyBotsTest', + location: '', name, storageId: 'default', }; cy.request('post', `/api/projects/${TemplateBotProjectId}/project/saveAs`, params).then((res) => { - const bot = res.body; - callback(bot); + callback(res.body); }); }); From 90262c643b6a9d5ff182f8645c5df508cd33dccf Mon Sep 17 00:00:00 2001 From: zhixzhan Date: Tue, 20 Apr 2021 11:57:45 +0800 Subject: [PATCH 5/6] update and merge --- .../cypress/integration/Breadcrumb.spec.ts | 42 ------ .../cypress/integration/CreateNewBot.spec.ts | 25 ---- .../cypress/integration/DesignPage.spec.ts | 135 ++++++++++++++++++ Composer/cypress/integration/HomePage.spec.ts | 63 ++++++++ Composer/cypress/integration/LGPage.spec.ts | 6 +- Composer/cypress/integration/LUPage.spec.ts | 6 +- .../cypress/integration/LeftNavBar.spec.ts | 20 --- .../cypress/integration/LuisDeploy.spec.ts | 6 +- .../cypress/integration/NavigateUrls.spec.ts | 23 --- .../cypress/integration/NewDialog.spec.ts | 21 --- .../integration/NotificationPage.spec.ts | 14 +- .../cypress/integration/Onboarding.spec.ts | 18 +-- .../cypress/integration/RemoveDialog.spec.ts | 25 ---- Composer/cypress/integration/SaveAs.spec.ts | 20 --- Composer/cypress/integration/ToDoBot.spec.ts | 51 ------- .../integration/TriggerCreation.spec.ts | 63 -------- .../integration/VisualDesigner.spec.ts | 23 --- Composer/cypress/support/commands.d.ts | 1 + 18 files changed, 225 insertions(+), 337 deletions(-) delete mode 100644 Composer/cypress/integration/Breadcrumb.spec.ts delete mode 100644 Composer/cypress/integration/CreateNewBot.spec.ts create mode 100644 Composer/cypress/integration/DesignPage.spec.ts delete mode 100644 Composer/cypress/integration/LeftNavBar.spec.ts delete mode 100644 Composer/cypress/integration/NavigateUrls.spec.ts delete mode 100644 Composer/cypress/integration/NewDialog.spec.ts delete mode 100644 Composer/cypress/integration/RemoveDialog.spec.ts delete mode 100644 Composer/cypress/integration/SaveAs.spec.ts delete mode 100644 Composer/cypress/integration/ToDoBot.spec.ts delete mode 100644 Composer/cypress/integration/TriggerCreation.spec.ts delete mode 100644 Composer/cypress/integration/VisualDesigner.spec.ts diff --git a/Composer/cypress/integration/Breadcrumb.spec.ts b/Composer/cypress/integration/Breadcrumb.spec.ts deleted file mode 100644 index eda8797212..0000000000 --- a/Composer/cypress/integration/Breadcrumb.spec.ts +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -context('breadcrumb', () => { - beforeEach(() => { - cy.createTestBot('EmptySample', ({ id }) => { - cy.visit(`/bot/${id}`); - }); - }); - - function hasBreadcrumbItems(cy: Cypress.cy, items: (string | RegExp)[]) { - cy.get('[data-testid="Breadcrumb"]') - .last() - .get('li') - .should(($li) => { - items.forEach((item, idx) => { - expect($li.eq(idx)).to.contain(item); - }); - }); - } - - it('can show dialog, trigger, action in breadcrumb', () => { - // Should path = main dialog at first render - hasBreadcrumbItems(cy, ['TestBot_EmptySample']); - - // Click on an trigger - cy.findByTestId('ProjectTree').within(() => { - cy.findAllByText('Greeting').last().click(); - }); - - hasBreadcrumbItems(cy, ['TestBot_EmptySample', 'Greeting']); - - // Click on an action - cy.withinEditor('VisualEditor', () => { - cy.findByTestId('RuleEditor').within(() => { - cy.findByText('Send a response').click(); - }); - }); - - hasBreadcrumbItems(cy, ['TestBot_EmptySample', 'Greeting', 'Send a response']); - }); -}); diff --git a/Composer/cypress/integration/CreateNewBot.spec.ts b/Composer/cypress/integration/CreateNewBot.spec.ts deleted file mode 100644 index 1ad5e991aa..0000000000 --- a/Composer/cypress/integration/CreateNewBot.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -context('Creating a new bot', () => { - beforeEach(() => { - cy.visit('/home'); - cy.findByTestId('LeftNav-CommandBarButtonHome').click(); - cy.findByTestId('homePage-Toolbar-New').within(() => { - cy.findByText('New').click(); - }); - }); - - it('can create a new bot', () => { - // eslint-disable-next-line cypress/no-unnecessary-waiting - cy.wait(3000); - cy.findByTestId('@microsoft/generator-bot-empty').click(); - cy.findByTestId('NextStepButton').click(); - cy.enterTextAndSubmit('NewDialogName', 'TestNewProject3', 'SubmitNewBotBtn'); - // eslint-disable-next-line cypress/no-unnecessary-waiting - cy.wait(150000); - cy.findByTestId('ProjectTree').within(() => { - cy.findAllByText('TestNewProject3').should('exist'); - }); - }); -}); diff --git a/Composer/cypress/integration/DesignPage.spec.ts b/Composer/cypress/integration/DesignPage.spec.ts new file mode 100644 index 0000000000..54a3b1a5dd --- /dev/null +++ b/Composer/cypress/integration/DesignPage.spec.ts @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +// Tests for dialog & trigger CRUD + +context('breadcrumb', () => { + beforeEach(() => { + cy.createTestBot('TestSample', ({ id }) => { + cy.visit(`/bot/${id}`); + }); + }); + + function hasBreadcrumbItems(cy: Cypress.cy, items: (string | RegExp)[]) { + cy.get('[data-testid="Breadcrumb"]') + .last() + .get('li') + .should(($li) => { + items.forEach((item, idx) => { + expect($li.eq(idx)).to.contain(item); + }); + }); + } + + it('can show dialog, trigger, action in breadcrumb', () => { + // Should path = main dialog at first render + hasBreadcrumbItems(cy, ['TestBot_TestSample']); + + // Click on an trigger + cy.findByTestId('ProjectTree').within(() => { + cy.findAllByText('Greeting').last().click(); + }); + + hasBreadcrumbItems(cy, ['TestBot_TestSample', 'Greeting']); + + // Click on an action + cy.withinEditor('VisualEditor', () => { + cy.findByTestId('RuleEditor').within(() => { + cy.findByText('Send a response').click(); + }); + }); + + hasBreadcrumbItems(cy, ['TestBot_TestSample', 'Greeting', 'Send a response']); + }); + + it('can create / remove dialog from project tree', () => { + // create + cy.findByTestId('BotHeader-TestBot_TestSample').within(() => { + cy.findByTestId('dialogMoreButton').click({ force: true }); + }); + cy.findAllByText('Add a dialog').click({ force: true }); + cy.findByTestId('NewDialogName').type('{selectall}TestNewDialog2{enter}'); + cy.findByTestId('ProjectTree').within(() => { + cy.findByText('TestNewDialog2').should('exist'); + }); + + // remove + cy.findByTestId('ProjectTree').within(() => { + cy.findByTestId('$Root_TestNewDialog2').within(() => { + cy.findByTestId('dialogMoreButton').first().invoke('attr', 'style', 'visibility: visible').click(); + }); + }); + + cy.findByText('Remove this dialog').click(); + + cy.findByText('Yes').click(); + + cy.findByTestId('ProjectTree').within(() => { + cy.get('[title="TestNewDialog2"]').should('not.exist'); + }); + }); + + it('can create different kinds of triggers ', () => { + cy.visitPage('Design'); + cy.findByTestId('DialogHeader-TestBot_TestSample').click(); + cy.findByTestId('recognizerTypeDropdown').click(); + cy.findByText('Regular expression recognizer').click(); + + //onintent trigger + cy.findByTestId('DialogHeader-TestBot_TestSample').within(() => { + cy.findByTestId('dialogMoreButton').click({ force: true }); + }); + cy.findAllByText('Add a trigger').click({ force: true }); + cy.findByTestId('triggerTypeDropDown').click(); + cy.get('[title="Intent recognized"]').click(); + cy.findByTestId('TriggerName').type('myTrigger1'); + cy.findByTestId('RegExField').type('test'); + cy.findByTestId('triggerFormSubmit').click(); + cy.findAllByText('myTrigger1').should('exist'); + + //on Dialog Event trigger + cy.findByTestId('DialogHeader-TestBot_TestSample').within(() => { + cy.findByTestId('dialogMoreButton').click({ force: true }); + }); + cy.findAllByText('Add a trigger').click({ force: true }); + cy.findByTestId('triggerTypeDropDown').click(); + cy.get('[title="Dialog events"]').click(); + cy.findByText('Select an event type').click(); + cy.findByText('Dialog started (Begin dialog event)').click(); + cy.findByTestId('triggerFormSubmit').click(); + cy.findAllByText('Begin dialog event').should('exist'); + + // custom event + cy.findByTestId('DialogHeader-TestBot_TestSample').within(() => { + cy.findByTestId('dialogMoreButton').click({ force: true }); + }); + cy.findAllByText('Add a trigger').click({ force: true }); + cy.findByTestId('triggerTypeDropDown').click(); + cy.get('[title="Custom events"]').click(); + cy.findByTestId('CustomEventName').type('myCustomEvent'); + cy.findByTestId('triggerFormSubmit').click(); + cy.findAllByText('myCustomEvent').should('exist'); + + //on activity trigger + cy.findByTestId('DialogHeader-TestBot_TestSample').within(() => { + cy.findByTestId('dialogMoreButton').click({ force: true }); + }); + cy.findAllByText('Add a trigger').click({ force: true }); + cy.findByTestId('triggerTypeDropDown').click(); + cy.get('[title="Activities"]').click(); + cy.findByText('Select an activity type').click(); + cy.findByText('Activities (Activity received)').click(); + cy.findByTestId('triggerFormSubmit').click(); + cy.findAllByText('Activities').should('exist'); + }); + + it('can find Visual Designer default trigger in container', () => { + cy.findByTestId('ProjectTree').within(() => { + cy.findByText('Greeting').click(); + }); + + cy.withinEditor('VisualEditor', () => { + cy.findByText('ConversationUpdate activity').should('exist'); + }); + }); +}); diff --git a/Composer/cypress/integration/HomePage.spec.ts b/Composer/cypress/integration/HomePage.spec.ts index b93c15e1ab..fc5d4fea15 100644 --- a/Composer/cypress/integration/HomePage.spec.ts +++ b/Composer/cypress/integration/HomePage.spec.ts @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +// Tests for bot create, save, page navigation, creation flow modal. + context('Home Page ', () => { beforeEach(() => { cy.visit('/home'); @@ -17,4 +19,65 @@ context('Home Page ', () => { cy.findByText('Cancel').click(); cy.findByTestId('homePage-Toolbar-New').click(); }); + + it('can expand left Nav Bar', () => { + cy.createTestBot('EmptySample', ({ id }) => { + cy.visit(`/bot/${id}`); + cy.findByTestId('LeftNavButton').click(); + cy.findByTestId('LeftNav-CommandBarButtonDesign').should('exist'); + cy.findByTestId('LeftNav-CommandBarButtonBot responses').click(); + cy.url().should('include', 'language-generation'); + cy.findByTestId('LeftNav-CommandBarButtonUser input').click(); + cy.url().should('include', 'language-understanding'); + cy.findByTestId('LeftNav-CommandBarButtonComposer settings').click(); + cy.url().should('include', 'setting'); + }); + }); + + it('should open Select Template window from a url', () => { + cy.visit('/projects/create'); + cy.findAllByTestId('dotnetFeed').should('exist'); + }); + + it('should open Define Conversations window from a url', () => { + cy.visit('/projects/create/dotnet/conversationalCore'); + cy.get('[data-testid="NewDialogName"]').should('be.visible'); + }); + + it('should create the Open a Bot window from a location through the specified url', () => { + cy.visit('/projects/open'); + cy.get('[data-testid="SelectLocation"]').should('be.visible'); + }); + + it('can create a new bot', () => { + cy.visit('/home'); + cy.findByTestId('LeftNav-CommandBarButtonHome').click(); + cy.findByTestId('homePage-Toolbar-New').within(() => { + cy.findByText('New').click(); + }); + // eslint-disable-next-line cypress/no-unnecessary-waiting + cy.wait(3000); + cy.findByTestId('@microsoft/generator-bot-empty').click(); + cy.findByTestId('NextStepButton').click(); + cy.enterTextAndSubmit('NewDialogName', 'TestNewProject3', 'SubmitNewBotBtn'); + // eslint-disable-next-line cypress/no-unnecessary-waiting + cy.wait(100000); + cy.findByTestId('ProjectTree').within(() => { + cy.findAllByText('TestNewProject3').should('exist'); + }); + }); + + it('can create a new bot from an existing bot', () => { + cy.createTestBot('EmptySample', ({ id }) => { + cy.visit(`/bot/${id}`); + cy.findByTestId('LeftNav-CommandBarButtonHome').click(); + cy.url().should('contain', 'home'); + cy.findByText('Save as').click(); + cy.enterTextAndSubmit('NewDialogName', 'TestSaveAs', 'SubmitNewBotBtn'); + cy.wait(5000); + cy.findByTestId('ProjectTree').within(() => { + cy.findAllByText('TestSaveAs').should('exist'); + }); + }); + }); }); diff --git a/Composer/cypress/integration/LGPage.spec.ts b/Composer/cypress/integration/LGPage.spec.ts index 3f7e3104ca..0ea9afb4f1 100644 --- a/Composer/cypress/integration/LGPage.spec.ts +++ b/Composer/cypress/integration/LGPage.spec.ts @@ -3,7 +3,7 @@ context('LG Page', () => { beforeEach(() => { - cy.createTestBot('EmptySample', ({ id }) => { + cy.createTestBot('TestSample', ({ id }) => { cy.visit(`/bot/${id}`); }); }); @@ -11,7 +11,7 @@ context('LG Page', () => { it('can open language generation page', () => { cy.findByTestId('LeftNav-CommandBarButtonBot responses').click(); // left nav tree - cy.contains('TestBot_EmptySample'); + cy.contains('TestBot_TestSample'); cy.findByTestId('showcode').as('switchButton'); @@ -29,7 +29,7 @@ context('LG Page', () => { // nav to Main dialog cy.findByTestId('ProjectTree').within(() => { - cy.findAllByText('TestBot_EmptySample').last().click(); + cy.findAllByText('TestBot_TestSample').last().click(); }); }); }); diff --git a/Composer/cypress/integration/LUPage.spec.ts b/Composer/cypress/integration/LUPage.spec.ts index ea77b53789..d71229d49f 100644 --- a/Composer/cypress/integration/LUPage.spec.ts +++ b/Composer/cypress/integration/LUPage.spec.ts @@ -3,7 +3,7 @@ context('LU Page', () => { beforeEach(() => { - cy.createTestBot('EmptySample', ({ id }) => { + cy.createTestBot('TestSample', ({ id }) => { cy.visit(`/bot/${id}`); }); }); @@ -11,7 +11,7 @@ context('LU Page', () => { it('can open language understanding page', () => { cy.findByTestId('LeftNav-CommandBarButtonUser input').click(); // left nav tree - cy.contains('TestBot_EmptySample'); + cy.contains('TestBot_TestSample'); // by default it goes to table view cy.findByTestId('LUPage').findByTestId('table-view').should('exist'); @@ -21,7 +21,7 @@ context('LU Page', () => { // nav to ToDoBotWithLuisSample.main dialog cy.findByTestId('ProjectTree').within(() => { - cy.findAllByText('TestBot_EmptySample').last().click(); + cy.findAllByText('TestBot_TestSample').last().click(); }); cy.findByTestId('showcode').as('switchButton'); // goto edit-mode diff --git a/Composer/cypress/integration/LeftNavBar.spec.ts b/Composer/cypress/integration/LeftNavBar.spec.ts deleted file mode 100644 index 4094dafcd0..0000000000 --- a/Composer/cypress/integration/LeftNavBar.spec.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -context('Left Nav Bar', () => { - beforeEach(() => { - cy.visit('/home'); - cy.createBot('TodoSample'); - }); - - it('can expand left Nav Bar', () => { - cy.findByTestId('LeftNavButton').click(); - cy.findByTestId('LeftNav-CommandBarButtonDesign').should('exist'); - cy.findByTestId('LeftNav-CommandBarButtonBot responses').click(); - cy.url().should('include', 'language-generation'); - cy.findByTestId('LeftNav-CommandBarButtonUser input').click(); - cy.url().should('include', 'language-understanding'); - cy.findByTestId('LeftNav-CommandBarButtonComposer settings').click(); - cy.url().should('include', 'setting'); - }); -}); diff --git a/Composer/cypress/integration/LuisDeploy.spec.ts b/Composer/cypress/integration/LuisDeploy.spec.ts index 3bc6e82af3..867ae8ffa3 100644 --- a/Composer/cypress/integration/LuisDeploy.spec.ts +++ b/Composer/cypress/integration/LuisDeploy.spec.ts @@ -7,9 +7,9 @@ context('Luis Deploy', () => { cy.route('POST', '/api/publish/*/publish/default', { endpointURL: 'anything', status: 202 }); cy.route('POST', '/api/projects/*/settings', 'OK'); cy.route('GET', '/api/publish/*/status/default', { endpointURL: 'anything', status: 404 }); - cy.visit('/home'); - cy.createBot('ToDoBotWithLuisSample'); - cy.visitPage('Design'); + cy.createTestBot('TestSample', ({ id }) => { + cy.visit(`/bot/${id}`); + }); }); it('can deploy luis success', () => { diff --git a/Composer/cypress/integration/NavigateUrls.spec.ts b/Composer/cypress/integration/NavigateUrls.spec.ts deleted file mode 100644 index 3ccbe1c001..0000000000 --- a/Composer/cypress/integration/NavigateUrls.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -context('Navigate Url', () => { - beforeEach(() => { - cy.visit('/home'); - }); - - it('should open Select Template window from a url', () => { - cy.visit('/projects/create'); - cy.findAllByTestId('dotnetFeed').should('exist'); - }); - - it('should open Define Conversations window from a url', () => { - cy.visit('/projects/create/dotnet/conversationalCore'); - cy.get('[data-testid="NewDialogName"]').should('be.visible'); - }); - - it('should create the Open a Bot window from a location through the specified url', () => { - cy.visit('/projects/open'); - cy.get('[data-testid="SelectLocation"]').should('be.visible'); - }); -}); diff --git a/Composer/cypress/integration/NewDialog.spec.ts b/Composer/cypress/integration/NewDialog.spec.ts deleted file mode 100644 index 990208678b..0000000000 --- a/Composer/cypress/integration/NewDialog.spec.ts +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -context('Creating a new Dialog', () => { - beforeEach(() => { - cy.visit('/home'); - cy.createBot('TodoSample'); - cy.findByTestId('LeftNav-CommandBarButtonDesign').click(); - }); - - it('can create a new dialog from project tree', () => { - cy.findByTestId('BotHeader-__TestTodoSample').within(() => { - cy.findByTestId('dialogMoreButton').click({ force: true }); - }); - cy.findAllByText('Add a dialog').click({ force: true }); - cy.findByTestId('NewDialogName').type('{selectall}TestNewDialog2{enter}'); - cy.findByTestId('ProjectTree').within(() => { - cy.findByText('TestNewDialog2').should('exist'); - }); - }); -}); diff --git a/Composer/cypress/integration/NotificationPage.spec.ts b/Composer/cypress/integration/NotificationPage.spec.ts index 4640447189..c5b0b0a815 100644 --- a/Composer/cypress/integration/NotificationPage.spec.ts +++ b/Composer/cypress/integration/NotificationPage.spec.ts @@ -3,7 +3,9 @@ context('Notification Page', () => { beforeEach(() => { - cy.createBot('ToDoBotWithLuisSample'); + cy.createTestBot('TestSample', ({ id }) => { + cy.visit(`/bot/${id}`); + }); }); it('can show lg syntax error ', () => { @@ -11,7 +13,7 @@ context('Notification Page', () => { cy.visitPage('Bot responses'); cy.findByTestId('ProjectTree').within(() => { - cy.findAllByText('__TestToDoBotWithLuisSample').last().click(); + cy.findAllByText('TestBot_TestSample').last().click(); }); cy.findByTestId('showcode').click(); @@ -20,7 +22,7 @@ context('Notification Page', () => { cy.findByTestId('LeftNav-CommandBarButtonDiagnostics').click(); cy.findByTestId('diagnostics-table-view').within(() => { - cy.findAllByText('__TestToDoBotWithLuisSample.en-us.lg').should('exist').first().click(); + cy.findAllByText('TestBot_TestSample.en-us.lg').should('exist').first().click(); }); cy.findAllByText('Bot responses').should('exist'); @@ -31,7 +33,7 @@ context('Notification Page', () => { cy.visitPage('User input'); cy.findByTestId('ProjectTree').within(() => { - cy.findAllByText('__TestToDoBotWithLuisSample').last().click(); + cy.findAllByText('TestBot_TestSample').last().click(); }); cy.findByTestId('showcode').click(); @@ -40,10 +42,10 @@ context('Notification Page', () => { cy.findByTestId('LeftNav-CommandBarButtonDiagnostics').click(); cy.findByTestId('diagnostics-table-view').within(() => { - cy.findAllByText('__TestToDoBotWithLuisSample.en-us.lu').should('exist').first().dblclick(); + cy.findAllByText('TestBot_TestSample.en-us.lu').should('exist').first().dblclick(); }); - cy.findAllByText('__TestToDoBotWithLuisSample').should('exist'); + cy.findAllByText('TestBot_TestSample').should('exist'); }); // it('can show dialog expression error ', () => { diff --git a/Composer/cypress/integration/Onboarding.spec.ts b/Composer/cypress/integration/Onboarding.spec.ts index a46dd7646c..e124d13d88 100644 --- a/Composer/cypress/integration/Onboarding.spec.ts +++ b/Composer/cypress/integration/Onboarding.spec.ts @@ -3,16 +3,16 @@ context('Onboarding', () => { beforeEach(() => { - cy.visit('/home'); - cy.createBot('TodoSample', 'Onboarding'); - cy.visitPage('Design'); - //enable onboarding setting - cy.visitPage('Composer settings'); - cy.findByTestId('ProjectTree').within(() => { - cy.findByText('Application Settings').click(); + cy.createTestBot('TestSample', ({ id }) => { + cy.visit(`/bot/${id}`); + //enable onboarding setting + cy.visitPage('Composer settings'); + cy.findByTestId('ProjectTree').within(() => { + cy.findByText('Application Settings').click(); + }); + cy.findByTestId('onboardingToggle').click(); + cy.visitPage('Design'); }); - cy.findByTestId('onboardingToggle').click(); - cy.visitPage('Design'); }); it('walk through product tour teaching bubbles', () => { diff --git a/Composer/cypress/integration/RemoveDialog.spec.ts b/Composer/cypress/integration/RemoveDialog.spec.ts deleted file mode 100644 index fb212a2cca..0000000000 --- a/Composer/cypress/integration/RemoveDialog.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -context('RemoveDialog', () => { - beforeEach(() => { - cy.visit('/home'); - cy.createBot('ToDoBotWithLuisSample'); - }); - - it('can remove dialog', () => { - cy.findByTestId('ProjectTree').within(() => { - cy.findByTestId('$Root_AddItem').within(() => { - cy.findByTestId('dialogMoreButton').first().invoke('attr', 'style', 'visibility: visible').click(); - }); - }); - - cy.findByText('Remove this dialog').click(); - - cy.findByText('Yes').click(); - - cy.findByTestId('ProjectTree').within(() => { - cy.get('[title="addItem"]').should('not.exist'); - }); - }); -}); diff --git a/Composer/cypress/integration/SaveAs.spec.ts b/Composer/cypress/integration/SaveAs.spec.ts deleted file mode 100644 index cc5948acee..0000000000 --- a/Composer/cypress/integration/SaveAs.spec.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -context('Saving As', () => { - beforeEach(() => { - cy.visit('/home'); - cy.createBot('EchoBot', 'TestBot'); - }); - - it('can create a new bot from an existing bot', () => { - cy.visitPage('Design'); - cy.findByTestId('LeftNav-CommandBarButtonHome').click(); - cy.url().should('contain', 'home'); - cy.findByText('Save as').click(); - cy.enterTextAndSubmit('NewDialogName', '__TestSaveAs', 'SubmitNewBotBtn'); - cy.findByTestId('ProjectTree').within(() => { - cy.findAllByText('__TestSaveAs').should('exist'); - }); - }); -}); diff --git a/Composer/cypress/integration/ToDoBot.spec.ts b/Composer/cypress/integration/ToDoBot.spec.ts deleted file mode 100644 index d1b45fc30d..0000000000 --- a/Composer/cypress/integration/ToDoBot.spec.ts +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -context('ToDo Bot', () => { - beforeEach(() => { - window.localStorage.setItem('composer:userSettings', JSON.stringify({ telemetry: { allowDataCollection: false } })); - cy.visit('/home'); - cy.createBot('TodoSample'); - }); - - it('can open the main dialog', () => { - cy.findByTestId('ProjectTree').within(() => { - cy.findAllByText('__TestTodoSample').last().click(); - }); - cy.withinEditor('PropertyEditor', () => { - cy.findAllByDisplayValue('__TestTodoSample').should('exist'); - }); - }); - - it('can open the AddToDo dialog', () => { - cy.findByTestId('ProjectTree').within(() => { - cy.findByTestId('addtodo_Dialog started').click(); - }); - - cy.url().should('contain', 'addtodo'); - }); - - it('can open the ClearToDos dialog', () => { - cy.findByTestId('ProjectTree').within(() => { - cy.findByTestId('cleartodos_Dialog started').click(); - }); - - cy.url().should('contain', 'cleartodos'); - }); - - it('can open the DeleteToDo dialog', () => { - cy.findByTestId('ProjectTree').within(() => { - cy.findByTestId('deletetodo_Dialog started').click(); - }); - - cy.url().should('contain', 'deletetodo'); - }); - - it('can open the ShowToDos dialog', () => { - cy.findByTestId('ProjectTree').within(() => { - cy.findByTestId('showtodos_Dialog started').click(); - }); - - cy.url().should('contain', 'showtodos'); - }); -}); diff --git a/Composer/cypress/integration/TriggerCreation.spec.ts b/Composer/cypress/integration/TriggerCreation.spec.ts deleted file mode 100644 index 3302c3bde6..0000000000 --- a/Composer/cypress/integration/TriggerCreation.spec.ts +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -context('Creating a new trigger', () => { - beforeEach(() => { - cy.visit('/home'); - cy.createBot('EmptyBot'); - }); - - it('can create different kinds of triggers ', () => { - cy.visitPage('Design'); - cy.findByTestId('DialogHeader-__TestEmptyBot').click(); - cy.findByTestId('recognizerTypeDropdown').click(); - cy.findByText('Regular expression recognizer').click(); - - //onintent trigger - cy.findByTestId('DialogHeader-__TestEmptyBot').within(() => { - cy.findByTestId('dialogMoreButton').click({ force: true }); - }); - cy.findAllByText('Add a trigger').click({ force: true }); - cy.findByTestId('triggerTypeDropDown').click(); - cy.get('[title="Intent recognized"]').click(); - cy.findByTestId('TriggerName').type('myTrigger1'); - cy.findByTestId('RegExField').type('test'); - cy.findByTestId('triggerFormSubmit').click(); - cy.findAllByText('myTrigger1').should('exist'); - - //on Dialog Event trigger - cy.findByTestId('DialogHeader-__TestEmptyBot').within(() => { - cy.findByTestId('dialogMoreButton').click({ force: true }); - }); - cy.findAllByText('Add a trigger').click({ force: true }); - cy.findByTestId('triggerTypeDropDown').click(); - cy.get('[title="Dialog events"]').click(); - cy.findByText('Select an event type').click(); - cy.findByText('Dialog started (Begin dialog event)').click(); - cy.findByTestId('triggerFormSubmit').click(); - cy.findAllByText('Begin dialog event').should('exist'); - - // custom event - cy.findByTestId('DialogHeader-__TestEmptyBot').within(() => { - cy.findByTestId('dialogMoreButton').click({ force: true }); - }); - cy.findAllByText('Add a trigger').click({ force: true }); - cy.findByTestId('triggerTypeDropDown').click(); - cy.get('[title="Custom events"]').click(); - cy.findByTestId('CustomEventName').type('myCustomEvent'); - cy.findByTestId('triggerFormSubmit').click(); - cy.findAllByText('myCustomEvent').should('exist'); - - //on activity trigger - cy.findByTestId('DialogHeader-__TestEmptyBot').within(() => { - cy.findByTestId('dialogMoreButton').click({ force: true }); - }); - cy.findAllByText('Add a trigger').click({ force: true }); - cy.findByTestId('triggerTypeDropDown').click(); - cy.get('[title="Activities"]').click(); - cy.findByText('Select an activity type').click(); - cy.findByText('Activities (Activity received)').click(); - cy.findByTestId('triggerFormSubmit').click(); - cy.findAllByText('Activities').should('exist'); - }); -}); diff --git a/Composer/cypress/integration/VisualDesigner.spec.ts b/Composer/cypress/integration/VisualDesigner.spec.ts deleted file mode 100644 index 6c44924333..0000000000 --- a/Composer/cypress/integration/VisualDesigner.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -context('Visual Designer', () => { - beforeEach(() => { - cy.visit('/home'); - cy.createBot('TodoSample'); - // Return to Main.dialog - cy.findByTestId('ProjectTree').within(() => { - cy.findAllByText('__TestTodoSample').last().click(); - }); - }); - - it('can find Visual Designer default trigger in container', () => { - cy.findByTestId('ProjectTree').within(() => { - cy.findByText('Greeting').click(); - }); - - cy.withinEditor('VisualEditor', () => { - cy.findByText('ConversationUpdate activity').should('exist'); - }); - }); -}); diff --git a/Composer/cypress/support/commands.d.ts b/Composer/cypress/support/commands.d.ts index ba60f9acf0..594d722e60 100644 --- a/Composer/cypress/support/commands.d.ts +++ b/Composer/cypress/support/commands.d.ts @@ -6,6 +6,7 @@ declare namespace Cypress { interface Chainable { /** + * Deprecated! * Creates a bot based on template id. * If botName not provided, names the bot __Test${botId}, * otherwise, __Test&{botName}. From 53fdfa2b8f71240d5998b4c2ad846cdaad0c4dd7 Mon Sep 17 00:00:00 2001 From: zhixzhan Date: Tue, 20 Apr 2021 13:54:07 +0800 Subject: [PATCH 6/6] update --- Composer/cypress/integration/HomePage.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Composer/cypress/integration/HomePage.spec.ts b/Composer/cypress/integration/HomePage.spec.ts index fc5d4fea15..a7fef16dbc 100644 --- a/Composer/cypress/integration/HomePage.spec.ts +++ b/Composer/cypress/integration/HomePage.spec.ts @@ -20,6 +20,7 @@ context('Home Page ', () => { cy.findByTestId('homePage-Toolbar-New').click(); }); + // page navigation it('can expand left Nav Bar', () => { cy.createTestBot('EmptySample', ({ id }) => { cy.visit(`/bot/${id}`); @@ -34,6 +35,7 @@ context('Home Page ', () => { }); }); + // creation flow it('should open Select Template window from a url', () => { cy.visit('/projects/create'); cy.findAllByTestId('dotnetFeed').should('exist'); @@ -55,19 +57,17 @@ context('Home Page ', () => { cy.findByTestId('homePage-Toolbar-New').within(() => { cy.findByText('New').click(); }); - // eslint-disable-next-line cypress/no-unnecessary-waiting cy.wait(3000); cy.findByTestId('@microsoft/generator-bot-empty').click(); cy.findByTestId('NextStepButton').click(); cy.enterTextAndSubmit('NewDialogName', 'TestNewProject3', 'SubmitNewBotBtn'); - // eslint-disable-next-line cypress/no-unnecessary-waiting cy.wait(100000); cy.findByTestId('ProjectTree').within(() => { cy.findAllByText('TestNewProject3').should('exist'); }); }); - it('can create a new bot from an existing bot', () => { + it('can save as a new bot from an existing bot', () => { cy.createTestBot('EmptySample', ({ id }) => { cy.visit(`/bot/${id}`); cy.findByTestId('LeftNav-CommandBarButtonHome').click();