1.17.1 • Published 2 months ago

systelab-components-wdio-test v1.17.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Build Status npm version Known Vulnerabilities

systelab-components-wdio-test

Library with test tools for systelab-components based applications using WebDriverIO test framework.

Installing the library

npm install systelab-components-wdio-test --save

Working with the repo

git clone https://github.com/systelab/systelab-components-wdio-test.git
cd systelab-components-wdio-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 tag name of the page component as a parameter.

export class MainPage extends BasePage {

	constructor() {
		super('my-page-component-tag-name');
	}

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.byId('AllergyTable'));
	}

Use the appropriate locator (i.e byId, byTagName, byCSS, ...) 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(Browser.byTagName('allergy-dialog'));
	}

And the class implementing the dialog will be something like:

export class AllergyDetailDialog extends Dialog {

	public getEnableSwitch() {
		return this.byId('AllergyEnableSwitch').byTagName('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 Reporting

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

With allure, test case actions are documented through the 'it' strings as in the following example:

it(`Write a valid username and password in the login form`, async () => {
	// Implement action here
});

If documentation for an expectation is needed, use the convenient static function called ReportUtility.addExpectedResult, that allow to write an expectation string that wraps a code snippet.

Using the function, the test case will look like the example below:

await ReportUtility.addExpectedResult("Invalid username or password message is displayed", async () => {
	AssertionUtility.expectEqual(await loginPage.getMessagePopup().getTextMessage(), "Invalid username or password");
});

Traceability

See traceability page for details on how to add into Allure Reporting traceability of specs with test cases.

Screenshots

See screenshots page for details on utilities for screenshot-based testing techniques.

1.17.1

2 months ago

1.17.0

3 months ago

1.15.0

7 months ago

1.14.0

7 months ago

1.16.3

6 months ago

1.16.2

6 months ago

1.16.1

6 months ago

1.16.0

6 months ago

1.16.6

6 months ago

1.16.5

6 months ago

1.16.4

6 months ago

1.16.8

5 months ago

1.13.0

7 months ago

1.11.0

9 months ago

2.0.0

1 year ago

1.10.2

1 year ago

1.10.1

1 year ago

1.10.0

2 years ago

1.9.0

2 years ago

1.8.0

2 years ago

1.7.1

2 years ago

1.7.0

2 years ago

1.6.0

2 years ago

1.5.0

2 years ago

1.2.0

3 years ago

1.4.0

3 years ago

1.3.0

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago