Skip to content

Commit

Permalink
Merge branch 'master' into liweitian/updateDefaultFolder
Browse files Browse the repository at this point in the history
  • Loading branch information
liweitian authored Nov 25, 2019
2 parents 88aacb5 + 9e70664 commit 96b8348
Show file tree
Hide file tree
Showing 89 changed files with 1,355 additions and 1,019 deletions.
12 changes: 8 additions & 4 deletions .github/actions/conventional-pr/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const validTypes = [
'ci',
'chore',
'revert',
'release',
];

const typeList = validTypes.map(t => ` - ${t}`).join('\n');
Expand All @@ -28,22 +29,25 @@ export function validateTitle(title: string): ValidationResult {
const hastype = validTypes.some(t => title.startsWith(`${t}: `));

if (!hastype) {
core.info(
`[Title] Missing type in title. Choose from the following:\n${typeList}`
errors.push(
`[Title] Must start with type (ex. 'feat: ').\nThe valid types are:\n${typeList}`
);
errors.push("[Title] Must start with type. i.e. 'feat: '");
}

return errors;
}

const refMatch = /(refs?|close(d|s)?|fix(ed|es)?) \#\d+/i;
const helpLink =
'https://help.github.com/en/github/managing-your-work-on-github/closing-issues-using-keywords';

export function validateBody(body: string): ValidationResult {
let errors: ValidationResult = [];

if (!refMatch.test(body)) {
errors.push('[Body] Must reference an issue.');
errors.push(
`[Body] Must reference an issue (ex. 'fixes #1234').\nSee ${helpLink} for more details.`
);
}

return errors;
Expand Down
1 change: 1 addition & 0 deletions BotProject/CSharp/Controllers/BotController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public BotController(BotManager botManager)
}

[HttpPost]
[HttpGet]
public async Task PostAsync()
{
// Delegate the processing of the HTTP POST to the adapter.
Expand Down
1 change: 1 addition & 0 deletions BotProject/CSharp/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)

app.UseDefaultFiles();
app.UseStaticFiles();
app.UseWebSockets();

//app.UseHttpsRedirection();
app.UseMvc();
Expand Down
1 change: 1 addition & 0 deletions BotProject/Templates/CSharp/Controllers/BotController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public BotController(IBotFrameworkHttpAdapter adapter, IBot bot)
}

[HttpPost]
[HttpGet]
public async Task PostAsync()
{
// Delegate the processing of the HTTP POST to the adapter.
Expand Down
1 change: 1 addition & 0 deletions BotProject/Templates/CSharp/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)

app.UseDefaultFiles();
app.UseStaticFiles();
app.UseWebSockets();

//app.UseHttpsRedirection();
app.UseMvc();
Expand Down
1 change: 0 additions & 1 deletion Composer/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module.exports = {
'eslint:recommended',
'plugin:prettier/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:@typescript-eslint/eslint-recommended',
'prettier/@typescript-eslint',
'plugin:@bfc/bfcomposer/recommended',
Expand Down
1 change: 1 addition & 0 deletions Composer/cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"**/examples/*",
"*.hot-update.js"
],
"supportFile": "cypress/support/index.ts",
"video": false,
"videoUploadOnPasses": false,
"viewportWidth": 1600,
Expand Down
3 changes: 3 additions & 0 deletions Composer/cypress/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['../.eslintrc.js', 'plugin:cypress/recommended'],
};
75 changes: 0 additions & 75 deletions Composer/cypress/integration/Breadcrumb.spec.js

This file was deleted.

66 changes: 66 additions & 0 deletions Composer/cypress/integration/Breadcrumb.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

context('breadcrumb', () => {
beforeEach(() => {
cy.visit(Cypress.env('COMPOSER_URL'));
cy.createBot('TodoSample');

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

function hasBreadcrumbItems(cy: Cypress.cy, items: (string | RegExp)[]) {
cy.findByTestId('Breadcrumb')
.get('li')
.should($li => {
items.forEach((item, idx) => {
expect($li.eq(idx)).to.contain(item);
});
});
}

it('can show dialog name in breadcrumb', () => {
// Should path = main dialog at first render
hasBreadcrumbItems(cy, ['__TestTodoSample.Main']);

// Click on AddToDo dialog
cy.findByTestId('ProjectTree').within(() => {
cy.findByText('AddToDo').click();
});
hasBreadcrumbItems(cy, ['AddToDo']);

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

hasBreadcrumbItems(cy, ['__TestTodoSample']);
});

it('can show event name in breadcrumb', () => {
cy.findByTestId('ProjectTree').within(() => {
cy.findByText('AddToDo').click();
cy.findByText('Dialog started (BeginDialog)').click();
});

hasBreadcrumbItems(cy, ['AddToDo', 'Dialog started (BeginDialog)']);
});

it('can show action name in breadcrumb', () => {
cy.findByTestId('ProjectTree').within(() => {
cy.findByText('Greeting (ConversationUpdate)').click();
});

// Click on an action
cy.withinEditor('VisualEditor', () => {
cy.findByTestId('RuleEditor').within(() => {
cy.findByText('Send a response').click();
});
});

hasBreadcrumbItems(cy, ['__TestTodoSample.Main', 'Greeting (ConversationUpdate)', 'Send a response']);
});
});
44 changes: 0 additions & 44 deletions Composer/cypress/integration/CreateNewBot.spec.js

This file was deleted.

35 changes: 35 additions & 0 deletions Composer/cypress/integration/CreateNewBot.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

context('Creating a new bot', () => {
beforeEach(() => {
cy.visit(Cypress.env('COMPOSER_URL'));
cy.findByTestId('LeftNav-CommandBarButtonHome').click();
cy.findByTestId('homePage-ToolBar-New').within(() => {
cy.findByText('New').click();
});
});

it('can create a new bot', () => {
cy.findByTestId('Create from scratch').click();
cy.findByTestId('NextStepButton').click();
cy.findByTestId('NewDialogName').type('{selectall}__TestNewProject{enter}');
cy.findByTestId('ProjectTree').within(() => {
cy.findByText('__TestNewProject.Main').should('exist');
});
});

it('can create a bot from the ToDo template', () => {
cy.findByTestId('Create from template').click();
cy.findByTestId('TodoSample').click();
cy.findByTestId('NextStepButton').click();
cy.findByTestId('NewDialogName').type('{selectall}__TestNewProject{enter}');
cy.findByTestId('ProjectTree').within(() => {
cy.findByText('__TestNewProject.Main').should('exist');
cy.findByText('AddToDo').should('exist');
cy.findByText('ClearToDos').should('exist');
cy.findByText('DeleteToDo').should('exist');
cy.findByText('ShowToDos').should('exist');
});
});
});
22 changes: 22 additions & 0 deletions Composer/cypress/integration/HomePage.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

context('Home Page ', () => {
beforeEach(() => {
cy.visit(Cypress.env('COMPOSER_URL'));
});

it('can open buttons in home page', () => {
cy.findByTestId('LeftNav-CommandBarButtonHome').click();
cy.findByTestId('homePage-ToolBar-New').click();
cy.findByText('Create from scratch?').should('exist');
cy.findByText('Cancel').should('exist');
cy.findByText('Cancel').click();
cy.findByTestId('homePage-ToolBar-Open').click();
cy.findByText('Select a Bot').should('exist');
cy.findByText('Cancel').should('exist');
cy.findByText('Cancel').click();
cy.findByTestId('homePage-body-New').click();
cy.findByText('Create from scratch?').should('exist');
});
});
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
/// <reference types="Cypress" />
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

context('check language generation page', () => {
context('LG Page', () => {
beforeEach(() => {
cy.visit(Cypress.env('COMPOSER_URL'));
cy.createBot('TodoSample');
});

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

cy.get('.toggleEditMode button').as('switchButton');

// by default is table view
cy.get('[data-testid="LGEditor"] [data-testid="table-view"]').should('exist');
cy.findByTestId('LGEditor')
.findByTestId('table-view')
.should('exist');
// goto edit-mode
cy.get('@switchButton').click();
cy.get('[data-testid="LGEditor"] .monaco-editor').should('exist');
cy.findByTestId('LGEditor')
.get('.monaco-editor')
.should('exist');

// back to table view
cy.get('@switchButton').click();

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

// dialog filter, edit mode button is disabled.
cy.get('@switchButton').should('be.disabled');
Expand Down
Loading

0 comments on commit 96b8348

Please sign in to comment.