当我运行有很多场景的项目时,我面临一个问题。主要问题是当我必须打开新的URL进行登录时,打开的页面是最后执行的页面,因此,当我的机器人尝试执行某些操作(在这种情况下,进行用户登录)时,出现最后一次会话(正在运行的最后一个场景)和我的测试结束了,因为没有找到打开页面时应该使用的元素。 我一直在寻找一种方法来执行此操作,但是我发现的情况最终没有帮助,只会使我的测试无法顺利进行。 我尝试了以下选项:
restart.browser.each.scenario=NEVER
restart.browser.each.scenario=true
restart.browser.each.scenario=Scenario
我正在使用java,黄瓜和宁静。
这是我的默认网址:
@DefaultUrl("https://login.com/")
Scenario: Cerrar la oportunidad
这是黄瓜的步骤:
Dado que el usuario navega a la pagina de inicio
这是我的步骤:
@Dado("^que el usuario navega a la pagina de inicio$")
public void dadoQueElUsuarioNavega() {
System.out.println("el usuario navega a la pagina de inicio de sesion en el CRM Cliente 360");
baseMetodosPage.eliminarCookies();
inicioDeSesion.open();
}
我的宁静属性:
enter code here
# Define the default driver
webdriver.driver=chrome
webdriver.chrome.driver=src/test/resources/driver/chromedriver.exe
# Appears at the top of the reports
serenity.project.name=PROYECTO1
# Root package for any JUnit acceptance tests
serenity.test.root=com.mysf.crmbcp.mino.steps
# Customise your riequirements hierarchy
serenity.requirement.types=feature, story
chrome.experimental_options.useAutomationExtension=false
# Customise page load strategy
chrome.capabilities.pageLoadStrategy=normal
# Run the tests without calling webdriver - useful to check your Cucumber wireing
serenity.dry.run=false
# Customise browser size
#serenity.browser.height = 1200
#serenity.browser.width = 1200
# Customise browser
chrome.switches=--disable-extensions--incognito--disable-download-notification--start-maximized
serenity.use.unique.browser=false
# How long webdriver waits by default when you use a fluent waiting method, in milliseconds.
webdriver.wait.for.timeout=80000
# How long should the driver wait for elements not immediately visible.
serenity.timeout=80000
# How long does Serenity wait for elements that are not present on the screen to load
webdriver.timeouts.implicitlywait=80000
# Customise Reports
serenity.take.screenshots=AFTER_EACH_STEP
serenity.compress.filenames=false
serenity.store.html.source=true
serenity.reports.show.step.details=true
serenity.report.show.manual.tests=true
# Encoding
feature.file.encoding=ISO-8859-1
serenity.report.encoding=ISO-8859-1
runners.file.encoding=ISO-8859-1
encoding=ISO-8859-1
#Others
serenity.restart.browser.for.each=scenario
serenity.verbose.steps=true
serenity.outputDirectory=target/site/report