Skip to content

Commit

Permalink
Merge pull request #9 from hammzj/dev/workflow-publish-to-npm
Browse files Browse the repository at this point in the history
add:publish to npmjs registry as well
  • Loading branch information
hammzj authored Apr 12, 2024
2 parents 01317b3 + 6524889 commit 0a3cc3e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,23 @@ name: Publish Package to registries
on:
workflow_dispatch:
release:
types: [published]
types: [ published ]
jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
scope: '@hammzj'
- run: yarn
- run: yarn publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_JS_REGISTRY_AUTH_TOKEN }}

publish-github:
runs-on: ubuntu-latest
steps:
Expand Down
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ examplePageObject.components.FooterObject((footerObject) => {

## Installation

This package is hosted on the GitHub NPM package repository. Please add or update your `.npmrc` file with the following:
This package is hosted on both the NPMJS registry and the GitHub NPM package repository.

If installing from GitHub, please add or update
your `.npmrc` file with the following:

```
@hammzj:registry=https://npm.pkg.github.com
Expand Down Expand Up @@ -100,7 +103,8 @@ class SearchForm extends ElementCollection {
Base elements are locators for HTML elements on the webpage. They should exist as chained from the base container, or
another element selector in the collection.

These are defined in `this.elements`. You can either extend the original elements with `this.elements = { ...this.elements, ... }`
These are defined in `this.elements`. You can either extend the original elements
with `this.elements = { ...this.elements, ... }`
or use `Object.assign(this.elements, { ... })` inside the class constructor.

<details>
Expand All @@ -116,7 +120,7 @@ class NewUserForm extends ElementCollection {
public elements = {
//An element selector chained from another element selector -- selects the first found "input"
usernameField: () => this.container().find(`input`).first(),
passwordField: () => this.elements.usernameField().next(),
passwordField: () => this.elements.usernameField().next(),
//Some selectors can return many elements at once!
fieldErrors: () => { //Assumes that multiple field errors can be present on submission, so it has the possiblity to return many elements!
//For example, you can use this.fieldErrors.eq(i) to find a single instance of the error.
Expand Down Expand Up @@ -285,7 +289,8 @@ class PaymentTypeButton extends ComponentObject {

## The `PageObject` class

A page object represents an entire page of an application, which can consist of page metadata, element selectors, nested components, and
A page object represents an entire page of an application, which can consist of page metadata, element selectors, nested
components, and
their own app actions and assertions that can utilize multiple nested components at once. They also have their
own url paths that can be set and defined. URLs with replaceable path variables are also allowed, and functions exist to
assist with constructing them.
Expand Down Expand Up @@ -315,6 +320,7 @@ userPostsPage.url("1234", "post-9876"); //=> "http://localhost:3000/user/1234/po

```js
const { PageObject } = require("@hammzj/cypress-page-object");

//Cypress.config().baseUrl = `http://localhost:3000`;

class PrivacySettingsPage extends PageObject {
Expand Down Expand Up @@ -360,7 +366,8 @@ yarn test:cypress:open:e2e

## TypeScript support

All typings are included in `/src/types`, but class types are found in their corresponding source file like `ElementCollection` in `/src/element.collection`.
All typings are included in `/src/types`, but class types are found in their corresponding source file
like `ElementCollection` in `/src/element.collection`.

## Notes

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hammzj/cypress-page-object",
"version": "2.0.0",
"version": "2.0.1",
"description": "A set of template classes and guides to help with developing component and page objects in Cypress.",
"author": "Zachary Hamm <[email protected]>",
"license": "MIT",
Expand Down

0 comments on commit 0a3cc3e

Please sign in to comment.