From 77b5163413b31300878817d27bba9b9d3955bc9a Mon Sep 17 00:00:00 2001 From: Dima May Date: Tue, 11 Jun 2024 15:31:50 +0000 Subject: [PATCH 1/6] #2490: working on tests for project admin management and project modal --- .github/workflows/build-and-test.yml | 2 +- .../src/components/access/RoleManager.vue | 43 ++++++++------ .../e2e/projects_admin_management_spec.js | 47 ++++++++------- .../e2e/projects_modal_management_spec.js | 59 +++++++++---------- 4 files changed, 81 insertions(+), 70 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index bc1e44c06a..6301ab8eb1 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -140,7 +140,7 @@ jobs: - name: Run Cypress tests run: | cd e2e-tests - ../.github/scripts/runSubsetOfCypressTests.sh -t 6 -c ${{ matrix.container }} -f 'projects_crud|/skills_table_spec|/skill_reuse_spec|quiz_creation|question_def|metrics-reUsedData_spec|quiz_and_survey|quiz_runs|quiz_skill_assignment|quiz_read|quiz_role|quiz_settings|quiz_skills-in_project_reuse|client-display_quiz_spec|client-display_quiz_theme_spec|client-display_quiz_visual_spec|client-display_run_quiz_spec|run_survey_spec|quiz_skills-catalog_spec|/inception|user_actions|configure-skill-expiration_spec|skill-expiration-table_spec|configure_video_spec|configure_video_features_spec|configure_skill_video_self_report_spec|configure_video_validation_spec|handle_video_without_duration_spec|client_display_video_on_subject_page_spec|client_display_video_on_skill_page_spec|/skills_spec|/users_spec|/subjects_spec|/levels_management_spec|/skills_group_spec|/skills_group_modal_spec|/move-skills/|/badges_spec|/skill-reuse/skill_reuse/|/catalog/|/project_settings_spec|/icon_manager_spec|/not_found_spec|my-usage_spec|/error_pages_spec|/add_skills_to_badge_spec|/tag-skills|/settings_spec|/client-display/|/learning-path/|/copy_project_spec|/project_errors_spec|/selfReport-approvalHistory_spec|/approver|/manage-my-projects_spec|/accessibility|/community/|/metrics/projectMetrics|/metrics/skillMetrics_spec|/metrics/subjectMetrics_spec|/projects_invite_only_spec|/app_features_spec|/breadcrumb_spec|/contact|/cross-project_spec|/discoverable_proj_invite_spec|/login_spec|/markdown_spec/metrics/multipleProjectMetrics_empty_spec|/metrics/multipleProjectMetrics_spec|/my-progress_breadcrumb_spec|/my-progress_spec|/my-progress-badges_spec|/navigation_spec|/progress_and_ranking_disabled_spec|/project_expiration_spec|performedSkills_table_spec' + ../.github/scripts/runSubsetOfCypressTests.sh -t 6 -c ${{ matrix.container }} -f 'projects_crud|/skills_table_spec|/skill_reuse_spec|quiz_creation|question_def|metrics-reUsedData_spec|quiz_and_survey|quiz_runs|quiz_skill_assignment|quiz_read|quiz_role|quiz_settings|quiz_skills-in_project_reuse|client-display_quiz_spec|client-display_quiz_theme_spec|client-display_quiz_visual_spec|client-display_run_quiz_spec|run_survey_spec|quiz_skills-catalog_spec|/inception|user_actions|configure-skill-expiration_spec|skill-expiration-table_spec|configure_video_spec|configure_video_features_spec|configure_skill_video_self_report_spec|configure_video_validation_spec|handle_video_without_duration_spec|client_display_video_on_subject_page_spec|client_display_video_on_skill_page_spec|/skills_spec|/users_spec|/subjects_spec|/levels_management_spec|/skills_group_spec|/skills_group_modal_spec|/move-skills/|/badges_spec|/skill-reuse/skill_reuse/|/catalog/|/project_settings_spec|/icon_manager_spec|/not_found_spec|my-usage_spec|/error_pages_spec|/add_skills_to_badge_spec|/tag-skills|/settings_spec|/client-display/|/learning-path/|/copy_project_spec|/project_errors_spec|/selfReport-approvalHistory_spec|/approver|/manage-my-projects_spec|/accessibility|/community/|/metrics/projectMetrics|/metrics/skillMetrics_spec|/metrics/subjectMetrics_spec|/projects_invite_only_spec|/app_features_spec|/breadcrumb_spec|/contact|/cross-project_spec|/discoverable_proj_invite_spec|/login_spec|/markdown_spec/metrics/multipleProjectMetrics_empty_spec|/metrics/multipleProjectMetrics_spec|/my-progress_breadcrumb_spec|/my-progress_spec|/my-progress-badges_spec|/navigation_spec|/progress_and_ranking_disabled_spec|/project_expiration_spec|performedSkills_table_spec|/projects_admin_management_spec|/projects_modal_management_spec' cd .. env: ELECTRON_EXTRA_LAUNCH_ARGS: '--disable-gpu' diff --git a/dashboard-prime/src/components/access/RoleManager.vue b/dashboard-prime/src/components/access/RoleManager.vue index ff5e99c4da..3c854b9f17 100644 --- a/dashboard-prime/src/components/access/RoleManager.vue +++ b/dashboard-prime/src/components/access/RoleManager.vue @@ -70,25 +70,25 @@ onMounted(() => { loadData(); }); + +const sortInfo = ref({ sortOrder: 1, sortBy: 'userId' }) +const possiblePageSizes = [ 5, 10, 15, 20] +const pageSize = ref(5) let table = ref({ options: { busy: true, - sortBy: 'userId', - sortDesc: 1, pagination: { hideUnnecessary: true, server: false, currentPage: 1, totalRows: 1, - pageSize: 5, - possiblePageSizes: [5, 10, 15, 20], }, tableDescription: `${props.roleDescription} table`, }, }); -let data = ref([]); -let userIds = ref([]); +const data = ref([]); +const userIds = computed(() => data.value.map((d) => d.userId)); const selectedUser = ref(null); const isSaving = ref(false); const errNotification = ref({ @@ -130,19 +130,18 @@ function getRoleDisplay(roleName) { return 'Unknown'; } -function loadData() { +const loadData = () => { table.value.options.busy = true; const pageParams = { limit: 200, - ascending: table.value.options.sortDesc === 1, page: 1, - orderBy: table.value.options.sortBy, + ascending: sortInfo.value.sortOrder === 1, + orderBy: sortInfo.value.sortBy }; AccessService.getUserRoles(props.projectId, props.roles, pageParams).then((result) => { table.value.options.busy = false; data.value = result.data; table.value.options.pagination.totalRows = result.totalCount; - // userIds.value = result.data.map((u) => [u.userId, u.userIdForDisplay]).flatten(); }); } @@ -225,7 +224,7 @@ function deleteUserRole(row) { table.value.options.busy = true; AccessService.deleteUserRole(row.projectId, row.userId, row.roleName).then(() => { data.value = data.value.filter((item) => item.userId !== row.userId); - userIds.value = userIds.value.filter((userId) => userId !== row.userId && userId !== row.userIdForDisplay); + userIds.value = userIds.value.filter((userId) => userId !== row.userId); emit('role-deleted', { userId: row.userId, role: row.roleName }); table.value.options.busy = false; table.value.options.pagination.totalRows = data.value.length; @@ -317,13 +316,20 @@ defineExpose({ Error! Request could not be completed! {{ errNotification.msg }} - + - + diff --git a/e2e-tests/cypress/e2e/projects_modal_management_spec.js b/e2e-tests/cypress/e2e/projects_modal_management_spec.js index 4d7abe5feb..7868664298 100644 --- a/e2e-tests/cypress/e2e/projects_modal_management_spec.js +++ b/e2e-tests/cypress/e2e/projects_modal_management_spec.js @@ -227,7 +227,8 @@ describe('Projects Modal Management Tests', () => { cy.get('[data-cy=newProjectButton]') .click(); - cy.get('[aria-label=Close]') + cy.get('[data-cy="projectName"]') + cy.get('[data-pc-group-section="headericon"][data-pc-section="closebutton"]') .click(); cy.get('[data-cy=newProjectButton]') .should('have.focus'); @@ -269,12 +270,12 @@ describe('Projects Modal Management Tests', () => { cy.wait(600) cy.get(proj1EditBtn).should('have.focus'); - // cy.get(proj1EditBtn).click(); - // cy.get('[data-cy=projectName]').should('be.visible'); - // cy.get('[aria-label=Close]').click(); - // cy.get('[data-cy=projectName]').should('not.exist'); - // cy.wait(600) - // cy.get(proj1EditBtn).should('have.focus'); + cy.get(proj1EditBtn).click(); + cy.get('[data-cy=projectName]').should('be.visible'); + cy.get('[data-pc-group-section="headericon"][data-pc-section="closebutton"]').click() + cy.get('[data-cy=projectName]').should('not.exist'); + cy.wait(600) + cy.get(proj1EditBtn).should('have.focus'); }); it('new level dialog should return focus to new level button', () => { diff --git a/e2e-tests/cypress/e2e/projects_sort_spec.js b/e2e-tests/cypress/e2e/projects_sort_spec.js index 7441ad07f0..569270ac23 100644 --- a/e2e-tests/cypress/e2e/projects_sort_spec.js +++ b/e2e-tests/cypress/e2e/projects_sort_spec.js @@ -100,16 +100,12 @@ describe('Projects Sort Order Tests', () => { .dragAndDrop(proj2Card); // overlay over both cards but loading message only on project 1 - cy.get('[data-cy="proj1_overlayShown"] [data-cy="updatingSortMsg"]') - .contains('Updating sort order'); + cy.get('[data-cy="proj1_overlayShown"] [data-cy="overlaySpinner"]') cy.get('[data-cy="proj2_overlayShown"]'); - cy.get('[data-cy="proj2_overlayShown"] [data-cy="updatingSortMsg"]') - .should('not.exist'); + cy.get('[data-cy="proj2_overlayShown"] [data-cy="overlaySpinner"]').should('not.exist'); cy.wait('@proj1Async'); - cy.get('[data-cy="proj1_overlayShown"]') - .should('not.exist'); - cy.get('[data-cy="proj2_overlayShown"]') - .should('not.exist'); + cy.get('[data-cy="proj1_overlayShown"]').should('not.exist'); + cy.get('[data-cy="proj2_overlayShown"]').should('not.exist'); }); it('change sort order using keyboard', () => { @@ -118,19 +114,19 @@ describe('Projects Sort Order Tests', () => { cy.createProject(3); cy.visit('/administrator/'); cy.validateElementsOrder('[data-cy="projectCard"]', ['This is project 1', 'This is project 2', 'This is project 3']); - cy.get('[data-cy="projectCard_proj1"] [data-cy="deleteProjBtn"]') + cy.get('[data-cy="projectCard_proj1"] [data-pc-section="closebutton"]') .tab() .type('{downArrow}'); cy.validateElementsOrder('[data-cy="projectCard"]', ['This is project 2', 'This is project 1', 'This is project 3']); cy.get('[data-cy="projectCard_proj1"] [data-cy="sortControlHandle"]') .should('have.focus'); - cy.get('[data-cy="projectCard_proj1"] [data-cy="deleteProjBtn"]') + cy.get('[data-cy="projectCard_proj1"] [data-pc-section="closebutton"]') .tab() .type('{downArrow}'); cy.validateElementsOrder('[data-cy="projectCard"]', ['This is project 2', 'This is project 3', 'This is project 1']); cy.get('[data-cy="projectCard_proj1"] [data-cy="sortControlHandle"]') .should('have.focus'); - cy.get('[data-cy="projectCard_proj1"] [data-cy="deleteProjBtn"]') + cy.get('[data-cy="projectCard_proj1"] [data-pc-section="closebutton"]') .tab() .type('{downArrow}'); cy.validateElementsOrder('[data-cy="projectCard"]', ['This is project 2', 'This is project 3', 'This is project 1']); @@ -142,13 +138,13 @@ describe('Projects Sort Order Tests', () => { cy.validateElementsOrder('[data-cy="projectCard"]', ['This is project 2', 'This is project 3', 'This is project 1']); // now let's move up - cy.get('[data-cy="projectCard_proj3"] [data-cy="deleteProjBtn"]') + cy.get('[data-cy="projectCard_proj3"] [data-pc-section="closebutton"]') .tab() .type('{upArrow}'); cy.validateElementsOrder('[data-cy="projectCard"]', ['This is project 3', 'This is project 2', 'This is project 1']); cy.get('[data-cy="projectCard_proj3"] [data-cy="sortControlHandle"]') .should('have.focus'); - cy.get('[data-cy="projectCard_proj3"] [data-cy="deleteProjBtn"]') + cy.get('[data-cy="projectCard_proj3"] [data-pc-section="closebutton"]') .tab() .type('{upArrow}'); cy.validateElementsOrder('[data-cy="projectCard"]', ['This is project 3', 'This is project 2', 'This is project 1']); From 6c144c3fa60f2f6fc8e1b588b36b61f33fb4ea74 Mon Sep 17 00:00:00 2001 From: Dima May Date: Tue, 11 Jun 2024 18:07:52 +0000 Subject: [PATCH 4/6] #2490: added trusted client props component; added projects_spec.js back to CI --- .github/workflows/build-and-test.yml | 4 +- .../src/components/access/AccessSettings.vue | 9 +- .../components/access/TrustedClientProps.vue | 70 ++++++++++ .../src/components/projects/MyProject.vue | 1 + e2e-tests/cypress/e2e/projects_spec.js | 130 +++--------------- 5 files changed, 101 insertions(+), 113 deletions(-) create mode 100644 dashboard-prime/src/components/access/TrustedClientProps.vue diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 140fdc0cd8..ee3d340079 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -75,7 +75,7 @@ jobs: matrix: #IMPORTANT: must, must, must match the total number of containers below: runSubsetOfCypressTests.sh.sh -t # container: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ] - container: [ 1, 2, 3, 4, 5, 6, 7] + container: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] services: postgres: @@ -140,7 +140,7 @@ jobs: - name: Run Cypress tests run: | cd e2e-tests - ../.github/scripts/runSubsetOfCypressTests.sh -t 7 -c ${{ matrix.container }} -f 'projects_crud|/skills_table_spec|/skill_reuse_spec|quiz_creation|question_def|metrics-reUsedData_spec|quiz_and_survey|quiz_runs|quiz_skill_assignment|quiz_read|quiz_role|quiz_settings|quiz_skills-in_project_reuse|client-display_quiz_spec|client-display_quiz_theme_spec|client-display_quiz_visual_spec|client-display_run_quiz_spec|run_survey_spec|quiz_skills-catalog_spec|/inception|user_actions|configure-skill-expiration_spec|skill-expiration-table_spec|configure_video_spec|configure_video_features_spec|configure_skill_video_self_report_spec|configure_video_validation_spec|handle_video_without_duration_spec|client_display_video_on_subject_page_spec|client_display_video_on_skill_page_spec|/skills_spec|/users_spec|/subjects_spec|/levels_management_spec|/skills_group_spec|/skills_group_modal_spec|/move-skills/|/badges_spec|/skill-reuse/skill_reuse/|/catalog/|/project_settings_spec|/icon_manager_spec|/not_found_spec|my-usage_spec|/error_pages_spec|/add_skills_to_badge_spec|/tag-skills|/settings_spec|/client-display/|/learning-path/|/copy_project_spec|/project_errors_spec|/selfReport-approvalHistory_spec|/approver|/manage-my-projects_spec|/accessibility|/community/|/metrics/projectMetrics|/metrics/skillMetrics_spec|/metrics/subjectMetrics_spec|/projects_invite_only_spec|/app_features_spec|/breadcrumb_spec|/contact|/cross-project_spec|/discoverable_proj_invite_spec|/login_spec|/markdown_spec/metrics/multipleProjectMetrics_empty_spec|/metrics/multipleProjectMetrics_spec|/my-progress_breadcrumb_spec|/my-progress_spec|/my-progress-badges_spec|/navigation_spec|/progress_and_ranking_disabled_spec|/project_expiration_spec|performedSkills_table_spec|/projects_admin_management_spec|/projects_modal_management_spec|/projects_modal_validation_spec' + ../.github/scripts/runSubsetOfCypressTests.sh -t 10 -c ${{ matrix.container }} -f 'projects_crud|/skills_table_spec|/skill_reuse_spec|quiz_creation|question_def|metrics-reUsedData_spec|quiz_and_survey|quiz_runs|quiz_skill_assignment|quiz_read|quiz_role|quiz_settings|quiz_skills-in_project_reuse|client-display_quiz_spec|client-display_quiz_theme_spec|client-display_quiz_visual_spec|client-display_run_quiz_spec|run_survey_spec|quiz_skills-catalog_spec|/inception|user_actions|configure-skill-expiration_spec|skill-expiration-table_spec|configure_video_spec|configure_video_features_spec|configure_skill_video_self_report_spec|configure_video_validation_spec|handle_video_without_duration_spec|client_display_video_on_subject_page_spec|client_display_video_on_skill_page_spec|/skills_spec|/users_spec|/subjects_spec|/levels_management_spec|/skills_group_spec|/skills_group_modal_spec|/move-skills/|/badges_spec|/skill-reuse/skill_reuse/|/catalog/|/project_settings_spec|/icon_manager_spec|/not_found_spec|my-usage_spec|/error_pages_spec|/add_skills_to_badge_spec|/tag-skills|/settings_spec|/client-display/|/learning-path/|/copy_project_spec|/project_errors_spec|/selfReport-approvalHistory_spec|/approver|/manage-my-projects_spec|/accessibility|/community/|/metrics/projectMetrics|/metrics/skillMetrics_spec|/metrics/subjectMetrics_spec|/projects_invite_only_spec|/app_features_spec|/breadcrumb_spec|/contact|/cross-project_spec|/discoverable_proj_invite_spec|/login_spec|/markdown_spec/metrics/multipleProjectMetrics_empty_spec|/metrics/multipleProjectMetrics_spec|/my-progress_breadcrumb_spec|/my-progress_spec|/my-progress-badges_spec|/navigation_spec|/progress_and_ranking_disabled_spec|/project_expiration_spec|performedSkills_table_spec|/projects_admin_management_spec|/projects_modal_management_spec|/projects_modal_validation_spec|/projects_spec' cd .. env: ELECTRON_EXTRA_LAUNCH_ARGS: '--disable-gpu' diff --git a/dashboard-prime/src/components/access/AccessSettings.vue b/dashboard-prime/src/components/access/AccessSettings.vue index c97ce7c518..2dc2f3ea95 100644 --- a/dashboard-prime/src/components/access/AccessSettings.vue +++ b/dashboard-prime/src/components/access/AccessSettings.vue @@ -1,12 +1,17 @@ + + + + \ No newline at end of file diff --git a/dashboard-prime/src/components/projects/MyProject.vue b/dashboard-prime/src/components/projects/MyProject.vue index c740114c0b..d74248e16b 100644 --- a/dashboard-prime/src/components/projects/MyProject.vue +++ b/dashboard-prime/src/components/projects/MyProject.vue @@ -247,6 +247,7 @@ defineExpose({ {{ warningMsgAboutPoints}}
{ cy.wait('@loadUserInfo'); cy.wait('@loadProjects'); - cy.clickButton('Project'); + cy.get('[data-cy="newProjectButton"]').click(); cy.get('[data-cy="projectName"]') .type('My New & test Project'); - cy.clickSave(); + cy.get('[data-cy="saveDialogBtn"]').click() cy.wait('@postNewProject'); cy.contains('My New & test Project'); }); - it('Provide clear instructions how to create a new project - root user', function () { - cy.logout(); - cy.fixture('vars.json') - .then((vars) => { - cy.login(vars.rootUser, vars.defaultPass); - }); - cy.visit('/administrator/'); - cy.contains('No Projects Yet...'); - cy.contains('A Project represents a gamified training profile that consists of skills divided into subjects'); - cy.get('[data-cy="firstNewProjectButton"]') - .click(); - cy.get('[data-cy="projectName"]') - .type('one'); - cy.get('[data-cy="saveProjectButton"]') - .click(); - cy.get('[data-cy="projCard_one_manageBtn"]'); - }); - - it('Provide clear instructions how to create a new project - regular user', function () { - cy.visit('/administrator/'); - cy.contains('No Projects Yet...'); - cy.contains('Note: This section of SkillTree is for project administrators only. If you do not plan on creating and integrating a project with SkillTree then please return to the Progress and Ranking page.'); - }); - it('Preview project training plan', function () { cy.request('POST', '/app/projects/proj1', { projectId: 'proj1', @@ -108,9 +84,9 @@ describe('Projects Tests', () => { name: 'proj1' }); cy.visit('/progress-and-rankings/projects/proj1'); - cy.dashboardCd() + cy.get('[data-cy="skillsDisplayHome"]') .contains('Overall Points'); - cy.contains('proj1'); + cy.get('[data-cy="skillsDisplayHome"] [data-cy="skillsTitle"]').contains('proj1'); }); it('Trusted client should be shown when oAuthOnly!=true', () => { @@ -155,51 +131,6 @@ describe('Projects Tests', () => { .should('exist'); }); - it('Project stats should all be the same size when they wrap', () => { - cy.viewport(1000, 1000); //original issue presented when stat cards wrapped to another row - - cy.request('POST', '/app/projects/abcdeghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxy', { - projectId: 'abcdeghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxy', - name: 'abcdeghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxy' - }); - cy.intercept('GET', '/admin/projects/abcdeghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxy') - .as('loadProj'); - cy.intercept('GET', '/api/projects/Inception/level') - .as('loadInception'); - cy.visit('/administrator/projects/abcdeghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxy/'); - cy.wait('@loadProj'); - cy.wait('@loadInception'); - - cy.contains('No Subjects Yet'); - cy.get('[data-cy="pageHeader"]') - .contains('ID: abcdeghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxy'); - cy.wait(2000); - cy.get('[data-cy="pageHeader"] .container-fluid') - .should('have.length', 1); - - cy.get('[data-cy=pageHeaderStat]') - .first() - .invoke('width') - .then((val) => { - cy.get('[data-cy=pageHeaderStat]') - .eq(1) - .invoke('width') - .should('eq', val); - cy.get('[data-cy=pageHeaderStat]') - .eq(2) - .invoke('width') - .should('eq', val); - cy.get('[data-cy=pageHeaderStat]') - .eq(3) - .invoke('width') - .should('eq', val); - cy.get('[data-cy=pageHeaderStat]') - .eq(4) - .invoke('width') - .should('eq', val); - }); - }); - it('Created and Last Reported Skill data should be visible on projects page', () => { cy.request('POST', '/app/projects/my_project_123', { projectId: 'my_project_123', @@ -328,7 +259,7 @@ describe('Projects Tests', () => { cy.contains('No Subjects Yet'); }); - it('project card stats', () => { + it('insufficient points warning', () => { cy.createProject(1); cy.createSubject(1, 1); cy.createSubject(1, 2); @@ -342,32 +273,11 @@ describe('Projects Tests', () => { cy.createProject(3); cy.visit('/administrator'); - cy.get('[data-cy="projectCard_proj1"] [data-cy="pagePreviewCardStat_Subjects"] [data-cy="statNum"]') - .contains(2); - cy.get('[data-cy="projectCard_proj1"] [data-cy="pagePreviewCardStat_Skills"] [data-cy="statNum"]') - .contains(3); - cy.get('[data-cy="projectCard_proj1"] [data-cy="pagePreviewCardStat_Points"] [data-cy="statNum"]') - .contains(600); - cy.get('[data-cy="projectCard_proj1"] [data-cy="pagePreviewCardStat_Badges"] [data-cy="statNum"]') - .contains(1); - - cy.get('[data-cy="projectCard_proj2"] [data-cy="pagePreviewCardStat_Subjects"] [data-cy="statNum"]') - .contains(0); - cy.get('[data-cy="projectCard_proj2"] [data-cy="pagePreviewCardStat_Skills"] [data-cy="statNum"]') - .contains(0); - cy.get('[data-cy="projectCard_proj2"] [data-cy="pagePreviewCardStat_Points"] [data-cy="statNum"]') - .contains(0); - cy.get('[data-cy="projectCard_proj2"] [data-cy="pagePreviewCardStat_Badges"] [data-cy="statNum"]') - .contains(0); - - cy.get('[data-cy="projectCard_proj2"] [data-cy="pagePreviewCardStat_Subjects"] [data-cy="warning"]') - .should('not.exist'); - cy.get('[data-cy="projectCard_proj2"] [data-cy="pagePreviewCardStat_Skills"] [data-cy="warning"]') - .should('not.exist'); - cy.get('[data-cy="projectCard_proj2"] [data-cy="pagePreviewCardStat_Points"] [data-cy="warning"]') - .should('exist'); - cy.get('[data-cy="projectCard_proj2"] [data-cy="pagePreviewCardStat_Badges"] [data-cy="warning"]') - .should('not.exist'); + cy.get('[data-cy="projectCard_proj1"] [data-cy="projectCardWarning"]').should('not.exist') + cy.get('[data-cy="projectCard_proj2"] [data-cy="projectCardWarning"]') + .contains('Project has insufficient points assigned'); + cy.get('[data-cy="projectCard_proj3"] [data-cy="projectCardWarning"]') + .contains('Project has insufficient points assigned'); }); it('project description is retained after editing', () => { @@ -385,22 +295,22 @@ describe('Projects Tests', () => { cy.wait('@loadDescription'); cy.get(makdownDivSelector).invoke('text').invoke('trim').should('equal', '') cy.get('[data-cy="markdownEditorInput"]').type('I am a description'); - cy.get('[data-cy="saveProjectButton"]').should('be.enabled'); - cy.get('[data-cy="saveProjectButton"]').click(); + cy.get('[data-cy="saveDialogBtn"]').should('be.enabled'); + cy.get('[data-cy="saveDialogBtn"]').click(); cy.wait('@saveProject'); cy.get('[data-cy="btn_edit-project"]').click(); cy.wait('@loadDescription'); cy.get(makdownDivSelector).should('have.text', 'I am a description'); cy.get('[data-cy="markdownEditorInput"]').click().type('jabberwocky jabberwocky jabberwocky'); cy.wait('@validateDescription'); - cy.get('[data-cy="projectDescriptionError"]').should('be.visible'); - cy.get('[data-cy="projectDescriptionError"]').should('contain.text', 'Project Description - paragraphs may not contain jabberwocky.'); - cy.get('[data-cy="saveProjectButton"]').should('be.disabled'); + cy.get('[data-cy="descriptionError"]').should('be.visible'); + cy.get('[data-cy="descriptionError"]').should('contain.text', 'Project Description - paragraphs may not contain jabberwocky'); + cy.get('[data-cy="saveDialogBtn"]').should('be.disabled'); cy.get('[data-cy="markdownEditorInput"]').click().type('{selectall}I am a description sans jw'); cy.wait('@validateDescription'); - cy.get('[data-cy="projectDescriptionError"]').should('not.be.visible'); - cy.get('[data-cy="saveProjectButton"]').should('be.enabled'); - cy.get('[data-cy="saveProjectButton"]').click(); + cy.get('[data-cy="descriptionError"]').should('not.be.visible'); + cy.get('[data-cy="saveDialogBtn"]').should('be.enabled'); + cy.get('[data-cy="saveDialogBtn"]').click(); cy.wait('@saveProject'); cy.visit('/administrator/'); cy.contains('This is project 1'); @@ -408,8 +318,8 @@ describe('Projects Tests', () => { cy.wait('@loadDescription'); cy.get(makdownDivSelector).should('have.text', 'I am a description sans jw'); cy.get('[data-cy="markdownEditorInput"]').click().type('{selectall}Am I a description?'); - cy.get('[data-cy="saveProjectButton"]').should('be.enabled'); - cy.get('[data-cy="saveProjectButton"]').click(); + cy.get('[data-cy="saveDialogBtn"]').should('be.enabled'); + cy.get('[data-cy="saveDialogBtn"]').click(); cy.wait('@saveProject'); cy.contains('This is project 1'); cy.get('[data-cy="editProjBtn"]').click(); From 3fe72a72f1e752fc1a6176c2050852ca71930bdb Mon Sep 17 00:00:00 2001 From: Dima May Date: Tue, 11 Jun 2024 18:42:30 +0000 Subject: [PATCH 5/6] #2490: removing race condition from a test --- .../cypress/e2e/client-display/client-display_spec.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/e2e-tests/cypress/e2e/client-display/client-display_spec.js b/e2e-tests/cypress/e2e/client-display/client-display_spec.js index e67ca22212..01fcaca6aa 100644 --- a/e2e-tests/cypress/e2e/client-display/client-display_spec.js +++ b/e2e-tests/cypress/e2e/client-display/client-display_spec.js @@ -217,27 +217,37 @@ describe('Client Display Tests', () => { it('clearly represent navigable components', () => { cy.cdVisit('?internalBackButton=true', true); + cy.get('[data-cy="pointHistoryChartWithData"]') cy.cdClickSubj(0, 'Subject 1',true); + cy.get('[data-cy="pointHistoryChartWithData"]') // make sure it can navigate into each skill via title cy.cdClickSkill(0, false); cy.cdBack('Subject 1'); + cy.get('[data-cy="pointHistoryChartWithData"]') cy.cdClickSkill(1, false); cy.cdBack('Subject 1'); + cy.get('[data-cy="pointHistoryChartWithData"]') cy.cdClickSkill(2, false); cy.cdBack('Subject 1'); + cy.get('[data-cy="pointHistoryChartWithData"]') cy.cdClickSkill(3, false); cy.cdBack('Subject 1'); + cy.get('[data-cy="pointHistoryChartWithData"]') // make sure it can navigate into each skill via progress bar cy.cdClickSkill(0); cy.cdBack('Subject 1'); + cy.get('[data-cy="pointHistoryChartWithData"]') cy.cdClickSkill(1); cy.cdBack('Subject 1'); + cy.get('[data-cy="pointHistoryChartWithData"]') cy.cdClickSkill(2); cy.cdBack('Subject 1'); + cy.get('[data-cy="pointHistoryChartWithData"]') cy.cdClickSkill(3); cy.cdBack('Subject 1'); + cy.get('[data-cy="pointHistoryChartWithData"]') }); it('components should not be clickable in the summary only option', () => { From a78f7eb195e1f3108f73fadededd5ff1927c1f00 Mon Sep 17 00:00:00 2001 From: Dima May Date: Tue, 11 Jun 2024 19:53:38 +0000 Subject: [PATCH 6/6] #2490: removing race condition from a test --- e2e-tests/cypress/e2e/client-display/client-display_spec.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/e2e-tests/cypress/e2e/client-display/client-display_spec.js b/e2e-tests/cypress/e2e/client-display/client-display_spec.js index 01fcaca6aa..81333d0a01 100644 --- a/e2e-tests/cypress/e2e/client-display/client-display_spec.js +++ b/e2e-tests/cypress/e2e/client-display/client-display_spec.js @@ -232,6 +232,7 @@ describe('Client Display Tests', () => { cy.cdBack('Subject 1'); cy.get('[data-cy="pointHistoryChartWithData"]') cy.cdClickSkill(3, false); + cy.get('[data-cy="prerequisitesCard"] [data-cy="skillLink-proj1-skill2"]') cy.cdBack('Subject 1'); cy.get('[data-cy="pointHistoryChartWithData"]') @@ -246,6 +247,7 @@ describe('Client Display Tests', () => { cy.cdBack('Subject 1'); cy.get('[data-cy="pointHistoryChartWithData"]') cy.cdClickSkill(3); + cy.get('[data-cy="prerequisitesCard"] [data-cy="skillLink-proj1-skill2"]') cy.cdBack('Subject 1'); cy.get('[data-cy="pointHistoryChartWithData"]') });