Skip to content

Commit

Permalink
modify tests for tag deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
miahro committed May 2, 2024
1 parent e75d6a3 commit 5ecabae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
15 changes: 13 additions & 2 deletions frontend/e2e/cypress/integration/tagManagement.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,28 @@ describe('Tag management', () => {
cy.get('.button').click()
cy.contains('Title must be at least 3 characters.').should('exist')
})
it('tag can be deleted', () => {
it('tag is not deleted when No is pressed in confirmation dialog', () => {
cy.get('#hamburger-menu-button')
.click()
.then(() => {
cy.contains('Tag management').click()
})
cy.get('#tagTitle').type('New tag')
cy.get('.delete-tag-button').click()
cy.contains('No').click()
cy.contains('New tag').should('exist')
})
it('tag is deleted when Yes is pressed in confirmation dialog', () => {
cy.get('#hamburger-menu-button')
.click()
.then(() => {
cy.contains('Tag management').click()
})
cy.get('#tagTitle').type('New tag')
cy.get('.delete-tag-button').click()
cy.contains('Yes').click()
cy.contains('New tag').should('not.exist')
})

// missing test: tag associated with existing time log cannot be deleted
// is not tested. This is because the test would require a time log to be created and associated with a tag.'
// and cannot be done before adding tag to time logs front end is implemented.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { useState, useEffect, useRef } from 'react'
import Typography from '@material-ui/core/Typography'
import TextField from '@material-ui/core/TextField'
import Button from '@material-ui/core/Button'
import { DeleteOutlineRounded } from '@material-ui/icons'
import tagService from '../../services/tags'
import './TagsDashboard.css'
import { connect } from 'react-redux'
Expand Down

0 comments on commit 5ecabae

Please sign in to comment.