Tests: Refactor photos test

This commit is contained in:
theresa 2021-02-05 16:48:39 +01:00
parent e7e2de3ce0
commit 11a3aa6d00
3 changed files with 109 additions and 50 deletions

View file

@ -335,4 +335,104 @@ export default class Page {
.typeText(Selector(".input-password input"), password, { replace: true })
.click(Selector(".action-confirm"));
}
async checkEditFormValues(
title,
day,
month,
year,
localTime,
utcTime,
timezone,
country,
altitude,
lat,
lng,
camera,
iso,
exposure,
lens,
fnumber,
flength,
subject,
artist,
copyright,
license,
description,
keywords,
notes
) {
if (title !== "") {
await t.expect(Selector(".input-title input").value).eql(title);
}
if (day !== "") {
await t.expect(Selector(".input-day input").value).eql(day);
}
if (month !== "") {
await t.expect(Selector(".input-month input").value).eql(month);
}
if (year !== "") {
await t.expect(Selector(".input-year input").value).eql(year);
}
if (timezone !== "") {
await t.expect(Selector(".input-timezone input").value).eql(timezone);
}
if (localTime !== "") {
await t.expect(Selector(".input-local-time input").value).eql(localTime);
}
if (utcTime !== "") {
await t.expect(Selector(".input-utc-time input").value).eql(utcTime);
}
if (altitude !== "") {
await t.expect(Selector(".input-altitude input").value).eql(altitude);
}
if (country !== "") {
await t.expect(Selector("div").withText(country).visible).ok();
}
if (lat !== "") {
await t.expect(Selector(".input-latitude input").value).eql(lat);
}
if (lng !== "") {
await t.expect(Selector(".input-longitude input").value).eql(lng);
}
if (camera !== "") {
await t.expect(Selector("div").withText(camera).visible).ok();
}
if (lens !== "") {
await t.expect(Selector("div").withText(lens).visible).ok();
}
if (iso !== "") {
await t.expect(Selector(".input-iso input").value).eql(iso);
}
if (exposure !== "") {
await t.expect(Selector(".input-exposure input").value).eql(exposure);
}
if (fnumber !== "") {
await t.expect(Selector(".input-fnumber input").value).eql(fnumber);
}
if (flength !== "") {
await t.expect(Selector(".input-focal-length input").value).eql(flength);
}
if (subject !== "") {
await t.expect(Selector(".input-subject textarea").value).eql(subject);
}
if (artist !== "") {
await t.expect(Selector(".input-artist input").value).eql(artist);
}
if (copyright !== "") {
await t.expect(Selector(".input-copyright input").value).eql(copyright);
}
if (license !== "") {
await t.expect(Selector(".input-license textarea").value).eql(license);
}
if (description !== "") {
await t.expect(Selector(".input-description textarea").value).eql(description);
}
if (notes !== "") {
await t.expect(Selector(".input-notes textarea").value).contains(notes);
}
if (keywords !== "") {
await t.expect(Selector(".input-keywords textarea").value).contains(keywords);
}
}
}

View file

@ -8,11 +8,11 @@ const logger = RequestLogger(/http:\/\/localhost:2343\/api\/v1\/*/, {
logResponseBody: true,
});
fixture`Test photos download`.page`${testcafeconfig.url}`.requestHooks(logger);
fixture`Test photos download`.page`${testcafeconfig.url}`.requestHooks(logger).skip;
const page = new Page();
//TODO Make those run from within the container
test.skip.meta("testID", "photos-download-001")(
test.meta("testID", "photos-download-001")(
"Test download jpg file from context menu and fullscreen",
async (t) => {
await page.search("name:monochrome-2.jpg");
@ -41,7 +41,7 @@ test.skip.meta("testID", "photos-download-001")(
}
);
test.skip.meta("testID", "photos-download-002")(
test.meta("testID", "photos-download-002")(
"Test download video from context menu",
async (t) => {
await page.openNav();
@ -61,7 +61,7 @@ test.skip.meta("testID", "photos-download-002")(
}
);
test.skip.meta("testID", "photos-download-003")(
test.meta("testID", "photos-download-003")(
"Test download multiple jpg files from context menu",
async (t) => {
await page.search("name:panorama_2.jpg");
@ -82,7 +82,7 @@ test.skip.meta("testID", "photos-download-003")(
);
//TODO Check RAW files as well
test.skip.meta("testID", "photos-download-004")(
test.meta("testID", "photos-download-004")(
"Test raw file from context menu and fullscreen mode",
async (t) => {
await page.openNav();

View file

@ -314,51 +314,10 @@ test.meta("testID", "photos-007")("Edit photo/video", async (t) => {
.eql("New Photo Title");
await page.selectPhotoFromUID(FirstPhoto);
await page.editSelected();
await t
.expect(Selector(".input-title input").value)
.eql("New Photo Title")
.expect(Selector(".input-timezone input").value)
.eql("Europe/Moscow")
.expect(Selector(".input-local-time input").value)
.eql("04:30:30")
.expect(Selector(".input-utc-time input").value)
.eql("01:30:30")
.expect(Selector(".input-day input").value)
.eql("15")
.expect(Selector(".input-month input").value)
.eql("07")
.expect(Selector(".input-year input").value)
.eql("2019")
.expect(Selector(".input-altitude input").value)
.eql("-1")
.expect(Selector("div").withText("Albania").visible)
.ok()
//.expect(Selector('div').withText('Apple iPhone 6').visible).ok()
//.expect(Selector('div').withText('Apple iPhone 5s back camera 4.15mm f/2.2').visible).ok()
.expect(Selector(".input-iso input").value)
.eql("32")
.expect(Selector(".input-exposure input").value)
.eql("1/32")
.expect(Selector(".input-fnumber input").value)
.eql("29")
.expect(Selector(".input-focal-length input").value)
.eql("33")
.expect(Selector(".input-subject textarea").value)
.eql("Super nice edited photo")
.expect(Selector(".input-artist input").value)
.eql("Happy")
.expect(Selector(".input-copyright input").value)
.eql("Happy2020")
.expect(Selector(".input-license textarea").value)
.eql("Super nice cat license")
.expect(Selector(".input-description textarea").value)
.eql("Description of a nice image :)")
.expect(Selector(".input-description textarea").value)
.eql("Description of a nice image :)")
.expect(Selector(".input-notes textarea").value)
.contains("Some notes")
.expect(Selector(".input-keywords textarea").value)
.contains("cat");
await page.checkEditFormValues("New Photo Title", "15", "07", "2019", "04:30:30",
"01:30:30", "Europe/Moscow", "Albania", "-1", "", "", "",
"32", "1/32", "", "29", "33", "Super nice edited photo", "Happy",
"Happy2020", "Super nice cat license", "Description of a nice image :)", "cat", "");
if (FirstPhotoTitle.empty || FirstPhotoTitle === "") {
await t.click(Selector(".input-title input")).pressKey("ctrl+a delete");
} else {