1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-12-24 13:43:12 +02:00

Fixes for cypress tests (#2679)

* fixes for cypress tests

* update

* update

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
Scott Bishel 2022-03-29 14:45:20 -06:00 committed by GitHub
parent 507f597148
commit 8b6ebc3b02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 10 deletions

View File

@ -15,7 +15,7 @@ declare namespace Cypress {
apiGetMe: () => Chainable<string>
apiChangePassword: (userId: string, oldPassword: string, newPassword: string) => Chainable
apiInitServer: () => Chainable
apiDeleteBlock: (id: string) => Chainable
apiDeleteBoard: (id: string) => Chainable
apiResetBoards: () => Chainable
apiSkipTour: (userID: string) => Chainable

View File

@ -97,7 +97,7 @@ describe('Card URL Property', () => {
const addView = (type: ViewType) => {
cy.log(`**Add ${type} view**`)
cy.findByRole('button', {name: 'View menu'}).click()
cy.findByText('Add view').click()
cy.findByText('Add view').realHover()
cy.findByRole('button', {name: type}).click()
cy.findByRole('textbox', {name: `${type} view`}).should('exist')
}

View File

@ -98,7 +98,7 @@ describe('Create and delete board / card', () => {
// Create table view
cy.log('**Create table view**')
cy.get('.ViewHeader').get('.DropdownIcon').first().parent().click()
cy.get('.ViewHeader').contains('Add view').click()
cy.get('.ViewHeader').contains('Add view').realHover()
cy.get('.ViewHeader').
contains('Add view').
parent().

View File

@ -11,7 +11,7 @@ describe('Login actions', () => {
cy.log('**Redirects to error then login page**')
cy.visit('/')
cy.location('pathname').should('eq', '/error')
cy.get('button').contains('Login').click()
cy.get('button').contains('Log in').click()
cy.location('pathname').should('eq', '/login')
cy.get('.LoginPage').contains('Log in')
cy.get('#login-username').should('exist')

View File

@ -52,32 +52,32 @@ Cypress.Commands.add('apiInitServer', () => {
return cy.apiRegisterUser(data, '', false).apiLoginUser(data)
})
Cypress.Commands.add('apiDeleteBlock', (id: string) => {
Cypress.Commands.add('apiDeleteBoard', (id: string) => {
return cy.request({
method: 'DELETE',
url: `/api/v1/workspaces/0/blocks/${encodeURIComponent(id)}`,
url: `/api/v1/boards/${encodeURIComponent(id)}`,
...headers(),
})
})
const deleteBlocks = (ids: string[]) => {
const deleteBoards = (ids: string[]) => {
if (ids.length === 0) {
return
}
const [id, ...other] = ids
cy.apiDeleteBlock(id).then(() => deleteBlocks(other))
cy.apiDeleteBoard(id).then(() => deleteBoards(other))
}
Cypress.Commands.add('apiResetBoards', () => {
return cy.request({
method: 'GET',
url: '/api/v1/workspaces/0/blocks?type=board',
url: '/api/v1/teams/0/boards',
...headers(),
}).then((response) => {
if (Array.isArray(response.body)) {
const boards = response.body as Board[]
const toDelete = boards.filter((b) => !b.isTemplate).map((b) => b.id)
deleteBlocks(toDelete)
deleteBoards(toDelete)
}
})
})