Frontend: Add acceptance test files

This commit is contained in:
Theresa Gresch 2020-06-01 09:16:11 +02:00
parent f68746768d
commit 6f4e26f547
10 changed files with 5 additions and 165 deletions

View file

@ -1,9 +1,8 @@
//search + filters? //search + filters?
//clipboard?
//views ? //views ?
//clipboard yes!
//create + delete album //create + delete album
//Add description to album (Update) //Add description to album (Update)

View file

@ -2,4 +2,4 @@
//download files //download files
//clipboard //clipboard yes

View file

@ -2,7 +2,7 @@
//views? //views?
//clipboard? //clipboard yes
//show only high prio labels + check labels exist //show only high prio labels + check labels exist

View file

@ -1,2 +1,2 @@
//upload file + import //upload file + import from library and from navigation + delete later

View file

@ -1,34 +0,0 @@
import { Selector } from 'testcafe';
import testcafeconfig from './testcafeconfig';
import Page from "./page-model";
import { RequestLogger } from 'testcafe';
const logger = RequestLogger( /http:\/\/localhost:2342\/api\/v1\/photos*/ , {
logResponseHeaders: true,
logResponseBody: true
});
fixture`Test favorites page`
.page `localhost:2342/favorites`
.requestHooks(logger);
const page = new Page();
test('Like photo', async t => {
}),
test('Dislike photo', async t => {
const FavoritesCount = await Selector('.t-like.t-on').count;
await t
.click(Selector('.t-like.t-on'));
logger.clear();
await t.navigateTo("../favorites");
const request3 = await logger.requests[0].responseBody;
const FavoritesCountAfterDislike = await Selector('.t-like.t-on').count;
await t
.expect(FavoritesCountAfterDislike).eql(FavoritesCount - 1);
});

View file

@ -1,22 +0,0 @@
import { Selector } from 'testcafe';
import testcafeconfig from '../testcafeconfig';
import Page from "../page-model";
import { RequestLogger } from 'testcafe';
const logger = RequestLogger( /http:\/\/localhost:2342\/api\/v1\*/ , {
logResponseHeaders: true,
logResponseBody: true
});
fixture`Library page`
.page`localhost:2342/library`
.requestHooks(logger);
const page = new Page();
test('Upload image', async t => {
await t
//.click(Selector(button).withText('Upload'));
});

View file

@ -1,23 +0,0 @@
import { Selector } from 'testcafe';
import testcafeconfig from '../testcafeconfig';
import Page from "../page-model";
fixture`Use navigation`
.page`${testcafeconfig.url}`;
const page = new Page();
test('Navigate', async t => {
await page.openNav();
await t
.click('a[href="/albums"]')
.expect(Selector('div.p-page-albums').exists, {timeout: 5000}).ok();
await page.openNav();
await t
.click('a[href="/places"]')
.expect(Selector('#map').exists).ok();
await page.openNav();
await t
.click('a[href="/labels"]')
.expect(Selector('div.p-page-labels').exists, {timeout: 5000}).ok();
});

View file

@ -1,35 +0,0 @@
import { Selector } from 'testcafe';
import testcafeconfig from '../testcafeconfig';
import Page from "../page-model";
fixture`Test clipboard`
.page`${testcafeconfig.url}`;
const page = new Page();
test('Test selecting photos and clear clipboard', async t => {
const clipboardCount = await Selector('span.t-clipboard-count');
await page.selectNthPhoto(0);
await page.selectNthPhoto(2);
await t
.expect(clipboardCount.textContent).eql("2");
await page.unselectPhoto(0);
await t
.expect(clipboardCount.textContent).eql("1")
await page.openNav();
await t
.click('a[href="/labels"]')
.expect(Selector('main .p-page-labels').exists, {timeout: 5000}).ok();
await page.openNav();
await t
.click('a[href="/photos"]')
.expect(clipboardCount.textContent).eql("1")
.click(Selector('div.p-photo-clipboard'))
.click(Selector('.p-photo-clipboard-clear'), {timeout: 15000});
await t.expect(Selector('#t-clipboard').exists).eql(false);
});

View file

@ -1,19 +0,0 @@
import { Selector } from 'testcafe';
import { ClientFunction } from 'testcafe';
const getLocation = ClientFunction(() => document.location.href);
fixture`Test places page`
.page `localhost:2342/places`;
test('Test places', async t => {
await t
.expect(Selector('#map').exists, {timeout: 15000}).ok()
.expect(Selector('div.p-map-control').visible).ok();
await t
.typeText(Selector('input[aria-label="Search"]'), 'Berlin')
.pressKey('enter');
await t
.expect(Selector('div.p-map-control').visible).ok()
.expect(getLocation()).contains('Berlin');
});

View file

@ -1,26 +0,0 @@
import { Selector } from 'testcafe';
import testcafeconfig from '../testcafeconfig';
import Page from "../page-model";
import { ClientFunction } from 'testcafe';
fixture`Scroll to top`
.page`${testcafeconfig.url}`;
const page = new Page();
const scroll = ClientFunction((x, y) => window.scrollTo(x, y));
const getcurrentPosition = ClientFunction(() => window.pageYOffset);
test('Test scroll to top functionality', async t => {
await t
.expect(Selector('button.p-photo-scroll-top').exists).notOk()
.expect(getcurrentPosition()).eql(0)
.expect(Selector('div[class="v-image__image v-image__image--cover"]').nth(0).visible).ok();
await scroll(0, 1200);
await t
.expect(getcurrentPosition()).eql(1200);
await scroll(0, 900);
await t
.expect(getcurrentPosition()).eql(900)
.click(Selector('button.p-photo-scroll-top'))
.expect(getcurrentPosition()).eql(0);
});