Login/Signup tests using Capybara + rspec + selenium, connected to my DB? - mysql

I'm trying to write 2 simple tests for my website. It's my first time doing this, and I'm running into a bit of an issue
The test specs are super simple: just fill_in the email + password fields, then I click "signup" or "login" based on which I am testing.
I am facing several issues sadly:
After the click_on("...") call, I have a page.should have_content call. But this never seems to succeed. Selenium closes firefox before I see a successful sign up or login.
For login, I'm not sure how to make sure that the test is using my local database. I am on mysql, and I know my DB is running (I can run queries on mysql administrator), but I don't know if the login is using my DB, and I don't know if the signup is actually putting a new record in my DB.
Thanks a lot for your help in advance!
Ringo

Rspec will use a different database as development and production.
You can check the name of the database in config/database.yml with the environment 'test'.
To see the page which is testing, you can call the method save_and_open_page.
It will open a page in your browser and you will be able to know what's going on.

Related

Not able to run scenario outline feature with Cucumber

I'm Running Cucumber feature file with Scenario outline feature and Examples keyword , while runnin the testing getting junit cucumber internalizing error
please help me out
**Scenario Outline: Launch and Login CRM Application with simple data driven with examples**
Given user is already on Login Page
When title of login page is Free CRM
Then I should login into the application with "<UserName>" as username and "<PassWord>" as password
And close the applciation
Examples:
|UserName |PassWord |
|parthipan**#gmail.com|*****|
If the * characters aren't part of the styling for this site (for the Scenario Outline line), I would say that the reason it in't finding the test is due to that.
The * characters will be fine for just the description (after the Scenario Outline:)
If it isn't due to this, then we'll need more information (perhaps a dump of the stack trace) to be able to help

New LightSwitch Project

I have started a new Lightswitch project using a SQL database that was created with Lightswitch. When I publish and install the new Desktop project everything goes fine with no errors in publishing, installing or loading the new application. The first and only screen appears. I can click on different records and the data shows up and I can edit the data. However, if I use the list search function all of the fields get Red x'd.
The original application works the way it supposed to work.
I have tried with and without IIS: Published with (local) and (IIS) and get the same results with both methods.
The connecection string options for the new app are not the same as the original in that System Admin and Sytem user connecection strings are not offered so it is difficult to know if I replicating a working setup or not.
In Mananagement Studio I am awash in security, permissions, roles, and login selecitons. It seems clear that this is permission level problem but I have no idea on where to start trouble shooting.
see:
Diagnosing Problems in a Deployed 3-Tier LightSwitch Application
http://blogs.msdn.com/b/lightswitch/archive/2011/09/20/diagnosing-problems-in-a-deployed-lightswitch-application-eric-erhardt.aspx
How many string properties are in the table that you're displaying? Is there a large number of properties that don't need to be included in the search?
This forum post discusses the same issue as you're encountering: Search returns error "Unable to load data" with a Red X
Have you checked your connection string setup? I do have those issues back when I was using SQL Express on development and using SQL Server Enterprise as my target database server.

Login not possible after moving osqa database to a new site

I moved my osqa site from one machine to another machine, so I moved my mysql database too.
After I finished this, the whole site is placed at another place. When I open the new site page, all information is fine.
But when I try to log into the new site, using my username and password (registered in my old site), it can't. When I look in the database, all user information is right here, not lost..
I just copied /var/lib/mysql/osqa from one machine to another for database migration.
What could be the reason that login doesn't work?
Might need more debug information, but I wonder if in moving the database, Django is no longer able to unencrypt the passwords. If this is the case, then running user.check_password("whatever") will return False. From the shell, run the following:
from forum.models import User
user = User.objects.get(username="foo")
user.check_password("bar")
If that gives you a "False" then you know that the password is no longer working. If you get "True", then report back and we'll try something else. Good luck.

RailsTutorial - Testing - What to put for Database.YML for MySQL?

First, thanks for your help.
As a noob, I've been happily chugging along this well-known tutorial:
http://ruby.railstutorial.org/chapters/static-pages#top
and I'm caught in a section where I enter
rspec spec/
where I receive 2 errors. The 2 errors are in the format of
PagesController GET 'home' should be
successful
Failure/Error: Unable to find matching line from backtrace
Mysql2::Error:Unknown database 'xyz.rb'
where "home" is the name of the action/page. The xyz.rb is the arbitrary
database name I have listed under the test section in database.yml. I
have already raked the database.
I'm pretty sure my problem has to do with how I'm not going with the
sqlite3 in the tutorial but instead with mysql2. The resources I have
managed to find only give guidance on what to input for the development
section in database.yml, but not for the rest of the sections like
"test". So, my question is, what exactly does this error mean, how to
fix it, and how should I configure my database.yml file? I tried
entering a file I see in my db folder like schema.rb, but this renders
the same error.
Thank you very much for your help.
You have two options:
Set up another sqlite database, as is default with a new rails application, or
Create another MySQL database, the same way you set up your development database, with a different name (such as test) and use that for testing.
Here's my database.yml file from the Rails Tutorial that uses SQLite for all the databases; you should be able to copy the test section if you decide to go with #1 above.

Can't access MySQL views when moving the PHP application on another server

My current project is about doing some changes in an already build web application (PHP/MySQL). For displaying data, the previous developer used views. I got the app on my computer in order to get familiar with it and I can't seem to make those views work (I don't get any output in the app).
I searched the web for this an there seems to be a problem when you create a view with one database user and the that user no longer exists.
Anyone who got into this issue before? How can this be solved?
If you're importing the views from SQL dump file, they are probably defined like this
CREATE DEFINER = 'userWhoDoesNotExist#thisServer' VIEW viewName AS ....
Try removing the DEFINER = part, and the view will be created using currenct user account.
since you are running the server on your own computer, I am assuming you have root access. Try using something like
ALTER VIEW brokenView DEFINER='newuser'
this passes the validation check here. As long as you are root when you do this, you should be able to recover your views.