No Browserscope shown in jsperf test case - jsperf

How I can see browser statistics in jsperf? Why my test case doesn't show Browserscope panel?
This is my test case:
https://jsperf.com/array-includes-and-find-methods-vs-set-has

Related

w2ui overlay is not rendered in cypress headless test

Test passes in headed mode, but always fails in headless mode
I am trying to perform a test on the w2ui field of type "list"
Ideally, when we click on this w2ui list element, a drop-down (overlay) is generated with the select options and then we select an option.
But while running the test in headless mode, this drop-down is not generated.
Code To reproduce the issue:-
Code for the webpage:
Link to HTML code
Save the code provided in the above link in the file "test_webpage.html". Place this HTML file in the directory where cypress.json is located.
Code of Cypress Test:
describe('W2UI List Test', function() {
it('Click List Field', function() {
cy.visit('test_webpage.html');
cy.get('.w2ui-select').siblings('.w2ui-field-helper').should('be.visible').click();
cy.wait(2000);
cy.get('#w2ui-overlay tr[index=0]').should('be.visible').click();
});
});
Test Fail ScreenShot
Yes, there is a bug in Cypress currently where certain mouse events are not properly simulated when the Test Runner window is not the active window. This is being worked on here: https://github.com/cypress-io/cypress/issues/1909#issuecomment-395995180 , This is being worked on
In the meantime, you can change your test code to this, for example:
cy.get('.w2ui-select').siblings('.w2ui-field-helper').click()
cy.contains('Barack Obama').click()
Cypressautomatically checks for actionability before clicking, so no need for should('be.visible')

pop-window disappeared before filling its fields- selenium

I need to test login function by having different Juint tests with different username & password values. all tests are located in same Juint. I use the following JAR files:
or these tests, browser will be only opened for the first test and closed at the last test.
My notes:
for chrome browser (v2.9.24) , all tests have successful run.
when I used the latest firefox browser(v45.0.1), only first test has a successful run and others are failed.
some of them can't catch the pop-window to enter values, and then it will continue for the next test.
In some cases, pop-window can't wait, it disappeared quickly and then unit test can't find username and password fields to fill values.
I need to test them on firefox, so how to overcome this problem.
Note:
I tried some of these suggestions but still the previous problem occurred.
WebDriverWait waitLog = new WebDriverWait(WebDriverRunner.getWebDriver(), 2);
waitLog.until(ExpectedConditions.elementToBeClickable($(".modal-dialog")));
Or set before test this parameter:
Configuration.fastSetValue=true;
However, I can't come with a way to solve this problem.

Selenium Python run multiple test cases how do i log in once and use the same instance browser

I have created some Test Cases in Selenium Python and I have put it in a Test Suite. Each time a Test Case runs it opens the browser and navigates to the URL.
It then logs in, does some tests and then logs out and the browser closes.
Is there a way to run the tests to only open 1 instance of the browser, log in once and keep using that instance for the rest of the test cases?
I do not want to close the browser for every single test case and open a new browser and log in each time.
For e.g.
Test Case 1 runs, opens the browser, navigate to URL, log in, run some tests. Log out and close the browser.
Test Case 2 runs, opens the browser, navigate to URL, log in, run some tests. Log out and close the browser.
Test Case 3 opens the browser, navigate to URL, log in, run some tests. Log out and close the browser.
and so on.
I would like to do it this way.
Test Case 1 runs, opens the browser, navigate to URL, log in, run some tests. Log out and close the browser.
Test Case 2 use the same browser from test case 1, you are still logged in, run some tests.
Test Case 3 use the same browser from test case 1, you are still logged in, run some tests.
The last test case use the same browser from test case 1, you are still logged in, run some tests. Log out, close the browser.
Opening a new browser for every single test case and logging in takes longer for the tests to complete.
My code snippet is as follows:
class BaseTestCase(unittest.TestCase):
#classmethod
def setUpClass(cls):
cls.driver = webdriver.Ie(Globals.IEdriver_path)
cls.driver.get(Globals.URL_justin_pc)
cls.login_page = login.LoginPage(cls.driver)
cls.driver.implicitly_wait(120)
cls.driver.maximize_window()
#classmethod
def tearDownClass(cls):
cls.login_page.click_logout()
cls.driver.close()
Test Case 1
class AdministrationPage_TestCase(BaseTestCase):
def test_add_Project(self):
print "*** test_add_project ***"
self.login_page.userLogin_valid(Globals.login_username, Globals.login_password)
menu_bar = MenuBarPage(self.driver)
administration_page = menu_bar.select_menuBar_item("Administration")
administration_page.click_add_project_button()
administration_page.add_project(project_name, Globals.project_description)
administration_page.click_save_add_project()
# etc ...
def test_edit_Project(self):
...
Test Case 2
class DataObjectsPage_TestCase(BaseTestCase):
def testa_add_Data_Objects_Name(self):
print "*** test_add_Data_Objects - Name ***"
self.login_page.userLogin_valid(Globals.login_username, Globals.login_password)
menu_bar = MenuBarPage(self.driver)
data_configuration_page = menu_bar.select_menuBar_item("Data Configuration")
project_navigator = ProjectNavigatorPage(self.driver)
data_objects = project_navigator.select_projectNavigator_item("Data Objects")
data_objects.click_add_button_for_data_objects()
def testb_add_Data_Objects_Address(self):
print "*** test_add_Data_Objects - Address ***"
...
def testc_add_Data_Objects_Phone(self):
...
Test Case 3 and so on
My Test Suite is:
def suite():
test_suite = unittest.TestSuite()
test_suite.addTest(unittest.makeSuite(TestCases.AdministrationPage_TestCase.AdministrationPage_TestCase))
test_suite.addTest(unittest.makeSuite(TestCases.DataObjectsPage_TestCase.DataObjectsPage_TestCase))
# etc...
Thanks,
Riaz
Slow automated tests caused by needlessly opening and closing browsers, hardcoded delays etc. are, as you say, a huge waste of time, and almost always avoidable in my experience.
The good news is that you don't need to do anything special to avoid this. If your tests are independent and run in sequence, also assuming that you only have one browser/version and set of Capabilities, then all your test runner needs to do is:
create singleton Driver at start of run (or application, if multiple runs allowed; or lazily when first required)
run each test in sequence, with no explicit close or quit calls, but with all other suitable cleanup (clearing any created cookies, logging out, clearing sessions, Local storage etc.)
quit Driver at the (very) end
It's not very much more work to support multiple browsers / capabilities in much the same way.

Ordered Selenium unit tests n

I have a small problem, I have created some Selenium tests. The problem is I can't order the testcases I have created. I know unit testing should not be ordered but this is what I need in my situation. I have to follow these steps: login first, create a new customer, change some details about the customer and finally log out.
Since there is no option to order unit tests in NUnit I can't execute this.
I already tried another option, to create a unittest project in Visual Studio, because Visual Studio 2012 has the ability to create a ordered unit test. But this is not working because I can't run a unit test while I am running my ASP.NET project. Another solution file is also not a good option because I want to verify my data after it has been submitted by a Selenium test.
Does someone of you have another solution to solve my problem?
If you want to test all of those steps in a specific order (and by the sounds of it, as a single session) then really it's more like an acceptance test you are talking about; and in that case it's not a sin to write more complex test methods and Assert your conditions after each step.
If you want to test each step in true isolation (a pure unit test) then each unit test must be capable of running by itself without any reference to any other tests; but when you're testing the actual site UI itself this isn't really an option for you.
Of course if you really you want to have every single test somehow setup every single dependency without reference to any other actions (e.g in the last test you would need to fake the login token, your data layer will have to pretend that you added a new customer, etc. A lot of work for dubious benefit...)
I say this based on the assumption that you already have unit tests written for the server-side controllers, layers, models, etc, that you run without any reference to the actual site running in a browser and are therefore confident that the various back-end part of your site do what they are supposed to do
In your case I'd recommend more of a hybrid integration/acceptance test
void Login(IWebDriver driver)
{
//use driver to open browser, navigate to login page, type user/password into box and press enter
}
void CreateNewCustomer(IWebDriver driver)
{
Login(driver);
//and then use driver to click "Create Customer" link, etc, etc
}
void EditNewlyCreatedCustomer(IWebDriver driver)
{
Login(driver);
CreateNewCustomer(driver);
//do your selenium stuff..
}
and then your test methods:
[Test]
void Login_DoesWhatIExpect()
{
var driver = new InternetExplorerDriver("your Login URL here");
Login(driver);
Assert(Something);
}
[Test]
void CreateNewCustomer_WorksProperly()
{
var driver = new InternetExplorerDriver("your Login URL here");
CreateNewCustomer(driver);
Assert(Something);
}
[Test]
void EditNewlyCreatedCustomer_DoesntExplodeTheServer()
{
var driver = new InternetExplorerDriver("your Login URL here");
EditNewlyCreatedCustomer(driver);
Assert(Something);
}
In this way the order of the specific tests do not matter; certainly if the Login test fails then the CreateNewCustomer and EditNewlyCreatedCustomer tests will also fail but that's actually irrelevant in this case as you are testing an entire "thread" of operation

How to copy test case from one suite to another in FitNesse?

I have 2 test suites created in the FrontPage, lets say Suite1 and Suite2. Now I have 1 test case created in Suite1, lets say TestCase1, and would like to have another copy of TestCase1 inside Suite2, may I know how can I use the "Recfactor" feature in the FitNesse to "copy" TestCase1 into Suite2?
Thanks #!
Assuming your suites Suite1 and Suite2 have been created directly on FrontPage.
To move a TestCase1 from Suite1 to Suite2 you can simply click on refactor link of TestCase1 page or open this link: http://localhost:8000/FrontPage.Suite1.TestCase1?refactor
Then enter FrontPage.Suite2 in "New Location" field under MOVE section. And then click on Move Page button. Now your TestCase1 has been moved under Suite2 from Suite1.