UNPKG

1.69 kBPlain TextView Raw
1import { ExtendDescribeThis } from '..';
2
3describe('Ecosia', () => {
4 before((browser) => browser.url('https://www.ecosia.org/'));
5
6 it('Demo test ecosia.org', () => {
7 // Setting network conditions before the actual test
8 browser.setNetworkConditions({
9 offline: false,
10 latency: 5, // Additional latency (ms).
11 download_throughput: 500 * 1024, // Maximal aggregated download throughput.
12 upload_throughput: 500 * 1024, // Maximal aggregated upload throughput.
13 });
14
15 browser
16 .waitForElementVisible('body')
17 .assert.titleContains('Ecosia')
18 .assert.titleContains('Ecosia')
19 .assert.visible('input[type=search]')
20 .setValue('input[type=search]', 'nightwatch')
21 .assert.visible('button[type=submit]')
22 .click('button[type=submit]');
23 });
24
25 xit('this test will be skipped', (browser) => {
26 browser.waitForElementVisible('body');
27 });
28
29 after((browser) => browser.end());
30});
31
32xdescribe('whole describle block will be skipped', () => {
33 test('ecosia', () => {
34 browser.url('https://ecosia.org').end();
35 });
36});
37
38//
39// test custom this
40//
41
42interface CustomThis {
43 bodySelector: string;
44}
45
46describe('Async Ecosia with custom this', function (this: ExtendDescribeThis<CustomThis>) {
47 this.tags = 'ecosia';
48 this.desiredCapabilities = {
49 browserName: 'chrome',
50 };
51 this.retries(2);
52
53 before(function (this: ExtendDescribeThis<CustomThis>, browser, done) {
54 browser.url('https://www.ecosia.org/');
55 this.bodySelector = 'body';
56 done();
57 });
58
59 it('Demo test ecosia.org', async (browser) => {
60 browser.waitForElementVisible(this.bodySelector!);
61 });
62
63 after((browser) => browser.end());
64});