Socket
Socket
Sign inDemoInstall

@serenity-js/web

Package Overview
Dependencies
Maintainers
1
Versions
118
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.24.1 to 3.25.0

16

CHANGELOG.md

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

# [3.25.0](https://github.com/serenity-js/serenity-js/compare/v3.24.1...v3.25.0) (2024-07-03)
### Bug Fixes
* **web:** renamed PageElement.outerHtml to PageElement.html for consistency with other methods ([9df6e0f](https://github.com/serenity-js/serenity-js/commit/9df6e0f2eece966d50ddac92e7550baa72bcb5f1))
### Features
* **web:** outerHtml lets you retrieve the HTML content of the given PageElement ([1bb6c6a](https://github.com/serenity-js/serenity-js/commit/1bb6c6afbfea3fb0c8883f9fe4aec385aa12ac27))
## [3.24.1](https://github.com/serenity-js/serenity-js/compare/v3.24.0...v3.24.1) (2024-06-26)

@@ -8,0 +24,0 @@

45

lib/screenplay/models/PageElement.d.ts

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

import type { Answerable, MetaQuestionAdapter, Optional } from '@serenity-js/core';
import type { Answerable, MetaQuestion, MetaQuestionAdapter, Optional, QuestionAdapter } from '@serenity-js/core';
import type { Locator } from './Locator';

@@ -23,2 +23,25 @@ import type { SelectOption } from './SelectOption';

static of<NET>(childElement: MetaQuestionAdapter<PageElement<NET>, PageElement<NET>> | PageElement<NET>, parentElement: Answerable<PageElement<NET>>): MetaQuestionAdapter<PageElement<NET>, PageElement<NET>>;
/**
* A static method producing a {@apilink MetaQuestion} that can be used with {@apilink PageElements.eachMappedTo} method
* to extract the HTML of each element in a collection.
*
* #### Example
*
* ```typescript
* import { actorCalled, Log } from '@serenity-js/core'
* import { Navigate, PageElement, By, Text } from '@serenity-js/web'
* import { includes } from '@serenity-js/assertions'
*
* await actorCalled('Debbie').attemptsTo(
* Navigate.to('https://serenity-js.org'),
*
* Log.the(
* PageElements.located(By.css('a'))
* .where(Text, includes('modular'))
* .eachMappedTo(PageElement.html())
* ),
* )
* ```
*/
static html<NET>(): MetaQuestion<PageElement<NET>, QuestionAdapter<string>>;
constructor(locator: Locator<Native_Element_Type>);

@@ -100,2 +123,22 @@ /**

/**
* An instance method that resolves to the value of the [`outerHTML`](https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML) property
* of the underlying element.
*
* #### Example
*
* ```typescript
* import { actorCalled, Log } from '@serenity-js/core'
* import { Navigate, PageElement, By } from '@serenity-js/web'
*
* await actorCalled('Debbie').attemptsTo(
* Navigate.to('https://serenity-js.org'),
*
* Log.the(
* PageElement.located(By.css('h1')).html()
* ),
* )
* ```
*/
abstract html(): Promise<string>;
/**
* When the element represents an [`iframe`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe),

@@ -102,0 +145,0 @@ * calling this method switches the current browsing context to the given `iframe` context.

@@ -40,2 +40,32 @@ "use strict";

}
/**
* A static method producing a {@apilink MetaQuestion} that can be used with {@apilink PageElements.eachMappedTo} method
* to extract the HTML of each element in a collection.
*
* #### Example
*
* ```typescript
* import { actorCalled, Log } from '@serenity-js/core'
* import { Navigate, PageElement, By, Text } from '@serenity-js/web'
* import { includes } from '@serenity-js/assertions'
*
* await actorCalled('Debbie').attemptsTo(
* Navigate.to('https://serenity-js.org'),
*
* Log.the(
* PageElements.located(By.css('a'))
* .where(Text, includes('modular'))
* .eachMappedTo(PageElement.html())
* ),
* )
* ```
*/
static html() {
return {
of: (pageElement) => core_1.Question.about(`outer HTML of ${pageElement}`, async (actor) => {
const element = await actor.answer(pageElement);
return element.html();
})
};
}
constructor(locator) {

@@ -42,0 +72,0 @@ this.locator = locator;

10

package.json
{
"name": "@serenity-js/web",
"version": "3.24.1",
"version": "3.25.0",
"description": "Serenity/JS Screenplay Pattern APIs for the Web",

@@ -48,4 +48,4 @@ "author": {

"dependencies": {
"@serenity-js/assertions": "3.24.1",
"@serenity-js/core": "3.24.1",
"@serenity-js/assertions": "3.25.0",
"@serenity-js/core": "3.25.0",
"tiny-types": "1.22.0"

@@ -58,3 +58,3 @@ },

"c8": "10.1.2",
"mocha": "10.5.1",
"mocha": "10.6.0",
"mocha-multi": "1.1.7",

@@ -64,3 +64,3 @@ "ts-node": "10.9.2",

},
"gitHead": "f7378fd85f00f055322f4d28624735ba3d2e2782"
"gitHead": "22657b685b6002f75b2569db54f4bea31ab91d12"
}

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

import type { Answerable, MetaQuestionAdapter, Optional } from '@serenity-js/core';
import type { Answerable, MetaQuestion, MetaQuestionAdapter, Optional , QuestionAdapter} from '@serenity-js/core';
import { Question, the } from '@serenity-js/core';

@@ -54,2 +54,34 @@ import { ensure, isDefined } from 'tiny-types';

/**
* A static method producing a {@apilink MetaQuestion} that can be used with {@apilink PageElements.eachMappedTo} method
* to extract the HTML of each element in a collection.
*
* #### Example
*
* ```typescript
* import { actorCalled, Log } from '@serenity-js/core'
* import { Navigate, PageElement, By, Text } from '@serenity-js/web'
* import { includes } from '@serenity-js/assertions'
*
* await actorCalled('Debbie').attemptsTo(
* Navigate.to('https://serenity-js.org'),
*
* Log.the(
* PageElements.located(By.css('a'))
* .where(Text, includes('modular'))
* .eachMappedTo(PageElement.html())
* ),
* )
* ```
*/
static html<NET>(): MetaQuestion<PageElement<NET>, QuestionAdapter<string>> {
return {
of: (pageElement: Answerable<PageElement<NET>>) =>
Question.about(`outer HTML of ${pageElement}`, async actor => {
const element = await actor.answer(pageElement);
return element.html();
})
}
}
constructor(public readonly locator: Locator<Native_Element_Type>) {

@@ -144,2 +176,23 @@ ensure('native element locator', locator, isDefined());

/**
* An instance method that resolves to the value of the [`outerHTML`](https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML) property
* of the underlying element.
*
* #### Example
*
* ```typescript
* import { actorCalled, Log } from '@serenity-js/core'
* import { Navigate, PageElement, By } from '@serenity-js/web'
*
* await actorCalled('Debbie').attemptsTo(
* Navigate.to('https://serenity-js.org'),
*
* Log.the(
* PageElement.located(By.css('h1')).html()
* ),
* )
* ```
*/
abstract html(): Promise<string>;
/**
* When the element represents an [`iframe`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe),

@@ -146,0 +199,0 @@ * calling this method switches the current browsing context to the given `iframe` context.

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