npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aft-ui-webdriverio

v12.1.1

Published

Automated Functional Testing (AFT) package supporting UI testing in mobile apps with support for BrowserStack, Sauce Labs and Local Appium

Downloads

13

Readme

AFT-UI-WEBDRIVERIO

Automated Functional Testing (AFT) package providing WebdriverIO-based WebdriverIoComponent extends UiComponent class for use with POM-based UI testing strategies as well as UiSessionGeneratorPlugin implementations for connecting to WebdriverIO's Browser instance.

Installation

> npm i aft-ui-webdriverio

Creating your own Components for use in testing

Take the following as an example of how one could interact with the following Android App

Step 1: create the View Component

// wikipedia-view.ts
export class WikipediaView extends WebdriverIoComponent {
    override get locator(): string {
        return '//*';
    }
    private get _searchButton() { return this.getRoot().then(r => r.$("~Search Wikipedia")); }
    private get _searchInput() { return this.driver.$('android=new UiSelector().resourceId("org.wikipedia.alpha:id/search_src_text")'); }
    private get _searchResults() { return this.getRoot().then(r => r.$$("android.widget.TextView")); }
    async searchFor(term: string): Promise<string[]> {
        await this.reporter.info("tapping on 'SearchButton'...");
        await this._searchButton.then(b => b.click());
        await this.sendTextToSearch(term);
        return await this.getResults();
    }
    async sendTextToSearch(text: string): Promise<void> {
        await this.reporter.info(`setting 'SearchInput' to '${text}'...`);
        await this._searchInput.then(i => i.addValue(text));
    }
    async getResults(): Promise<string[]> {
        await this.reporter.info("getting text from 'SearchResults' to return as 'string[]'");
        const resultsText = new Array<string>();
        const searchResults = await this._searchResults;
        for (var i=0; i<searchResults.length; i++) {
            let res = searchResults[i];
            let txt: string = await res.getText().catch(err => null);
            if (txt) { resultsText.push(txt); }
        }
        await this.reporter.info(`found results of: [${resultsText.join(', ')}]`);
        return resultsText;
    }
}

Step 2: use them to interact with the mobile application

// wikipedia-app.spec.ts mocha test using AftMochaReporter
describe('WebdriverIoSession', () => {
    it('[C1234] can access mobile apps using AFT and UiComponents with AftMochaTest', async function() {
        await aftMochaTest(this, async (v: AftMochaTest) => {
            const lowercaseResults = new Array<string>();
            await using(new WebdriverIoSession({reporter: v.reporter}), async (session) => {
                await session.reporter.step('get the WikipediaView Facet from the Session...');
                const view: WikipediaView = await session.getComponent(WikipediaView);
                await session.reporter.step('enter a search term...');
                await view.searchFor('pizza');
                await session.reporter.step('get the results and ensure they contain the search term...');
                const results: string[] = await view.getResults();

                lowercaseResults.push(...results);
            });
            await v.verify(lowercaseResults, containing('pizza')); // if no results contained the word 'pizza' test fails
        }); 
    })

    it('[C2345] can access mobile apps using AFT and UiComponents with AftMochaReporter', async function() {
        const aft = new AftMochaTest(this);
        if (!(await aft.shouldRun())) {
            await aft.pending();
        } else {
            await using(new WebdriverIoSession({reporter: aft.reporter}), async (session) => {
                await session.reporter.step('get the WikipediaView Facet from the Session...');
                const view: WikipediaView = await session.getComponent(WikipediaView);
                await session.reporter.step('enter a search term...');
                await view.searchFor('pizza');
                await session.reporter.step('get the results and ensure they contain the search term...');
                const results: string[] = await view.getResults();

                expect(results.some(item => item.includes('pizza'))).to.eql(true);
            });
        }
    })
})

aftconfig.json keys and values supported by aft-ui-webdriverio package

this package does not support any additional configuration. see aft-ui for values relevant in the UiSessionConfig