Skip to content

Conversation

@individual-it
Copy link
Member

Description

This is a slenium test for the PR #26979 that fixes the issue #26975
It depends on PR #27056 (Selenium implementation)

Related Issue

PR #26979
issue #26975

Motivation and Context

See issue #27055 & PR #27056

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

individual-it and others added 12 commits January 27, 2017 14:07
only run the selenium tests whe SAUCE_USERNAME & SAUCE_ACCESS_KEY are
configured. That way a PR from an external, that does not have access to
the sauce env., will not trigger the selenium tests
login into oC with admin credentials
This is a test for the PR #26979 that was done to fix the issue #26975
Everything in this branch looks good.
@mention-bot
Copy link

@individual-it, thanks for your PR! By analyzing the history of the files in this pull request, we identified @DeepDiver1975 and @PVince81 to be potential reviewers.

@DeepDiver1975 DeepDiver1975 added this to the 10.0 milestone Jan 31, 2017
@@ -0,0 +1,49 @@
<?php
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please do not add the vendor directory

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so do you want the webdriver be in tests/facebook/webdriver ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add this as dev dependency into /composer.json

.travis.yml Outdated
before_install:
- make
- sh -c "if [ '$TEST_DAV' = '1' ]; then bash tests/travis/before_install.sh $DB; fi"
- if [ ! -z "$SAUCE_USERNAME" ] && [ ! -z "$SAUCE_ACCESS_KEY" ]; then export TEST_SELENIUM=1 ; else export TEST_SELENIUM=0 ; fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add this as a test case just like we do with caldav, carddav.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is to prevent the tests to run if a PR comes from a remote fork.
So if we make it a test-case by setting TEST_SELENIUM=1 and the sauce_connector is setup in owncloud/core and I make a fork to individual-it/core commit something and make a PR. Travis would try to build that PR but the selenium tests would fail because $SAUCE_USERNAME & $SAUCE_ACCESS_KEY are not set

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that part - we can still make this work (somehow ;-) )

But on travis I'd like to see an explicit job with TC=selenium listed

@individual-it
Copy link
Member Author

I've made the requested changes. Tests are passing on my travis instance: https://travis-ci.org/individual-it/owncloud-core/builds/196904627
Somehow composer decided to change the time format in composer.lock

@DeepDiver1975
Copy link
Member

Somehow composer decided to change the time format in composer.lock

this is okay - nothing to worry from my pov

@DeepDiver1975
Copy link
Member

We need to fix the regular phpunit execution as done on jenkins.
The selenium tests are executed as well.
Maybe we move the selenium tests into a different folder.

@PVince81 @SergioBertolinSG integration tests will stay in build/integration? What is the current play?

Otherwise I suggest to restructure the tests folder:

  • tests
    • unit (move all unit tests in here)
    • integration tests (move build/integration in here)
    • ui (move all selenium tests are of this pr)

objections?

@individual-it
Copy link
Member Author

individual-it commented Jan 31, 2017 via email

@DeepDiver1975
Copy link
Member

The even more basic question is were do you like to have the selenium tests run?

As far as I can tell: travis is fine for me - let's see how this evolves. We can always move these tests to jenkins.

@DeepDiver1975
Copy link
Member

In any case: @individual-it thanks a lot for the effort you put into this! Much appreciated!

@SergioBertolinSG
Copy link
Contributor

I think we should use behat mink for this http://mink.behat.org/en/latest/
and make use of the page object pattern.

The tests which find the elements using xpath can break easily, that requires an improvement of the frontend to include proper ids to every element.

@individual-it
Copy link
Member Author

I totally agree that relying on xpath might be problematic, depending on how you use it.
is good: WebDriverBy::xpath(".//table[@id='userlist']")
is fine: WebDriverBy::xpath(".//*[@id='app-content']/div[@class='loading']")
problematic: WebDriverBy::xpath(".//*table[@class='hascontrols']/tbody/tr[2]/th

use of page object pattern sounds very good to me. Selenium-documentation on Page Objects Its basically the question about how much to generalize and reuse the code. And more reuse of code if of course better.
Within your web app's UI there are areas that your tests interact with. A Page Object simply models these as objects within the test code. This reduces the amount of duplicated code and means that if the UI changes, the fix need only be applied in one place.
If the concept of UI testing with selenium is taken onboard for oC I'm happy to write a couple PageObjects for general use

You can make mink drive selenium on sauce-labs.
How do you think it would benefit oC to use behat & mink? Do you think of changing from PHPUnit to Behat? Or is it about using Gherkin as language?
How much chance/need is to go on behavior-driven development (BDD) for oC?

@individual-it
Copy link
Member Author

I've converted my Sauce Labs account into a OSS account and that makes the tests public. If someone is interested in seeing this test+result on sauce labs site here it is: https://saucelabs.com/beta/tests/53361d4a9812466a87027fdb5a4b0109/commands#0

Selenium better waiting & nicer code formatting
@PVince81
Copy link
Contributor

PVince81 commented Feb 6, 2017

restructure the tests folder

@DeepDiver1975 sounds good

@SergioBertolinSG
Copy link
Contributor

SergioBertolinSG commented Feb 7, 2017

You can make mink drive selenium on sauce-labs.
How do you think it would benefit oC to use behat & mink? Do you think of changing from PHPUnit to Behat? Or is it about using Gherkin as language?
How much chance/need is to go on behavior-driven development (BDD) for oC?

To be consistent with the current integration tests suite which are already using behat. Also easier to create new tests and understand them.

@michaelstingl
Copy link

+1 for behat

@individual-it
Copy link
Member Author

@SergioBertolinSG I just watched your behat presentation on owncloud https://www.youtube.com/watch?v=_Sbgctq1P1U
As far as I understood you are running the behat tests on Jenkins. So if the UI tests were done in behat would you run them also on Jenkins or try to run the UI behat still on travis as @DeepDiver1975 proposed?

@individual-it
Copy link
Member Author

Closing this and will make a new PR with a behat / mink solution

This was referenced Feb 15, 2017
@individual-it individual-it mentioned this pull request Mar 6, 2017
9 tasks
@lock
Copy link

lock bot commented Aug 3, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants