Skip to content

Commit

Permalink
Merge pull request #2607 from NationalSecurityAgency/t#2490/settings-…
Browse files Browse the repository at this point in the history
…tests-fix

#2490 Update settings tests, fix home page setting
  • Loading branch information
rmmayo authored Jun 25, 2024
2 parents f025127 + 34ad72d commit fad1896
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ onMounted(() => {
<template>
<div>
<skills-spinner :is-loading="loadingDescription" />
<div v-if="!loadingDescription">
<div v-if="!loadingDescription" :data-cy="`projectDescriptionRow_${projectId}`">
<markdown-text v-if="description" :text="description" />
<div v-else>Project does not have a description</div>
</div>
Expand Down
5 changes: 3 additions & 2 deletions dashboard-prime/src/components/settings/Preferences.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ import SettingsService from '@/components/settings/SettingsService.js'
import { useAppConfig } from '@/common-components/stores/UseAppConfig.js'
import { useColors } from '@/skills-display/components/utilities/UseColors.js'
import {useThemesHelper} from "@/components/header/UseThemesHelper.js";
import {useUserInfo} from "@/components/utils/UseUserInfo.js";
const themeHelper = useThemesHelper()
const appConfig = useAppConfig();
const colors = useColors()
const userInfo = useUserInfo()
const isLoading = ref(true);
const settings = ref({
Expand Down Expand Up @@ -115,8 +117,7 @@ function saveUserSettings(dirtyChanges) {
const [key, value] = entry;
settings[key] = Object.assign(value, { dirty: false, lastLoadedValue: value.value });
if (key === 'homePage') {
// const userInfo = { ...$store.getters.userInfo, landingPage: value.value };
// $store.commit('storeUser', userInfo);
userInfo.userInfo.value.landingPage = value.value
}
if (key === 'enableDarkMode') {
if(value.value) {
Expand Down
20 changes: 9 additions & 11 deletions e2e-tests/cypress/e2e/projects_settings_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ describe('Project Settings Tests', () => {
.contains('Invite Only');
});

it.skip('project-level settings: project description', () => {
it('project-level settings: project description', () => {
cy.createProject(1, { description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vitae tellus.'});

cy.createProject(2, { description: '' });
Expand Down Expand Up @@ -468,34 +468,32 @@ describe('Project Settings Tests', () => {
cy.loginAsProxyUser();
cy.visit('/progress-and-rankings/manage-my-projects');
cy.wait('@loadMyProjects');
cy.get('[data-cy="expandDetailsBtn_proj1"]').should('be.visible');
cy.get('[data-cy="expandDetailsBtn_proj2"]').should('not.exist');
cy.get('[data-cy="expandDetailsBtn_proj3"]').should('be.visible');
cy.get('[data-cy="expandDetailsBtn_proj1"]').click();
cy.get('[data-pc-section="rowtoggler"]').should('have.length', 3);
cy.get('[data-pc-section="rowtoggler"]').first().click();
cy.wait('@loadProj1Description');
cy.get('[data-cy="proj1_projectDescription"]').should('exist');
cy.get('[data-cy="proj1_projectDescription"]').should('contain.text', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vitae tellus.');
cy.get('[data-cy="projectDescriptionRow_proj1"]').should('exist');
cy.get('[data-cy="projectDescriptionRow_proj1"]').should('contain.text', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vitae tellus.');


cy.intercept('/progress-and-rankings/projects/proj1** ')
.as('loadP1Cd');
cy.visit('/progress-and-rankings/projects/proj1');
cy.wait('@loadP1Cd');
cy.wrapIframe().find('[data-cy="projectDescription"]').should('be.visible');
cy.wrapIframe().find('[data-cy="projectDescription"]').should('contain.text', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vitae tellus.')
cy.get('[data-cy="projectDescription"]').should('be.visible');
cy.get('[data-cy="projectDescription"]').should('contain.text', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vitae tellus.')

// proj2 has no description defined so it shouldn't be displayed
cy.intercept('/progress-and-rankings/projects/proj2** ')
.as('loadP2Cd');
cy.visit('/progress-and-rankings/projects/proj2');
cy.wait('@loadP2Cd');
cy.wrapIframe().find('[data-cy="projectDescription"]').should('not.exist');
cy.get('[data-cy="projectDescription"]').should('not.exist');

// proj3 has a description but is using the default configuration which hides it from display in the client-display
cy.intercept('/progress-and-rankings/projects/proj3** ')
.as('loadP3Cd');
cy.visit('/progress-and-rankings/projects/proj3');
cy.wait('@loadP3Cd');
cy.wrapIframe().find('[data-cy="projectDescription"]').should('not.exist');
cy.get('[data-cy="projectDescription"]').should('not.exist');
});
});
38 changes: 18 additions & 20 deletions e2e-tests/cypress/e2e/settings_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,7 @@ describe('Settings Tests', () => {
cy.contains('* First Name');
});

it.skip('Landing Page preference', () => {
it('Landing Page preference', () => {
cy.intercept('POST', '/app/userInfo/**')
.as('saveUserInfo');
cy.intercept('GET', '/app/userInfo/**')
Expand All @@ -1255,9 +1255,8 @@ describe('Settings Tests', () => {
.should('be.visible');

// verify the default is set to 'Progress and Rankings'
// [data-pc-section="input"]').should('have.value', 'on');
cy.get('[data-cy="admin"]').should('not.have.class', 'p-highlight');
cy.get('[data-cy="progress"]').should('have.class', 'p-highlight');
cy.get('[data-cy="admin"] > input').should('not.be.checked');
cy.get('[data-cy="progress"] > input').should('be.checked');

// click SkillTree logo and verify we are on the correct page
cy.get('[data-cy="skillTreeLogo"]')
Expand All @@ -1276,8 +1275,8 @@ describe('Settings Tests', () => {
.should('be.disabled');

cy.get('[data-cy="admin"]').click();
cy.get('[data-cy="admin"]').should('have.class', 'p-highlight');
cy.get('[data-cy="progress"]').should('not.have.class', 'p-highlight');
cy.get('[data-cy="admin"] > input').should('be.checked');
cy.get('[data-cy="progress"] > input').should('not.be.checked');

cy.get('[data-cy="userPrefsSettingsSave"]')
.should('not.be.disabled');
Expand All @@ -1302,12 +1301,11 @@ describe('Settings Tests', () => {
.should('be.visible');
cy.get('[data-cy="userPrefsSettingsSave"]')
.should('be.disabled');
cy.get('[data-cy="landingPageSelector"] [value="progress"]')
.click({ force: true });
cy.get('[data-cy="landingPageSelector"] [value="admin"]')
.should('not.be.checked');
cy.get('[data-cy="landingPageSelector"] [value="progress"]')
.should('be.checked');
cy.get('[data-cy="progress"]')
.click();
cy.get('[data-cy="admin"] > input').should('not.be.checked');
cy.get('[data-cy="progress"] > input').should('be.checked');

cy.get('[data-cy="userPrefsSettingsSave"]')
.should('not.be.disabled');
cy.get('[data-cy="userPrefsSettingsSave"]')
Expand All @@ -1334,11 +1332,11 @@ describe('Settings Tests', () => {
.should('not.exist');
cy.get('[data-cy="userPrefsSettingsSave"]')
.should('be.disabled');
cy.get('[data-cy="landingPageSelector"] [value="admin"]')
.click({ force: true });
cy.get('[data-cy="landingPageSelector"] [value="progress"]')
cy.get('[data-cy="admin"]')
.click();
cy.get('[data-cy="progress"] > input')
.should('not.be.checked');
cy.get('[data-cy="landingPageSelector"] [value="admin"]')
cy.get('[data-cy="admin"] > input')
.should('be.checked');

// unsaved changes visible and save button enabled
Expand All @@ -1348,11 +1346,11 @@ describe('Settings Tests', () => {
.should('not.be.disabled');

// switch values back to original and unsaved changes should not visible and save button disabled
cy.get('[data-cy="landingPageSelector"] [value="progress"]')
.click({ force: true });
cy.get('[data-cy="landingPageSelector"] [value="admin"]')
cy.get('[data-cy="progress"]')
.click();
cy.get('[data-cy="admin"] > input')
.should('not.be.checked');
cy.get('[data-cy="landingPageSelector"] [value="progress"]')
cy.get('[data-cy="progress"] > input')
.should('be.checked');
cy.get('[data-cy="unsavedChangesAlert"]')
.should('not.exist');
Expand Down

0 comments on commit fad1896

Please sign in to comment.