Skip to content

Commit

Permalink
fix playwright snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
bmatthieu3 committed Sep 10, 2024
1 parent 186e634 commit 72d7e4e
Show file tree
Hide file tree
Showing 21 changed files with 27 additions and 47 deletions.
4 changes: 2 additions & 2 deletions examples/al-cfht.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
</head>
<body>

<div id="aladin-lite-div" style="width: 1024px; height: 768px"></div>
<div id="aladin-lite-div" style="width: 512px; height: 512px"></div>

<script type="module">
import A from '../src/js/A.js';
let aladin;
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {survey: "data/hips/PanSTARRS_DR1_color-z-zg-g", fov:1.5, target: "NGC 7318B", showSettingsControl: true});
aladin = A.aladin('#aladin-lite-div', {survey: "data/hips/PanSTARRS_DR1_color-z-zg-g", fov:2.0, target: "NGC 7318B", showSettingsControl: true});
aladin.setProjection('AIT');
let cfht = aladin.createImageSurvey("CFHT", "CFHT MegaCam u+g+r", "./data/hips/CFHT", "equatorial", 10, {imgFormat: 'png'});
let jwst1 = aladin.createImageSurvey("CDS/P/JWST/Stephans-Quintet/NIRCam+MIRI", "JWST NIRCam+MIRI", "data/hips/JWST_NIRCam_MIRI", null, null, {imgFormat: 'png'});
Expand Down
2 changes: 1 addition & 1 deletion examples/al-displayFITS.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</head>
<body>

<div id="aladin-lite-div" style="width:440px;height:300px"></div>
<div id="aladin-lite-div" style="width: 512px; height: 512px"></div>

<script type="module">
import A from '../src/js/A.js';
Expand Down
7 changes: 2 additions & 5 deletions examples/al-hips-local.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@
</head>
<body>

<div id="aladin-lite-div" style="width: 1024px; height: 768px"></div>
<div id="aladin-lite-div" style="width: 512px; height: 512px"></div>

<script type="module">
import A from '../src/js/A.js';

let aladin;
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {target: "05 40 59.12 -02 27 04.1", fov: 2});

let survey = aladin.createImageSurvey('DSS2 local', "local hips", "data/hips/CDS_P_DSS2_color");
aladin.setBaseImageLayer(survey);
aladin = A.aladin('#aladin-lite-div', {survey: "data/hips/CDS_P_DSS2_color", target: "05 40 59.12 -02 27 04.1", fov: 2});
});
</script>

Expand Down
4 changes: 2 additions & 2 deletions examples/al-onames-labels.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<head>
</head>
<body>
<div id="aladin-lite-div" style="width: 500px; height: 400px"></div>
<div id="aladin-lite-div" style="width: 512px; height: 512px"></div>
<script type="module">
import A from '../src/js/A.js';
let aladin;
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {survey: 'data/hips/CDS_P_DSS2_color', target: 'M1', fov: 0.3});
aladin = A.aladin('#aladin-lite-div', {survey: 'data/hips/CDS_P_DSS2_color', target: '05 34 30.89 +22 00 52.9', fov: 0.3});
var cat = A.catalogFromURL('data/votable/labels.vot', {sourceSize:12, color: '#cc99bb', displayLabel: true, labelColumn: 'main_id', labelColor: '#ae4', labelFont: '9px sans-serif'});
aladin.addCatalog(cat);
});
Expand Down
4 changes: 2 additions & 2 deletions examples/al-ui-off.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta name="viewport" content="width=device-width, height=device-height, maximum-scale=1.0, initial-scale=1.0, user-scalable=no">
</head>
<body>
<div id="aladin-lite-div" style="width: 500px; height: 500px"></div>
<div id="aladin-lite-div" style="width: 512px; height: 512px"></div>

<script type="module">
import A from '../src/js/A.js';
Expand All @@ -15,7 +15,7 @@
{
fullScreen: true,
cooFrame: "ICRSd",
survey: "../examples/hips/CDS_P_DSS2_color",
survey: "data/hips/CDS_P_DSS2_color",
target: "05 40 59.12 -02 27 04.1",
fov: 2,
showSimbadPointerControl: false,
Expand Down
4 changes: 2 additions & 2 deletions examples/al-ui-on.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta name="viewport" content="width=device-width, height=device-height, maximum-scale=1.0, initial-scale=1.0, user-scalable=no">
</head>
<body>
<div id="aladin-lite-div" style="width: 500px; height: 500px"></div>
<div id="aladin-lite-div" style="width: 512px; height: 512px"></div>

<script type="module">
import A from '../src/js/A.js';
Expand All @@ -15,7 +15,7 @@
{
fullScreen: true,
cooFrame: "ICRSd",
survey: "../examples/hips/CDS_P_DSS2_color",
survey: "data/hips/CDS_P_DSS2_color",
target: "05 40 59.12 -02 27 04.1",
fov: 2,
showSimbadPointerControl: true,
Expand Down
Binary file modified examples/data/hips/CDS_P_DSS2_color/Moc.fits
Binary file not shown.
Binary file modified examples/data/hips/CDS_P_DSS2_color/Norder0/Dir0/Npix5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 4 additions & 7 deletions examples/data/hips/CDS_P_DSS2_color/properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ hips_creation_date = 2010-05-01T19:05Z
hips_release_date = 2019-05-07T10:55Z
hips_creator = Oberto A. (CDS) , Fernique P. (CDS)
hips_version = 1.4
hips_order = 7
hips_order = 5
hips_frame = equatorial
hips_tile_width = 512
hips_tile_format = jpeg
dataproduct_type = image
client_application = AladinLite
#hips_service_url = http://alasky.u-strasbg.fr/DSS/DSSColor
hips_status = public partial unclonable
hips_rgb_red = DSS2Merged [1488.0 8488.8125 14666.0 Linear]
hips_rgb_blue = DSS2-blue-XJ-S [4286.0 12122.5 19959.0 Linear]
Expand All @@ -27,22 +26,20 @@ hips_pixel_scale = 2.236E-4
hips_initial_ra = 085.30251
hips_initial_dec = -02.25468
hips_initial_fov = 2
moc_sky_fraction = 2.034E-5
moc_sky_fraction = 0.001302
hips_copyright = CNRS/Unistra
obs_ack = The Digitized Sky Surveys were produced at the Space Telescope Science Institute under U.S. Government grant NAG W-2166. The images of these surveys are based on photographic data obtained using the Oschin Schmidt Telescope on Palomar Mountain and the UK Schmidt Telescope. The plates were processed into the present compressed digital form with the permission of these institutions. The National Geographic Society - Palomar Observatory Sky Atlas (POSS-I) was made by the California Institute of Technology with grants from the National Geographic Society. The Second Palomar Observatory Sky Survey (POSS-II) was made by the California Institute of Technology with funds from the National Science Foundation, the National Geographic Society, the Sloan Foundation, the Samuel Oschin Foundation, and the Eastman Kodak Corporation. The Oschin Schmidt Telescope is operated by the California Institute of Technology and Palomar Observatory. The UK Schmidt Telescope was operated by the Royal Observatory Edinburgh, with funding from the UK Science and Engineering Research Council (later the UK Particle Physics and Astronomy Research Council), until 1988 June, and thereafter by the Anglo-Australian Observatory. The blue plates of the southern Sky Atlas and its Equatorial Extension (together known as the SERC-J), as well as the Equatorial Red (ER), and the Second Epoch [red] Survey (SES) were all taken with the UK Schmidt. Supplemental funding for sky-survey work at the ST ScI is provided by the European Southern Observatory.
prov_progenitor = STScI
bib_reference = 1996ASPC..101...88L
bib_reference_url = http://cdsads.u-strasbg.fr/abs/1996ASPC..101...88L
# 1975-1999
t_min = 42413
t_max = 51179
obs_regime = Optical
em_min = 4e-7
em_max = 6e-7
#hips_master_url = ex: http://yourHipsServer/null
hips_order_min = 0
dataproduct_subtype = color
hipsgen_date = 2019-05-07T10:55Z
hipsgen_params = out=/asd-volumes/sc1-asd-volume8/DSS/DSSColor UPDATE
hipsgen_date_1 = 2024-09-10T14:49Z
hipsgen_params_1 = in=https://alasky.cds.unistra.fr/DSS/DSSColor out=./hips/CDS_P_DSS2_color region=6/24185 order=7 MIRROR
hipsgen_date_1 = 2024-09-10T16:50Z
hipsgen_params_1 = in=https://alasky.cds.unistra.fr/DSS/DSSColor/ out=./CDS_P_DSS2_color region=3/357 order=5 MIRROR
19 changes: 4 additions & 15 deletions examples/data/hips/CFHT/properties
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
hips_initial_fov = 1.17162
hips_initial_ra = 339.12169
hips_initial_dec = +34.2324
hips_initial_dec = 34.2324
creator_did = ivo://CDS/P/CDS_EPO/2022_Duc
hips_overlay = mean
hips_hierarchy = median
hips_creator = Sebastien Derriere, CDS
#hips_copyright = Copyright mention of the HiPS
obs_title = CFHT deep view of NGC7331 and Stephan's quintet u+g+r
#obs_collection = Dataset collection name
obs_description = CFHT MegaCam u+g+r color composition enhancing low surface brightness stellar components
obs_ack = Image created by P.-A. Duc
obs_title = CFHT deep view of NGC7331 and Stephans quintet ugr
obs_description = CFHT MegaCam ugr color composition enhancing low surface brightness stellar components
prov_progenitor = CFHT MegaCam observations
#bib_reference = Bibcode for bibliographic reference
bib_reference_url = https://www.nature.com/articles/s41586-022-05206-x
#obs_copyright = Copyright mention of the original data
#obs_copyright_url = URL to copyright page of the original data
#t_min = Start time in MJD ( =(Unixtime/86400)+40587 or https://heasarc.gsfc.nasa.gov/cgi-bin/Tools/xTime/xTime.pl)
#t_max = Stop time in MJD
#obs_regime = Waveband keyword (Radio Infrared Optical UV X-ray Gamma-ray)
#em_min = Start in spectral coordinates in meters ( =2.998E8/freq in Hz, or =1.2398841929E-12*energy in MeV )
#em_max = Stop in spectral coordinates in meters
hips_builder = Aladin/HipsGen v12.001
hips_version = 1.4
hips_release_date = 2022-10-19T15:00Z
Expand All @@ -33,7 +22,7 @@ hips_pixel_scale = 1.118E-4
s_pixel_scale = 1.558E-4
dataproduct_type = image
hipsgen_date = 2022-10-18T15:43Z
hipsgen_params = in=NGC7331_u+g+r-max out=NGC7331_u+g+r-maxHiPS creator_did=ivo://CDS
hipsgen_params = in=NGC7331_ugr-max out=NGC7331_ugr-maxHiPS creator_did=ivo://CDS
hips_creation_date = 2022-10-18T15:43Z
dataproduct_subtype = color
hipsgen_date_1 = 2024-09-10T15:15Z
Expand Down
19 changes: 8 additions & 11 deletions tests/example.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
import {test, expect, LocatorScreenshotOptions} from '@playwright/test';
import {test, expect} from '@playwright/test';

async function open(page, exampleName) {
await page.goto(`http://localhost:5173/tests/${exampleName}.html`);
await page.setViewportSize({height: 600, width: 800});
}

const screenshotOptions: LocatorScreenshotOptions = {
type: "png"
};

const toMatchOptions = {
maxDiffPixels: 10
};

const tests = [
// Check if ui elements appear correctly when the boolean option are on
{
Expand Down Expand Up @@ -47,8 +39,13 @@ const tests = [
await open(page, t.path);
await page.waitForLoadState("networkidle")

expect(await page.locator('canvas').nth(1).screenshot(screenshotOptions))
.toMatchSnapshot(toMatchOptions);
expect(
await page.locator('canvas').nth(1).screenshot({
type: "png"
})
).toMatchSnapshot({
maxDiffPixels: 30
});
});
}
})()
Expand Down
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.
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.
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.
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 72d7e4e

Please sign in to comment.