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

ts-page-object

v0.0.3

Published

This repository is a mono repository which contains multiple page-object base projects

Downloads

3

Readme

ts-page-object, ngx-page-object and react-ts-page-object

This repository is a mono repository which contains multiple page-object base projects

What is a PageObject

The original idea of a PageObject dates back (as far as I know) to Martin Fowler 2013.

In short a PageObject should be a non HTML based functional API to the web application.

It is recommended to use one PageObject per component and page. That way you will gain maximum reuseability and encapsulation.

Examples for functions in PageObjects would be clickContinue(), selectPassenger(), getPageTitle(), getAge()

A function in a PageObject should NEVER return HTMLElements. Instead return string, number, boolean, objects or arrays (i know arrays are typeof objects in JS). And if your component or page is containing sub-components you should definetly write a own PageObject for the sub component and let the parent return it.

Why should I use ts-page-object or ngx-page-object

The ts-page-object and ngx-page-object are providing you with utility functions to quickly write nice PageObjects.

| Function | Description | | ---------------------- | ------------------------------------------------------------------------------------------------- | | constructor | creates the PageObject by the HTMLElement and when wanted with the selector | | $ | first HTMLElement for selector | | $$ | all HTMLElements for selector as array | | normalizeText | Replaces all whitespace characters with a space. Remove multiple consequtive spaces. Strips | | textContent | textContent of first HTMLElement | | normalizedTextContent | normalized textContent of first HTMLElement | | textContents | array of textContent of all HTMLElements | | normalizedTextContents | array or normalized textContent of all HTMLElements | | isDisplayed | true when HTMLElement is in DOM | | idDisabled | true when HTMLElement has disabled attribute | | waitToAppear | Resolves Promise when HTMLElement is in DOM. Waits 3 seconds per default before rejecting. | | waitToDisappear | Resolved Promise when HTMLElement is not in DOM. Waits 3 seconds per default before rejecting | | getFloat | textContent as float number | | getInt | textContent as int number | | blur | send blur, input and change event to HTMLElement | | setValue | sets value attribute of HTMLInputElement | | getValue | get value of value attribute of HTMLInputElement | | click | clicks HTMLElement | | isChecked | true when HTMLInputElement has checked attribute | | isValid | true when attribute aria-invalid is not existing | | keyUp | send keyup event with given key to HTMLInputElement |

How to use

Simply create a class which extends PageObject and implement the getSelector function that it returns the HTMLElements selector.

Check the demo applications in packages/demo