Tests with #javascript not working in Sylius (plugin) - behat

I have been facing this issue for more than a day now, and I can't seem to figure it out.
I have configured my plugin using docker and I am running behat with headless chrome, getting this:
docker-compose exec -e APP_ENV=test sylius_plugin bash -c "vendor/bin/behat features/user/managing_vendors/deleting_multiple_vendors.feature"
#managing_vendors
Feature: Deleting multiple vendors
In order to get rid of deprecated vendors in an efficient way
As an Administrator
I want to be able to delete multiple vendor accounts at once
Background:
Given I am logged in as an administrator
And there is a vendor "ted" whose email is "ted#example.com"
And there is also a vendor "john" whose email is "john#example.com"
#ui #javascript
Scenario: Deleting multiple vendors at once
Given I browse vendors
Expected to be on "http://0.0.0.0:80/admin/vendor-users/" but found "http://0.0.0.0/admin/login" instead (FriendsOfBehat\PageObjectExtension\Page\UnexpectedPageException)
This feature is based on deleting_multiple_administrators.feature that is provided in the sylius package.
I found this other issue (https://github.com/Sylius/PluginSkeleton/issues/138) and tried to apply those solutions but none worked.
Could you enlighten me on this?
Happy to provide additional info.
Thanks

I have found the problem. There was a conflict between the environments (and therefore databases) dev and test.
The solution was to separate the environments in two docker containers and run them in an isolated manner.

Related

Changing default path for Chrome executable for karate-chrome

I am using the Karate framework to do the API testing. As part of CI efforts, we send an email at the end of test execution listing the summary of test results. There is a need to include the screeshot of the test execution counts from 'overview-feature.html' file.
I did so through the TestRunner.java file - launched Chrome using Chrome.start() and then using it to take screenshot. It all works well locally on Windows.
However when executing on CI server which is a Unix box, the chrome executable is not present in the default location (usr/bin/google-chrome) and hence the connection for the localhost fails.
Is there a way we can change the default location of the chrome executable?
PS: Apologies if this was too trivial to be asked.
Yes Chrome on CI is hard to get right, refer: https://stackoverflow.com/a/62325328/143475 - note that CI boxes typically are "headless" a browser may not be even installed.
I think the best thing for you is to ZIP the HTML and send it. But I really think you need to work with some CI experts, because the report generation and e-mailing business is normally done by things like Jenkins. What you are doing is certainly not normal or best-practice.
If you really want, there is a Karate Docker container that can give you a proper Chrome instance (see docs) but that is overkill for what you need.
EDIT: The Chrome Java API allows for customization of the executable path and this is in the docs: https://github.com/intuit/karate/tree/master/karate-core#chrome-java-api
It should be something like this:
Chrome.start("/opt/blah/chrome");

Tcm is finding tests, but they all fail

Been scratching my head for a while with this and I thought I would ask here. I am trying to run automated tests with tcm via command prompt. I have set up and configured a test controller and agent. Tcm is recognizing all the tests from tfs when I list etc. Created a test run and the results came back:
Total:128
Passed:0
Failed:128
Inconclusive:128
Does this have something to do with the Controller or Agent not being set up properly? Would tcm recognize the tests if they were not set up properly? I have set up a lab environment and I can access the controller PC.
Any help would be greatly appreciated.
Thanks
Russ
Based on the information that "The build directory of the test run either does not exist or access permission is required", from steps 6 and 7 of this MSDN documentation:
Create and Define a build definition
Copy a build directory with the relevant information into this solution
This may also have relevant information if the above doesn't work

Delete or reset Gitlab CI builds

Is it possible to delete old builds in Gitlab CI?
I tested a few things and have now about 20 builds that are useless (most are failed anyway).
It also shows stages that I don't have anymore which kinda clutters the Pipelines page and some of the uploaded artifacts are a bit big.
I wasn't able to find any documentation on this, only that disabling CI in the settings doesn't remove the builds.
Using Gitlab 8.10 Community (hosted by Gitlab.com)
There is currently no option in the GUI to completely get rid of a build other than expunge related data from the build. (The erase option in the build)
If you would have a local installation you could modify the database directly but I would advise caution. (I'll put the guide here for completeness sake)
Login to the GitLab database. If you use the default PostgreSQL :
sudo -u gitlab-psql /opt/gitlab/embedded/bin/psql -h /var/opt/gitlab/postgresql -d gitlabhq_production
Check if there is a table ci_builds. For pSQL: \dt
Delete the builds with normal SQL. For example: DELETE FROM ci_builds WHERE id = 2
(Optional) If you want to cleanup a list of commits which triggered a build you need to midify the table ci_commits.

Local Monticello repository

I would like to run a local Monticello HTTP repository at work, so that we can share code easily among colleagues.
Is there a way to run something similar to SmalltalkHub privately?
EDIT:
I have tried all the options here and neither of them seems to work smoothly. Let me recap the options:
1) WebDAV on Apache, following Stuart. I have tried it, following some online guides. My current dav.conf looks like this:
DavLockDB /tmp/DavLock
Alias /pharo /opt/data/pharo
<Location /pharo>
Order Allow,Deny
Allow from all
Options Indexes MultiViews
Dav On
AuthType None
</Location>
I worked for a few days. Then suddenly I am not able to read new versions of a certain package. Whenever I write a version in an image and read it in another one, I get an exception ZnInvalidUTF8. I am not sure why, it may be that WebDAV has issues listing too many files?
2) Setting up my FTP. It seems to work, but when I try to set this repository as a remote in the versionner I get MCFtpRepository doesNotUnderstnd: #koRemote
3) SqueakSource3, following Tobias. I have tried running the two Gofer commands in both Pharo2 and Pharo3. In Pharo2 it does not load at all. In Pharo3, more or less everything works. I had to fix a few errors due to deprecated or removed messages, but in the end I am able to create projects and write to them.
The problem arises when I read. Apparently SS3 keeps some kind of internal cache. The result is that the list of packages I see on the project page is different from the list of packages that the client gets. The difference seems to be that the client requires a short version of the page, like http://localhost:8080/ss/MyProject/?C=M;O%3DD, and the results there are consistently less than in the full page http://localhost:8080/ss/MyProject.
Moreover, even on the project page, the list of versions remains cached until I navigate on a different project.
4) SmallTalkHub, following Sean. I have tried both using images from the INRIA server and images suggested from the Pharo-VM-loader (they may be the same).
I had to install Seaside again, since there was no ZnZincAdaptor in the downloaded image. I am now able to start SmallTalkHub, but as soon as I try to register a user, I get an error MessageNotUnderstood: receiver of "new" is nil. I am not able to track where this error comes from (is there a way to open a server-side debugger instead of returing 500 in Seaside?).
After this error, I can see a user both in mongodb and in the interface, but I am not able to login.
5) Git using filetree, as suggested by Kylon. This would prevent me from using MetaCello to handle dependencies and looks even more compelx than the other options.
At this point I am at a loss. :-( If I want to use Pharo, I will need to be able to collaborate with my colleagues. Using open source repositories is not an option, at least right now.
Is there a simple, tried and tested way to set up such a repository?
SqueakSource3 or SmallTalkHub would be even better, thanks to their user interfaces, but I really need at least basic collboration. Having an option that can run on a headless server would also be a big plus, as if this becomes a tool we use, it will not be doable to host the repository on my laptop.
Per this thread on the Pharo Dev mailing list:
Setting up the Server:
Download a SmalltalkHub image (https://ci.inria.fr/pharo-contribution/job/SmalltalkHub/)
Install mongodb on your computer (for Debian: apt-get install mongodb)
Launch the SmalltalkHub image
Evaluate: ZnZincServerAdaptor startOn: 8080
Visit http://localhost:8080/tools/hub, create an account and a project
In addition to Sean's answer - if you just want a Metacello repository, and don't necessarily need the full SmalltalkHub stuff, then you just need a WebDav server. Apache will work fine, and I've even used Confluence's WebDAV support (with some tweaking) successfully in the past.
In addition to the other answers:
Just storing your versions in DropBox work very well!
You can also install SqueakSource3 (like SmalltalkHub, doesn't need MongoDB):
Gofer new
url:'http://www.smalltalkhub.com/mc/Seaside/MetacelloConfigurations/main';
package: 'ConfigurationOfSeaside3';
load.
((Smalltalk at: #ConfigurationOfSeaside3) project version: #stable) load.
Gofer new
url:'http://www.squeaksource.com/MetacelloRepository';
package: 'ConfigurationOfSqueakSource';
load.
((Smalltalk at: #ConfigurationOfSqueakSource) project version: #bleedingEdge) load: #('All').
Then start your Adaptor (eg ZnZincServerAdaptor startOn: 8080) and goto http://localhost:8080/instalSS
Another way is go down the popular route of Git. I am using Github for my projects and it works great while Git itself works very well locally too. So if are already familiar with Git then its a very good choice
You can find more information here https://ci.inria.fr/pharo-contribution/job/PharoForTheEnterprise/lastSuccessfulBuild/artifact/GitAndPharo/GitAndPharo.pier.html
Sorry about the bad smalltalkhub experience. I have made some fixes to the configuration, and need to check if that is enough

Running multiple JIRA issues as Behat tests

I am using Behat and JIRA together to run automated tests. Currently I am able to run a single JIRA issue using:
$ bin/behat jira:ISSUE_NUMBER
In order to this, I am using the JIRA extension for Behat (http://extensions.behat.org/jira-extension/)
However, I am looking for a way to run a group of tests on my JIRA account. I need this to work similar to the #tags in behat.
Any help would be greatly appreciated.
Thanks,
Girish Kini
This is currently not possible. After research, I have learnt that this feature is currently not supported by the jira extension. In the interim, try adding support for a comma separated list, eg jira:issue-1,issue-2,etc-n via the FeatureLoaderService.php.
sources: Anthon Pang via vipsoft/JiraExtension [ GitHub ]
You could create a version that included all the tickets that you wanted to run. Then in your behat.yml file specify that version using jql. Afterwhich you can run the following command.
php bin/behat http://myserver.com:8080/