Skip to content

Commit

Permalink
Merge branch 'master' into renovate/mocha-multi-1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelJacob21012 authored Oct 16, 2023
2 parents d2ef82b + 9b8430b commit 22d2aaa
Show file tree
Hide file tree
Showing 15 changed files with 179 additions and 61 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,5 @@ functional-output/
.pnp.*
projects/media-viewer/.yarn/*
projects/media-viewer/.yarn/cache/*

.angular/cache/*
2 changes: 1 addition & 1 deletion Jenkinsfile_nightly
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static LinkedHashMap<String, Object> secret(String secretName, String envVar) {
}

withNightlyPipeline(type, product, component) {
env.TEST_URL = params.ExUI_URL
env.TEST_URL = 'http://em-showcase-aat.service.core-compute-aat.internal/media-viewer'
env.IDAM_URL = params.IDAM_API_URL
env.S2S_PROVIDER = params.S2S_PROVIDER_URL
env.CCD_DATA_STORE_API_URL = params.CCD_DATA_STORE_URL
Expand Down
80 changes: 79 additions & 1 deletion audit.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
"karma-jasmine-html-reporter": "^1.5.0",
"karma-phantomjs-launcher": "^1.0.4",
"mocha": "9.2.2",
"mocha-jenkins-reporter": "0.4.7",
"mocha-jenkins-reporter": "0.4.8",
"mocha-junit-reporter": "2.0.2",
"mocha-multi": "1.1.7",
"mochawesome": "7.1.3",
Expand Down
12 changes: 6 additions & 6 deletions projects/media-viewer/src/lib/media-viewer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ export class MediaViewerComponent implements OnChanges, OnDestroy, AfterContentI
this.api.annotationApiUrl = this.annotationApiUrl;
}

if (changes.contentType) {
this.convertibleContent = this.needsConverting();
this.multimediaContent = this.isMultimedia();
this.unsupportedContent = !this.isSupported();
}

if (changes.url) {
this.toolbarEvents.reset();
this.commentService.resetCommentSet();
Expand All @@ -170,12 +176,6 @@ export class MediaViewerComponent implements OnChanges, OnDestroy, AfterContentI
}
}

if (changes.contentType) {
this.convertibleContent = this.needsConverting();
this.multimediaContent = this.isMultimedia();
this.unsupportedContent = !this.isSupported();
}

this.setToolbarButtons();
this.detectOs();
this.typeException = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ describe('OutlineItemComponent', () => {
});

it('should find the ending page number', () => {
expect(component.findEndPage(undefined)).toBe(Number.MAX_SAFE_INTEGER);
component.endPage = Math.floor(Math.random() * 1000);
expect(component.findEndPage(undefined)).toBe(component.endPage);
const nextOutline = <Outline> {};
nextOutline.pageNumber = Math.floor(Math.random() * 10000);
expect(component.findEndPage(nextOutline)).toBe(nextOutline.pageNumber);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { Outline } from './outline.model';
export class OutlineItemComponent implements OnInit {

@Input() outline: Outline;
@Input() currentPageNumber: Number;
@Input() currentPageNumber: number;
@Input() isCurrentSection: boolean;
@Input() endPage: Number;
@Input() endPage: number;
@Output() navigationEvent = new EventEmitter();

showOutlineItems: boolean;
Expand Down Expand Up @@ -38,7 +38,7 @@ export class OutlineItemComponent implements OnInit {
}

findEndPage(next: Outline): number {
return next === undefined ? Number.MAX_SAFE_INTEGER : next.pageNumber;
return next === undefined ? this.endPage : next.pageNumber;
}

showHighlightOutlineCss() {
Expand Down
5 changes: 4 additions & 1 deletion test/end-to-end/data/commonConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,8 @@
"searchAllBtn": "#mvSearchAllBtn",
"redactAllBtn": "#mvRedactAllBtn",
"findRedactResultsCount" : "#findRedactResultsCount",
"rectangleClass" : ".rectangle"
"rectangleClass" : ".rectangle",
"collateCommentsCheck": "ngx-datatable",
"closeCommentSummary": "button#modal-close-button",
"imageTabButton": "#image-button"
}
66 changes: 28 additions & 38 deletions test/end-to-end/helpers/mvCaseHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,8 @@ async function enterShouldJumpViewerToNextSearchResultsTest(I, caseId, searchKey
}

async function pdfViewerPageNavigationTest(I, caseId, mediaType, pageNoToNavigate) {
if (await previewEnv()) {
await I.amOnPage(testConfig.TestUrl, testConfig.PageLoadTime);
} else {
await openCaseDocumentsInMediaViewer(I, caseId, mediaType);
await I.pdfViewerPageNavigation(pageNoToNavigate);
}
await executeTestsOnPreview(I, caseId, mediaType);
await I.pdfViewerPageNavigation(pageNoToNavigate);
}

async function pdfViewerZoomInOutTest(I, caseId, mediaType) {
Expand Down Expand Up @@ -161,6 +157,15 @@ async function collateCommentsTest(I, caseId, mediaType) {
await I.collateComments();
}

async function collateCommentsNotBlankTest(I, caseId, mediaType) {
await executeTestsOnPreview(I, caseId, mediaType);
await I.clickCommentsPanel();
await I.deleteAllExistingComments();
await I.addMultipleComments();
await I.collateComments();
await I.collateCommentsNotBlank();
}

async function commentsSearchTest(I, caseId, mediaType) {
await executeTestsOnPreview(I, caseId, mediaType);
await I.clickCommentsPanel();
Expand Down Expand Up @@ -229,40 +234,28 @@ async function navigateNestedDocsUsingIndexTest(I, caseId, mediaType, nestedPage
}

async function nonTextualHighlightAndAddACommentTest(I, caseId, mediaType) {
if (await previewEnv()) {
await I.amOnPage(testConfig.TestUrl, testConfig.PageLoadTime);
} else {
await openCaseDocumentsInMediaViewer(I, caseId, mediaType);
await I.nonTextualHighlightAndComment();
}
await executeTestsOnPreview(I, caseId, mediaType);
await I.openImage();
await I.nonTextualHighlightAndComment();
}

async function nonTextualHighlightUsingDrawBoxTest(I, caseId, mediaType) {
if (await previewEnv()) {
await I.amOnPage(testConfig.TestUrl, testConfig.PageLoadTime);
} else {
await openCaseDocumentsInMediaViewer(I, caseId, mediaType);
await I.deleteAllExistingNonTextualHighlights();
await I.highlightOnImage(900, 900, 900, 900, ['mousedown', 'mousemove', 'mouseup'], 'box-highlight', 0);
}
await executeTestsOnPreview(I, caseId, mediaType);
await I.openImage();
await I.deleteAllExistingNonTextualHighlights();
await I.highlightOnImage(900, 900, 900, 900, ['mousedown', 'mousemove', 'mouseup'], 'box-highlight', 0);
}

async function updateNonTextualCommentTest(I, caseId, mediaType, comment, updatedComment) {
if (await previewEnv()) {
await I.amOnPage(testConfig.TestUrl, testConfig.PageLoadTime);
} else {
await openCaseDocumentsInMediaViewer(I, caseId, mediaType);
await I.updateNonTextualComments();
}
await executeTestsOnPreview(I, caseId, mediaType);
await I.openImage();
await I.updateNonTextualComments();
}

async function deleteNonTextualCommentTest(I, caseId, mediaType) {
if (await previewEnv()) {
await I.amOnPage(testConfig.TestUrl, testConfig.PageLoadTime);
} else {
await openCaseDocumentsInMediaViewer(I, caseId, mediaType);
await I.deleteAllExistingNonTextualHighlights();
}
await executeTestsOnPreview(I, caseId, mediaType);
await I.openImage();
await I.deleteAllExistingNonTextualHighlights();
}


Expand All @@ -280,13 +273,9 @@ async function previewEnv() {
}

async function executeTestsOnPreview(I, caseId, mediaType) {
if (process.env.TEST_URL.includes(mvData.PREVIEW_ENV) || process.env.TEST_URL.includes(mvData.LOCAL_ENV)) {
await I.amOnPage(testConfig.TestUrl, testConfig.PageLoadTime);
await I.waitForEnabled(commonConfig.assertEnvTestData, testConfig.TestTimeToWaitForText);
console.log(await I.grabCurrentUrl());
} else {
await openCaseDocumentsInMediaViewer(I, caseId, mediaType);
}
await I.amOnPage(testConfig.TestUrl, testConfig.PageLoadTime);
await I.waitForEnabled(commonConfig.assertEnvTestData, testConfig.TestTimeToWaitForText);
console.log(await I.grabCurrentUrl());
}

async function uploadDocumentEvent(I, caseId, eventName) {
Expand Down Expand Up @@ -330,6 +319,7 @@ module.exports = {
deleteHighlightsTest,
updateCommentTest,
collateCommentsTest,
collateCommentsNotBlankTest,
commentsSearchTest,
addMultipleCommentsTest,
markContentForRedactionUsingDrawBoxTest,
Expand Down
9 changes: 8 additions & 1 deletion test/end-to-end/mvFeatures/annotationsAndComments.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const {
addCommentTest,
deleteCommentTest,
updateCommentTest,
deleteHighlightsTest
deleteHighlightsTest,
collateCommentsNotBlankTest
} = require("../helpers/mvCaseHelper");
const { mvData } = require('../pages/common/constants.js');

Expand Down Expand Up @@ -44,6 +45,12 @@ Scenario('Annotations: Collate Comments', async ({ I }) => {
}).tag('@ci')
.retry(testConfig.TestRetryScenarios);

Scenario('Collate Comments should not be blank', async ({ I }) => {
await collateCommentsNotBlankTest(I, mvData.CASE_ID, mvData.PDF_DOCUMENT);

}).tag('@ci')
.retry(testConfig.TestRetryScenarios);

Scenario('Annotations: Search Comment Text', async ({ I }) => {
await commentsSearchTest(I, mvData.CASE_ID, mvData.PDF_DOCUMENT);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ module.exports = async function () {
await I.fillField(commonConfig.firstCommentXp, commonConfig.firstComment1);
await I.retry(3).click('//button[@class="govuk-button" and contains(text(), "Save")]');
await I.wait(testConfig.BookmarksAndAnnotationsWait);
await I.nonTextualHighlightAndComment();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict'
const commonConfig = require('../../data/commonConfig.json');
const testConfig = require("../../../config");

module.exports = async function () {
const I = this;
await I.seeElement(commonConfig.collateCommentsCheck);
await I.click(commonConfig.closeCommentSummary);

await I.highlightOnImage(500, 500, 500, 500, ['mousedown', 'mousemove', 'mouseup'], 'box-highlight', 0);
await I.retry(2).click(commonConfig.commentPopup);
await I.fillField(commonConfig.firstCommentXp, commonConfig.firstComment1);
await I.retry(3).click(commonConfig.saveButton);
await I.wait(testConfig.BookmarksAndAnnotationsWait);

await I.retry(2).click(commonConfig.commentsSummaryBtn);
await I.wait(testConfig.BookmarksAndAnnotationsWait);

await I.seeElement(commonConfig.collateCommentsCheck);

let commentsList = await I.grabTextFromAll(commonConfig.commentsCount);
commentsList.forEach(comment => console.log(comment));
}
11 changes: 11 additions & 0 deletions test/end-to-end/pages/imageViewer/openImage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict'
const commonConfig = require('../../data/commonConfig.json');
const testConfig = require("../../../config");
const chai = require('chai');


module.exports = async function () {
const I = this;
await I.click(commonConfig.imageTabButton);
await I.dontSee('Index');
};
4 changes: 3 additions & 1 deletion test/end-to-end/pages/steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module.exports = () => {
deleteAllExistingComments: steps.annotationsAndComments.deleteAllExistingComments,
clickCommentsPanel: steps.annotationsAndComments.clickCommentsPanel,
collateComments: steps.annotationsAndComments.collateComments,
collateCommentsNotBlank: steps.annotationsAndComments.collateCommentsNotBlank,
commentsSearch: steps.annotationsAndComments.commentsSearch,
addMultipleComments: steps.annotationsAndComments.addMultipleComments,
clickRedactMenu: steps.redact.clickRedactMenu,
Expand All @@ -65,6 +66,7 @@ module.exports = () => {
clickSearchFrom: steps.redact.clickSearchFrom,
redactFillSearchInput: steps.redact.redactFillSearchInput,
clickRedactSearchButton: steps.redact.clickRedactSearchButton,
clickRedactAllButton: steps.redact.clickRedactAllButton
clickRedactAllButton: steps.redact.clickRedactAllButton,
openImage: steps.imageViewer.openImage
});
};
14 changes: 7 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1958,7 +1958,7 @@ __metadata:
karma-jasmine-html-reporter: ^1.5.0
karma-phantomjs-launcher: ^1.0.4
mocha: 9.2.2
mocha-jenkins-reporter: 0.4.7
mocha-jenkins-reporter: 0.4.8
mocha-junit-reporter: 2.0.2
mocha-multi: 1.1.7
mochawesome: 7.1.3
Expand Down Expand Up @@ -13226,16 +13226,16 @@ __metadata:
languageName: node
linkType: hard

"mocha-jenkins-reporter@npm:0.4.7":
version: 0.4.7
resolution: "mocha-jenkins-reporter@npm:0.4.7"
"mocha-jenkins-reporter@npm:0.4.8":
version: 0.4.8
resolution: "mocha-jenkins-reporter@npm:0.4.8"
dependencies:
diff: 4.0.1
mkdirp: ^0.5.4
mkdirp: ^1.0.4
xml: ^1.0.1
peerDependencies:
mocha: ^5.2.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0
checksum: 2e48a2bb51210cfb64b6966ce8dcccdec9a288f49d98efb86b39f7f22f865db60de508de215807c31f5cfd1097a5232fbe5ae5995bf1c580502db85c196007e2
mocha: ^5.2.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0
checksum: df42cdf4fb2cd7fbdc236637fb680e9019861dd9745239a4ff8b1e7278b980bcda50e28769c03739730d2c44ec40b72db6caf548bd2a5751850f016aebd2b103
languageName: node
linkType: hard

Expand Down

0 comments on commit 22d2aaa

Please sign in to comment.