Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to resaltate elements whit interactue #3139

Open
jecardenasri01 opened this issue May 23, 2023 · 0 comments
Open

How to resaltate elements whit interactue #3139

jecardenasri01 opened this issue May 23, 2023 · 0 comments

Comments

@jecardenasri01
Copy link

hi i have implement this method

my idea is:

the element is resaltated after action in color red.
And before action the element remains black.

now working whit my actual test project and his funtion is fine.

I was wondering if this was already applied in serenity screenplay or if it could be implemented :)

public Performable resaltarElemento(Target elemento, String color) {

    JavascriptExecutor js = (JavascriptExecutor) Serenity.getDriver();
    String xpath =((By.ByXPath) ((ByTarget) elemento).getLocator()).getRemoteParameters().value().toString();

    if (color == "r") {
        js.executeScript("arguments[0].style.border = '3px solid red'", Serenity.getDriver().findElement(By.xpath(xpath)));
    } else {
        js.executeScript("arguments[0].style.border = '3px solid black'", Serenity.getDriver().findElement(By.xpath(xpath)));

    }
    return null;
}

image

this is my gradle :
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-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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant