Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ jobs:
continue-on-error: true
run: yarn test:integration
working-directory: Composer
continue-on-error: true
env:
CYPRESS_COMPOSER_URL: http://localhost:5000
- name: Archive E2E Failures
continue-on-error: true
uses: actions/upload-artifact@v1
if: failure()
with:
name: cypress
path: Composer/cypress/screenshots
Expand Down
27 changes: 22 additions & 5 deletions BotProject/CSharp/BotManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void SetCurrent(string botDir)
.UseLanguageGeneration(resourceExplorer, "common.lg")
.Use(new RegisterClassMiddleware<IConfiguration>(Config))
.Use(new InspectionMiddleware(inspectionState, userState, conversationState, credentials));

adapter.OnTurnError = async (turnContext, exception) =>
{
await turnContext.SendActivityAsync(exception.Message).ConfigureAwait(false);
Expand All @@ -104,7 +104,7 @@ public void SetCurrent(string botDir)
CurrentBot = new ComposerBot("Main.dialog", conversationState, userState, resourceExplorer, DebugSupport.SourceMap);
}

public void SetCurrent(Stream fileStream, string endpointKey = null, string appPwd = null)
public void SetCurrent(Stream fileStream, string endpointKey = null, string appPwd = null, string qnaEndpointKey = null)
{
lock (Locker)
{
Expand All @@ -114,12 +114,12 @@ public void SetCurrent(Stream fileStream, string endpointKey = null, string appP
// extract to bot folder
var extractPath = ExtractFile(downloadPath, GenNewBotDir());

RetrieveSettingsFile(extractPath, endpointKey, appPwd);
RetrieveSettingsFile(extractPath, endpointKey, appPwd, qnaEndpointKey);
SetCurrent(extractPath);
}
}

public void RetrieveSettingsFile(string extractPath, string endpointKey, string appPwd)
public void RetrieveSettingsFile(string extractPath, string endpointKey, string appPwd, string qnaEndpointKey)
{
var settingsPaths = Directory.GetFiles(extractPath, "appsettings.json", SearchOption.AllDirectories);
if (settingsPaths.Length == 0)
Expand Down Expand Up @@ -158,6 +158,11 @@ public void RetrieveSettingsFile(string extractPath, string endpointKey, string
{
AddOAuthConfig(appPwd);
}

if (!string.IsNullOrEmpty(qnaEndpointKey))
{
AddQnaConfig(qnaEndpointKey);
}
}

public void AddLuisConfig(string extractPath, LuisConfig luisConfig, string endpointKey)
Expand Down Expand Up @@ -197,6 +202,18 @@ private void AddOAuthConfig(string appPwd)
}
}

private void AddQnaConfig(string qnaKey)
{
if (string.IsNullOrEmpty(qnaKey))
{
this.Config["qna:endpointKey"] = string.Empty;
}
else
{
this.Config["qna:endpointKey"] = qnaKey;
}
}

private string GenNewBotDir()
{
return System.Guid.NewGuid().ToString("N");
Expand Down Expand Up @@ -226,4 +243,4 @@ private string ExtractFile(string filePath, string dstDirPath)
return finalDstPath;
}
}
}
}
8 changes: 4 additions & 4 deletions BotProject/CSharp/Controllers/BotAdminController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ public BotAdminController(BotManager botManager)
this.botManager = botManager;
}

[HttpGet]
[HttpGet]
public IActionResult GetAsync()
{
return Ok();
}

[HttpPost]
public IActionResult PostAsync(IFormFile file, [FromForm]string endpointKey = null, [FromForm]string microsoftAppPassword = null)
public IActionResult PostAsync(IFormFile file, [FromForm]string endpointKey = null, [FromForm]string microsoftAppPassword = null, [FromForm]string qnaEndpointKey = null)
{
if (file == null)
{
return BadRequest();
}

botManager.SetCurrent(file.OpenReadStream(), endpointKey, microsoftAppPassword);
botManager.SetCurrent(file.OpenReadStream(), endpointKey, microsoftAppPassword, qnaEndpointKey);

return Ok();
}
}
Expand Down
2 changes: 1 addition & 1 deletion BotProject/CSharp/IBotManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ public interface IBotManager

IBot CurrentBot { get; }

void SetCurrent(Stream fileStream, string endpointKey = null, string appPwd = null);
void SetCurrent(Stream fileStream, string endpointKey = null, string appPwd = null, string qnaKey = null);
}
}
23 changes: 12 additions & 11 deletions Composer/cypress/integration/Breadcrumb.spec.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
/// <reference types="Cypress" />

context('breadcrumb', () => {

beforeEach(() => {
before(() => {
cy.visit(Cypress.env('COMPOSER_URL'));
cy.createBot('TodoSample');
cy.createBot('ToDoBot');
cy.wait(100);

});

beforeEach(() => {
// Return to Main.dialog
cy.get('[data-testid="ProjectTree"]').within(() => {
cy.wait(1000);
cy.getByText('__TestTodoSample.Main').click();
cy.getByText('__TestToDoBot.Main').click();
cy.wait(1000);
});
});
Expand All @@ -19,7 +20,7 @@ context('breadcrumb', () => {
// Should path = main dialog at first render
cy.getByTestId('Breadcrumb')
.invoke('text')
.should('contain', '__TestTodoSample.Main');
.should('contain', '__TestToDoBot.Main');

// Click on AddToDo dialog
cy.get('[data-testid="ProjectTree"]').within(() => {
Expand All @@ -31,13 +32,13 @@ context('breadcrumb', () => {
cy.wait(1000);
// Return to Main.dialog
cy.get('[data-testid="ProjectTree"]').within(() => {
cy.getByText('__TestTodoSample.Main').click();
cy.getByText('__TestToDoBot.Main').click();
cy.wait(100);
});

cy.getByTestId('Breadcrumb')
.invoke('text')
.should('contain', '__TestTodoSample');
.should('contain', '__TestToDoBot');
});

it('can show event name in breadcrumb', () => {
Expand All @@ -50,7 +51,7 @@ context('breadcrumb', () => {

cy.getByTestId('Breadcrumb')
.invoke('text')
.should('match', /AddToDo.*Dialog started (BeginDialog)*/);
.should('match', /AddToDo.*Event received.*/);
});

it('can show action name in breadcrumb', () => {
Expand All @@ -63,13 +64,13 @@ context('breadcrumb', () => {
// Click on an action
cy.withinEditor('VisualEditor', () => {
cy.getByTestId('RuleEditor').within(() => {
cy.getByText('Send a response').click();
cy.getByText('Set a Property').click();
cy.wait(500);
});
});

cy.getByTestId('Breadcrumb')
.invoke('text')
.should('match', /__TestTodoSample.Main.*Conversation started \(ConversationUpdate\).*Send a response/);
.should('match', /ToDoBot.+Set a Property/);
});
});
2 changes: 1 addition & 1 deletion Composer/cypress/integration/CreateNewBot.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ context('Creating a new bot', () => {
it('can create a bot from the ToDo template', () => {
cy.get('input[data-testid="Create from template"]').click({ force: true });
cy.wait(100);
cy.get('[data-testid="TodoSample"]').click();
cy.get('[data-testid="ToDoBot"]').click();
cy.wait(100);
cy.get('button[data-testid="NextStepButton"]').click();
cy.wait(100);
Expand Down
6 changes: 3 additions & 3 deletions Composer/cypress/integration/LGPage.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
context('check language generation page', () => {
beforeEach(() => {
cy.visit(Cypress.env('COMPOSER_URL'));
cy.createBot('TodoSample');
cy.createBot('ToDoBot');
});

it('can open language generation page', () => {
cy.get('[data-testid="LeftNav-CommandBarButtonBot Responses"]').click();
// left nav tree
cy.contains('TodoSample.Main');
cy.contains('ToDoBot.Main');
cy.contains('All');

cy.get('.toggleEditMode button').as('switchButton');
Expand All @@ -24,7 +24,7 @@ context('check language generation page', () => {
cy.get('@switchButton').click();

// nav to Main dialog
cy.get('.dialogNavTree button[title="__TestTodoSample.Main"]').click();
cy.get('.dialogNavTree button[title="__TestToDoBot.Main"]').click();
cy.wait(300);

// dialog filter, edit mode button is disabled.
Expand Down
8 changes: 4 additions & 4 deletions Composer/cypress/integration/LUPage.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
context('check language understanding page', () => {
before(() => {
cy.visit(Cypress.env('COMPOSER_URL'));
cy.createBot('ToDoBotWithLuisSample');
cy.createBot('ToDoLuisBot');
});

it('can open language understanding page', () => {
cy.get('[data-testid="LeftNav-CommandBarButtonUser Input"]').click();

// left nav tree
cy.contains('ToDoBotWithLuisSample.Main');
cy.contains('ToDoLuisBot.Main');
cy.contains('All');

cy.get('.toggleEditMode button').as('switchButton');
Expand All @@ -21,8 +21,8 @@ context('check language understanding page', () => {
// by default is table view
cy.get('[data-testid="LUEditor"] [data-testid="table-view"]').should('exist');

// nav to ToDoBotWithLuisSample.main dialog
cy.get('.dialogNavTree button[title="__TestToDoBotWithLuisSample.Main"]').click({ multiple: true });
// nav to ToDoLuisBot.main dialog
cy.get('.dialogNavTree button[title="__TestToDoLuisBot.Main"]').click({ multiple: true });
cy.wait(300);

// goto edit-mode
Expand Down
2 changes: 1 addition & 1 deletion Composer/cypress/integration/LeftNavBar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
context('check Nav Expandion ', () => {
beforeEach(() => {
cy.visit(Cypress.env('COMPOSER_URL'));
cy.createBot('TodoSample');
cy.createBot('ToDoBot');
});

it('can expand left Nav Bar', () => {
Expand Down
6 changes: 3 additions & 3 deletions Composer/cypress/integration/LuisDeploy.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ context('Luis Deploy', () => {
cy.route('POST', '/api/launcher/sync', 'OK');
cy.route('POST', 'api/projects/opened/settings', 'OK');
cy.visit(Cypress.env('COMPOSER_URL'));
cy.createBot('ToDoBotWithLuisSample');
cy.createBot('ToDoLuisBot');
});

it('can deploy luis success', () => {
Expand All @@ -33,7 +33,7 @@ context('Luis Deploy', () => {
.type('0d4991873f334685a9686d1b48e0ff48');
// wait for the debounce interval of sync settings
cy.wait(1000);
cy.getByText('OK').click();
cy.getByText('Publish').click();
cy.wait(1000);
cy.getByText('Restart Bot').should('exist');
cy.getByText('Test in Emulator').should('exist');
Expand All @@ -49,6 +49,6 @@ context('Luis Deploy', () => {
cy.getByText('Try again').click();
cy.wait(1000);
cy.get('[data-testid="AuthoringKeyInput"]').type('no-id');
cy.getByText('OK').click();
cy.getByText('Publish').click();
});
});
2 changes: 1 addition & 1 deletion Composer/cypress/integration/NewDialog.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
context('Creating a new Dialog', () => {
beforeEach(() => {
cy.visit(Cypress.env('COMPOSER_URL'));
cy.copyBot('TodoSample', 'ToDoBotCopy');
cy.copyBot('ToDoBot', 'ToDoBotCopy');
cy.get('[data-testid="LeftNav-CommandBarButtonDesign Flow"]').click();
});

Expand Down
24 changes: 12 additions & 12 deletions Composer/cypress/integration/RemoveDialog.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
context('RemoveDialog', () => {
beforeEach(() => {
cy.visit(Cypress.env('COMPOSER_URL'));
cy.copyBot('ToDoBotWithLuisSample', 'ToDoBotWithLuisSampleSpec');
cy.copyBot('ToDoLuisBot', 'ToDoLuisBotSpec');
});

it('can remove dialog', () => {
cy.getByTestId('ProjectTree').within(() => {
cy.getByTestId('DialogTreeItemtriggers[4]').within(() => {
cy.getByTestId('dialogMoreButton')
.first()
.invoke('attr', 'style', 'visibility: visible')
.click();
});
});

cy.get('[data-testid="ProjectTree"]').within(() => {
cy.get('[data-testid="DialogTreeItemAddItem"]')
.click()
.trigger('mousedown');
cy.get('[data-testid="dialogMoreButton"]')
.first()
.invoke('attr', 'style', 'visibility: visible')
.click();
});
cy.get('.ms-ContextualMenu-linkContent > .ms-ContextualMenu-itemText').within(() => {
cy.getByText('Delete').click();
});

cy.getByTestId('ProjectTree').within(() => {
cy.getByText('Yes').click();
cy.get('[data-testid="ProjectTree"]').within(() => {
cy.get('[title="AddItem"]').should('not.exist');
});
});
Expand Down
5 changes: 2 additions & 3 deletions Composer/cypress/integration/SaveAs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ context('Saving As', () => {
});

it('can create a new bot from an existing bot', () => {
cy.createBot('ToDoBotWithLuisSample');
cy.createBot('ToDoLuisBot');
cy.get('[data-testid="LeftNav-CommandBarButtonHome"]').click();
cy.getByText('Save as').click();

cy.get('input[data-testid="NewDialogName"]').type('__TestSaveAs');
cy.get('input[data-testid="NewDialogName"]').type('{enter}');
cy.wait(1000);

cy.get('[data-testid="ProjectTree"]').within(() => {
cy.getByText('__TestSaveAs.Main').should('exist');
cy.getByText('ViewCollection').should('exist');
cy.getByText('ShowItems').should('exist');
});
});
});
8 changes: 4 additions & 4 deletions Composer/cypress/integration/ToDoBot.spec.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/// <reference types="Cypress" />

context('ToDo Bot', () => {
beforeEach(() => {
before(() => {
cy.visit(Cypress.env('COMPOSER_URL'));
cy.createBot('TodoSample');
cy.createBot('ToDoBot');
});

it('can open the main dialog', () => {
cy.get('[data-testid="ProjectTree"]').within(() => {
cy.getByText('__TestTodoSample.Main').click();
cy.getByText('__TestToDoBot.Main').click();
cy.wait(100);
});
cy.withinEditor('FormEditor', () => {
cy.getByDisplayValue('__TestTodoSample').should('exist');
cy.getByDisplayValue('__TestToDoBot').should('exist');
});
});

Expand Down
4 changes: 2 additions & 2 deletions Composer/cypress/integration/VisualDesigner.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
context('Visual Designer', () => {
before(() => {
cy.visit(Cypress.env('COMPOSER_URL'));
cy.createBot('TodoSample');
cy.createBot('ToDoBot');
cy.wait(100);
});

beforeEach(() => {
// Return to Main.dialog
cy.get('[data-testid="ProjectTree"]').within(() => {
cy.getByText('__TestTodoSample.Main').click();
cy.getByText('__TestToDoBot.Main').click();
cy.wait(100);
});
});
Expand Down
Loading