Code Monkey home page Code Monkey logo

wdio-wait-for's Introduction

Stand With Ukraine

WebdriverIO

Next-gen browser and mobile automation test framework for Node.js.

Build Status Package Health OpenSSF Best Practices
Support Channel Issue Resolution time Open issues


Homepage | Developer Guide | API Reference | Contribute | Changelog | Roadmap


WebdriverIO is a test automation framework, for e2e as well as unit and component testing in the browser, that allows you to run tests based on the WebDriver and WebDriver BiDi as well as Appium automation technology. It provides support for your favorite BDD/TDD test framework and will run your tests locally or in the cloud using Sauce Labs, BrowserStack, TestingBot or LambdaTest.

๐Ÿ‘ฉโ€๐Ÿ’ป ๐Ÿ‘จโ€๐Ÿ’ป Contributing

Do you like WebdriverIO and want to help make it better? Awesome! Have a look into our Contributor Documentation to get started and find out what contributions can be and how to make them.

Getting started with GitHub Codespaces

To get started, create a codespace for this repository by clicking this ๐Ÿ‘‡

Open in GitHub Codespaces

A codespace will open in a web-based version of Visual Studio Code. The dev container is fully configured with the software needed for this project.

Note: Dev containers are an open spec that is supported by GitHub Codespaces and other tools.

Getting started with Gitpod

You can also just click on:

Open in Gitpod

to get a ready-to-use development environment for you to start working on this code base.

If you're looking for issues to help out with, check out the issues labeled "good first pick". You can also reach out to our Matrix Channel if you have questions on where to start contributing.

๐Ÿข WebdriverIO for Enterprise

Available as part of the Tidelift Subscription.

The maintainers of WebdriverIO and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open-source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

๐Ÿ“ฆ Packages

This repository contains some of the core packages of the WebdriverIO project. There are many wonderful curated resources the WebdriverIO community has put together.

Did you build a WebdriverIO service or reporter? That's awesome! Please add it to our configuration wizard and docs (e.g. like in this example commit) as well as to our awesome-webdriverio list. Thank you! ๐Ÿ™ โค๏ธ

Core

  • webdriver - A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol
  • webdriverio - Next-gen browser and mobile automation test framework for Node.js
  • @wdio/cli - A WebdriverIO testrunner command line interface

Helper

  • @wdio/config - A helper utility to parse and validate WebdriverIO options
  • @wdio/logger - A helper utility for logging WebdriverIO packages
  • @wdio/protocols - Utility package providing information about automation protocols
  • @wdio/repl - A WDIO helper utility to provide a repl interface for WebdriverIO
  • @wdio/reporter - A WebdriverIO utility to help report all events
  • @wdio/runner - A WebdriverIO service that runs tests in arbitrary environments
  • @wdio/utils - A WDIO helper utility to provide several utility functions used across the project
  • @wdio/globals - A WDIO helper utility for importing global variables directly

Reporter

Services

  • @wdio/appium-service - A WebdriverIO service to start & stop Appium Server
  • @wdio/browserstack-service - A WebdriverIO service that can be used to use BrowserStack Test Observability which is a reporting, debugging, and test suite quality tracking tool for any test running anywhere. The service also helps for a better integration with the BrowserStack grid if you're running tests on the grid.
  • @wdio/devtools-service - A WebdriverIO service that allows you to run Chrome DevTools commands in your tests
  • @wdio/firefox-profile-service - A WebdriverIO service that lets you define your Firefox profile in your wdio.conf.js
  • @wdio/sauce-service - A WebdriverIO service that provides a better integration into Sauce Labs
  • @wdio/shared-store-service - A WebdriverIO service to exchange data across processes
  • @wdio/testingbot-service - A WebdriverIO service that provides a better integration into TestingBot

Runner

Framework Adapters

Others

๐Ÿค Project Governance

This project is maintained by awesome people following a common set of rules and treating each other with respect and appreciation.

๐Ÿ‘จโ€๐Ÿณ ๐Ÿ‘ฉโ€๐Ÿณ Backers

Become a backer and show your support for our open-source project.

๐Ÿ’ธ Sponsors

Does your company use WebdriverIO? Ask your manager or marketing team if your company would be interested in supporting our project. Support will allow the maintainers to dedicate more time to maintenance and new features for everyone. Also, your company's logo will show on GitHub - who doesn't want a little extra exposure? Here's the info.

๐Ÿ’Ž Premium Sponsor

We are immensely grateful to our exclusive Premium Sponsor for their invaluable support in the development of this project:

BrowserStack ย  ย  ย  Sauce Labs

๐Ÿฅˆ Silver Sponsor

Lambdatest

๐Ÿฅ‰ Bronze Sponsor

Eslint

๐Ÿ“„ License

MIT

FOSSA Status

๐Ÿ”ฐ Badge

Show the world you're using webdriver.io โ†’ tested with webdriverio

GitHub markup
[![tested with webdriver.io](https://img.shields.io/badge/tested%20with-webdriver.io-%23ea5906)](https://webdriver.io/)
HTML
<a href="https://webdriver.io/">
    <img alt="WebdriverIO" src="https://img.shields.io/badge/tested%20with-webdriver.io-%23ea5906">
</a>

๐Ÿ‘ Supporters

Stargazers repo roster for WebdriverIO Forkers repo roster for WebdriverIO

Animated footer bars


Back to top

wdio-wait-for's People

Contributors

christian-bromann avatar dependabot[bot] avatar elaichenkov avatar m-hammad-faisal avatar rohantalkad747 avatar seanpoulter avatar wdio-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wdio-wait-for's Issues

support ChainablePromiseElement<Promise<WebdriverIO.Element>

would love to use v7 of webdriverio with a ChainablePromiseElement

//locator
get sortOverlayHeader() { return $('aur-sortable-header-overlay header h3'); }

//method
async clickHeader() {
        ...
        await header.click();
        await browser.waitUntil(presenceOf(this.sortOverlayHeader));       <------ S2345: Argument of type 'ChainablePromiseElement<Promise<Element>>' is not assignable to parameter of type 'string | Promise<Element>
}

WDIO8 / wdio-wait-for - Condition is not a function

After updating to WDIO8 and wdio-wait-for 3.0.1 I started to get this "Condition is not a function" whenever I try to use "urlContains"

Simple code :

import { urlContains } from 'wdio-wait-for';

export async function crossSellHandler(option: string) {
    await basePage.waitForPageStopLoadding()
    return await browser.waitUntil(urlContains("/test/"), { timeout: 60000, timeoutMsg: "Test page is not displayed" });

Error :

Error: Condition is not a function
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async World.crossSellHandler (...\test.ts:17:12)

Any clues where to look? The same code was properly working before updating.

FYI : It works fine with version 2.2.6

Logical `not` doesn't work with browser conditions

Hi! I am trying to use not together with urlContains, like this:

import { not, urlContains } from 'wdio-wait-for';
describe('Login page', () => {
  let page: LoginPage;

  beforeAll(async () => {
    page = new LoginPage();
  });

  // a couple of `it` statements skipped

  it('should log user in and redirect them to corresponding home page', async () => {
    const submitButton = page.getSubmitButton();
    await submitButton.click();

    await browser.waitUntil(not(urlContains('login')));
    await sleep(500);

    const urlAfterRedirects = await browser.getUrl();
    expect(urlAfterRedirects).toBe(`${browser.options.baseUrl}v3/library/my`);
  });
});

And get the following error:

Error: waitUntil condition failed with the following reason: Cannot read properties of undefined (reading 'getTitle')

In the source code for urlContains, it expects the context to be passed, which works if you don't wrap it:

 await browser.waitUntil(urlContains('login')); // this works correctly

but doesn't work when wrapped in not.

I believe the situation is the same for all combinations of logical + browser conditions.

wdio-wait-for functions' parameter types became incompatible with $ command return type

After this PR #7978 in webdriverio project included in this release v7.16.15 (2022-02-10) all the wdio-wait-for functions' element type are incompatible with the $ command return type. See an example:

await browser.waitUntil(visibilityOf($('element')));

Argument of type 'ChainablePromiseElement<Element>' is not assignable to parameter of type 'string | ChainablePromiseElement<Promise<Element>>'.
  Type 'ChainablePromiseElement<Element>' is not assignable to type 'ChainablePromiseElement<Promise<Element>>'.
    Type 'Element' is missing the following properties from type 'Promise<Element>': then, catch, finally, [Symbol.toStringTag]ts(2345)

With that change the return type of the $ command has been changed from ChainablePromiseElement<Promise<Element>> to ChainablePromiseElement<Element>.

Move project to WebdriverIO Community Org

Hey @elaichenkov ,

first off, thank you for creating this plugin and extending the WebdriverIO ecosystem!

I was wondering if you would be interested moving this repository into the WebdriverIO Community organisation. It would allow us to help maintain this package, automate a few things like releases and allow others to contribute to it and make the package even better. You would of course continue to have full access to it.

What do you think? Please let me know if you have any questions.

Help needed

I was just going thru this library and found that under the hood it uses the default wdio element locators only.
for example :

export function **visibilityOf**(selector: string): () => Promise<boolean> {
  return async (): Promise<boolean> => {
    const element = await $(selector);

    try {
      const isVisible = await element.isDisplayed();

      return isVisible;
    } catch {
      return false;
    }
  };
}

browser.visibility of uses isDisplayed() api of wdio.I am a bit confused on the use of this.
Why is this repo seperately published.
Please pardon my knowledge on this.I just wanted to clear my doubt

Multiremote support

I've just started looking at converting some protractor tests to webdriver.io and I'm trying to use this package to make the switchover as easy as possible.

Our tests use multiple browsers Multiremote and it looks like this package may not handle that as expected.

In my wdio.conf file I have this capabilities configuration

capabilities: {
        browser1: {
            capabilities: {
                browserName: 'chrome'
            }
        },
        browser2: {
            capabilities: {
                browserName: 'chrome'
            }
        }
    }

In my test, I am navigating to a url with one of the browsers and trying to wait until the title is correct.

await browser1.url('https://webdriver.io/docs/wdio-wait-for/#api');

await browser1.waitUntil(
   titleContains('expected conditions'), {
   timeout: 5000,
   timeoutMsg: 'expected title....'
});

The above snippet does not work, the test timeouts. But using the standard waitUntil, the below does work.

await browser1.url('https://webdriver.io/docs/wdio-wait-for/#api');

await browser1.waitUntil(
  async function () {
    const title = await browser1.getTitle();

    return title.includes('expected conditions')
  },
  {
    timeout: 5000,
    timeoutMsg: 'expected title....'
  }
);

It seems that when Multiremote is used the wait is waiting for both browsers.

Are my expectations/assumptions correct here, is this something that could be supported?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.