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

systelab-components-test

v2.2.4

Published

Widgets to be use in the E2E Tests based in Protractor

Downloads

234

Readme

Codacy Badge Build Status codecov npm version Known Vulnerabilities

systelab-components-test

Library with test tools for systelab-components based applications.

Installing the library

npm install systelab-components-test --save

Working with the repo

git clone https://github.com/systelab/systelab-components-test.git
cd systelab-components-test
npm install

Improving and publishing the library

Once you get your improvements merged, you will need an authorised user in order to publish it. Having the new version updated in the package.json file, you'll neeed to execute the following commands:

npm login 
# Here you will enter your credentials
npm publish

Using the library

Create your Page Object

For every page object create a new class by extending BasePage. Call the super constructor with the selector as a parameter.

export class MainPage extends BasePage {

	constructor() {
		super('my-selector');
	}

In the Page Object, create methods to access the different widgets that can be directly found in the page. Some available widgets are: Button, ComboBox, ContextMenu, Datepicker, Grid, Icon, InputField, Label, MesssagePopup, Popup, Dialog, Tab, Tabs

For example:

	public getAllergyGrid(): Grid {
		return new Grid(this.current.element(by.id('AllergyTable')));
	}

Use the appropriate locator in order to get the right ElementFinder.

Dialogs are considered widgets an not page objects, therefore, for each one, you will have to create a class extending Dialog and in that class create methods to access the different widgets that can be directly found in the dialog.

For example:

	public getAllergyDetailDialog(): AllergyDetailDialog {
		return new AllergyDetailDialog(element(by.tagName('allergy-dialog')));
	}

And the class implementing the dialog will be something like:

export class AllergyDetailDialog extends Dialog {

	public getEnableSwitch() {
		return this.byId('AllergyEnableSwitch').element(by.tagname('input'));
	}
...

Create your Test spec

In your spec files, use the needed page objects and access to the widgets through the methods defined. Interact with the widgets with the methods provided by the library.

For example:

it(`Should be able to do something`, async () => {
        const patientMaintenanceDialog = await mainPage.getPatientMaintenanceDialog();
		await patientMaintenanceDialog.getButtonAdd().click();
		const patientDialog = await patientMaintenanceDialog.getPatientDialog();
		await patientDialog.getTabs().selectTab(1);
	});

Allure

In order to document test cases we suggest to use Allure.

With allure the test cases will look like the following example:

await allure.createStep(`Action: Set a valid username and password`, async () => {
			await LoginActionService.login(loginPage);
		})();

If documentation for an expectatio is needed, use the convenient function called because, that can be combined with the normal expect function to avoid the need of an inner function for Allure.

Using the function, the test case will look like the above example.

	await because('The logged user is Administrator').expect(await mainPage.getFullUsernameField().getText()).toEqual('Administrator');

For more information, please read the documentation at Allure reporter

Experimental

Included in the library, there is a decorator and a method that can be used in order to simplify common checks on the widgets.

The idea is to annotate the methods that get specific widgets to test with the @TestAttribute decorator

	@TestAttribute({type: AttributeType.Text, visible: true, enable: true, mandatory: true, length: 20, name: 'name'})
	public getNameInput(): InputField {
		return new InputField(this.byId('PatientNameInput'));
	}

Once you have all the widgets to test with the proper decorator, in your test you can check the attributes with the method check in the service TestAttributesService:

	public static async check(dialog: Widget | BasePage) {

For example:

	it(`Check patient dialog`, async () => {
		await patientMaintenanceDialog.getButtonAdd().click();
		await TestAttributesService.check(patientDialog)
		await patientDialog.getButtonClose().click();
	});

Useful Links