testcafe-workshop/tests/intro.test.js
Børge Antonsen 67b67a7b96 Refaktorert tester før workshop
- Gått igjennom og sett at de faktisk fungerer
2018-10-23 01:07:43 +02:00

65 lines
1.5 KiB
JavaScript

// @ts-check
import { Selector } from 'testcafe'
fixture('Bouvet NORD - FGM TestCafe')
.page('https://codepen.io/bovan/full/BqOLbX')
// test('CSS selectors', async t => {
// let iframe = Selector('iframe#result');
// await t
// .switchToIframe(iframe)
// .wait(2000)
// .click("label[for='cb3']")
// .wait(2000);
// })
// test('withAttribute og chaining', async t => {
// let iframe = Selector('iframe#result');
// let li = Selector('.tg-list-item');
// await t
// .switchToIframe(iframe)
// .wait(2000)
// .click(li.child("label").withAttribute('data-tg-off', 'Nope'))
// .wait(2000);
// })
// test('count & exists', async t => {
// let iframe = Selector('iframe#result');
// let li = Selector('.tg-list-item');
// await t
// .switchToIframe(iframe)
// .wait(2000)
// .expect(li.count).eql(5)
// .expect(li.child("label").withAttribute('data-tg-off', 'Nope').exists).ok()
// .wait(2000);
// })
/**
* Andre ting som kan være kjekt å vite om:
*
Nyttige funksjoner:
- t.hover(element);
- t.pressKey("backspace enter")
- t.typeText(input, "google this")
- t.resizeWindow(width/height)
- t.takeScreenshot([ path for fil ])
- t.debug()
Assertions:
- Deep Equals: .eql() / .notEql()
- Boolean sjekk: .ok() / .notOk()
- Contains: .contains() / .notContains()
- TypeSjekk: .typeOf() / .notTypeOf()
- Tallsammenligning: .gt() / .gte() / lt() / lte()
*/