Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove Add toolbar dropdown button #4990

Merged
merged 3 commits into from
Nov 30, 2020
Merged
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
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
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
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ export const ProjectTree: React.FC<Props> = ({
width: 100%;
label: bot-header;
`}
data-testid={`BotHeader-${bot.name}`}
role="grid"
>
<TreeItem
Expand Down Expand Up @@ -436,6 +437,7 @@ export const ProjectTree: React.FC<Props> = ({
width: 100%;
label: dialog-header;
`}
data-testid={`DialogHeader-${dialog.displayName}`}
role="grid"
>
<TreeItem
Expand Down
38 changes: 0 additions & 38 deletions Composer/packages/client/src/pages/design/DesignPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -443,50 +443,12 @@ const DesignPage: React.FC<RouteComponentProps<{ dialogId: string; projectId: st
},
];

const getMenuItems = () => {
const items = [
{
'data-testid': 'FlyoutNewDialog',
key: 'adddialog',
text: formatMessage('Add new dialog'),
onClick: () => {
const id = skillId ?? projectId;
createDialogBegin([], onCreateDialogComplete(id), id);
},
},
{
'data-testid': 'FlyoutNewTrigger',
key: 'addtrigger',
text: formatMessage(`Add new trigger on {displayName}`, {
displayName: currentDialog?.displayName ?? '',
}),
onClick: () => {
if (!projectId || !currentDialog) return;
openNewTriggerModal(projectId, currentDialog.id);
},
},
];
return items;
};

const toolbarItems: IToolbarItem[] = [
{
type: 'element',
element: <DiagnosticsHeader onClick={() => navigateTo(createDiagnosticsPageUrl(rootProjectId))} />,
align: 'right',
},
{
type: 'dropdown',
text: formatMessage('Add'),
align: 'left',
dataTestid: 'AddFlyout',
buttonProps: {
iconProps: { iconName: 'Add' },
},
menuProps: {
items: getMenuItems(),
},
},
{
type: 'dropdown',
text: formatMessage('Edit'),
Expand Down