Перейти к содержимому

DennisM

Регистрация: 29 янв 2016
Offline Активность: 13 сен 2016 20:55
-----

Мои сообщения

В теме: isDisplayed=true но ElementNotFound

11 июля 2016 - 13:57

Столкнулся с регрессией. Компонент визуально скрыт, но WebDriver упорно отвечает, что isDisplayed=true, а при попытке .click() соответственно валится с ElementNotFound. Вот сам элемент

 

http://pastebin.com/bsVVTS9R

 

Сейчас переводим приложение на React, часть ещё на Angular, так что периодически всплывают такие вот интересные аномалии... 

Когда элемент виден, добавляется класс "show-dates", но, честно говоря, переделывать везде ожидание видимости на проверку наличия класса... это не наш метод. Да и не гарантирует он видимость-невидимость. Что делать, ребята? Пинать девелопера? Он клянётся, что всё работает как раньше на ангуляре, но по факту - нет.

 

Жди элемента по примеру:

 

import org.openqa.selenium.support.ui.ExpectedConditions;

import org.openqa.selenium.support.ui.WebDriverWait;

 

new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(ElementLocator));

 

или

 

new WebDriverWait(driver, 10).until(ExpectedConditions.visibilityOfElementLocated(ElementLocator));

 

 

или проверяй boolean из

boolean visible = ExpectedConditions.visibilityOfElementLocated(ElementLocator);

 

не поможет, смотри другие проверки из ExpectedConditions


В теме: Запуск Cucumber тестов в параллели?

08 июля 2016 - 13:20

Ееее!!! Победили зверя!
Если билдишь через Jenkins то можно запихать переменные в билд и перед выполнением выбирать папку для запуска, количество потоков, тэги.
 
<profile>
<id>CucumberAll</id>
<activation>
<property>
<name>environment</name>
<value>CucumberAll</value>
</property>
</activation>
 
 
<build>
<plugins>
<plugin>
<groupId>com.github.temyers</groupId>
<artifactId>cucumber-jvm-parallel-plugin</artifactId>
<version>1.3.0</version>
<executions>
<execution>
<id>generateRunners</id>
<phase>validate</phase>
<goals>
<goal>generateRunners</goal>
</goals>
<configuration>
<!-- Mandatory -->
<!-- comma separated list of package names to scan for glue code -->
<glue>com.expion.test.CucumberStepDefinition</glue>
<!-- These are the default values -->
<!-- Where to output the generated Junit tests -->
<outputDirectory>${project.build.directory}/generated-test-sources/cucumber</outputDirectory>
<!-- The diectory containing your feature files. -->
<featuresDirectory>src/test/resources/${env.TESTS_FOLDER}</featuresDirectory>
<!-- Directory where the cucumber report files shall be written -->
<cucumberOutputDir>c:/Jenkins/reports/</cucumberOutputDir>
<!-- comma separated list of output formats -->
<format>json</format>
<!-- CucumberOptions.strict property -->
<strict>true</strict>
<!-- CucumberOptions.monochrome property -->
<monochrome>true</monochrome>
<!-- The tags to run, maps to CucumberOptions.tags property -->
<tags>${env.TESTS_BY_TAGS}</tags>
<!-- If set to true, only feature files containing the required 
tags shall be generated. -->
<!-- Excluded tags (~@notMe) are ignored. -->
<filterFeaturesByTags>true</filterFeaturesByTags>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<forkCount>${env.TESTS_IN_PARALLEL}</forkCount>
<!-- <forkCount>2</forkCount> -->
<reuseForks>true</reuseForks>
<includes>
<include>**/*IT.class</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
 
</profile>

В теме: Запуск Cucumber тестов в параллели?

07 июля 2016 - 15:27

 

 

Ух ёпт. У тебя эти таги не указаны!
Запиши:    <tags>@runTest</tags>
 
 
<configuration>
                            <!-- Mandatory -->
                            <!-- comma separated list of package names to scan for glue code -->
                            <glue>ru.StepDefinitions</glue>
                            <!-- These are the default values -->
                            <!-- Where to output the generated Junit tests -->
                            <outputDirectory>${project.build.directory}/generated-test-sources/cucumber</outputDirectory>
                            <!-- The diectory containing your feature files. -->
                            <featuresDirectory>src/test/Resorses/Features/</featuresDirectory>
                            <!-- Directory where the cucumber report files shall be written -->
                            <cucumberOutputDir>target/cucumber-parallel</cucumberOutputDir>
                            <!-- comma separated list of output formats -->
                            <format>html</format>
                            <!-- CucumberOptions.strict property -->
                            <strict>true</strict>
                            <!-- CucumberOptions.monochrome property -->
                            <monochrome>true</monochrome>
                            <!-- The tags to run, maps to CucumberOptions.tags property -->
                            <tags></tags>
                            <!-- If set to true, only feature files containing the required
                            tags shall be generated. -->
                            <!-- Excluded tags (~@notMe) are ignored. -->
                            <filterFeaturesByTags>true</filterFeaturesByTags>
                        </configuration>

 

 
В секцию добавил <tags>"@runTest"</tags>
Вот такая ошибка у меня возникла, которую я победить не смог (( 
ошибка была и ранее, когда настраивал по вашему сценарию
 
D:\git\AQC\test>mvn clean test
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for ru:rts-tender:jar:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.apache.maven.plugins:maven-surefire-plugin @ line 104, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building rts-tender 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ rts-tender ---
[INFO] Deleting D:\git\AQC\test\target
[INFO]
[INFO] --- cucumber-jvm-parallel-plugin:1.3.0:generateRunners (generateRunners) @ rts-tender ---
[INFO] Adding D:\git\AQC\test\target\generated-test-sources\cucumber to test-compile source root
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ rts-tender ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\git\AQC\test\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ rts-tender ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 111 source files to D:\git\AQC\test\target\classes
[INFO] /D:/git/AQC/test/src/main/java/Helpers/UserProfiles/SupplierLegalEntityProfile.java: Some input files use unchecked or unsafe operations.
[INFO] /D:/git/AQC/test/src/main/java/Helpers/UserProfiles/SupplierLegalEntityProfile.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ rts-tender ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\git\AQC\test\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ rts-tender ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 11 source files to D:\git\AQC\test\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ rts-tender ---
 
-------------------------------------------------------
 T E S T S
-------------------------------------------------------
None of the features at [classpath:Features/AccreditationEntrepreneur.feature] matched the filters: [@runTest]
None of the features at [classpath:Features/FullAuction.feature] matched the filters: [@runTest]
 
0 Scenarios
0 Steps
0m0,000s
 
 
0 Scenarios
0 Steps
0m0,000s
 
 
Results :
 
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.258 s
[INFO] Finished at: 2016-07-07T18:14:18+03:00
[INFO] Final Memory: 26M/311M
[INFO] ------------------------------------------------------------------------

 

было такое. Проблема решилась перемещением файлов фичей в первую после resources папку (не далее). и переименуй всё в lowercase.  Плагин капризный! :)

\src\test\resources\cucumber\TestCase.feature


В теме: Запуск Cucumber тестов в параллели?

07 июля 2016 - 14:48

Ух ёпт. У тебя эти таги не указаны!
Запиши:    <tags>@runTest</tags>
 
 
<configuration>
                            <!-- Mandatory -->
                            <!-- comma separated list of package names to scan for glue code -->
                            <glue>ru.StepDefinitions</glue>
                            <!-- These are the default values -->
                            <!-- Where to output the generated Junit tests -->
                            <outputDirectory>${project.build.directory}/generated-test-sources/cucumber</outputDirectory>
                            <!-- The diectory containing your feature files. -->
                            <featuresDirectory>src/test/Resorses/Features/</featuresDirectory>
                            <!-- Directory where the cucumber report files shall be written -->
                            <cucumberOutputDir>target/cucumber-parallel</cucumberOutputDir>
                            <!-- comma separated list of output formats -->
                            <format>html</format>
                            <!-- CucumberOptions.strict property -->
                            <strict>true</strict>
                            <!-- CucumberOptions.monochrome property -->
                            <monochrome>true</monochrome>
                            <!-- The tags to run, maps to CucumberOptions.tags property -->
                            <tags></tags>
                            <!-- If set to true, only feature files containing the required
                            tags shall be generated. -->
                            <!-- Excluded tags (~@notMe) are ignored. -->
                            <filterFeaturesByTags>true</filterFeaturesByTags>
                        </configuration>

В теме: Запуск Cucumber тестов в параллели?

07 июля 2016 - 14:41

запусти без указания тагов и папки с тестами. В плагине в pom.xml таги и папка с фичами уже указаны

просто

mvn clean test