Skip to content

Commit

Permalink
Release 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
WebdriverIO Release Bot committed May 27, 2021
1 parent 5482b52 commit 725214c
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 84 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wdio-wait-for",
"version": "2.0.3",
"version": "2.1.0",
"description": "a library of conditions that are useful for end-to-end tests",
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
Expand Down
164 changes: 82 additions & 82 deletions tests/multiremote/multiremote.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
elementToBeClickable,
elementToBeEnabled,
elementToBeSelected,
numberOfElementsToBeLessThan
numberOfElementsToBeLessThan,
} from '../../src';

declare const browserA: Browser<'async'>;
Expand All @@ -19,89 +19,89 @@ describe('Multiremote', () => {
beforeEach(async () => await browser.url('/'));

describe('Browser', () => {
it('should verify urlContains method', async () => {
await browserB.url('https://webdriver.io');
expect(await urlContains('io').call(browserB)).toBe(true);
expect(await urlContains('io').call(browserA)).toBe(false);
});
it('should verify urlIs method', async () => {
await browserB.url('https://webdriver.io');
expect(await urlIs('https://the-internet.herokuapp.com/').call(browserA)).toBe(true);
expect(await urlIs('https://webdriver.io/').call(browserB)).toBe(true);
});
it('should verify alertIsPresent method', async () => {
await browserB.execute('alert("Alert");');
expect(await alertIsPresent().call(browserB)).toBe(true);
expect(await alertIsPresent().call(browserA)).toBe(false);
});
it('should verify titleIs method', async () => {
await browserA.url('https://webdriver.io');
expect(await titleIs('The Internet').call(browserA)).toBe(false);
expect(await titleIs('The Internet').call(browserB)).toBe(true);
});
it('should verify titleContains method', async () => {
await browserA.url('https://webdriver.io');
expect(await titleContains('Internet').call(browserB)).toBe(true);
expect(await titleContains('WebdriverIO').call(browserA)).toBe(true);
});
it('should verify numberOfWindowsToBe method', async () => {
const link = await browserA.$('.large-centered a');
await link.click();
expect(await numberOfWindowsToBe(2).call(browserA)).toBe(true);
expect(await numberOfWindowsToBe(2).call(browserB)).toBe(false);
});
it('should verify urlContains method', async () => {
await browserB.url('https://webdriver.io');

expect(await urlContains('io').call(browserB)).toBe(true);
expect(await urlContains('io').call(browserA)).toBe(false);
});

it('should verify urlIs method', async () => {
await browserB.url('https://webdriver.io');

expect(await urlIs('https://the-internet.herokuapp.com/').call(browserA)).toBe(true);
expect(await urlIs('https://webdriver.io/').call(browserB)).toBe(true);
});

it('should verify alertIsPresent method', async () => {
await browserB.execute('alert("Alert");');

expect(await alertIsPresent().call(browserB)).toBe(true);
expect(await alertIsPresent().call(browserA)).toBe(false);
});

it('should verify titleIs method', async () => {
await browserA.url('https://webdriver.io');

expect(await titleIs('The Internet').call(browserA)).toBe(false);
expect(await titleIs('The Internet').call(browserB)).toBe(true);
});

it('should verify titleContains method', async () => {
await browserA.url('https://webdriver.io');

expect(await titleContains('Internet').call(browserB)).toBe(true);
expect(await titleContains('WebdriverIO').call(browserA)).toBe(true);
});

it('should verify numberOfWindowsToBe method', async () => {
const link = await browserA.$('.large-centered a');
await link.click();

expect(await numberOfWindowsToBe(2).call(browserA)).toBe(true);
expect(await numberOfWindowsToBe(2).call(browserB)).toBe(false);
});
});

describe('Element', () => {
it('should verify elementToBeClickable method', async () => {
await browser.url('/add_remove_elements/');
await browserB.execute('document.querySelector("button").setAttribute("disabled", "");');
expect(await elementToBeClickable(browserB.$('button'))()).toBe(false);
expect(await elementToBeClickable(browserA.$('button'))()).toBe(true);
});

it('should verify elementToBeEnabled method', async () => {
await browser.url('/add_remove_elements/');
await browserB.execute('document.querySelector("button").setAttribute("disabled", "");');
expect(await elementToBeEnabled(browserB.$('button'))()).toBe(false);
expect(await elementToBeEnabled(browserA.$('button'))()).toBe(true);
});

it('should verify elementToBeSelected method', async () => {
await browser.url('/checkboxes');
const selector = '#checkboxes input';
const checkbox = await browserA.$(selector);
await checkbox.click();
expect(await elementToBeSelected(browserA.$(selector))()).toBe(true);
expect(await elementToBeSelected(browserB.$(selector))()).toBe(false);
});

it('should verify numberOfElementsToBeLessThan method', async () => {
await browser.url('/add_remove_elements/');
const selector = '#elements button';
const addElementButton = await browserA.$('button');
await Promise.all([addElementButton.click(), addElementButton.click()]);
expect(await numberOfElementsToBeLessThan(browserA.$$(selector), 3)()).toBe(true);
expect(await numberOfElementsToBeLessThan(browserB.$$(selector), 1)()).toBe(true);
});
it('should verify elementToBeClickable method', async () => {
await browser.url('/add_remove_elements/');

await browserB.execute('document.querySelector("button").setAttribute("disabled", "");');

expect(await elementToBeClickable(browserB.$('button'))()).toBe(false);
expect(await elementToBeClickable(browserA.$('button'))()).toBe(true);
});

it('should verify elementToBeEnabled method', async () => {
await browser.url('/add_remove_elements/');

await browserB.execute('document.querySelector("button").setAttribute("disabled", "");');

expect(await elementToBeEnabled(browserB.$('button'))()).toBe(false);
expect(await elementToBeEnabled(browserA.$('button'))()).toBe(true);
});

it('should verify elementToBeSelected method', async () => {
await browser.url('/checkboxes');

const selector = '#checkboxes input';
const checkbox = await browserA.$(selector);
await checkbox.click();

expect(await elementToBeSelected(browserA.$(selector))()).toBe(true);
expect(await elementToBeSelected(browserB.$(selector))()).toBe(false);
});

it('should verify numberOfElementsToBeLessThan method', async () => {
await browser.url('/add_remove_elements/');

const selector = '#elements button';
const addElementButton = await browserA.$('button');
await Promise.all([addElementButton.click(), addElementButton.click()]);

expect(await numberOfElementsToBeLessThan(browserA.$$(selector), 3)()).toBe(true);
expect(await numberOfElementsToBeLessThan(browserB.$$(selector), 1)()).toBe(true);
});
});
});

0 comments on commit 725214c

Please sign in to comment.