Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@serenity-js/web

Package Overview
Dependencies
Maintainers
1
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@serenity-js/web - npm Package Compare versions

Comparing version 3.5.0 to 3.6.0

17

CHANGELOG.md

@@ -6,2 +6,19 @@ # Change Log

# [3.6.0](https://github.com/serenity-js/serenity-js/compare/v3.5.0...v3.6.0) (2023-07-11)
### Bug Fixes
* **deps:** update dependency tiny-types to ^1.20.0 ([6d7bf43](https://github.com/serenity-js/serenity-js/commit/6d7bf43c6135968bc90869cb8f9782ed70ca8dd9))
### Features
* **web:** selectors are comparable and serialisable to JSON ([b285389](https://github.com/serenity-js/serenity-js/commit/b2853897e18a1a6693af156844830e8760d1a2b7)), closes [#1784](https://github.com/serenity-js/serenity-js/issues/1784)
* **web:** you can now use Serenity/JS Screenplay Pattern APIs for UI component testing ([3c9aa4b](https://github.com/serenity-js/serenity-js/commit/3c9aa4b16d223844116ffcb21d23f9cc8b96a793)), closes [#1784](https://github.com/serenity-js/serenity-js/issues/1784)
# [3.5.0](https://github.com/serenity-js/serenity-js/compare/v3.4.2...v3.5.0) (2023-07-02)

@@ -8,0 +25,0 @@

8

lib/screenplay/abilities/BrowseTheWeb.d.ts

@@ -83,6 +83,2 @@ import { Ability } from '@serenity-js/core';

/**
* Returns {@apilink BrowserCapabilities|basic meta-data} about the browser associated with this ability.
*/
abstract browserCapabilities(): Promise<BrowserCapabilities>;
/**
* Returns a {@apilink Page} representing the currently active browser tab.

@@ -96,3 +92,7 @@ */

allPages(): Promise<Array<Page<Native_Element_Type>>>;
/**
* Returns {@apilink BrowserCapabilities|basic meta-data} about the browser associated with this ability.
*/
browserCapabilities(): Promise<BrowserCapabilities>;
}
//# sourceMappingURL=BrowseTheWeb.d.ts.map

@@ -99,4 +99,10 @@ "use strict";

}
/**
* Returns {@apilink BrowserCapabilities|basic meta-data} about the browser associated with this ability.
*/
async browserCapabilities() {
return this.session.browserCapabilities();
}
}
exports.BrowseTheWeb = BrowseTheWeb;
//# sourceMappingURL=BrowseTheWeb.js.map
import type { CorrelationId } from '@serenity-js/core/lib/model';
import type { BrowserCapabilities } from './BrowserCapabilities';
import type { Page } from './Page';

@@ -20,2 +21,6 @@ /**

/**
* Returns {@apilink BrowserCapabilities|basic meta-data} about the browser associated with this browsing session.
*/
abstract browserCapabilities(): Promise<BrowserCapabilities>;
/**
* Returns a {@apilink Page} representing the currently active top-level browsing context.

@@ -22,0 +27,0 @@ */

@@ -33,4 +33,7 @@ /// <reference types="node" />

toString(): string;
/**
* Custom [Node.js inspection method](https://nodejs.org/api/util.html#utilinspectcustom).
*/
[util.inspect.custom]: (depth: number, options: util.InspectOptionsStylized, inspect: typeof util.inspect) => string;
}
//# sourceMappingURL=Locator.d.ts.map

@@ -48,2 +48,5 @@ "use strict";

this.selector = selector;
/**
* Custom [Node.js inspection method](https://nodejs.org/api/util.html#utilinspectcustom).
*/
this[_a] = (0, io_1.inspectedObject)(this, ['parent', 'selector']);

@@ -50,0 +53,0 @@ }

@@ -198,2 +198,8 @@ /// <reference types="node" />

/**
* Creates a {@apilink PageElement} wrapping a native element.
*
* @param nativeElement
*/
abstract createPageElement(nativeElement: Native_Element_Type): PageElement<Native_Element_Type>;
/**
* Creates a {@apilink PageElement}, retrieving an element located by {@apilink Selector}.

@@ -200,0 +206,0 @@ *

@@ -20,2 +20,3 @@ import type { Answerable, MetaQuestion, Optional, QuestionAdapter } from '@serenity-js/core';

readonly locator: Locator<Native_Element_Type>;
static from<NET>(nativeElement: NET): QuestionAdapter<PageElement<NET>> & MetaQuestion<PageElement, PageElement>;
static located<NET>(selector: Answerable<Selector>): QuestionAdapter<PageElement<NET>> & MetaQuestion<PageElement, PageElement>;

@@ -22,0 +23,0 @@ static of<NET>(childElement: Answerable<PageElement<NET>>, parentElement: Answerable<PageElement<NET>>): QuestionAdapter<PageElement<NET>> & MetaQuestion<PageElement, PageElement>;

@@ -19,2 +19,8 @@ "use strict";

class PageElement {
static from(nativeElement) {
return core_1.Question.about(`native page element`, async (actor) => {
const currentPage = await abilities_1.BrowseTheWeb.as(actor).currentPage();
return currentPage.createPageElement(nativeElement);
});
}
static located(selector) {

@@ -21,0 +27,0 @@ return core_1.Question.about((0, core_1.d) `page element located ${selector}`, async (actor) => {

@@ -0,1 +1,2 @@

import { TinyType } from 'tiny-types';
/**

@@ -6,5 +7,5 @@ * Describes a selector you use to identify a {@apilink PageElement} or a group of {@apilink PageElements}.

*/
export declare abstract class Selector {
export declare abstract class Selector extends TinyType {
toString(): string;
}
//# sourceMappingURL=Selector.d.ts.map

@@ -5,2 +5,3 @@ "use strict";

const core_1 = require("@serenity-js/core");
const tiny_types_1 = require("tiny-types");
/**

@@ -11,3 +12,3 @@ * Describes a selector you use to identify a {@apilink PageElement} or a group of {@apilink PageElements}.

*/
class Selector {
class Selector extends tiny_types_1.TinyType {
toString() {

@@ -14,0 +15,0 @@ const selectorDescription = this.constructor.name.replaceAll(/([a-z])([A-Z])/g, '$1 $2').toLowerCase();

{
"name": "@serenity-js/web",
"version": "3.5.0",
"version": "3.6.0",
"description": "Serenity/JS Screenplay Pattern APIs for the Web",

@@ -47,5 +47,5 @@ "author": {

"dependencies": {
"@serenity-js/assertions": "3.5.0",
"@serenity-js/core": "3.5.0",
"tiny-types": "^1.19.1"
"@serenity-js/assertions": "3.6.0",
"@serenity-js/core": "3.6.0",
"tiny-types": "^1.20.0"
},

@@ -62,3 +62,3 @@ "devDependencies": {

},
"gitHead": "c34ec9a491ded36cc178f219a9b3cae058c34c2b"
"gitHead": "970ac224860693ab70e813e176b7532241503b14"
}

@@ -88,7 +88,2 @@ import { Ability } from '@serenity-js/core';

/**
* Returns {@apilink BrowserCapabilities|basic meta-data} about the browser associated with this ability.
*/
abstract browserCapabilities(): Promise<BrowserCapabilities>;
/**
* Returns a {@apilink Page} representing the currently active browser tab.

@@ -107,2 +102,9 @@ */

}
/**
* Returns {@apilink BrowserCapabilities|basic meta-data} about the browser associated with this ability.
*/
async browserCapabilities(): Promise<BrowserCapabilities> {
return this.session.browserCapabilities();
}
}
import type { CorrelationId } from '@serenity-js/core/lib/model';
import type { BrowserCapabilities } from './BrowserCapabilities';
import type { Page } from './Page';

@@ -34,2 +35,7 @@

/**
* Returns {@apilink BrowserCapabilities|basic meta-data} about the browser associated with this browsing session.
*/
public abstract browserCapabilities(): Promise<BrowserCapabilities>;
/**
* Returns a {@apilink Page} representing the currently active top-level browsing context.

@@ -36,0 +42,0 @@ */

@@ -58,3 +58,6 @@ import { inspectedObject } from '@serenity-js/core/lib/io';

/**
* Custom [Node.js inspection method](https://nodejs.org/api/util.html#utilinspectcustom).
*/
[util.inspect.custom] = inspectedObject(this, [ 'parent' as keyof this, 'selector' ]);
}

@@ -261,2 +261,9 @@ import type { Expectation, ExpectationOutcome, Optional, QuestionAdapter } from '@serenity-js/core';

/**
* Creates a {@apilink PageElement} wrapping a native element.
*
* @param nativeElement
*/
abstract createPageElement(nativeElement: Native_Element_Type): PageElement<Native_Element_Type>;
/**
* Creates a {@apilink PageElement}, retrieving an element located by {@apilink Selector}.

@@ -263,0 +270,0 @@ *

@@ -25,2 +25,10 @@ import type { Answerable, MetaQuestion, Optional, QuestionAdapter } from '@serenity-js/core';

static from<NET>(nativeElement: NET): QuestionAdapter<PageElement<NET>> & MetaQuestion<PageElement, PageElement> {
return Question.about(`native page element`, async actor => {
const currentPage = await BrowseTheWeb.as<BrowseTheWeb<NET>>(actor).currentPage();
return currentPage.createPageElement(nativeElement);
}) as QuestionAdapter<PageElement<NET>> & MetaQuestion<PageElement, PageElement>;
}
static located<NET>(selector: Answerable<Selector>): QuestionAdapter<PageElement<NET>> & MetaQuestion<PageElement, PageElement> {

@@ -27,0 +35,0 @@ return Question.about(d`page element located ${ selector }`, async actor => {

import { f } from '@serenity-js/core';
import { TinyType } from 'tiny-types';

@@ -8,3 +9,3 @@ /**

*/
export abstract class Selector {
export abstract class Selector extends TinyType {

@@ -11,0 +12,0 @@ toString(): string {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc