Test angepasst
This commit is contained in:
parent
895cb36fea
commit
be130a99e8
@ -2,7 +2,9 @@ import {Selector} from 'testcafe';
|
|||||||
import {ClientFunction} from 'testcafe';
|
import {ClientFunction} from 'testcafe';
|
||||||
|
|
||||||
const goBack = ClientFunction(() => window.history.back());
|
const goBack = ClientFunction(() => window.history.back());
|
||||||
const testLocalStorageSet = ClientFunction((key, value) => { localStorage.setItem(key, value)});
|
const testLocalStorageSet = ClientFunction((key, value) => {
|
||||||
|
localStorage.setItem(key, value)
|
||||||
|
});
|
||||||
const replaceRandom = ClientFunction((sequence) => {
|
const replaceRandom = ClientFunction((sequence) => {
|
||||||
window.index = 0;
|
window.index = 0;
|
||||||
window.sequence = sequence;
|
window.sequence = sequence;
|
||||||
@ -17,11 +19,17 @@ async function beforeEachTest(t){
|
|||||||
// await replaceRandom();
|
// await replaceRandom();
|
||||||
}
|
}
|
||||||
|
|
||||||
let isLocal = false;
|
async function afterEachTest(t) {
|
||||||
|
return await t.eval(() => indexedDB.deleteDatabase('wordRotator'));
|
||||||
|
}
|
||||||
|
|
||||||
|
let isLocal = true;
|
||||||
if (isLocal) {
|
if (isLocal) {
|
||||||
fixture`Play`
|
fixture`Play`
|
||||||
.page`https://127.0.0.1/pwa/wordRotator/publicTest/`.beforeEach(async t => {
|
.page`https://127.0.0.1/pwa/wordRotator/publicTest/`.beforeEach(async t => {
|
||||||
await beforeEachTest(t);
|
await beforeEachTest(t);
|
||||||
|
}).afterEach(async t => {
|
||||||
|
await afterEachTest(t);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -33,6 +41,8 @@ else {
|
|||||||
}).beforeEach(async t => {
|
}).beforeEach(async t => {
|
||||||
await beforeEachTest(t);
|
await beforeEachTest(t);
|
||||||
await t.wait(20000);
|
await t.wait(20000);
|
||||||
|
}).afterEach(async t => {
|
||||||
|
await afterEachTest(t);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +169,7 @@ test('Play', async t => {
|
|||||||
offsetY: 41
|
offsetY: 41
|
||||||
})
|
})
|
||||||
.drag(Selector('.segment-parent').nth(SEGMENT.ONE).find('div').withText('S'), 10, dragDimen, {
|
.drag(Selector('.segment-parent').nth(SEGMENT.ONE).find('div').withText('S'), 10, dragDimen, {
|
||||||
offsetX: 64,
|
offsetX: dragDimen,
|
||||||
offsetY: 32
|
offsetY: 32
|
||||||
})
|
})
|
||||||
.drag(Selector('.segment-parent').nth(SEGMENT.TEN), dragDimen, 4, {
|
.drag(Selector('.segment-parent').nth(SEGMENT.TEN), dragDimen, 4, {
|
||||||
@ -205,17 +215,17 @@ test('Play', async t => {
|
|||||||
.click(Selector('.segment-parent').nth(SEGMENT.THREE))
|
.click(Selector('.segment-parent').nth(SEGMENT.THREE))
|
||||||
.click(Selector('.segment-parent').nth(SEGMENT.FOUR))
|
.click(Selector('.segment-parent').nth(SEGMENT.FOUR))
|
||||||
.click(Selector('.segment-parent').nth(SEGMENT.FIVE))
|
.click(Selector('.segment-parent').nth(SEGMENT.FIVE))
|
||||||
.drag(Selector('.segment-parent').nth(SEGMENT.SIX), 3, dragDimen, {
|
// .drag(Selector('.segment-parent').nth(SEGMENT.SIX), 3, dragDimen, {
|
||||||
offsetX: 86,
|
// offsetX: 86,
|
||||||
offsetY: 133
|
// offsetY: 133
|
||||||
})
|
// })
|
||||||
.click(Selector('.segment-parent').nth(SEGMENT.THREE))
|
.click(Selector('.segment-parent').nth(SEGMENT.THREE))
|
||||||
.click(Selector('.segment-parent').nth(SEGMENT.FOUR))
|
.click(Selector('.segment-parent').nth(SEGMENT.FOUR))
|
||||||
.click(Selector('.segment-parent').nth(SEGMENT.SEVEN))
|
.click(Selector('.segment-parent').nth(SEGMENT.SEVEN))
|
||||||
.drag(Selector('.segment-parent').nth(SEGMENT.SIX), 10, dragDimen, {
|
// .drag(Selector('.segment-parent').nth(SEGMENT.SIX), 10, dragDimen, {
|
||||||
offsetX: 60,
|
// offsetX: 60,
|
||||||
offsetY: 137
|
// offsetY: 137
|
||||||
})
|
// })
|
||||||
.expect(Selector('#won-text').visible).eql(true)
|
.expect(Selector('#won-text').visible).eql(true)
|
||||||
.expect(Selector('#continue-button').visible).eql(true)
|
.expect(Selector('#continue-button').visible).eql(true)
|
||||||
.click(Selector('#continue-button'))
|
.click(Selector('#continue-button'))
|
||||||
@ -282,18 +292,17 @@ test('Play', async t => {
|
|||||||
offsetX: 50,
|
offsetX: 50,
|
||||||
offsetY: 73
|
offsetY: 73
|
||||||
})
|
})
|
||||||
|
|
||||||
.click(Selector('.segment-parent').nth(SEGMENT.SEVEN))
|
.click(Selector('.segment-parent').nth(SEGMENT.SEVEN))
|
||||||
.click(Selector('.segment-parent').nth(SEGMENT.THIRTEEN))
|
.click(Selector('.segment-parent').nth(SEGMENT.THIRTEEN))
|
||||||
.click(Selector('.segment-parent').nth(SEGMENT.TWO))
|
.click(Selector('.segment-parent').nth(SEGMENT.TWO))
|
||||||
.drag(Selector('.segment-parent').nth(SEGMENT.ELEVEN), 14, dragDimen, {
|
.drag(Selector('.segment-parent').nth(SEGMENT.ELEVEN), 14, dragDimen, {
|
||||||
offsetX: 55,
|
offsetX: dragDimen,
|
||||||
offsetY: 57
|
offsetY: 57
|
||||||
})
|
})
|
||||||
.drag(Selector('.segment-parent').nth(SEGMENT.ONE), 4, dragDimen, {
|
// .drag(Selector('.segment-parent').nth(SEGMENT.ONE), 4, dragDimen, {
|
||||||
offsetX: 50,
|
// offsetX: 50,
|
||||||
offsetY: 73
|
// offsetY: 73
|
||||||
})
|
// })
|
||||||
.click(Selector('.segment-parent').nth(SEGMENT.THREE))
|
.click(Selector('.segment-parent').nth(SEGMENT.THREE))
|
||||||
.click(Selector('.segment-parent').nth(SEGMENT.EIGHT))
|
.click(Selector('.segment-parent').nth(SEGMENT.EIGHT))
|
||||||
.click(Selector('.segment-parent').nth(SEGMENT.SEVEN))
|
.click(Selector('.segment-parent').nth(SEGMENT.SEVEN))
|
||||||
@ -307,13 +316,13 @@ test('Play', async t => {
|
|||||||
.click(Selector('.segment-parent').nth(SEGMENT.NINE))
|
.click(Selector('.segment-parent').nth(SEGMENT.NINE))
|
||||||
.click(Selector('.segment-parent').nth(SEGMENT.FOUR))
|
.click(Selector('.segment-parent').nth(SEGMENT.FOUR))
|
||||||
.drag(Selector('.segment-parent').nth(SEGMENT.ELEVEN), 14, dragDimen, {
|
.drag(Selector('.segment-parent').nth(SEGMENT.ELEVEN), 14, dragDimen, {
|
||||||
offsetX: 55,
|
offsetX: dragDimen,
|
||||||
offsetY: 57
|
offsetY: 57
|
||||||
})
|
})
|
||||||
.drag(Selector('.segment-parent').nth(SEGMENT.ONE), 4, dragDimen, {
|
// .drag(Selector('.segment-parent').nth(SEGMENT.ONE), 4, dragDimen, {
|
||||||
offsetX: 50,
|
// offsetX: 50,
|
||||||
offsetY: 73
|
// offsetY: 73
|
||||||
})
|
// })
|
||||||
// .click(Selector('.segment-parent').nth(SEGMENT.THIRTEEN))
|
// .click(Selector('.segment-parent').nth(SEGMENT.THIRTEEN))
|
||||||
.click(Selector('#help-button'))
|
.click(Selector('#help-button'))
|
||||||
.wait(5000)
|
.wait(5000)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user