Add command for creating tag

This commit is contained in:
Amanda Hämynen
2026-03-18 12:00:32 +02:00
parent 9214904ebe
commit a9705c1be1
2 changed files with 20 additions and 11 deletions
@@ -24,17 +24,8 @@ describe('Student tag page', () => {
studentIds: ['012345698'],
})
cy.visit('/')
cy.get('#hamburger-menu-button')
.click()
.then(() => {
cy.contains('Tag management').click()
})
cy.get('#tagTitle').type('Coding')
cy.get('.button').click()
cy.contains('Coding').should('exist')
cy.get('#tagTitle').type('Meeting')
cy.get('.button').click()
cy.contains('Meeting').should('exist')
cy.createTag('Coding')
cy.createTag('Meeting')
cy.loginAsRegisteredUser()
cy.visit('/')
+18
View File
@@ -893,3 +893,21 @@ Cypress.Commands.add('deleteAllSprints', () => {
})
})
})
/* TAG CREATION FOR TESTING */
Cypress.Commands.add('createTag', (tagTitle) => {
withLoggedAdminToken((token) => {
const authHeaders = {
Authorization: 'Bearer ' + token
}
cy.request({
url: '/api/tags',
method: 'POST',
headers: authHeaders,
body: {
title: tagTitle
}
})
})
})