Skip to content

Commit

Permalink
chore: Merge bot-projects feature onto main (#5066)
Browse files Browse the repository at this point in the history
  • Loading branch information
srinaath authored Dec 3, 2020
1 parent 2fb9f59 commit 05aa579
Show file tree
Hide file tree
Showing 248 changed files with 12,552 additions and 4,592 deletions.
4 changes: 2 additions & 2 deletions Composer/cypress/integration/Breadcrumb.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ context('breadcrumb', () => {

// Return to Main.dialog
cy.findByTestId('ProjectTree').within(() => {
cy.findByText('__TestTodoSample').click();
cy.findAllByText('__TestTodoSample').last().click();
});
});

Expand All @@ -29,7 +29,7 @@ context('breadcrumb', () => {

// Return to Main.dialog
cy.findByTestId('ProjectTree').within(() => {
cy.findByText('__TestTodoSample').click();
cy.findAllByText('__TestTodoSample').last().click();
});

hasBreadcrumbItems(cy, ['__TestTodoSample']);
Expand Down
4 changes: 2 additions & 2 deletions Composer/cypress/integration/CreateNewBot.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ context('Creating a new bot', () => {
cy.findByTestId('NextStepButton').click();
cy.enterTextAndSubmit('NewDialogName', '__TestNewProject', 'SubmitNewBotBtn');
cy.findByTestId('ProjectTree').within(() => {
cy.findByText('__TestNewProject').should('exist');
cy.findAllByText('__TestNewProject').should('exist');
});
});

Expand All @@ -25,7 +25,7 @@ context('Creating a new bot', () => {
cy.findByTestId('NextStepButton').click();
cy.enterTextAndSubmit('NewDialogName', '__TestNewProject2', 'SubmitNewBotBtn');
cy.findByTestId('ProjectTree').within(() => {
cy.findByText('__TestNewProject2').should('exist');
cy.findAllByText('__TestNewProject2').should('exist');
cy.findByText('addtodo').should('exist');
cy.findByText('cleartodos').should('exist');
cy.findByText('deletetodo').should('exist');
Expand Down
3 changes: 1 addition & 2 deletions Composer/cypress/integration/LGPage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ context('LG Page', () => {
cy.findByTestId('LeftNav-CommandBarButtonBot Responses').click();
// left nav tree
cy.contains('TodoSample');
cy.contains('All');

cy.findByTestId('showcode').as('switchButton');

Expand All @@ -29,7 +28,7 @@ context('LG Page', () => {

// nav to Main dialog
cy.findByTestId('ProjectTree').within(() => {
cy.findByText('__TestTodoSample').click();
cy.findAllByText('__TestTodoSample').last().click();
});
});
});
9 changes: 1 addition & 8 deletions Composer/cypress/integration/LUPage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ context('LU Page', () => {
cy.findByTestId('LeftNav-CommandBarButtonUser Input').click();
// left nav tree
cy.contains('__TestToDoBotWithLuisSample');
cy.contains('All');

cy.findByTestId('showcode').should('not.exist');

Expand All @@ -23,17 +22,11 @@ context('LU Page', () => {

// nav to ToDoBotWithLuisSample.main dialog
cy.findByTestId('ProjectTree').within(() => {
cy.findByText('__TestToDoBotWithLuisSample').click('left');
cy.findAllByText('__TestToDoBotWithLuisSample').last().click('left');
});
cy.findByTestId('showcode').as('switchButton');
// goto edit-mode
cy.get('@switchButton').click();
cy.findByTestId('LUPage').get('.monaco-editor').should('exist');

// back to all table view
cy.findByTestId('ProjectTree').within(() => {
cy.findByText('All').click();
});
cy.findByTestId('LUPage').findByTestId('table-view').should('exist');
});
});
2 changes: 1 addition & 1 deletion Composer/cypress/integration/LeftNavBar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ context('Left Nav Bar', () => {
cy.url().should('include', 'language-generation');
cy.findByTestId('LeftNav-CommandBarButtonUser Input').click();
cy.url().should('include', 'language-understanding');
cy.findByTestId('LeftNav-CommandBarButtonSettings').click();
cy.findByTestId('LeftNav-CommandBarButtonComposer Settings').click();
cy.url().should('include', 'setting');
});
});
33 changes: 14 additions & 19 deletions Composer/cypress/integration/LuisDeploy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,35 @@ context('Luis Deploy', () => {
cy.server();
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: 200 });
cy.route('GET', '/api/publish/*/status/default', { endpointURL: 'anything', status: 404 });
cy.visit('/home');
cy.createBot('ToDoBotWithLuisSample');
});

it('can deploy luis success', () => {
cy.findByTestId('LeftNav-CommandBarButtonUser Input').click();
cy.visitPage('Project Settings');
cy.findAllByTestId('rootLUISKey').type('12345678', { delay: 200 });
cy.findAllByTestId('rootLUISRegion').type('westus', { delay: 200 });
cy.visitPage('User Input');
cy.url().should('contain', 'language-understanding/all');
cy.visitPage('Design');
cy.route({
method: 'POST',
url: 'api/projects/*/build',
status: 200,
response: 'fixture:luPublish/success',
status: 400,
response: 'fixture:luPublish/failure',
});
cy.findByText(/^(Start|Restart) Bot$/).click();

// clear its settings before
cy.enterTextAndSubmit('ProjectNameInput', 'MyProject');
cy.enterTextAndSubmit('EnvironmentInput', 'composer');
cy.enterTextAndSubmit('AuthoringKeyInput', '0d4991873f334685a9686d1b48e0ff48');
// wait for the debounce interval of sync settings
cy.findByText('OK').click();
cy.findByText('Restart Bot').should('exist');
cy.findByText('Test in Emulator').should('exist');
cy.findByTitle(/^Start all bots/).click();
cy.findByTitle('Open start bots panel').click();
cy.findByText('See Details').click();

cy.route({
method: 'POST',
url: 'api/projects/*/build',
status: 400,
response: 'fixture:luPublish/error',
status: 200,
response: 'fixture:luPublish/success',
});
cy.findByText('Restart Bot').click();
cy.findByText('Try again').click();
cy.findByTestId('AuthoringKeyInput').type('no-id');
cy.findByText('OK').click();
cy.findByTitle(/^Stop all bots/).click();
});
});
6 changes: 4 additions & 2 deletions Composer/cypress/integration/NewDialog.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ context('Creating a new Dialog', () => {
});

it('can create a new dialog from project tree', () => {
cy.findByTestId('AddFlyout').click();
cy.findByTestId('FlyoutNewDialog').click();
cy.findByTestId('BotHeader-__TestTodoSample').within(() => {
cy.findByTestId('dialogMoreButton').click({ force: true });
});
cy.findAllByText('Add a dialog').click();
cy.findByTestId('NewDialogName').type('{selectall}TestNewDialog2{enter}');
cy.findByTestId('ProjectTree').within(() => {
cy.findByText('TestNewDialog2').should('exist');
Expand Down
20 changes: 13 additions & 7 deletions Composer/cypress/integration/NotificationPage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,39 @@ context('Notification Page', () => {
});

it('can show lg syntax error ', () => {
cy.visitPage('Design');
cy.visitPage('Bot Responses');

cy.findByTestId('ProjectTree').within(() => {
cy.findAllByText('__TestToDoBotWithLuisSample').last().click();
});

cy.findByTestId('showcode').click();
cy.get('textarea').type('#', { delay: 200 });

cy.findByTestId('LeftNav-CommandBarButtonNotifications').click();
cy.findByTestId('LeftNav-CommandBarButtonDiagnostics').click();

cy.findByTestId('notifications-table-view').within(() => {
cy.findAllByText('common.en-us.lg').should('exist').first().click();
cy.findByTestId('diagnostics-table-view').within(() => {
cy.findAllByText('__TestToDoBotWithLuisSample.en-us.lg').should('exist').first().click();
});

cy.findAllByText('Bot Responses').should('exist');
});

it('can show lu syntax error ', () => {
cy.visitPage('Design');
cy.visitPage('User Input');

cy.findByTestId('ProjectTree').within(() => {
cy.findByText('__TestToDoBotWithLuisSample').click();
cy.findAllByText('__TestToDoBotWithLuisSample').last().click();
});

cy.findByTestId('showcode').click();
cy.get('textarea').type('t', { delay: 200 });
cy.get('textarea').type('t*', { delay: 200 });

cy.findByTestId('LeftNav-CommandBarButtonNotifications').click();
cy.findByTestId('LeftNav-CommandBarButtonDiagnostics').click();

cy.findByTestId('notifications-table-view').within(() => {
cy.findByTestId('diagnostics-table-view').within(() => {
cy.findAllByText('__TestToDoBotWithLuisSample.en-us.lu').should('exist').first().dblclick();
});

Expand Down
2 changes: 1 addition & 1 deletion Composer/cypress/integration/Onboarding.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ context('Onboarding', () => {
cy.createBot('TodoSample', 'Onboarding');
cy.visitPage('Design');
//enable onboarding setting
cy.visitPage('Settings');
cy.visitPage('Composer Settings');
cy.findByTestId('ProjectTree').within(() => {
cy.findByText('Application Settings').click();
});
Expand Down
28 changes: 8 additions & 20 deletions Composer/cypress/integration/Publish.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,32 +44,20 @@ context('Publish Page', () => {
it('can add profile and publish in publish page', () => {
// click left nav button
cy.findByTestId('LeftNav-CommandBarButtonPublish').click();
// publish page
cy.contains('Publish Profiles');
// target list exist
cy.contains('All profiles');
cy.findByTestId('Publish').findByTestId('target-list').should('exist');
cy.findByText('__TestEchoBot');

// status list exist
cy.contains('Time');
cy.contains('Bot');
cy.contains('Date');
cy.findByTestId('Publish').findByTestId('publish-status-list').should('exist');

// add profile
cy.findByText('Add new profile').click();
cy.visitPage('Project Settings');
cy.findByText('Add new publish profile').click();
cy.findByText('Add a publish profile').should('exist');
cy.findByText('Name').type('testProfile');
cy.findAllByPlaceholderText('My Publish Profile').first().type('testProfile');
cy.findByText('Choose One').click();
cy.findByText('azure publish').click();
// show instruction
cy.findByText('plugin instruction').should('exist');
// save profile
cy.findByText('Save').click();
// new profile should exist in target list
cy.findByTestId('Publish')
.findByTestId('target-list')
.within(() => {
cy.findByText('testProfile').should('exist');
});

cy.findByTestId('LeftNav-CommandBarButtonPublish').click();
cy.findByText('testProfile');
});
});
4 changes: 1 addition & 3 deletions Composer/cypress/integration/RemoveDialog.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ context('RemoveDialog', () => {
});
});

cy.get('.ms-ContextualMenu-linkContent > .ms-ContextualMenu-itemText').within(() => {
cy.findByText('Remove this dialog').click();
});
cy.findByText('Remove this dialog').click();

cy.findByText('Yes').click();

Expand Down
2 changes: 1 addition & 1 deletion Composer/cypress/integration/SaveAs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ context('Saving As', () => {
cy.findByText('Save as').click();
cy.enterTextAndSubmit('NewDialogName', '__TestSaveAs', 'SubmitNewBotBtn');
cy.findByTestId('ProjectTree').within(() => {
cy.findByText('__TestSaveAs').should('exist');
cy.findAllByText('__TestSaveAs').should('exist');
});
});
});
4 changes: 2 additions & 2 deletions Composer/cypress/integration/ToDoBot.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ context('ToDo Bot', () => {

it('can open the main dialog', () => {
cy.findByTestId('ProjectTree').within(() => {
cy.findByText('__TestTodoSample').click();
cy.findAllByText('__TestTodoSample').last().click();
});
cy.withinEditor('PropertyEditor', () => {
cy.findByDisplayValue('__TestTodoSample').should('exist');
cy.findAllByDisplayValue('__TestTodoSample').should('exist');
});
});

Expand Down
25 changes: 17 additions & 8 deletions Composer/cypress/integration/TriggerCreation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ context('Creating a new trigger', () => {

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('AddFlyout').click();
cy.findByTestId('FlyoutNewTrigger').click();
cy.findByTestId('DialogHeader-__TestEmptyBot').within(() => {
cy.findByTestId('dialogMoreButton').click({ force: true });
});
cy.findAllByText('Add a trigger').click();
cy.findByTestId('triggerTypeDropDown').click();
cy.get('[title="Intent recognized"]').click();
cy.findByTestId('TriggerName').type('myTrigger1');
Expand All @@ -23,8 +26,10 @@ context('Creating a new trigger', () => {
cy.findAllByText('myTrigger1').should('exist');

//on Dialog Event trigger
cy.findByTestId('AddFlyout').click();
cy.findByTestId('FlyoutNewTrigger').click();
cy.findByTestId('DialogHeader-__TestEmptyBot').within(() => {
cy.findByTestId('dialogMoreButton').click({ force: true });
});
cy.findAllByText('Add a trigger').click();
cy.findByTestId('triggerTypeDropDown').click();
cy.get('[title="Dialog events"]').click();
cy.findByTestId('eventTypeDropDown').click();
Expand All @@ -33,17 +38,21 @@ context('Creating a new trigger', () => {
cy.findAllByText('Begin dialog event').should('exist');

// custom event
cy.findByTestId('AddFlyout').click();
cy.findByTestId('FlyoutNewTrigger').click();
cy.findByTestId('DialogHeader-__TestEmptyBot').within(() => {
cy.findByTestId('dialogMoreButton').click({ force: true });
});
cy.findAllByText('Add a trigger').click();
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('AddFlyout').click();
cy.findByTestId('FlyoutNewTrigger').click();
cy.findByTestId('DialogHeader-__TestEmptyBot').within(() => {
cy.findByTestId('dialogMoreButton').click({ force: true });
});
cy.findAllByText('Add a trigger').click();
cy.findByTestId('triggerTypeDropDown').click();
cy.get('[title="Activities"]').click();
cy.findByTestId('activityTypeDropDown').click();
Expand Down
2 changes: 1 addition & 1 deletion Composer/cypress/integration/VisualDesigner.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ context('Visual Designer', () => {
cy.createBot('TodoSample');
// Return to Main.dialog
cy.findByTestId('ProjectTree').within(() => {
cy.findByText('__TestTodoSample').click();
cy.findAllByText('__TestTodoSample').last().click();
});
});

Expand Down
7 changes: 3 additions & 4 deletions Composer/cypress/support/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ import axios from 'axios';
import './commands';

beforeEach(() => {

cy.exec('yarn test:integration:clean');
window.localStorage.setItem('composer:OnboardingState', JSON.stringify({ complete: true }));
window.sessionStorage.setItem('composer:ProjectIdCache', '');
cy.request('post', '/api/settings', {
settings: {
telemetry: {
allowDataCollection: false
}
}
allowDataCollection: false,
},
},
});
});

Expand Down
Loading

0 comments on commit 05aa579

Please sign in to comment.