Skip to content

Commit 6a15280

Browse files
committed
Fix Cypress journey regressions
1 parent a52abe5 commit 6a15280

12 files changed

Lines changed: 99 additions & 29 deletions

File tree

cypress/e2e/journeys/flows/default-contact-type-link-color.cy.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,14 @@ const selectPrimeOption = (selector: string, label: string): void => {
7373
};
7474

7575
const closeSampleDatasetOverlay = (): void => {
76-
cy.get(byTestId(testIds.appSampleDatasetButton), { timeout: 120000 })
77-
.should('be.visible')
78-
.click({ force: true });
76+
cy.get('body').then(($body) => {
77+
const continueButton = $body.find(`${byTestId(testIds.appSampleDatasetButton)}:visible`);
78+
if (!continueButton.length) return;
79+
80+
cy.get(byTestId(testIds.appSampleDatasetButton), { timeout: 120000 })
81+
.should('be.visible')
82+
.click({ force: true });
83+
});
7984

8085
cy.get('#overlay', { timeout: 15000 }).should('not.be.visible');
8186
};

cypress/support/journey-helpers.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ export function visitAppAndAcceptEula(options: JourneyVisitOptions = {}): void {
9292
}
9393

9494
cy.get('body').then(($body) => {
95-
if (!resolvedOptions.skipDemoSession) return;
96-
9795
const continueButton = $body.find(`${byTestId(testIds.appSampleDatasetButton)}:visible`);
9896
if (!continueButton.length) return;
9997

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "MicrobeTrace",
3-
"version": "2.2.0",
3+
"version": "2.2.1",
44
"scripts": {
55
"ng": "ng",
66
"start": "ng serve -c development",

scripts/tomcat/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ Use it to validate generated WAR files before handing them to DevOps.
3636

3737
## Typical local flow
3838

39-
`bash scripts/tomcat/run-war-smoke.sh --skip-build --war dist/MicrobeTrace_2.2.0.war --context ROOT`
39+
`bash scripts/tomcat/run-war-smoke.sh --skip-build --war dist/MicrobeTrace_2.2.1.war --context ROOT`
4040

41-
`scripts/tomcat/run-war-smoke.cmd --skip-build --war dist\\MicrobeTrace_2.2.0.war --context ROOT`
41+
`scripts/tomcat/run-war-smoke.cmd --skip-build --war dist\\MicrobeTrace_2.2.1.war --context ROOT`
4242

4343
## Package.json shortcuts
4444

src/app/contactTraceCommonServices/color-mapping.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,15 @@ export class ColorMappingService {
158158
// For each distinct value, see if we have a color in the “history”
159159
const reservedColors = new Set<string>();
160160
distinctValues.forEach((value) => {
161-
const existingColor = variableHistory[value] ?? storedColorsByValue[value];
161+
const existingColor = storedColorsByValue[value] ?? variableHistory[value];
162162
if (typeof existingColor === 'string') {
163163
reservedColors.add(existingColor);
164164
}
165165
});
166166

167167
const usedColors = new Set<string>();
168168
const mappedColors = distinctValues.map((value, index) => {
169-
const existingColor = variableHistory[value] ?? storedColorsByValue[value];
169+
const existingColor = storedColorsByValue[value] ?? variableHistory[value];
170170
if (typeof existingColor === 'string') {
171171
variableHistory[value] = existingColor;
172172
usedColors.add(existingColor);

src/app/filesComponent/files-plugin.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,10 @@ export class FilesComponent extends BaseComponentDirective implements OnInit {
859859
}
860860

861861
private dismissWelcomeOverlay() {
862-
$('#overlay').stop(true, true).fadeOut('fast');
862+
const overlay = $('#overlay');
863+
overlay.addClass('overlay-hidden').css('pointer-events', 'none');
864+
overlay.find('.dnd-input').css('pointer-events', 'none');
865+
overlay.stop(true, true).fadeOut('fast');
863866
$('.ui-tabview-nav').stop(true, true).fadeTo('fast', 1);
864867
$('.m-portlet').stop(true, true).fadeTo('fast', 1);
865868
}

src/app/microbe-trace-next-plugin.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@
597597
<div id="link-color-value-row" class="form-group row" title="What color should the links be?">
598598
<div class="col-5"><label for="link-color">Links</label></div>
599599
<div class="col-7">
600-
<input type="color" id="link-color" class="form-control form-control-sm" [(ngModel)]="SelectedLinkColorVariable" (ngModelChange)="onLinkColorChanged()">
600+
<input type="color" id="link-color" class="form-control form-control-sm" [value]="SelectedLinkColorVariable" (input)="onLinkColorChanged($any($event.target).value)" (change)="onLinkColorChanged($any($event.target).value)">
601601
</div>
602602
</div>
603603
}

src/app/microbe-trace-next-plugin.component.ts

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ export class MicrobeTraceNextHomeComponent extends AppComponentBase implements A
182182
// messages to display in loading modal
183183
messages: string[] = [];
184184

185-
version: string = '2.2';
185+
version: string = '2.2.1';
186186
auspiceUrlVal: string|null = '';
187187

188188
private thresholdSubscription: Subscription;
@@ -208,6 +208,15 @@ export class MicrobeTraceNextHomeComponent extends AppComponentBase implements A
208208

209209

210210
// posts: BlockchainProofHashDto[] = new Array<BlockchainProofHashDto>();
211+
212+
private dismissWelcomeOverlay(duration: JQuery.Duration = 'slow'): void {
213+
const overlay = $('#overlay');
214+
overlay.addClass('overlay-hidden').css('pointer-events', 'none');
215+
overlay.find('.dnd-input').css('pointer-events', 'none');
216+
overlay.stop(true, true).fadeOut(duration);
217+
$('.ui-tabview-nav').stop(true, true).fadeTo(duration, 1);
218+
$('.m-portlet').stop(true, true).fadeTo(duration, 1);
219+
}
211220
// Blockchaindata: BlockchainProofHashDto = new BlockchainProofHashDto();
212221
date: Date;
213222
// Inputdownloadblock: DownloadFilteredBlockDto = new DownloadFilteredBlockDto();
@@ -1517,9 +1526,7 @@ export class MicrobeTraceNextHomeComponent extends AppComponentBase implements A
15171526

15181527
// this.homepageTabs[1].isActive = false;
15191528
this.homepageTabs[0].isActive = true;
1520-
$('#overlay').fadeOut();
1521-
$('.ui-tabview-nav').fadeTo("slow", 1);
1522-
$('.m-portlet').fadeTo("slow", 1);
1529+
this.dismissWelcomeOverlay();
15231530
this.showExport = false;
15241531
this.showCenter = false;
15251532
this.showPinAllNodes = false;
@@ -1651,9 +1658,7 @@ export class MicrobeTraceNextHomeComponent extends AppComponentBase implements A
16511658
*/
16521659
public continueClicked() : void {
16531660
// this._removeGlView('Files');
1654-
$('#overlay').fadeOut("slow");
1655-
$('.ui-tabview-nav').fadeTo("slow", 1);
1656-
$('.m-portlet').fadeTo("slow", 1);
1661+
this.dismissWelcomeOverlay();
16571662
}
16581663

16591664
/**
@@ -2607,8 +2612,17 @@ export class MicrobeTraceNextHomeComponent extends AppComponentBase implements A
26072612
}
26082613
}
26092614

2610-
public onLinkColorChanged(silent: boolean = false) : void {
2615+
public onLinkColorChanged(valueOrSilent: string | boolean | Event = false, silent: boolean = false) : void {
2616+
if (typeof valueOrSilent === 'string') {
2617+
this.SelectedLinkColorVariable = valueOrSilent;
2618+
} else if (valueOrSilent instanceof Event) {
2619+
this.SelectedLinkColorVariable = (valueOrSilent.target as HTMLInputElement | null)?.value ?? this.SelectedLinkColorVariable;
2620+
} else {
2621+
silent = valueOrSilent;
2622+
}
2623+
26112624
this.commonService.session.style.widgets["link-color"] = this.SelectedLinkColorVariable;
2625+
this.commonService.GlobalSettingsModel.SelectedLinkColorVariable = this.SelectedLinkColorVariable;
26122626

26132627
if(!silent) this.publishUpdateLinkColor();
26142628

@@ -2618,6 +2632,12 @@ export class MicrobeTraceNextHomeComponent extends AppComponentBase implements A
26182632
onColorLinksByChanged(silent: boolean = false) {
26192633
this.commonService.GlobalSettingsModel.SelectedColorLinksByVariable = this.SelectedColorLinksByVariable;
26202634
this.commonService.session.style.widgets['link-color-variable'] = this.SelectedColorLinksByVariable;
2635+
2636+
if (this.SelectedColorLinksByVariable === 'None') {
2637+
this.SelectedLinkColorVariable = this.commonService.session.style.widgets["link-color"] || this.SelectedLinkColorVariable;
2638+
this.commonService.GlobalSettingsModel.SelectedLinkColorVariable = this.SelectedLinkColorVariable;
2639+
this.cdref.detectChanges();
2640+
}
26212641

26222642
this.onLinkColorTableChanged(silent);
26232643
if (this.isKeyTableDocked('link-color')) {
@@ -4394,9 +4414,7 @@ export class MicrobeTraceNextHomeComponent extends AppComponentBase implements A
43944414
this.homepageTabs[0].isActive = true;
43954415
console.log("Trying to launch");
43964416
this.homepageTabs[0].componentRef.instance.launchClick();
4397-
$('#overlay').fadeOut();
4398-
$('.ui-tabview-nav').fadeTo("slow", 1);
4399-
$('.m-portlet').fadeTo("slow", 1);
4417+
this.dismissWelcomeOverlay();
44004418
}
44014419
});
44024420
break;

src/app/visualizationComponents/BubbleComponent/bubble.component.ts

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1652,6 +1652,44 @@ export class BubbleComponent extends BaseComponentDirective implements OnInit, M
16521652
return new XMLSerializer().serializeToString(doc.documentElement);
16531653
}
16541654

1655+
private saveGeneratedFile(content: Blob | string, filename: string): void {
1656+
const browserWindow = window as Window & {
1657+
__mtTestSaveAs?: (content: Blob | string, filename: string) => void;
1658+
};
1659+
1660+
if (typeof browserWindow.__mtTestSaveAs === 'function') {
1661+
browserWindow.__mtTestSaveAs(content, filename);
1662+
return;
1663+
}
1664+
1665+
saveAs(content as any, filename);
1666+
}
1667+
1668+
private dataUrlToBlob(dataUrl: string): Blob {
1669+
const [metadata, payload = ''] = dataUrl.split(',');
1670+
const mimeType = metadata.match(/^data:([^;]+);base64$/)?.[1] || 'application/octet-stream';
1671+
const binary = atob(payload);
1672+
const bytes = new Uint8Array(binary.length);
1673+
1674+
for (let index = 0; index < binary.length; index++) {
1675+
bytes[index] = binary.charCodeAt(index);
1676+
}
1677+
1678+
return new Blob([bytes], { type: mimeType });
1679+
}
1680+
1681+
private exportRasterVisualization(): void {
1682+
const scale = Number(this.SelectedBubbleExportScaleVariable) || 1;
1683+
const dataUrl = this.cy.png({
1684+
full: true,
1685+
scale,
1686+
bg: '#ffffff',
1687+
output: 'base64uri',
1688+
});
1689+
1690+
this.saveGeneratedFile(this.dataUrlToBlob(dataUrl), `${this.BubbleExportFileName}.png`);
1691+
}
1692+
16551693
exportVisualization() {
16561694
const exportOptions: ExportOptions = {
16571695
filename: this.BubbleExportFileName,
@@ -1670,7 +1708,7 @@ export class BubbleComponent extends BaseComponentDirective implements OnInit, M
16701708

16711709
this.exportService.requestSVGExport([], content, true, false);
16721710
} else {
1673-
this.exportService.requestExport([this.cyContainer.nativeElement], true, false);
1711+
this.exportRasterVisualization();
16741712
}
16751713
this.exportOpen = false;
16761714
}

0 commit comments

Comments
 (0)