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

refactor: convert cypress tests to typescript #1630

Merged
merged 30 commits into from
Nov 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
6bef8c4
remove eslint typechecking rules
a-b-r-o-w-n Nov 19, 2019
dd03ea0
consolidate tsconfig
a-b-r-o-w-n Nov 19, 2019
e409315
set up cypress for typescript
a-b-r-o-w-n Nov 19, 2019
8057cf7
remove unused files
a-b-r-o-w-n Nov 19, 2019
bf4fd91
only need to lint ts and tsx
a-b-r-o-w-n Nov 19, 2019
bc9cbed
use base tsconifg
a-b-r-o-w-n Nov 19, 2019
ed25d99
fix lint errors and TS errors
a-b-r-o-w-n Nov 19, 2019
6a00450
set up integration tests for typescript
a-b-r-o-w-n Nov 19, 2019
a2a88cb
remove old js files
a-b-r-o-w-n Nov 19, 2019
2d22ec7
configure eslint for cypress
a-b-r-o-w-n Nov 19, 2019
ed374ea
convert support files to typescript
a-b-r-o-w-n Nov 19, 2019
9d20479
fix create bot command
a-b-r-o-w-n Nov 20, 2019
5983495
remove waits
a-b-r-o-w-n Nov 20, 2019
4cc6f91
update create bot spec
a-b-r-o-w-n Nov 20, 2019
a27d175
restore before each cleanup task
a-b-r-o-w-n Nov 20, 2019
da9d1fd
convert home page spec to typescript
a-b-r-o-w-n Nov 21, 2019
7e573e1
convert LeftNavBar spec to typescript
a-b-r-o-w-n Nov 21, 2019
64b6228
convert LGPage spec to typescript
a-b-r-o-w-n Nov 21, 2019
929ccc8
convert LuisDeploy spec to typescript
a-b-r-o-w-n Nov 21, 2019
bbc1a5c
convert LUPage spec to typescript
a-b-r-o-w-n Nov 21, 2019
569169a
convert NewDialog spec to typescript
a-b-r-o-w-n Nov 21, 2019
5c4eaac
convert NotificationPage spec to typescript
a-b-r-o-w-n Nov 21, 2019
c15e29b
convert Onboarding spec to typescript
a-b-r-o-w-n Nov 21, 2019
7245e44
convert RemoveDialog spec to typescript
a-b-r-o-w-n Nov 21, 2019
5dde974
remove commented waits
a-b-r-o-w-n Nov 21, 2019
cb0ea64
convert SaveAs spec to typescript
a-b-r-o-w-n Nov 21, 2019
176314e
remove switch condition spec
a-b-r-o-w-n Nov 21, 2019
51450a1
convert ToDo spec to typescript
a-b-r-o-w-n Nov 21, 2019
f94ceb1
convert VisualDesigner spec to typescript
a-b-r-o-w-n Nov 21, 2019
507da0f
remove unused cypress commands
a-b-r-o-w-n Nov 21, 2019
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
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
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/// <reference types="Cypress" />
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

context('check language understanding page', () => {
context('LU Page', () => {
before(() => {
cy.visit(Cypress.env('COMPOSER_URL'));
cy.createBot('ToDoBotWithLuisSample');
});

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

// left nav tree
cy.contains('ToDoBotWithLuisSample.Main');
Expand All @@ -19,18 +20,23 @@ context('check language understanding page', () => {
cy.get('@switchButton').should('be.disabled');

// by default is table view
cy.get('[data-testid="LUEditor"] [data-testid="table-view"]').should('exist');
cy.findByTestId('LUEditor')
.findByTestId('table-view')
.should('exist');

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

// goto edit-mode
cy.get('@switchButton').click();
cy.get('[data-testid="LUEditor"] .monaco-editor').should('exist');
cy.findByTestId('LUEditor')
.get('.monaco-editor')
.should('exist');

// back to all table view
cy.get('.dialogNavTree button[title="All"]').click();
cy.get('[data-testid="LUEditor"] [data-testid="table-view"]').should('exist');
cy.findByTestId('LUEditor')
.findByTestId('table-view')
.should('exist');
});
});
18 changes: 0 additions & 18 deletions Composer/cypress/integration/LeftNavBar.spec.js

This file was deleted.

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

context('Left Nav Bar', () => {
beforeEach(() => {
cy.visit(Cypress.env('COMPOSER_URL'));
cy.createBot('TodoSample');
});

it('can expand left Nav Bar', () => {
cy.findByTestId('LeftNavButton').click();
cy.findByTestId('LeftNav-CommandBarButtonDesign Flow').should('exist');
cy.findByTestId('LeftNav-CommandBarButtonBot Responses').click();
cy.url().should('include', 'language-generation');
cy.findByTestId('LeftNav-CommandBarButtonUser Input').click();
cy.url().should('include', 'language-understanding');
cy.findByTestId('LeftNav-CommandBarButtonSettings').click();
cy.url().should('include', 'setting');
});
});
Loading