Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…mposer into toanzian/update-fix
  • Loading branch information
tonyanziano committed May 6, 2020
2 parents 2582673 + 52a54a4 commit d3312a0
Show file tree
Hide file tree
Showing 425 changed files with 7,644 additions and 3,327 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

* @cwhitten @boydc2014 @a-b-r-o-w-n

/BotProject/ @boydc2014 @luhan2017
/runtime/ @boydc2014 @luhan2017 @carlosscastro @benbrown

/Composer/ @cwhitten @boydc2014 @a-b-r-o-w-n @corinagum @beyackle @srinaath @tonyanziano

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ jobs:
dotnet-version: "3.1.102" # SDK Version to use.
- name: dotnet build
run: dotnet build
working-directory: BotProject/Templates/CSharp
working-directory: runtime/dotnet
- name: dotnet test
run: dotnet test
working-directory: BotProject/Templates/CSharp
working-directory: runtime/dotnet/tests

docker-build:
name: Docker Build
Expand Down
1 change: 0 additions & 1 deletion BotProject/Node/README.md

This file was deleted.

31 changes: 0 additions & 31 deletions BotProject/Templates/CSharp/BotProject.sln

This file was deleted.

44 changes: 0 additions & 44 deletions BotProject/Templates/CSharp/README.md

This file was deleted.

19 changes: 0 additions & 19 deletions BotProject/Templates/CSharp/Tests/Tests.csproj

This file was deleted.

12 changes: 6 additions & 6 deletions Composer/cypress/integration/NotificationPage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ context('Notification Page', () => {
cy.get('@switchButton').click();
cy.get('textarea').type('#');

cy.get('[data-testid="notifications-info-button"]').click();
cy.findByTestId('LeftNav-CommandBarButtonNotifications').click();

cy.get('[data-testid="notifications-table-view"]').within(() => {
cy.findByTestId('notifications-table-view').within(() => {
cy.findAllByText('common.en-us.lg')
.should('exist')
.first()
Expand All @@ -37,9 +37,9 @@ context('Notification Page', () => {
cy.get('.toggleEditMode button').click();
cy.get('textarea').type('t');

cy.get('[data-testid="notifications-info-button"]').click();
cy.findByTestId('LeftNav-CommandBarButtonNotifications').click();

cy.get('[data-testid="notifications-table-view"]').within(() => {
cy.findByTestId('notifications-table-view').within(() => {
cy.findAllByText('__testtodobotwithluissample.en-us.lu')
.should('exist')
.first()
Expand Down Expand Up @@ -71,9 +71,9 @@ context('Notification Page', () => {
.wait(1000);
});

cy.get('[data-testid="notifications-info-button"]').click();
cy.findByTestId('LeftNav-CommandBarButtonNotifications').click();

cy.get('[data-testid="notifications-table-view"]').within(() => {
cy.findByTestId('notifications-table-view').within(() => {
cy.findAllByText('__testtodobotwithluissample.dialog')
.should('exist')
.first()
Expand Down
1 change: 0 additions & 1 deletion Composer/cypress/integration/Onboarding.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

context('Onboarding', () => {
beforeEach(() => {
window.localStorage.setItem('composer:OnboardingState', JSON.stringify({ complete: false }));
cy.visit(Cypress.env('COMPOSER_URL'));
cy.createBot('TodoSample', 'Onboarding');

Expand Down
2 changes: 1 addition & 1 deletion Composer/cypress/integration/ToDoBot.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

context('ToDo Bot', () => {
before(() => {
beforeEach(() => {
cy.visit(Cypress.env('COMPOSER_URL'));
cy.createBot('TodoSample');
});
Expand Down
15 changes: 8 additions & 7 deletions Composer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"license": "MIT",
"private": true,
"resolutions": {
"@types/react": "16.9.23"
"@types/react": "16.9.23",
"mkdirp": "^0.5.2"
},
"engines": {
"node": ">=12"
Expand Down Expand Up @@ -33,14 +34,17 @@
"build:server": "yarn workspace @bfc/server build",
"build:client": "yarn workspace @bfc/client build",
"build:tools": "yarn workspace @bfc/tools build:all",
"build:plugins": "cd plugins/localPublish && yarn install && yarn build",
"build:plugins": "yarn build:plugins:localpublish && yarn build:plugins:samples && yarn build:plugins:azurePublish",
"build:plugins:localpublish": "cd plugins/localPublish && yarn install && yarn build",
"build:plugins:samples": "cd plugins/samples && yarn install && yarn build",
"build:plugins:azurePublish": "cd plugins/azurePublish && yarn install && yarn build",
"start": "cross-env NODE_ENV=production PORT=3000 yarn start:server",
"startall": "node scripts/update.js && yarn start",
"start:dev": "concurrently \"npm:start:client\" \"npm:start:server:dev\"",
"start:client": "yarn workspace @bfc/client start",
"start:server": "yarn workspace @bfc/server start",
"start:server:dev": "yarn workspace @bfc/server start:dev",
"runtime": "cd ../BotProject/CSharp/ && dotnet build && dotnet run",
"runtime": "cd ../runtime/dotnet/azurewebapp && dotnet build && dotnet run",
"test": "yarn typecheck && jest",
"test:watch": "yarn typecheck && jest --watch",
"test:coverage": "yarn test --coverage --no-cache --reporters=default",
Expand Down Expand Up @@ -100,9 +104,6 @@
"get-port": "^5.1.1",
"husky": "^1.3.1",
"lint-staged": "^8.1.0",
"mocha": "5.2.0",
"mocha-junit-reporter": "^1.22.0",
"mocha-multi-reporters": "^1.1.7",
"prettier": "^1.19.1",
"react-testing-library": "^6.0.2",
"rimraf": "^2.6.3",
Expand All @@ -113,4 +114,4 @@
"dependencies": {
"cross-env": "^6.0.3"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,68 @@
// Licensed under the MIT License.

import * as React from 'react';
import { render, fireEvent } from '@bfc/test-utils';
import { render, fireEvent, getByLabelText, getByTestId } from '@bfc/test-utils';
import { Skill } from '@bfc/shared';

import Skills from '../../src/pages/skills';
import SkillList from '../../src/pages/skills/skill-list';
import SkillForm from '../../src/pages/skills/skill-form';
import { renderWithStore } from '../testUtils';

const items = [
const items: Skill[] = [
{
manifestUrl: 'https://yuesuemailskill0207-gjvga67.azurewebsites.net/manifest/manifest-1.0.json',
name: 'Email Skill',
description: 'The Email skill provides email related capabilities and supports Office and Google calendars.',
endpointUrl: 'https://yuesuemailskill0207-gjvga67.azurewebsites.net/api/messages',
msAppId: '79432da8-0f7e-4a16-8c23-ddbba30ae85d',
protocol: '',
endpoints: [],
body: '',
},
{
manifestUrl: 'https://hualxielearn2-snskill.azurewebsites.net/manifest/manifest-1.0.json',
name: 'Point Of Interest Skill',
description: 'The Point of Interest skill provides PoI search capabilities leveraging Azure Maps and Foursquare.',
endpointUrl: 'https://hualxielearn2-snskill.azurewebsites.net/api/messages',
msAppId: 'e2852590-ea71-4a69-9e44-e74b5b6cbe89',
protocol: '',
endpoints: [],
body: '',
},
];

describe('Skill page', () => {
it('can add a new skill', () => {
const { getByText } = renderWithStore(<Skills />);

const button = getByText('Connect to a new skill');
fireEvent.click(button);

const manifestUrl = getByLabelText(document.body, 'Manifest url');
expect(manifestUrl).toBeTruthy();

const cancel = getByTestId(document.body, 'SkillFormCancel');
fireEvent.click(cancel);
});
});

describe('<SkillList />', () => {
it('should render the SkillList', () => {
const { container } = render(<SkillList skills={items} />);
const { container } = render(<SkillList skills={items} projectId="test-project" onEdit={jest.fn()} />);
expect(container).toHaveTextContent('Email Skill');
expect(container).toHaveTextContent('Point Of Interest Skill');
});

it('should open/close skill form', () => {
const renderResult = render(<SkillList skills={items} />);
const createButton = renderResult.getByText('Connect to a new skill');
fireEvent.click(createButton);
it('can edit the skill', () => {
const onEdit = jest.fn();
const { getAllByTestId } = render(<SkillList skills={items} projectId="test-project" onEdit={onEdit} />);

const cancelButton = renderResult.getByText('Cancel');
fireEvent.click(cancelButton);
const editBtns = getAllByTestId('EditSkill');
editBtns.forEach((btn, i) => {
fireEvent.click(btn);
expect(onEdit).toHaveBeenCalledWith(i);
});
});
});

Expand All @@ -48,11 +74,11 @@ describe('<SkillForm />', () => {
});
const onDismiss = jest.fn(() => {});
const { getByLabelText, getByText } = render(
<SkillForm skills={items} editIndex={0} onSubmit={onSubmit} onDismiss={onDismiss} />
<SkillForm skills={items} editIndex={0} onSubmit={onSubmit} onDismiss={onDismiss} isOpen />
);

const urlInput = getByLabelText('Manifest url');
expect(urlInput.value).toBe(items[0].manifestUrl);
expect(urlInput.getAttribute('value')).toBe(items[0].manifestUrl);
fireEvent.change(urlInput, { target: { value: 'http://AwesomeSkill' } });

const submitButton = getByText('Confirm');
Expand Down
11 changes: 0 additions & 11 deletions Composer/packages/client/__tests__/testUtils/renderWithStore.jsx

This file was deleted.

31 changes: 31 additions & 0 deletions Composer/packages/client/__tests__/testUtils/renderWithStore.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import React from 'react';
import { render } from '@bfc/test-utils';
import mapValues from 'lodash/mapValues';

import { State } from '../../src/store/types';
import * as initialActions from '../../src/store/action';
import { initialState, StoreContext, StoreContextValue } from '../../src/store';

export function renderWithStore(subject, state: Partial<State> = {}, actions = {}) {
const store: StoreContextValue = {
actions: {
...mapValues(initialActions, () => jest.fn()),
...actions,
},
state: {
...initialState,
...state,
},
dispatch: jest.fn(),
resolvers: {
lgImportresolver: jest.fn(),
lgFileResolver: jest.fn(),
luFileResolver: jest.fn(),
},
};

return render(<StoreContext.Provider value={store}>{subject}</StoreContext.Provider>);
}
4 changes: 2 additions & 2 deletions Composer/packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@uifabric/icons": "^7.3.4",
"@uifabric/styling": "^7.10.4",
"adaptive-expressions": "^4.8.0-preview-110700",
"axios": "^0.18.0",
"axios": "^0.19.2",
"botbuilder-lg": "^4.9.0-preview-119754",
"format-message": "^6.2.3",
"immer": "^5.2.0",
Expand Down Expand Up @@ -91,7 +91,7 @@
"fs-extra": "7.0.1",
"html-webpack-plugin": "4.0.0-beta.8",
"mini-css-extract-plugin": "0.8.0",
"optimize-css-assets-webpack-plugin": "5.0.3",
"optimize-css-assets-webpack-plugin": "^5.0.3",
"pnp-webpack-plugin": "1.5.0",
"postcss-flexbugs-fixes": "4.1.0",
"postcss-loader": "3.0.0",
Expand Down
Loading

0 comments on commit d3312a0

Please sign in to comment.