-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: convert cypress tests to typescript (#1630)
* remove eslint typechecking rules causes too many issues with vscode for now * consolidate tsconfig * set up cypress for typescript * remove unused files * only need to lint ts and tsx * use base tsconifg * fix lint errors and TS errors * set up integration tests for typescript * remove old js files * configure eslint for cypress * convert support files to typescript * fix create bot command * remove waits * update create bot spec * restore before each cleanup task * convert home page spec to typescript * convert LeftNavBar spec to typescript * convert LGPage spec to typescript * convert LuisDeploy spec to typescript * convert LUPage spec to typescript * convert NewDialog spec to typescript * convert NotificationPage spec to typescript * convert Onboarding spec to typescript * convert RemoveDialog spec to typescript * remove commented waits * convert SaveAs spec to typescript * remove switch condition spec too unstable * convert ToDo spec to typescript * convert VisualDesigner spec to typescript * remove unused cypress commands
- Loading branch information
1 parent
29b4232
commit 2f96b52
Showing
78 changed files
with
1,259 additions
and
994 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
extends: ['../.eslintrc.js', 'plugin:cypress/recommended'], | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}); | ||
}); |
17 changes: 11 additions & 6 deletions
17
Composer/cypress/integration/LGPage.spec.js → Composer/cypress/integration/LGPage.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}); | ||
}); |
Oops, something went wrong.