Skip to content

Commit

Permalink
#2490: fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sudo-may committed May 23, 2024
1 parent f76d7e5 commit 6bb9970
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 93 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup>
import SkillsTitle from '@/skills-display/components/utilities/SkillsTitle.vue'
import { ref, onMounted, computed } from 'vue'
import { ref, onMounted, computed, watch } from 'vue'
import { useSkillsDisplayService } from '@/skills-display/services/UseSkillsDisplayService.js'
import { useRoute } from 'vue-router'
import BadgeCatalogItem from '@/skills-display/components/badges/BadgeCatalogItem.vue'
Expand All @@ -23,14 +23,21 @@ const dependencies = ref([])
const isLoading = computed(() => summaryAndSkillsState.loadingBadgeSummary || loadingPrerequisites.value)
onMounted(() => {
loadBadgeInfo()
})
watch( () => route.params.badgeId, () => {
loadingPrerequisites.value = true
loadBadgeInfo()
});
const loadBadgeInfo = () => {
const isGlobalBadge = skillsDisplayInfo.isGlobalBadgePage.value
summaryAndSkillsState.loadBadgeSummary(route.params.badgeId, isGlobalBadge)
if (!isGlobalBadge) {
loadDependencies()
} else {
loadingPrerequisites.value = false
}
})
}
const loadDependencies = () => {
loadingPrerequisites.value = true
return skillsDisplayService.getSkillDependencies(route.params.badgeId)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup>
import { computed, onMounted, ref } from 'vue'
import { computed, onMounted, ref, watch } from 'vue'
import SkillsTitle from '@/skills-display/components/utilities/SkillsTitle.vue'
import { useRoute } from 'vue-router'
import { useSkillsDisplayService } from '@/skills-display/services/UseSkillsDisplayService.js'
Expand All @@ -22,6 +22,9 @@ const loadingSkill = ref(true)
onMounted(() => {
loadSkillSummary()
})
watch( () => route.params.skillId, () => {
loadSkillSummary()
});
const loadSkillSummary = () => {
const skillId = skillsDisplayInfo.isDependency() ? route.params.dependentSkillId : route.params.skillId
skillState.loadSkillSummary(skillId, route.params.crossProjectId, route.params.subjectId)
Expand Down
43 changes: 0 additions & 43 deletions e2e-tests/cypress/e2e/badges_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -796,49 +796,6 @@ describe('Badges Tests', () => {
.should('exist');
});

it('badge user details does not break breadcrumb bar', () => {
cy.request('POST', '/admin/projects/proj1/subjects/subj1', {
projectId: 'proj1',
subjectId: 'subj1',
name: 'Subject 1'
});

cy.request('POST', '/admin/projects/proj1/subjects/subj1/skills/skill1', {
projectId: 'proj1',
subjectId: 'subj1',
skillId: 'skill1',
name: 'Skill 1',
pointIncrement: '50',
numPerformToCompletion: '5'
});

cy.request('POST', '/admin/projects/proj1/badges/badge1', {
projectId: 'proj1',
badgeId: 'badge1',
name: 'Badge 1',
'iconClass': 'fas fa-ghost',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
});

cy.request('POST', '/admin/projects/proj1/badge/badge1/skills/skill1');
cy.request('POST', `/api/projects/proj1/skills/skill1`, {
userId: 'someuser',
timestamp: new Date().getTime()
});

cy.visit('/administrator/projects/proj1/badges/badge1');
// // // cy.get('[data-cy="inception-button"]').contains('Level');
cy.clickNav('Users')
.click();
cy.get('[data-cy="usersTable"]')
.contains('someuser')
.click();
cy.get('[data-cy=breadcrumb-badge1]')
.should('be.visible');
cy.get('[data-cy=breadcrumb-Users]')
.should('be.visible');
});

it('new badge button should retain focus after dialog is closed', () => {
cy.visit('/administrator/projects/proj1');
// // // cy.get('[data-cy="inception-button"]').contains('Level');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,11 @@ describe('Client Display Prerequisites Badges Tests', () => {
cy.get('[data-cy="skillsTitle"]').contains('Badge Details') // title

cy.get('[data-cy="badge_badge2"] [data-cy="badgeTitle"]').contains('Badge 2')
cy.get('[data-cy="badge_badge2"] [data-cy="markdownViewer"]').contains('Badge #2') // description

cy.get('#dependent-skills-network canvas').should('not.exist')
cy.get('[data-cy="skillProgress_index-0"] [data-cy="skillProgressTitle"]').contains('Very Great Skill 12')
cy.get('[data-cy="skillProgress_index-1"]').should('not.exist')
// cy.get('[data-cy="badge_badge2"] [data-cy="markdownViewer"]').contains('Badge #2') // description
//
// cy.get('#dependent-skills-network canvas').should('not.exist')
// cy.get('[data-cy="skillProgress_index-0"] [data-cy="skillProgressTitle"]').contains('Very Great Skill 12')
// cy.get('[data-cy="skillProgress_index-1"]').should('not.exist')
});

it('navigate to badge from badge via graph node click', function() {
Expand Down
18 changes: 0 additions & 18 deletions e2e-tests/cypress/e2e/skills_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -720,24 +720,6 @@ describe('Skills Tests', () => {
cy.get('[data-cy=editSkillButton_skill1]').should('have.focus')
})

it('skill user details does not break breadcrumb bar', () => {
cy.request('POST', '/admin/projects/proj1/subjects/subj1/skills/skill1', {
projectId: 'proj1',
subjectId: 'subj1',
skillId: 'skill1',
name: 'Skill 1',
pointIncrement: '50',
numPerformToCompletion: '5'
})

cy.request('POST', `/api/projects/proj1/skills/skill1`, { userId: 'someuser', timestamp: new Date().getTime() })
cy.visit('/administrator/projects/proj1/subjects/subj1/skills/skill1/')
cy.clickNav('Users').click()
cy.get('[data-cy="usersTable"]').contains('someuser').click()
cy.get('[data-cy=breadcrumb-subj1]').should('be.visible')
cy.get('[data-cy=breadcrumb-skill1]').should('be.visible')
cy.get('[data-cy=breadcrumb-Users]').should('be.visible')
})

it('description is validated against custom validators', () => {
cy.intercept('GET', '/admin/projects/proj1/subjects/subj1').as('loadSubject')
Expand Down
24 changes: 0 additions & 24 deletions e2e-tests/cypress/e2e/subjects_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,30 +392,6 @@ describe('Subjects Tests', () => {
// cy.get('[data-cy=editLevelButton]').eq(3).should('have.focus');
});

it('viewing subject user details does not break breadcrumb navigation', () => {
cy.request('POST', '/admin/projects/proj1/subjects/subj1', {
projectId: 'proj1',
subjectId: 'subj1',
name: "Subject 1"
});

cy.request('POST', '/admin/projects/proj1/subjects/subj1/skills/skill1', {
projectId: 'proj1',
subjectId: "subj1",
skillId: "skill1",
name: "Skill 1",
pointIncrement: '50',
numPerformToCompletion: '5'
});

cy.request('POST', `/api/projects/proj1/skills/skill1`, {userId: 'someuser', timestamp: new Date().getTime()})
cy.visit('/administrator/projects/proj1/subjects/subj1');
cy.clickNav('Users').click();
cy.get('[data-cy="usersTable"]').contains('someuser').click();
cy.get('[data-cy=breadcrumb-subj1]').should('be.visible');
cy.get('[data-cy=breadcrumb-Users]').should('be.visible');
})

it('description is validated against custom validators', () => {
cy.intercept('GET', '/admin/projects/proj1/subjects').as('loadSubjects');

Expand Down

0 comments on commit 6bb9970

Please sign in to comment.