Skip to content

Commit

Permalink
Apply image_layer tests to mobile view (#643)
Browse files Browse the repository at this point in the history
* Apply image_layer tests to mobile

* prettier

* Handle multiple flatpickr instances

* prettier

* Fix issue where sometimes date is not updated

* Fix date/time input blur bug

* Increase timeout
  • Loading branch information
dgarciabriseno authored Nov 14, 2024
1 parent e8a4a87 commit 445a4c8
Show file tree
Hide file tree
Showing 13 changed files with 260 additions and 166 deletions.
15 changes: 8 additions & 7 deletions resources/js/HelioviewerWebClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,6 @@ var HelioviewerWebClient = HelioviewerClient.extend(

//Fix Scroll
$('#hv-drawer-data').on( 'scroll', function(){
$('.periodpicker_timepicker_dialog').removeClass('visible');
$('#vso-start-time, #vso-end-time, #sdo-start-time, #sdo-end-time').blur() ;

$('#vso-start-date')[0]._flatpickr.close();
Expand All @@ -665,9 +664,11 @@ var HelioviewerWebClient = HelioviewerClient.extend(
$('#sdo-end-date')[0]._flatpickr.close();
});
$('#hv-drawer-left').on( 'scroll', function(){
$('.periodpicker_timepicker_dialog').removeClass('visible');
$('#time').blur() ;
$('#date')[0]._flatpickr.close();
const date_flatpickr = $('#date')[0]._flatpickr;
if (date_flatpickr.isOpen) {
date_flatpickr.close();
}
});


Expand Down Expand Up @@ -1227,8 +1228,8 @@ var HelioviewerWebClient = HelioviewerClient.extend(
+ '</a>';

Helioviewer.messageConsole.success(body, {
sticky: true,
header: 'Just now'
sticky: true,
header: 'Just now'
});
});

Expand Down Expand Up @@ -1256,8 +1257,8 @@ var HelioviewerWebClient = HelioviewerClient.extend(
+ '</a>';

Helioviewer.messageConsole.success(body, {
sticky: true,
header: 'Just now'
sticky: true,
header: 'Just now'
});

});
Expand Down
2 changes: 2 additions & 0 deletions resources/js/UI/TileLayerAccordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ var TileLayerAccordion = Layer.extend(
allowInput: true,
dateFormat: 'Y/m/d',
position: 'below',
disableMobile: true,
onChange:function(selected, datestr, instance){
let $input = $(instance.input);
onDiffDate($input.val()+' '+$('#'+id+' .difftime').val());
Expand All @@ -363,6 +364,7 @@ var TileLayerAccordion = Layer.extend(
time_24hr: true,
minuteIncrement: 1,
secondIncrement: 1,
disableMobile: true,
onClose: function (selected, datestr, instance) {
if(time != ''){
let $input = $(instance.input);
Expand Down
8 changes: 7 additions & 1 deletion resources/js/UI/TimeControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ var TimeControls = Class.extend(
dateFormat: 'Y/m/d',
disableMobile: true,
// onChange: $.proxy(this._onTextFieldChange, this),
onClose: (a, b, flatpickr) => {
this._onTextFieldChange();
},
onChange: (a, b, flatpickr) => {
delayed_flatpickr_update(flatpickr);
},
Expand Down Expand Up @@ -299,7 +302,10 @@ var TimeControls = Class.extend(
secondIncrement: 1,
disableMobile: true,
position: "above",
onChange: $.proxy(this._onTextFieldChange, this)
onChange: $.proxy(this._onTextFieldChange, this),
onClose: (a, b, flatpickr) => {
this._onTextFieldChange();
},
});
this._timeInput.keydown(createCloseFunction(this._timeInput));
},
Expand Down
6 changes: 0 additions & 6 deletions resources/lib/responsive/responsive_hv.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ $(function() {
// Discard Safari since it also matches Chrome
if ((chromeAgent) && (safariAgent)) safariAgent = false;

// position the time picker differently in Safari
if(safariAgent) {
$('.periodpicker_timepicker_dialog.visible').css('bottom','72px');
}

// force-close right drawers (add drawers as necessary)
function closeallHVwindows() {
$('#hv-drawer-left').css('display','none');
Expand Down Expand Up @@ -578,7 +573,6 @@ $(document.body).on('click','.toggle_empty',function(){

// on orientation change [portait / landscape]
$(window).on('orientationchange resize', function () {
$(".periodpicker_timepicker_dialog").removeClass("visible");
$("#time").blur();
});

Expand Down
8 changes: 4 additions & 4 deletions tests/desktop/multi/unmatched_image_warning.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ test("[Normal] Helioviewer shows a warning when the image displayed is at least
await page.getByLabel("Observation date", { exact: true }).press("Enter");
// Wait for page to load
await page.waitForFunction(() => document.getElementById("loading")?.style.display == "none", null, {
timeout: 60000
timeout: 90000
});
// Expect the warning to appear with the expected text
await expect(page.getByText("The AIA 304 layer is 6 hours")).toBeVisible();
Expand All @@ -50,7 +50,7 @@ test("[Normal] Helioviewer shows a warning when the image displayed is at least
await page.getByLabel("Observation time").press("Enter");
// Wait for page to load
await page.waitForFunction(() => document.getElementById("loading")?.style.display == "none", null, {
timeout: 60000
timeout: 90000
});
// Expect the warning to disappear with the expected text
await expect(page.getByText("The AIA 304 layer is 6 hours")).not.toBeVisible();
Expand All @@ -69,7 +69,7 @@ test("[Minimal] Helioviewer shows a warning when the image displayed is at least
await page.getByRole("textbox", { name: "Time" }).press("Enter");
// Wait for page to load
await page.waitForFunction(() => document.getElementById("loading")?.style.display == "none", null, {
timeout: 60000
timeout: 90000
});
// Expect the warning to appear
await expect(page.getByText("The AIA 171 layer is 6 hours")).toBeVisible();
Expand All @@ -82,7 +82,7 @@ test("[Minimal] Helioviewer shows a warning when the image displayed is at least
await page.getByRole("textbox", { name: "Time" }).press("Enter");
// Wait for page to load
await page.waitForFunction(() => document.getElementById("loading")?.style.display == "none", null, {
timeout: 60000
timeout: 90000
});
// Expect the warning to disappear
await expect(page.getByText("The AIA 171 layer is 6 hours")).not.toBeVisible();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect } from "@playwright/test";
import { test } from "@playwright/test";
import { Helioviewer } from "../../../page_objects/helioviewer";
import { mockEvents } from "../../../utils/events";

Expand All @@ -8,7 +8,7 @@ import { mockEvents } from "../../../utils/events";
* then asserts all of the childnodes of event_tree , should be checked,
* also asserts all of the other nodes, should be unchecked
*/
test("Checked event type should check all of its child frms and event_instances", async ({ page, browser }, info) => {
test("Checked event type should check all of its child frms and event_instances", async ({ page }, info) => {
// mocked event data
const events = {
CCMC: {
Expand Down
Loading

0 comments on commit 445a4c8

Please sign in to comment.