From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 5F35DE00B46; Thu, 31 Mar 2016 12:04:07 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [74.125.82.53 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from mail-wm0-f53.google.com (mail-wm0-f53.google.com [74.125.82.53]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id CDD0AE0092C for ; Thu, 31 Mar 2016 12:04:05 -0700 (PDT) Received: by mail-wm0-f53.google.com with SMTP id p65so126529324wmp.0 for ; Thu, 31 Mar 2016 12:04:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=BZs5cWV4unFrgOWo4hpdCqyx4qJvktCBG8E9uWpQXR4=; b=oBrzZKdmE35GCu5hS3cOMW3gOMVA4HfiMyd7/xK1hJ2WUkfcLZilvNLEkn6dcOd21K QPX9HsUvN2Ma37Egfh/k0aQMbEH/i0bpSMqXEqOgDbBZluNJhpYuOgnj4Q7DPpmKhAiN zQsqu00Mz8M3toPcSfMJ2kGMlWJB4oIuze22bTAAM12txCzSw3nk9NzhV/mjVk/SK1uK prUzeFIhmPj+LTMoyPkXSiBVHA8fzw6sJA6yw3uPuwYho5yfYRKW5bucjX1LPBurbM1x pdHL9tZ+K5Nwz7UuWRJUM8pfxHyOTveMI+qmDeiTsegmgUE2RXKOXALdjn8vDdPBflNl s+IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=BZs5cWV4unFrgOWo4hpdCqyx4qJvktCBG8E9uWpQXR4=; b=IRCs3uVjfSr6g1e66gmwwh8tyGcpEtwvotEZKauQokWT1ibmPXL6vKu+rjxNwLcSFx u9LJB1PermcSzn/+qbLmkiWk6eH+INTTBXZJpq0ZefdZ5WJBazytB7bEdetMHmOw28ld gcuQioJxgEUqMHrlkJzXpRZ6ZrGxte8w2YkxaxB9Ru/CFzGLUuabsS3kVd46K+6hUJb5 Ir0vJMNCL7jHwrFGoTJJLOup8VXACTf/wMqXZVod5h+XZpIJ2kh+aNW8JRZj+4nDxwRQ LBKzxvQpYgO/uF7YedkQ2NhlTV4NDHpoYhKOgPqkXS6lDsmJweenceiRSdPxsEKj4k1Z mHgQ== X-Gm-Message-State: AD7BkJKkLJzIiIojnr2IdTn2BkqLS11FmPs+/ZMCcWTiLZzOG8UEgtZednb8waIeA0jXlZQF X-Received: by 10.194.90.3 with SMTP id bs3mr4953864wjb.105.1459451044627; Thu, 31 Mar 2016 12:04:04 -0700 (PDT) Received: from [192.168.2.24] ([83.217.123.106]) by smtp.googlemail.com with ESMTPSA id z6sm10882935wme.9.2016.03.31.12.04.03 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 31 Mar 2016 12:04:03 -0700 (PDT) To: "Smith, Elliot" References: <1458133834-26276-1-git-send-email-elliot.smith@intel.com> <1458133834-26276-6-git-send-email-elliot.smith@intel.com> <56FD3721.6090703@intel.com> <56FD3E68.70204@intel.com> From: Michael Wood Message-ID: <56FD74A3.2090205@intel.com> Date: Thu, 31 Mar 2016 20:04:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <56FD3E68.70204@intel.com> Cc: toaster@yoctoproject.org Subject: Re: [PATCH 5/5] toaster-tests: migrate landing page tests to Selenium X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Mar 2016 19:04:07 -0000 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Thanks this is great. Sent upstream and to toaster-next. I did a sed on the paths in the patches so that an additional commit to move the files into tests was no longer necessary. For those following along, this makes running these selenium tests very easy, here it is for firefox: (activate virtualenv if using) $ cd ./bitbake/lib/toaster/ $ pip install -r ./tests/toaster-tests-requirements.txt $ TOASTER_TESTS_BROWSER=firefox ./manage.py test tests.browser Michael On 31/03/16 16:12, Michael Wood wrote: > Yes that'd be great. > > Michael > > On 31/03/16 16:06, Smith, Elliot wrote: >> Sounds like a good idea to me. Do you want me to amend my branch to >> start the ball rolling? >> >> Elliot >> >> On 31 March 2016 at 15:41, Michael Wood > > wrote: >> >> Hijacking this with a bit of an RFC, but as I'm looking at tests >> at the moment, shall we start consolidating the tests in a single >> directory? >> >> I was thinking: >> >> ├──bitbake/lib/toaster/tests >> │ ├── browser >> │ ├── views >> │ ├── build >> │ ├── api >> │ ├── static >> ...etc >> >> usage ./manage.py test tests [or tests.views etc] >> >> Michael >> >> >> On 16/03/16 13:10, Elliot Smith wrote: >> >> Signed-off-by: Elliot Smith > > >> --- >> .../lib/toaster/tests_browser/test_landing_page.py | 108 >> +++++++++++++++++++++ >> bitbake/lib/toaster/toastergui/tests.py | 74 -------------- >> 2 files changed, 108 insertions(+), 74 deletions(-) >> create mode 100644 >> bitbake/lib/toaster/tests_browser/test_landing_page.py >> >> diff --git >> a/bitbake/lib/toaster/tests_browser/test_landing_page.py >> b/bitbake/lib/toaster/tests_browser/test_landing_page.py >> new file mode 100644 >> index 0000000..8343630 >> --- /dev/null >> +++ b/bitbake/lib/toaster/tests_browser/test_landing_page.py >> @@ -0,0 +1,108 @@ >> +#! /usr/bin/env python >> +# ex:ts=4:sw=4:sts=4:et >> +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil >> -*- >> +# >> +# BitBake Toaster Implementation >> +# >> +# Copyright (C) 2013-2016 Intel Corporation >> +# >> +# This program is free software; you can redistribute it >> and/or modify >> +# it under the terms of the GNU General Public License >> version 2 as >> +# published by the Free Software Foundation. >> +# >> +# This program is distributed in the hope that it will be >> useful, >> +# but WITHOUT ANY WARRANTY; without even the implied >> warranty of >> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >> +# GNU General Public License for more details. >> +# >> +# You should have received a copy of the GNU General Public >> License along >> +# with this program; if not, write to the Free Software >> Foundation, Inc., >> +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >> + >> +from django.core.urlresolvers import reverse >> +from django.utils import timezone >> +from toaster.tests_browser.selenium_helpers import >> SeleniumTestCase >> + >> +from orm.models import Project, Build >> + >> +class TestLandingPage(SeleniumTestCase): >> + """ Tests for redirects on the landing page """ >> + >> + PROJECT_NAME = 'test project' >> + LANDING_PAGE_TITLE = 'This is Toaster' >> + CLI_BUILDS_PROJECT_NAME = 'command line builds' >> + >> + def setUp(self): >> + """ Add default project manually """ >> + self.project = Project.objects.create_project( >> + self.CLI_BUILDS_PROJECT_NAME, >> + None >> + ) >> + self.project.is_default = True >> + self.project.save() >> + >> + def test_only_default_project(self): >> + """ >> + No projects except default >> + => should see the landing page >> + """ >> + self.get(reverse('landing')) >> + self.assertTrue(self.LANDING_PAGE_TITLE in >> self.get_page_source()) >> + >> + def test_default_project_has_build(self): >> + """ >> + Default project has a build, no other projects >> + => should see the builds page >> + """ >> + now = timezone.now() >> + build = Build.objects.create(project=self.project, >> + started_on=now, >> + completed_on=now) >> + build.save() >> + >> + self.get(reverse('landing')) >> + >> + elements = self.find_all('#allbuildstable') >> + self.assertEqual(len(elements), 1, 'should redirect >> to builds') >> + content = self.get_page_source() >> + self.assertFalse(self.PROJECT_NAME in content, >> + 'should not show builds for project >> %s' % self.PROJECT_NAME) >> + self.assertTrue(self.CLI_BUILDS_PROJECT_NAME in >> content, >> + 'should show builds for cli project') >> + >> + def test_user_project_exists(self): >> + """ >> + User has added a project (without builds) >> + => should see the projects page >> + """ >> + user_project = Project.objects.create_project('foo', >> None) >> + user_project.save() >> + >> + self.get(reverse('landing')) >> + >> + elements = self.find_all('#projectstable') >> + self.assertEqual(len(elements), 1, 'should redirect >> to projects') >> + >> + def test_user_project_has_build(self): >> + """ >> + User has added a project (with builds), command line >> builds doesn't >> + => should see the builds page >> + """ >> + user_project = >> Project.objects.create_project(self.PROJECT_NAME, None) >> + user_project.save() >> + >> + now = timezone.now() >> + build = Build.objects.create(project=user_project, >> + started_on=now, >> + completed_on=now) >> + build.save() >> + >> + self.get(reverse('landing')) >> + >> + elements = self.find_all('#allbuildstable') >> + self.assertEqual(len(elements), 1, 'should redirect >> to builds') >> + content = self.get_page_source() >> + self.assertTrue(self.PROJECT_NAME in content, >> + 'should show builds for project %s' % >> self.PROJECT_NAME) >> + self.assertFalse(self.CLI_BUILDS_PROJECT_NAME in >> content, >> + 'should not show builds for cli >> project') >> diff --git a/bitbake/lib/toaster/toastergui/tests.py >> b/bitbake/lib/toaster/toastergui/tests.py >> index 6975ac1..eebd1b7 100644 >> --- a/bitbake/lib/toaster/toastergui/tests.py >> +++ b/bitbake/lib/toaster/toastergui/tests.py >> @@ -493,80 +493,6 @@ class ViewTests(TestCase): >> "Changed page on table %s >> but first row is the " >> "same as the previous page" >> % name) >> -class LandingPageTests(TestCase): >> - """ Tests for redirects on the landing page """ >> - # disable bogus pylint message error: >> - # "Instance of 'WSGIRequest' has no 'url' member >> (no-member)" >> - # (see >> https://github.com/landscapeio/pylint-django/issues/42) >> - # pylint: disable=E1103 >> - >> - LANDING_PAGE_TITLE = 'This is Toaster' >> - >> - def setUp(self): >> - """ Add default project manually """ >> - self.project = Project.objects.create_project('foo', >> None) >> - self.project.is_default = True >> - self.project.save() >> - >> - def test_only_default_project(self): >> - """ >> - No projects except default >> - => get the landing page >> - """ >> - response = self.client.get(reverse('landing')) >> - self.assertTrue(self.LANDING_PAGE_TITLE in >> response.content) >> - >> - def test_default_project_has_build(self): >> - """ >> - Default project has a build, no other projects >> - => get the builds page >> - """ >> - now = timezone.now() >> - build = Build.objects.create(project=self.project, >> - started_on=now, >> - completed_on=now) >> - build.save() >> - >> - response = self.client.get(reverse('landing')) >> - self.assertEqual(response.status_code, 302, >> - 'response should be a redirect') >> - self.assertTrue('/builds' in response.url, >> - 'should redirect to builds') >> - >> - def test_user_project_exists(self): >> - """ >> - User has added a project (without builds) >> - => get the projects page >> - """ >> - user_project = Project.objects.create_project('foo', >> None) >> - user_project.save() >> - >> - response = self.client.get(reverse('landing')) >> - self.assertEqual(response.status_code, 302, >> - 'response should be a redirect') >> - self.assertTrue('/projects' in response.url, >> - 'should redirect to projects') >> - >> - def test_user_project_has_build(self): >> - """ >> - User has added a project (with builds) >> - => get the builds page >> - """ >> - user_project = Project.objects.create_project('foo', >> None) >> - user_project.save() >> - >> - now = timezone.now() >> - build = Build.objects.create(project=user_project, >> - started_on=now, >> - completed_on=now) >> - build.save() >> - >> - response = self.client.get(reverse('landing')) >> - self.assertEqual(response.status_code, 302, >> - 'response should be a redirect') >> - self.assertTrue('/builds' in response.url, >> - 'should redirect to builds') >> - >> class BuildDashboardTests(TestCase): >> """ Tests for the build dashboard /build/X """ >> >> >> -- _______________________________________________ >> toaster mailing list >> toaster@yoctoproject.org >> https://lists.yoctoproject.org/listinfo/toaster >> >> >> >> >> -- >> Elliot Smith >> Software Engineer >> Intel Open Source Technology Centre >> >> --------------------------------------------------------------------- >> Intel Corporation (UK) Limited >> Registered No. 1134945 (England) >> Registered Office: Pipers Way, Swindon SN3 1RJ >> VAT No: 860 2173 47 >> >> This e-mail and any attachments may contain confidential material for >> the sole use of the intended recipient(s). Any review or distribution >> by others is strictly prohibited. If you are not the intended >> recipient, please contact the sender and delete all copies. >> >