Docs: https://serenity-js.org | Issues: https://github.com/serenity-js/serenity-js/issues | Backlog: https://github.com/orgs/serenity-js/projects
renovate[bot] on babel-monorepo
fix(deps): update dependency @b… (compare)
Hi Team, I have imported project template "protractor-jasmine-todomvc" in Visual Studio Code but when I try to run Start.ts using npx ts-node Start.ts command I am getting:
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module './Start.ts'
Require stack:
Hey Folks! 3.0.0-rc.7
is now available with a bunch of fixes and several new features, please see changelog
The big highlight:
You can now check if Page
, ModalDialog
, PageElement
, or any field of any object returned by Question.about
is present in a consistent way, thanks to a new interface - Optional
For example Ensure.that(ModalDialog.window(), isPresent())
, Ensure.that(LastResponse.body().books[0].authors.name, isPresent())
, Wait.until(PageElement, isPresent())
, etc
Please take 3.0.0-rc.7
for a spin and let me know what you think!
Also, if you haven't already, please add your team / company to the list of all the awesome places using Serenity/JS :) serenity-js/serenity-js#898
Hey folks! I'm exploring ways to improve how Serenity/JS selectors work and need your help!
Could you please take a couple of minutes to answer this short survey?
https://forms.gle/CGebfBPwKJQHkXr69
Thank you! :bow:
Hey folks! I'm continuing to expand the Serenity/JS 3.0 migration guide at serenity-js/serenity-js#1100
Thoughts, feedback and questions are welcome!
Hey folks, Serenity/JS 3.0.0-rc.9 is now available on npm
Highlights:
isVisible()
works with elements in Shadow DOMBy.css
can be prefixed with >>>
to locate elements in Shadow DOM - e.g. By.css('>>>div.info'))
; This works with both Protractor and WebdriverIO integrations. Hi all, I've just released protractor-cucumber-framework
version 8.3.0
with Serenity/JS 2.33.0
.
This release fixes an issue that prevented limiting the execution of test scenarios by line number a given scenario is on. See protractor-cucumber-framework/protractor-cucumber-framework#238
I'll merge the fix to 3.0.0-rc shortly too
Hi - I just made a problem, and am wondering if I simply should have done something different....:
I wanted to keep the bdd simple, while under the hood stuffs got done so I made:When Terry gets the stuff api
Then he should see a "DIV" tag id "testTagId" with values
| stringValue |
| stuffs: "stringyStuffs" |
| otherStuffs: "thingyStuffs" |
with more going on in the step to check specifically the tag is right and it has some expected strings (i know i could probably forego the id check and just use the tag check but thats not my question):
'{pronoun} should see a {string} tag id {string} with values',
(pronoun, expectedTag, tagId, tableOfStrings: DataTable) => {
pronoun.attemptsTo(
Ensure.that(
LastResponse.body<string>().describedAs(`the fragment has a tag ${tagId}`).map(
() => (body) => JSDOM.fragment(body).getElementById(tagId),
),
not(equals(null)),
),
Ensure.that(
LastResponse.body<string>().describedAs(`the tag ${tagId} is a ${expectedTag} tag`).map(
() => (body) => JSDOM.fragment(body).getElementById(tagId).tagName,
),
includes(expectedTag),
),
tableOfStrings.rows().forEach((row) => {
Ensure.that(
LastResponse.body<string>().describedAs(`${tagId} has string`).map(
() => (body) => JSDOM.fragment(body).getElementById(tagId).textContent,
),
includes(row[0]),
)
}),
)
},
);
This passes the test, and the report looks ok (though it reports the last ensure first), but there is a problem summarising to the console, and I think its caused by the last ensure with an iteration through the table:✓ Execution successful (95ms)
[ser:test:execute] ✓ Terry ensures that the tag testTagId is a SCRIPT tag does include 'SCRIPT' (14ms)
[ser:test:execute] /pathToProject/node_modules/@serenity-js/core/src/screenplay/activities/ActivityDescriber.ts:8
[ser:test:execute] const template = activity.toString() !== ({}).toString()
[ser:test:execute] ^
[ser:test:execute] TypeError: Cannot read properties of undefined (reading 'toString')
[ser:test:execute] at ActivityDescriber.describe (/pathToProject/node_modules/@serenity-js/core/src/screenplay/activities/ActivityDescriber.ts:8:35)
[ser:test:execute] at TrackedActivity.performAs (/pathToProject/node_modules/@serenity-js/core/src/screenplay/activities/TrackedActivity.ts:26:69)
[ser:test:execute] at /pathToProject/node_modules/@serenity-js/core/src/screenplay/actor/Actor.ts:72:40 {
[ser:test:execute] [Symbol(originalCallSite)]: [ CallSite {}, CallSite {}, CallSite {} ],
[ser:test:execute] [Symbol(mutatedCallSite)]: [ CallSite {}, CallSite {}, CallSite {} ]
[ser:test:execute] }
[failsafe] Script 'ser:test:execute' exited with code 1
[ser:test:report]
[ser:test:report] > projectName@1.0.0 ser:test:report
[ser:test:report] > serenity-bdd run --features ./features
If I have te table check as a separate pronoun.attemptsTo(...) in the same step, it seems ok.... Thoughts?
Hey folks, Serenity/JS 3.0.0-rc.11 is now available! 🎉🎉🎉
It brings you:
Switch.to(pageOrFrame)
, which works consistently for both Page
and Frame
modelsFor example, you can now easily switch to an iframe, perform a sequence of interactions, and then Serenity will switch you back when you're done. No need to mess about with having to remember about parent frames:
actorCalled('Francesca').attemptsTo(
Navigate.to('/screenplay/models/frame/page_with_an_iframe.html'),
Ensure.that(Text.of(heading), equals('Page with an iframe')),
Switch.to(Frame.located(By.css('iframe'))).and(
Ensure.that(Text.of(heading), equals('An iframe')),
),
Ensure.that(Text.of(heading), equals('Page with an iframe')),
)
And it works for switching between windows/tabs too!
actorCalled('Bernie').attemptsTo(
Click.on(MainPage.newTabLink),
Wait.until(Page.whichTitle(equals(NewTab.title)), isPresent()),
// click automatically switches context,
// so make sure we're on the main page
Switch.to(Page.whichTitle(equals(MainPage.title))),
Switch.to(Page.whichTitle(equals(NewTab.title))).and(
Ensure.that(heading, equals(NewTab.heading)),
),
Ensure.that(Page.current().title(), equals(MainPage.title)),
));
Thoughts and feedback are welcome!
Like for example,
I have a task something like,
Check.whether(URL, isequal('step-1')).andIfSo(execute('__dir/step-1.feature')) // execute will accept the location for the feature file and start executing it
isGreen: () => Expectation.thatActualShould('become green', 'become green').soThat(actualValue =>
Attribute.of(actualValue).called('color-indication'), includes('i-am-green')
),
Hey folks! Applitools are hosting a free Future of Testing conference today, and @wakaleo and I will be talking about the Screenplay pattern and some of the new features in Serenity BDD (Java)
If you have a moment to tune in about at 1:45 UTC, please feel free to join us :)
Registration:
https://applitools.com/future-of-testing-frameworks-2022/
Hello @jan-molak I'm doing Api testing and I need save values of diferentes request to use it after, example: I need to save Id of my first request but I need use this Id in the second request as a parameter... I read about take notes but those take notes save values but in the same context of the first request but when I want to use Id in the second request my note using Note.of say that not exist.
Are there any way to answer my problem? Thanks!
Hi,
i am actually working on a poc implementing serenity-js into our existing cucumber webdriverio project. I noticed that the Photographer actually only work on screenplay tests and researched about a work around for webdriver.io legacy tests. So I did the following after finding an issue about this from @jan-molak :
const { After } = require('@cucumber/cucumber');
const { actorCalled } = require('@serenity-js/core');
const { Check, equals } = require('@serenity-js/assertions');
const { TakeScreenshot } = require('@serenity-js/web');
After(scenario => actorCalled('Inspector').attemptsTo(
Check.whether(scenario.result.status, equals('failed'))
.andIfSo(TakeScreenshot(scenario.pickle.name))
));
But actually i dont get it to make a screenshot but i already find out that it actually get reached by the code on failure with a console.log. Is there something i am missing or did someone manage to make webdriver.io take a Screenshot somehow ? :-) Thx in advance for any help and sorry for the long post :D
Hey folks, 3.0.0-rc.13
is now available!
Most notable changes:
Frame
and PageElement
models and removed Frame
Switch.to(...)
with any PageElement
. If that PageElement
is a frame
or iframe
, calling Switch.to(PageElement.located(By.css('frame'))
results in switching the top-level browsing context to that frame. If that element is any regular Web element, like input
, Switch.to(element)
will set focus on that element.Check out the examples and let me know what you think!
Argument of type 'QuestionAdapter<Promise<number>>' is not assignable to parameter of type 'Answerable<number>'.
Type 'QuestionAdapter<Promise<number>>' is not assignable to type 'Question<number>'.
The types returned by 'describedAs(...).answeredBy(...)' are incompatible between these types.
Type 'Promise<Promise<number>>' is not assignable to type 'number'.ts(2345)
- could do with some help on correctign this - have looked and can't really find the answer to these...
Hi together, did someone have an idea what can cause this error from serenity-bdd ? t] Mar 15, 2022 11:41:32 AM freemarker.log._JULLoggerFactory$JULLogger error
[test:report] 11:41:33.104 [pool-2-thread-3] WARN n.t.c.r.t.FreemarkerReportTemplate - Report generation failed
[test:report] freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:
[test:report] ==> row.result [in template "freemarker/default.ftl" at line 329, column 43]
[test:report]
actually I can see it creates all the screenshots and its using an after hook for it since its legacy wdio. and also its working without issue for some tests
Hey folks, I'm thinking of combining interactions to Press
and Enter
and introducing a new one along the lines of Type.text(valueOrKeyboardShortcuts).into(field)
Please share your thoughts under serenity-js/serenity-js#1148
Hi @jan-molak , how you doing?
I'm currently using Serenity/JS 2.32.5 with wdio and Jasmine and I have seen some strange behavior with beforeAll method.
I created a simplified version of my code:
import { actorCalled, Log } from "@serenity-js/core";
import { ACTOR } from "./actors";
describe(`My Serenity Suite`, () => {
beforeAll(async function () {
console.log("Serenity beforeAll");
//unless we remove the following await, test #2 never gets executed
await actorCalled(ACTOR.ADMIN).attemptsTo(Log.the("Serenity BeforeAll"));
});
afterAll(async function () {
console.log("Serenity afterAll");
await actorCalled(ACTOR.MANAGER).attemptsTo(Log.the("Serenity afterAll"));
});
it("Test #1", function () {
console.log("Serenity test #1");
});
it("Test #2", function () {
console.log("Serenity test #2");
});
});
the output is:
[0-0] RUNNING in chrome - /test/specs/jasmine-serenity-problem.spec.ts
[0-0] Serenity beforeAll
[0-0] Serenity test #1
[0-0] Serenity afterAll
[0-0] PASSED in chrome - /test/specs/jasmine-serenity-problem.spec.ts
So, test #2 NEVER gets executed.
If I remove the "await" in the beforeAll, everything works properly and, if I replace beforeAll-->beforeEach works fine, so I guess is a problem of the await in the beforeAll method.
Do you think this is a bug? Do you any kind of test related to this?
Hey folks, as I'm working on Chapter 13 of "BDD in Action, second edition", dedicated to Serenity/JS, I noticed that there's a number of improvements I could make around the ability to TakeNotes
and Notes
in general.
I've described my ideas here, so let me know what you think about them and if there's anything else that you'd like to see improved in that area - serenity-js/serenity-js#817
Make sure to perform a HTTP API call before checking on the response
while upgrading some tests from 2.33.0 to 3.0.0-rc.13 ... - I am still using the same actor declarations and steps, just changing the ensures. I tried creating a new project just to work through some of the issues, and can't see what I can be doing differently to cause this....
Hey /@all! I've just released 3.0.0-rc.16
with a completely rewritten ability to TakeNotes
, question about Note
, and interaction to TakeNote
. The new implementation provides better type safety, an easy way to instantiate a notepad with some initial state, and take advantage of the new QuestionAdapter
APIs.
Please have a look at the migration guide at serenity-js/serenity-js#1100 and let me know if you have any questions or feedback!
Take care and Happy Easter :-)
statement from the serenity/js website: Serenity/JS comes with over 100 building blocks to help you create high-quality automated acceptance tests interacting with Web apps, REST APIs, and more.
question:
statement from the serenity/js website: Serenity/JS is easy to extend, so there are no limits to what you can test!
question:
statement from the serenity/js website: Serenity/JS supercharges Jasmine, Mocha, Cucumber, Protractor, and WebdriverIO with capabilities to produce in-depth reports and living documentation that make failure analysis and release readiness assessment much more efficient.
question:
HI @jan-molak , I'm in trouble with your latest change for Note
in 3.0.0-rc.16:
I was using an actor.whoCan(TakeNotes.usingASharedNotepad()
. All my actor.named('some-name')
s used this Actor
.
I took generic notes with a dynamic subject, like
TakeNote.of(
Value.of(PageElementAValue)))
.as('dynamic subject A'),
TakeNote.of(
Value.of(PageElementBValue))
.as('dynamic subject B')
and then every actor could acces this note
Log.the('note of dynamic subject', Note.of('dynamic subjectA)),
Log.the('note of dynamic subject', Note.of('dynamic subjectB)),
Now I'm stuck with the new implementation. I have to init a shared notepad with an interface. In your examples it it is
// initialise a shared notepad when the Actors class is initialised
private readonly sharedNotepad = Notepad.with<AuthCredentials>({
username: 'test-user',
password: 'SuperSecretP@ssword!',
});
In my case it would be empty at the beginning, because I want to fill it later
// initialise a shared notepad when the Actors class is initialised
private readonly sharedNotepad = Notepad.with<AuthCredentials>({});
and I want not just one set of username and password, but different instances of this value pair. How can I achieve this?
Hey @/all!
@viper3400 and I are busy working on updating the docs and templates to help you get started with Serenity/JS 3.0
Please check out the updated migration guide, take the new templates for a spin, and let us know what you think!