Skip to content

Commit

Permalink
#2490 - fixing tests. added in importFinalizePending warning message …
Browse files Browse the repository at this point in the history
…to reuse skill dialog
  • Loading branch information
rmmayo committed Jun 24, 2024
1 parent b26d063 commit f933566
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ const onReuseOrMove = (changedSkills) => {
movedOrReusedSkills.value = changedSkills
}
const hasDestinations = computed(() => destinations.value && destinations.value.length > 0)
const showStepper = computed(() => !state.value.skillsWereMovedOrReusedAlready && hasDestinations.value)
const showStepper = computed(() => !state.value.skillsWereMovedOrReusedAlready && hasDestinations.value && !importFinalizePending.value)
const importFinalizePending = computed(() => finalizeInfo.value.numSkillsToFinalize && finalizeInfo.value.numSkillsToFinalize > 0)
const onVisibleChanged = (isVisible) => {
if (!isVisible) {
Expand All @@ -138,18 +139,23 @@ const handleFocus = () => {
>
<div data-cy="reuseOrMoveDialog">
<skills-spinner :is-loading="isLoadingData" class="my-8" />
<div v-if="!isLoadingData" class="w-100">
<div v-if="!isLoadingData" data-cy="reuseModalContent" class="w-100">
<no-content2
class="mt-5 mb-4"
v-if="state.skillsWereMovedOrReusedAlready"
title="Please Refresh"
:show-refresh-action="true"
message="Skills were moved or reused in another browser tab OR modified by another project administrator." />
message="`Cannot initiate skill ${actionNameLowerCase} while skill finalization is pending.`"/>
<no-content2
class="mt-5 mb-4"
v-if="!hasDestinations && !state.skillsWereMovedOrReusedAlready"
title="No Destinations Available"
:message="`There are no Subjects or Groups that this skill can be ${actionNameInPast} ${actionDirection}. Please create additional subjects and/or groups if you want to ${actionNameLowerCase} skills.`" />
<no-content2
class="mt-5 mb-4"
v-if="importFinalizePending"
:title="`Cannot ${textCustomization.actionName}`"
:message="`Cannot initiate skill ${actionNameLowerCase} while skill finalization is pending.`"/>

<Stepper v-if="showStepper" :linear="true" class="w-100">
<StepperPanel header="Select Destination">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,23 @@ describe('Skill Reuse and Dashboard Tests', () => {
cy.createSubject(1, 2);
});

it.skip('Search and Navigate directly to a skill properly labels reused skills', () => {
it('Search and Navigate directly to a skill properly labels reused skills', () => {
cy.reuseSkillIntoAnotherSubject(1, 1, 2);
cy.createSkillsGroup(1, 1, 12);
cy.reuseSkillIntoAnotherGroup(1, 1, 1, 12);

cy.visit('/administrator/projects/proj1/');

cy.get('input.vs__search')
.invoke('attr', 'placeholder')
.should('contain', 'Search and Navigate directly to a skill');
cy.get('[data-cy="skillsSelector"]').should('contain', 'Search and Navigate directly to a skill')
cy.get('[data-cy="skillsSelector"]')
.click();
cy.get('[data-cy="skillsSelector"]')
cy.get('li.p-dropdown-empty-message')
.contains('Type to search for skills')
.should('be.visible');
cy.get('[data-cy="skillsSelector"]')
cy.get(`[data-pc-section="filterinput"]`)
.type('s');

cy.get('[data-cy="skillsSelector"] [data-cy="skillsSelector-skillId"]')
cy.get('[data-cy="skillsSelector-skillId"]')
.should('have.length', 3)
.as('skillIds');
cy.get('@skillIds')
Expand All @@ -57,7 +55,7 @@ describe('Skill Reuse and Dashboard Tests', () => {
.eq(2)
.contains('skill1');

cy.get('[data-cy="skillsSelector"] [data-cy="skillsSelector-skillName"]')
cy.get('[data-cy="skillsSelector-skillName"]')
.should('have.length', 3)
.as('skillIds');
cy.get('@skillIds')
Expand All @@ -71,15 +69,15 @@ describe('Skill Reuse and Dashboard Tests', () => {
.eq(2)
.find('[data-cy="reusedBadge"]');

cy.get('[data-cy="skillsSelector"] [data-cy="skillsSelector-groupName"]')
cy.get('[data-cy="skillsSelector-groupName"]')
.should('have.length', 1)
.as('skillIds');
cy.get('@skillIds')
.eq(0)
.contains('Awesome Group 12 Subj1');
});

it.skip('reused skills must NOT be available for badges', () => {
it('reused skills must NOT be available for badges', () => {
cy.reuseSkillIntoAnotherSubject(1, 1, 2);
cy.createSkillsGroup(1, 1, 12);
cy.reuseSkillIntoAnotherGroup(1, 1, 1, 12);
Expand All @@ -88,15 +86,15 @@ describe('Skill Reuse and Dashboard Tests', () => {
cy.visit('/administrator/projects/proj1/badges/badge1');
cy.get('[data-cy="skillsSelector"]')
.click();
cy.get('[data-cy="skillsSelector"] [data-cy="skillsSelector-skillId"]')
cy.get('[data-cy="skillsSelector-skillId"]')
.should('have.length', 1)
.as('skillIds');
cy.get('@skillIds')
.eq(0)
.contains('skill1');
});

it.skip('cannot initiate reuse when finalization is pending', () => {
it('cannot initiate reuse when finalization is pending', () => {
cy.createSkill(1, 1, 1);
cy.createSkill(1, 1, 2);
cy.exportSkillToCatalog(1, 1, 1);
Expand All @@ -111,17 +109,15 @@ describe('Skill Reuse and Dashboard Tests', () => {
cy.importSkillFromCatalog(2, 1, 1, 2);

cy.visit('/administrator/projects/proj2/subjects/subj1/');
cy.get('[data-cy="skillSelect-skill11"]')
.click({ force: true });
cy.get('[data-cy="skillsTable"] [data-p-index="2"] [data-pc-name="rowcheckbox"]').click()
cy.get('[data-cy="skillActionsBtn"]')
.click();
cy.get('[data-cy="skillReuseBtn"]')
.click();
cy.get('[data-cy="skillsActionsMenu"] [aria-label="Reuse in this Project"]').click()
cy.get('[data-cy="reuseModalContent"]')
.contains('Cannot initiate skill reuse while skill finalization is pending');
});

it.skip('cannot initiate reuse when finalization is running', () => {
it('cannot initiate reuse when finalization is running', () => {
cy.createSkill(1, 1, 1);
cy.createSkill(1, 1, 2);
cy.exportSkillToCatalog(1, 1, 1);
Expand All @@ -137,17 +133,14 @@ describe('Skill Reuse and Dashboard Tests', () => {
cy.importSkillFromCatalog(2, 1, 1, 2);

cy.visit('/administrator/projects/proj2/subjects/subj1/');
cy.get('[data-cy="skillSelect-skill11"]');
cy.get('[data-cy="skillsTable"] [data-p-index="2"] [data-pc-name="rowcheckbox"]').click()
cy.get('[data-cy="finalizeBtn"]')
.click();
cy.get('[data-cy="doPerformFinalizeButton"]')
cy.get('[data-cy="saveDialogBtn"]')
.click();
cy.get('[data-cy="skillSelect-skill11"]')
.click({ force: true });
cy.get('[data-cy="skillActionsBtn"]')
.click();
cy.get('[data-cy="skillReuseBtn"]')
.click();
cy.get('[data-cy="skillsActionsMenu"] [aria-label="Reuse in this Project"]').click()
cy.get('[data-cy="reuseModalContent"]')
.contains('Cannot initiate skill reuse while skill finalization is pending');
cy.waitForBackendAsyncTasksToComplete();
Expand Down

0 comments on commit f933566

Please sign in to comment.