ab3bf6312c
* Persistent user config (#2133) * Added user config API * Add unit tests * lint fix * Fixed webapp tests * Fixed webapp tests * Updated props in store after updating * Minor fixes * Removed redundent data from audit logs * Onboarding Tour (#2287) * Created private board * Roughly displayed tour * Synced with Dhama's changes * WIP * Trying to add GIF * Added 3 tour steps * WIP * WIP * WIP * checked in missed file * Synced with feature branch * WIp * Adde skip tour option * Fixed image loading for on-prem * Made tour work on presonal server: * Adde missed file * Adding telemetry * Adding telemetry * Added tour tip telemetry * Fixed pulsating dot styling for personal server * reverted personal config * Added reset tour button * Displayed share tour tip of feature is enabled * Lint fixes * Fixed webapp tests * Fixed webapp tests * Completed webapp tests * Completed webapp tests * Webapp lint fixes * Added server tests * Testing cypress skip tour fix * Fixed Cypress tests * Added share board tour step * Added share board tour step * webapp lint fixes * Updated logic to pick welcome board * Updated tests: * lint fixes * Updating UI changes * Fixed a bug causing card tour to re-appear * FIxed minor issue * FIxed bug where card tour didn't start in clickingh on card * Fixed tests * Make update user props use string instead of interface * Fixed a value type * Updating gif size * Updating resolution breakpoint * Updating tutorial tip * Updating view selector * Refactored tour components * Misc fixes * minor refactoring * GH-2258: allow date range to overflow (#2268) * allow date range to overflow * Fixed issue with date overflowing into neighbouring column Co-authored-by: Harshil Sharma <harshilsharma63@gmail.com> Co-authored-by: Mattermod <mattermod@users.noreply.github.com> * Update readme with accurate Linux standalone app build instructions (#2351) * Bump follow-redirects from 1.14.7 to 1.14.8 in /experiments/webext (#2339) Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.7 to 1.14.8. - [Release notes](https://github.com/follow-redirects/follow-redirects/releases) - [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.7...v1.14.8) --- updated-dependencies: - dependency-name: follow-redirects dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Switch component style fixed: selector specificity increased by adding additional class. (#2179) * Adding sever side undelete endpoint (#2222) * Adding sever side undelete endpoint * Removing long lines golangci-lint errors * Fixing linter errors * Fixing a test problem * Fixing tests Co-authored-by: Mattermod <mattermod@users.noreply.github.com> * Removing transactions from sqlite backend (#2361) * Removing transactions from sqlite backend * Skipping tests in sqlite because the lack of transactions * Generating the mocks * Fixing golangci-lint * Fixing problem opening the tour tooltip on card open * Fixing texts missmatch * Adding the Product Tour entry in the user settings menu * Fixing some tests * Fixing tests Co-authored-by: Asaad Mahmood <asaadmahmood@users.noreply.github.com> Co-authored-by: Scott Bishel <scott.bishel@mattermost.com> Co-authored-by: Mattermod <mattermod@users.noreply.github.com> Co-authored-by: Doug Lauder <wiggin77@warpmail.net> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: kamre <eremchenko@gmail.com> Co-authored-by: Jesús Espino <jespinog@gmail.com> * Restored package json * Restored package json Co-authored-by: Asaad Mahmood <asaadmahmood@users.noreply.github.com> Co-authored-by: Scott Bishel <scott.bishel@mattermost.com> Co-authored-by: Mattermod <mattermod@users.noreply.github.com> Co-authored-by: Doug Lauder <wiggin77@warpmail.net> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: kamre <eremchenko@gmail.com> Co-authored-by: Jesús Espino <jespinog@gmail.com>
154 lines
4.4 KiB
TypeScript
154 lines
4.4 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {Board} from '../../src/blocks/board'
|
|
import {UserConfigPatch} from '../../src/user'
|
|
|
|
Cypress.Commands.add('apiRegisterUser', (data: Cypress.UserData, token?: string, failOnError?: boolean) => {
|
|
return cy.request({
|
|
method: 'POST',
|
|
url: '/api/v1/register',
|
|
body: {
|
|
...data,
|
|
token,
|
|
},
|
|
headers: {
|
|
'X-Requested-With': 'XMLHttpRequest',
|
|
},
|
|
failOnStatusCode: failOnError,
|
|
})
|
|
})
|
|
|
|
Cypress.Commands.add('apiLoginUser', (data: Cypress.LoginData) => {
|
|
return cy.request({
|
|
method: 'POST',
|
|
url: '/api/v1/login',
|
|
body: {
|
|
...data,
|
|
type: 'normal',
|
|
},
|
|
headers: {
|
|
'X-Requested-With': 'XMLHttpRequest',
|
|
},
|
|
}).then((response) => {
|
|
expect(response.body).to.have.property('token')
|
|
localStorage.setItem('focalboardSessionId', response.body.token)
|
|
})
|
|
})
|
|
|
|
const headers = () => ({
|
|
headers: {
|
|
'X-Requested-With': 'XMLHttpRequest',
|
|
Authorization: `Bearer ${localStorage.getItem('focalboardSessionId')}`,
|
|
},
|
|
})
|
|
|
|
Cypress.Commands.add('apiInitServer', () => {
|
|
const data: Cypress.UserData = {
|
|
username: Cypress.env('username'),
|
|
password: Cypress.env('password'),
|
|
email: Cypress.env('email'),
|
|
}
|
|
return cy.apiRegisterUser(data, '', false).apiLoginUser(data)
|
|
})
|
|
|
|
Cypress.Commands.add('apiDeleteBlock', (id: string) => {
|
|
return cy.request({
|
|
method: 'DELETE',
|
|
url: `/api/v1/workspaces/0/blocks/${encodeURIComponent(id)}`,
|
|
...headers(),
|
|
})
|
|
})
|
|
|
|
const deleteBlocks = (ids: string[]) => {
|
|
if (ids.length === 0) {
|
|
return
|
|
}
|
|
const [id, ...other] = ids
|
|
cy.apiDeleteBlock(id).then(() => deleteBlocks(other))
|
|
}
|
|
|
|
Cypress.Commands.add('apiResetBoards', () => {
|
|
return cy.request({
|
|
method: 'GET',
|
|
url: '/api/v1/workspaces/0/blocks?type=board',
|
|
...headers(),
|
|
}).then((response) => {
|
|
if (Array.isArray(response.body)) {
|
|
const boards = response.body as Board[]
|
|
const toDelete = boards.filter((b) => !b.fields.isTemplate).map((b) => b.id)
|
|
deleteBlocks(toDelete)
|
|
}
|
|
})
|
|
})
|
|
|
|
Cypress.Commands.add('apiSkipTour', (userID: string) => {
|
|
const body: UserConfigPatch = {
|
|
updatedFields: {
|
|
focalboard_welcomePageViewed: '1',
|
|
},
|
|
}
|
|
|
|
return cy.request({
|
|
method: 'PUT',
|
|
url: `/api/v1/users/${encodeURIComponent(userID)}/config`,
|
|
...headers(),
|
|
body,
|
|
})
|
|
})
|
|
|
|
Cypress.Commands.add('apiGetMe', () => {
|
|
return cy.request({
|
|
method: 'GET',
|
|
url: '/api/v1/users/me',
|
|
...headers(),
|
|
}).then((response) => response.body.id)
|
|
})
|
|
|
|
Cypress.Commands.add('apiChangePassword', (userId: string, oldPassword: string, newPassword: string) => {
|
|
const body = {oldPassword, newPassword}
|
|
return cy.request({
|
|
method: 'POST',
|
|
url: `/api/v1/users/${encodeURIComponent(userId)}/changepassword`,
|
|
...headers(),
|
|
body,
|
|
})
|
|
})
|
|
|
|
Cypress.Commands.add('uiCreateNewBoard', (title?: string) => {
|
|
cy.log('**Create new empty board**')
|
|
cy.findByText('+ Add board').click()
|
|
cy.get('.empty-board').first().click({force: true})
|
|
cy.findByPlaceholderText('Untitled board').should('exist')
|
|
cy.wait(10)
|
|
if (title) {
|
|
cy.log('**Rename board**')
|
|
cy.findByPlaceholderText('Untitled board').type(`${title}{enter}`)
|
|
cy.findByRole('textbox', {name: title}).should('exist')
|
|
}
|
|
cy.wait(500)
|
|
})
|
|
|
|
Cypress.Commands.add('uiAddNewGroup', (name?: string) => {
|
|
cy.log('**Add a new group**')
|
|
cy.findByRole('button', {name: '+ Add a group'}).click()
|
|
cy.findByRole('textbox', {name: 'New group'}).should('exist')
|
|
|
|
if (name) {
|
|
cy.log('**Rename group**')
|
|
cy.findByRole('textbox', {name: 'New group'}).type(`{selectall}${name}{enter}`)
|
|
cy.findByRole('textbox', {name}).should('exist')
|
|
}
|
|
cy.wait(500)
|
|
})
|
|
|
|
Cypress.Commands.add('uiAddNewCard', (title?: string, columnIndex?: number) => {
|
|
cy.log('**Add a new card**')
|
|
cy.findByRole('button', {name: '+ New'}).eq(columnIndex || 0).click()
|
|
cy.findByRole('dialog').should('exist')
|
|
|
|
if (title) {
|
|
cy.log('**Change card title**')
|
|
cy.findByPlaceholderText('Untitled').type(title)
|
|
}
|
|
})
|