[GH-42] Cypress tests for login actions (#1679)
* Testing API added to server:
- registered only if `enableTestingAPI` is set to `true` in the config file
- has only one route `test/reset`
- reset clears the tables in db for blocks, users, sessions
- functions `DeleteAllBlocks` and `DeleteAllUsers` added to `Store` interface
- new functions implemented for `SQLStore`
* Cypress tests (initial version) for login actions added:
- redirect to login page,
- register user,
- test for loading home page deleted,
- allow js in `tsconfig.json` for cypress tests.
* Cypress tests for login actions:
- check that main page with workspace is visible after registration,
- initial version of test for login of register user.
* Cypress tests for login actions:
- function for checking that workspace is available added,
- functions for login and logout added,
- test for password change added,
- session parameters added to server config for cypress testing.
* Switch Cypress tests to typescript.
* Use ids for inputs instead of placeholder text.
* Use cypress request for login without loading login page.
* Cypress custom command for login added.
* Cypress tests fixed:
- new cypress commands for server reset, register/login user
- single test for "create and delete board/card"
- fixes for `BoardPage` component useEffect callbacks
- npm script `runserver-test` doesn't use single user mode
* Deletion of all blocks changed:
- also deletes blocks from history
- public function renamed to DeleteAllBlocksPermanently
- code for mocks and public methods generated
* Server tests for files fixed on windows.
* Cypress tests for the registration of second user via invite link added.
* Added `baseUrl` in main `tsconfig.json` (required by cypress configuration).
* Cypress test fixed. Comments as well as log messages added.
* Log a message if testing API is enabled.
* Single cypress test for register/login actions.
* Revert changes to server.
* More convenient cypress commands:
- all API calls made as separate commands
- declarations for commands moved to separate global.d.ts file
- utility functions moved after test actions in 'Login actions' test
2021-11-22 16:59:01 +01:00
|
|
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
|
|
// See LICENSE.txt for license information.
|
|
|
|
|
|
|
|
declare namespace Cypress {
|
|
|
|
type LoginData = {
|
|
|
|
username: string
|
|
|
|
password: string
|
|
|
|
}
|
|
|
|
type UserData = LoginData & {
|
|
|
|
email: string
|
|
|
|
}
|
|
|
|
interface Chainable {
|
|
|
|
apiRegisterUser: (data: UserData, token?: string, failOnError?: boolean) => Chainable
|
|
|
|
apiLoginUser: (data: LoginData) => Chainable
|
|
|
|
apiGetMe: () => Chainable<string>
|
|
|
|
apiChangePassword: (userId: string, oldPassword: string, newPassword: string) => Chainable
|
|
|
|
apiInitServer: () => Chainable
|
2022-03-29 22:45:20 +02:00
|
|
|
apiDeleteBoard: (id: string) => Chainable
|
2021-12-15 17:57:58 +01:00
|
|
|
apiResetBoards: () => Chainable
|
2022-02-28 12:28:16 +01:00
|
|
|
apiSkipTour: (userID: string) => Chainable
|
|
|
|
|
2021-12-15 17:57:58 +01:00
|
|
|
uiCreateNewBoard: (title?: string) => Chainable
|
|
|
|
uiAddNewGroup: (name?: string) => Chainable
|
2022-01-13 17:26:27 +01:00
|
|
|
uiAddNewCard: (title?: string, columnIndex?: number) => Chainable
|
2022-01-07 19:58:28 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a board on a given menu item.
|
|
|
|
*
|
|
|
|
* @param {string} item - one of the template menu options, ex. 'Empty board'
|
|
|
|
*/
|
|
|
|
uiCreateBoard: (item: string) => Chainable
|
2022-02-02 09:38:57 +01:00
|
|
|
uiCreateEmptyBoard: () => Chainable
|
[GH-42] Cypress tests for login actions (#1679)
* Testing API added to server:
- registered only if `enableTestingAPI` is set to `true` in the config file
- has only one route `test/reset`
- reset clears the tables in db for blocks, users, sessions
- functions `DeleteAllBlocks` and `DeleteAllUsers` added to `Store` interface
- new functions implemented for `SQLStore`
* Cypress tests (initial version) for login actions added:
- redirect to login page,
- register user,
- test for loading home page deleted,
- allow js in `tsconfig.json` for cypress tests.
* Cypress tests for login actions:
- check that main page with workspace is visible after registration,
- initial version of test for login of register user.
* Cypress tests for login actions:
- function for checking that workspace is available added,
- functions for login and logout added,
- test for password change added,
- session parameters added to server config for cypress testing.
* Switch Cypress tests to typescript.
* Use ids for inputs instead of placeholder text.
* Use cypress request for login without loading login page.
* Cypress custom command for login added.
* Cypress tests fixed:
- new cypress commands for server reset, register/login user
- single test for "create and delete board/card"
- fixes for `BoardPage` component useEffect callbacks
- npm script `runserver-test` doesn't use single user mode
* Deletion of all blocks changed:
- also deletes blocks from history
- public function renamed to DeleteAllBlocksPermanently
- code for mocks and public methods generated
* Server tests for files fixed on windows.
* Cypress tests for the registration of second user via invite link added.
* Added `baseUrl` in main `tsconfig.json` (required by cypress configuration).
* Cypress test fixed. Comments as well as log messages added.
* Log a message if testing API is enabled.
* Single cypress test for register/login actions.
* Revert changes to server.
* More convenient cypress commands:
- all API calls made as separate commands
- declarations for commands moved to separate global.d.ts file
- utility functions moved after test actions in 'Login actions' test
2021-11-22 16:59:01 +01:00
|
|
|
}
|
|
|
|
}
|