Giter VIP home page Giter VIP logo

screenplay-pattern-todomvc's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

screenplay-pattern-todomvc's Issues

MalformedJsonExceptionin serenity.conf line# 18

Hello,

Running on windows with serenity-gradle-plugin:2.3.5 and serenityCoreVersion=2.3.5

Running this example I am getting Could not instantiate class org.openqa.selenium.chrome.ChromeDriver.
Took a little digging but it looks like the error is related to the below line not being valid json

download: "{prompt_for_download: false,directory_upgrade: true,default_directory:'${user.dir}/downloaded-files'}"

Caused by:
com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Invalid escape sequence at line 1 column 76 path $.
at com.google.gson.Gson.fromJson(Gson.java:947)
at com.google.gson.Gson.fromJson(Gson.java:897)
at com.google.gson.Gson.fromJson(Gson.java:846)
at com.google.gson.Gson.fromJson(Gson.java:817)
at net.thucydides.core.webdriver.CapabilityValue.asMap(CapabilityValue.java:54)
at net.thucydides.core.webdriver.CapabilityValue.asObject(CapabilityValue.java:24)
at net.thucydides.core.webdriver.capabilities.ChromePreferences.from(ChromePreferences.java:41)
at net.serenitybdd.core.webdriver.driverproviders.ChromeDriverCapabilities.addPreferencesTo(ChromeDriverCapabilities.java:136)
at net.serenitybdd.core.webdriver.driverproviders.ChromeDriverCapabilities.configuredOptions(ChromeDriverCapabilities.java:65)
at net.serenitybdd.core.webdriver.driverproviders.ChromeDriverCapabilities.getCapabilities(ChromeDriverCapabilities.java:42)
at net.serenitybdd.core.webdriver.driverproviders.ChromeDriverProvider.enhancedCapabilitiesConfiguredIn(ChromeDriverProvider.java:78)
at net.serenitybdd.core.webdriver.driverproviders.ChromeDriverProvider.newInstance(ChromeDriverProvider.java:49)

What is an alternative way to use viewBy in UIStateReaderBuilder

Hello
I see that this method is deprecated in serenity-screenplay-webdriver 3.1.5 version

public T viewedBy(Actor actor) {
try {
return (T) type.getConstructor(Target.class, Actor.class).newInstance(target, actor);
} catch (Exception e) {
logger.error("Failed to instantiate UIStateReader of type " + type, e);
throw new IllegalStateException("Failed to instantiate UIStateReader of type " + type, e);
}
}

What is the better way instead of using this?
Thank you!

The report failed on test step

Hi experts.

I have a problem whit my project implement serenity and screenplay ,all the steps in report are equal to test

image
image
image

build :

buildscript {
ext.serenityCoreVersion = '3.3.0'
repositories {
mavenCentral()
}
dependencies {
classpath("net.serenity-bdd:serenity-gradle-plugin:3.4.2")
classpath "net.serenity-bdd:serenity-single-page-report:$serenityCoreVersion"
}
}

plugins {
id "net.serenity-bdd.serenity-gradle-plugin" version "${serenityCoreVersion}"
id 'java'
id 'eclipse'
id 'idea'
}

defaultTasks 'clean','test','aggregate'

group 'co.com.base.gradle'
version '1.0-SNAPSHOT'

compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
mavenCentral()
}

ext {
junitVersion = '5.8.2'
logbackVersion = '1.2.10'
lombokVersion = '1.18.22'
}

dependencies {
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"

implementation ("net.serenity-bdd:serenity-core:${serenityCoreVersion}")
implementation "net.serenity-bdd:serenity-junit5:${serenityCoreVersion}"
implementation "net.serenity-bdd:serenity-cucumber:${serenityCoreVersion}"
implementation "net.serenity-bdd:serenity-rest-assured:${serenityCoreVersion}"

implementation "net.serenity-bdd:serenity-ensure:${serenityCoreVersion}"

// implementation "net.serenity-bdd:serenity-ensure:2.3.5"
implementation "net.serenity-bdd:serenity-screenplay:${serenityCoreVersion}"
implementation "net.serenity-bdd:serenity-screenplay-webdriver:${serenityCoreVersion}"
implementation "net.serenity-bdd:serenity-screenplay-rest:${serenityCoreVersion}"

implementation "ch.qos.logback:logback-classic:${logbackVersion}"

compileOnly "org.projectlombok:lombok:${lombokVersion}"
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
testCompileOnly "org.projectlombok:lombok:${lombokVersion}"
testAnnotationProcessor "org.projectlombok:lombok:${lombokVersion}"

}

test {
useJUnitPlatform()
testLogging.showStandardStreams = true
systemProperties System.getProperties()
}

serenity {
testRoot = "co.com.base.gradle.runners"
requirementsBaseDir = "src/test/resources/features"
reports = ["single-page-html"]
}

gradle.startParameter.continueOnFailure = true
test.finalizedBy(aggregate)

No waits implemented in code so need help

Hi, Firstly, it is a great code and concept I would say and trying to use it for one of the project where I'm going to create Automation framework from scratch so have few below questions and your inputs will greatly help.

  1. The web application which I'm going to automate is built upon on Angular JS so I believe keeping this code as reference and using the code as it is would work?
  2. How to handle waits properly in Screenplay? I don't see good documentation which explains how to handle waits in code using Screenplay. There is lot documentation for Serenity but not Screenplay I mean.
    a. How to wait until page is loaded?
    b. For example, I want to check element visibility before I perform any action on it so how to do it in efficient way? I have
    used it like below under 'task' but it seems like duplication as I repeated same wait step 3 times as there are 3 target
    locators so wanted to know whether this is the only way or any efficient way to perform waits

public static Performable toISAApplicationForm() {
return Task.where("{0} navigates to Application page",
WaitUntil.the(ImportantInfo.READ_DOCUMENTS,WebElementStateMatchers.isVisible()),
JSClick.on(ImportantInfo.READ_DOCUMENTS),
WaitUntil.the(ImportantInfo.PROCCED_TO_PROCESS_DESCRIPTION,WebElementStateMatchers.isVisible()),
Click.on(ImportantInfo.PROCCED_TO_PROCESS_DESCRIPTION),
WaitUntil.the(Processdescription.START_MY_TRANFER,WebElementStateMatchers.isVisible()),
Click.on(Processdescription.START_MY_TRANFER)
);
}

headless mode is ignored by firefox on linux

geckodriver 0.30.0
serenity 3.0.5
firefox 94.0

serenity.conf at the bottom.

export DISPLAY=

running any test yields:

_|-- Given I open the main page
21:03:09.039 [main] INFO net.serenitybdd.core.webdriver.driverproviders.FirefoxDriverProvider - Not using automatically driver download
Nov 27, 2021 9:03:09 PM org.openqa.selenium.remote.DesiredCapabilities firefox
INFO: Using new FirefoxOptions() is preferred to DesiredCapabilities.firefox()
21:03:09.989 [main] INFO net.serenitybdd.core.webdriver.driverproviders.ProvideNewDriver - Instantiating driver
21:03:09.989 [main] INFO net.serenitybdd.core.webdriver.driverproviders.ProvideNewDriver - Driver capabilities: Capabilities {acceptInsecureCerts: true, autodownload: false, browserName: firefox, driver: firefox, firefox_profile: org.openqa.selenium.firefox..., headless: true, loggingPrefs: org.openqa.selenium.logging..., marionette: true, moz:firefoxOptions: {args: [], profile: UEsDBBQACAgIAGSoe1MAAAAAAAA...}}
1638043390165 geckodriver INFO Listening on 127.0.0.1:8494
1638043390292 mozrunner::runner INFO Running command: "/usr/lib/firefox/firefox" "--marionette" "-no-remote" "-profile" "/tmp/rust_mozprofiletQ0dXE"
Unable to init server: Broadway display type not supported:
Error: cannot open display:

Step failed_

Any clue how to get the "--headless" and "--disable-gpu" into the cmdline params?

br Thomas

serenity.conf:

webdriver {
driver=firefox
autodownload=false
}
headless.mode = true

chrome.switches="""--start-maximized;--test-type;--no-sandbox;--ignore-certificate-errors;
--disable-popup-blocking;--disable-default-apps;--disable-extensions-file-access-check;
--incognito;--disable-infobars,--disable-gpu"""

firefox {
preferences = "browser.download.folderList=1;browser.download.manager.showWhenStarting=false;browser.helperApps.neverAsk.saveToDisk=text/html"
}

drivers {
windows {
webdriver.chrome.driver = src/test/resources/chromedriver.exe
webdriver.gecko.driver = src/test/resources/geckodriver.exe
}
linux {
webdriver.gecko.driver = src/test/resources/geckodriver-linux64-0.30.0
webdriver.chrome.driver = src/test/resources/chromedriver-linux64
}
}

serenity {
logging = VERBOSE
verbose {
steps = true
}
browser {
width = 1920
height = 1920
}
store {
html {
source = true
}
}
reports {
show {
step {
details = true
}
}
}
restart.browser.for.each = feature
}

WebDriver is launched at each step

When following this tuto: http://testerstories.com/2016/06/screenplay-pattern-with-java-part-2/
And and typing the code exactly as it is shown
Then I should be able to run the test...

Test FAILED...

bug: The browser is launched at each step. have tried with firefox and iexplorer.
The bug is reproduced with tests of my own, I can't run a test involving more than one step/task.

gradle build:

apply plugin: 'java'
apply plugin: 'net.serenity-bdd.aggregator'

buildscript {
project.ext {
serenityVersion = '1.8+'
}

repositories {
	mavenLocal()
	maven { url "http://repo1.maven.org/maven2" }
}

dependencies {
    classpath('net.serenity-bdd:serenity-gradle-plugin:1.8.2')
}

}

allprojects {
repositories {
maven { url "http://repo1.maven.org/maven2" }
}
}

dependencies {
compile 'net.serenity-bdd:serenity-core:' + serenityVersion
compile 'net.serenity-bdd:serenity-journey:1.1+'
compile 'net.serenity-bdd:serenity-screenplay-webdriver:1.1+'
testCompile 'junit:junit:4.12'
testCompile 'net.serenity-bdd:serenity-junit:' + serenityVersion
testCompile 'net.serenity-bdd:serenity-cucumber:1.6+'
testCompile 'net.serenity-bdd:serenity-jbehave:' + serenityVersion
testCompile 'org.assertj:assertj-core:3.8+'
testCompile 'org.slf4j:slf4j-simple:1.7+'
}

gradle.startParameter.continueOnFailure = true

Task Listeners

Could i check if there is any task listeners in serenity screenplay, a listener that should be executed after every task. Thanks !

Getting Tests are skipped When using Base Class

Hi I am editing this example to create and run test with screenplay pattern. Currently I am trying to use a base class to manage Test data for my tests. Base Test class goes as follows,

public class BaseTest {
    public TestParams testParams;


    public BaseTest(Map<String,String> testData) {

        testParams = TestParams.haveValues(testData);
    }

    protected Actor james = Actor.named("James");
    @Managed
    protected WebDriver driver;

    @Before
    public void jamesCanBrowseTheWeb() {
        james.can(BrowseTheWeb.with(driver));
    }

    @TestData
    public Collection<Object[]> getTestData() {
        return DataProvider.getSheet("testdata/ExcelInputData.xlsx",this.getClass().getSimpleName());
    }
}

And my test class is,

public class CloneViewTest extends BaseTest {
    public CloneViewTest(Map<String,String> testData) {
        super(testData);
    }

    @Test
    public void should_be_able_to_clone_views() {
        james.attemptsTo(Open.browserOn().the(Column_dictionaryPage.class));

    }
}

But when I try to run this test I get
[INFO] Tests are skipped.
In the console log. It's my first try to use Serenity with screenplay pattern and i am not very familiar with it. I apologize in advance if it is something stupid.

How to close previous browser before another browser is opened in Serenity Screenplay

Dear,

I'm using Serenity Screenplay for my auto project,
The feature file has scripts likes:

  And AccountA go to admin portal
  And AccountA login with credentials
  And AccountB go to admin portal
  And AccountB login with credentials

2 new browers will be opened, one for AccountA, then another one for AccountB,
I want to close 1st browser which for AccountA before 2nd browser for AccountB is opened.
Is there any way to do that?

Thanks all so much.

Screenplay tests do not run in Firefox

Hi,
I am trying to tun the screenplay tests in firefox , i updated the webdriver.driver=firefox in serenity.properties file but the tests would ingore this and would continue to run in chrome. AM i doing something wrong? Do i need to update the preference elsewhere?

The platform i am running on in MAC , the rest of the properties like setting screen height and screen width seems to be working but its just that when i set the browser to firefox it does not work , the version of firefox that i have is Firefox 45

I even tried with Safari , it seem to ignore it , i even tried to define it in the pom.xml and that also does not seem to have any effect as the tests would only run in chrome , whatever the setting is

Any help would be appreciated.

How to run tests on desktop applications with serenity-cucumber-screenplay

It happened to me to ask him about how to implement the automation of desktop applications with Serenity-Cucumber-ScreenPlay.

What we need is to customize the driver to consume desktop applications and automate different applications that are purely client-server and we have the need to consume this from the tool with which we automate. We have several libraries like “Winium” or “AppDriver” but we do not know how to implement it within BDD SERENITY.

I would appreciate if you have an example or strategy for this type of testing using ScreenPlay-Cucumber-Serenity.

regards

missing dependency for guice

Hi,

I cloned project locally and couldn't compile it. I had to add guice dependency to pom.xml which solved my problem.

<dependency>
    <groupId>com.google.inject</groupId>
    <artifactId>guice</artifactId>
    <version>4.0</version>
</dependency>

Trying to run Serenity tests in Firefox headless mode

I have a java automation test suite that I am trying to run in headless mode.

My serenity.properties file sets the webdriver as follows:
webdriver.driver=firefox

Where should I set the tests to run in headless mode? I have a serenity.conf file which contains the following:
webdriver.autodownload=false

Would I add a line: headless.mode=true? to this file?

When I run the tests on the command line I use the following command:
mvn clean verify -Dcucumber.tags.filter=@TagName

Would I instead need to specify headless at the command line rather than inside one of the project files?

Thanks in advance.

how to run serenity scripts on mozilla firefox

Inside serenity properties file I have written

webdriver.driver=firefox
webdriver.gecko.driver="address of my firefox driver"

inside POM file <webdriver.gecko.driver>firefox.exe</webdriver.gecko.driver>

but when i am running the script its just opening the browser and going to the provided link.

Screenplay tests do not show proper names on Sauce Labs

mvn clean verify -Ppageobjects -Dsaucelabs.target.platform=win10 -Dwebdriver.driver=chrome -Dsaucelabs.driver.version=48 -Dsaucelabs.url=http://taoz:<somesaucekey-IDon'tWantOthersToSeeItOnGithub>@ondemand.saucelabs.com:80/wd/hub -Dsaucelabs.access.key=<somesaucekey-IDon'tWantOthersToSeeItOnGithub> -Dsaucelabs.user.id=taoz -Dwebdriver.base.url=http://todomvc.com/examples/angularjs/#/ -Dmaven.test.failure.ignore=true

The above works, which is pageobject version. But once I removed -Ppageobjects switching to 'screenplay' pattern, those tests don't even create driver instances on Sauce Labs do not show up on Sauce Labs Dashboard with proper names.

Maybe it is easily fixable. I haven't looked into the reason yet. Just want to report the behavior here.

No such method error: net.serenitybdd.screenplay.targets.TargetResolver.findBy(Ljava/lang/String;)Lnet/serenitybdd/core/pages/WebElementFacade;

serenity-core 2.0.24
serenity-core 2.0.23

We are unable to interact with webelement/target in screenplay.
Always getting following error :
No such method error: net.serenitybdd.screenplay.targets.TargetResolver.findBy(Ljava/lang/String;)Lnet/serenitybdd/core/pages/WebElementFacade;
at line where target is being initialized.

even tried serenity screenplay version alone. https://mvnrepository.com/artifact/net.serenity-bdd/serenity-screenplay/2.0.24

We don't see any issue if we use it with non screenplay project(serenity)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.