Skip to content

Commit

Permalink
#2490: added markdown cypress tests back to CI and fixed related bugs
Browse files Browse the repository at this point in the history
sudo-may committed Jun 6, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 18eed37 commit ad6abaf
Showing 6 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -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|/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'
../.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|/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'
cd ..
env:
Original file line number Diff line number Diff line change
@@ -288,10 +288,13 @@ watch(value, (newValue) =>{
</a>
</div>
</div>
<div v-if="attachmentWarningMessage && hasNewAttachment"
class="p-error text-sm pt-2">
<i class="fas fa-exclamation-triangle" aria-hidden="true" /> {{ attachmentWarningMessage }}
</div>
<Message
v-if="attachmentWarningMessage && hasNewAttachment"
severity="error"
data-cy="attachmentWarningMessage"
class="m-0 mt-2">
{{ attachmentWarningMessage }}
</Message>
</div>
</BlockUI>
<small role="alert" class="p-error" :id="`${name}Error`" data-cy="descriptionError">{{ errorMessage || '' }}</small>
@@ -304,7 +307,7 @@ watch(value, (newValue) =>{
:accept="allowedAttachmentFileTypes"
hidden />
<Message severity="error" v-if="attachmentError"
class="m-0"
class="m-0 mt-2"
@close="attachmentError = ''"
role="alert"
data-cy="attachmentError"
24 changes: 13 additions & 11 deletions e2e-tests/cypress/e2e/markdown_spec.js
Original file line number Diff line number Diff line change
@@ -78,7 +78,7 @@ describe('Markdown Tests', () => {

cy.get(markdownInput).get('a[href^="/api/download/"]:contains(test-pdf.pdf)')
.should('have.attr', 'target', '_blank');
cy.get('[data-cy="attachmentWarningMessage"]').should('have.text', ' Only upload attachments that are safe!')
cy.get('[data-cy="attachmentWarningMessage"]').should('have.text', 'Only upload attachments that are safe!')
cy.clickSave();
cy.get('[data-cy="manageSkillLink_skill1Skill"]')
.click();
@@ -96,15 +96,15 @@ describe('Markdown Tests', () => {
cy.get(markdownInput).focus().selectFile('cypress/attachments/test-file.invalid', { action: 'drag-drop' })
cy.get('[data-cy="attachmentError"]').contains('Unable to upload attachment - File type is not supported.')
cy.get(markdownInput).get('a[href^="/api/download/"]').should('not.exist')
cy.get('[data-cy="saveSkillButton"]').should('be.enabled')
cy.get('[data-cy="saveDialogBtn"]').should('be.enabled')
cy.get(markdownInput).type('k')
cy.get('[data-cy="attachmentError"]').should('not.exist')

cy.get(markdownInput).focus().selectFile('cypress/attachments/test-file.invalid', { action: 'drag-drop' })
cy.get('[data-cy="attachmentError"]').contains('Unable to upload attachment - File type is not supported.')
cy.get(markdownInput).get('a[href^="/api/download/"]').should('not.exist')
cy.get('[data-cy="saveSkillButton"]').should('be.enabled')
cy.get('[data-cy="saveSkillButton"]').click()
cy.get('[data-cy="saveDialogBtn"]').should('be.enabled')
cy.get('[data-cy="saveDialogBtn"]').click()

cy.get('[data-cy="editSkillButton_sk1Skill"]').click()
cy.get(markdownInput).contains('k')
@@ -122,7 +122,7 @@ describe('Markdown Tests', () => {

cy.get('a[href^="/api/download/"]:contains(test-pdf.pdf)')
.should('have.attr', 'target', '_blank');
cy.get('[data-cy="attachmentWarningMessage"]').should('have.text', ' Only upload attachments that are safe!')
cy.get('[data-cy="attachmentWarningMessage"]').should('have.text', 'Only upload attachments that are safe!')
cy.clickSave();
cy.get('[data-cy="manageSkillLink_skill1Skill"]')
.click();
@@ -149,7 +149,7 @@ describe('Markdown Tests', () => {

cy.get(markdownInput).get('a[href^="/api/download/"]')
.should('not.exist');
cy.get('[data-cy=saveSkillButton]').should('be.enabled');
cy.get('[data-cy=saveDialogBtn]').should('be.enabled');
cy.get('[data-cy=attachmentError]').contains('Unable to upload attachment - File size [7.25 KB] exceeds maximum file size [5 B]');
});

@@ -191,7 +191,7 @@ describe('Markdown Tests', () => {

cy.get(markdownInput).get('a[href^="/api/download/"]')
.should('not.exist');
cy.get('[data-cy=saveSkillButton]').should('be.enabled');
cy.get('[data-cy=saveDialogBtn]').should('be.enabled');
cy.get('[data-cy=attachmentError]').contains('Unable to upload attachment - File type is not supported. Supported file types are [.xlsx,.docx,.pptx,.doc,.odp,.ods,.odt,.pdf,.ppt,.xls]');
});

@@ -219,7 +219,7 @@ describe('Markdown Tests', () => {
cy.get(markdownInput).get(`a[href^="/api/download/"]:contains(${file})`).should('exist');
cy.get(markdownInput).type('\n\n')
});
cy.get('[data-cy=saveSkillButton]').should('be.enabled');
cy.get('[data-cy=saveDialogBtn]').should('be.enabled');
cy.get('[data-cy=attachmentError]').should('not.exist');
cy.clickSave();
cy.get('[data-cy="manageSkillLink_skill1Skill"]').click();
@@ -230,6 +230,7 @@ describe('Markdown Tests', () => {
});

it('keyboard navigation', () => {
cy.viewport(800, 1280);
cy.request('POST', '/admin/projects/proj1/subjects/subj1/skills/skill1', {
projectId: 'proj1',
subjectId: 'subj1',
@@ -420,9 +421,10 @@ describe('Markdown Tests', () => {
cy.visit('/administrator/projects/proj1/subjects/subj1');
cy.wait('@inceptionLevel');
cy.contains('Level');
const selectorSkillsRowToggle = '[data-cy="expandDetailsBtn_skill1"]';
cy.get(selectorSkillsRowToggle)
.click();
// const selectorSkillsRowToggle = '[data-cy="expandDetailsBtn_skill1"]';
// cy.get(selectorSkillsRowToggle)
// .click();
cy.get(`[data-cy="skillsTable"] [data-p-index="0"] [data-pc-section="rowtoggler"]`).click()
cy.contains('Description');
cy.contains('Emojis');
cy.contains('👍 👍 👍 👍');
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ad6abaf

Please sign in to comment.