コード例 #1
0
    def test_add_tile(self):
        selenium = self.selenium
        self.login()
        selenium.get(self.portal.absolute_url())
        # create a basic page
        test_utils.create_page(selenium, 'basic')
        # click edit
        self.click('.castle-toolbar-edit a')
        # click customize
        self.click('.mosaic-button-layout')
        self.click('.mosaic-button-customizelayout')
        # click insert select2
        test_utils.mousedown(selenium, By.CSS_SELECTOR,
                             '.mosaic-menu-insert .select2-chosen')
        # select text tile to insert
        test_utils.mousedown(
            selenium, By.CSS_SELECTOR,
            '.select2-results .mosaic-option-plone-app-standardtiles-rawhtml .select2-result-label'
        )
        # click on the page to place this new text tile
        click_placement = self.get(
            '#content .mosaic-IDublinCore-description-tile')
        actionchain = ActionChains(selenium)
        actionchain.move_to_element_with_offset(click_placement, 0, 0)
        actionchain.click(click_placement)
        actionchain.perform()

        container = self.get('.mosaic-selected-tile')
        container.find_element_by_class_name('mosaic-rich-text')

        # click the save button
        try:
            self.click('.mosaic-button-save')
        except:
            self.selenium.find_element_by_id('form-buttons-save').click()
コード例 #2
0
 def test_create_page_under_folder(self):
     selenium = self.selenium
     self.login()
     selenium.get(self.portal.absolute_url())
     test_utils.create_folder(selenium, 'folder')
     test_utils.create_page(selenium, 'basic')
     self.assertEqual(
         self.selenium.current_url,
         self.portal.absolute_url() + '/test_folder/test_basic')
コード例 #3
0
 def test_change_page_title(self):
     selenium = self.selenium
     self.login()
     selenium.get(self.portal.absolute_url())
     # create the page
     test_utils.create_page(selenium, 'basic')
     # page is created, now edit the title
     self.get('.castle-toolbar-edit a').click()
     self.get('h1').send_keys('new title')
     self.click('.mosaic-button-save')
コード例 #4
0
    def test_query_listing(self):
        selenium = self.selenium
        self.login()
        # create a folder
        test_utils.create_folder(selenium, 'folder-query', 'testfolder')
        # add tag for folder
        test_utils.add_tag(selenium, 'test_tag')
        # create some content in this new folder
        # create a page
        test_utils.create_page(selenium, 'basic')
        # add tag for this page
        # click edit
        test_utils.add_tag(selenium, 'test_tag')
        # create a page
        test_utils.create_page(selenium, 'document')
        # add tag for this page
        test_utils.add_tag(selenium, 'test_tag')
        test_utils.create_page(selenium, 'twocolumn')
        test_utils.add_tag(selenium, 'test_tag')
        test_utils.create_page(selenium, 'threecolumn')
        test_utils.add_tag(selenium, 'test_tag')
        # fill rest with news items until pagenation occurs
        pagen_trigger = 12
        while pagen_trigger > 0:
            test_utils.create_news_item(selenium,
                                        'test_news%s' % pagen_trigger)
            test_utils.add_tag(selenium, 'test_tag')
            pagen_trigger -= 1

        selenium.get(self.portal.absolute_url() + '/testfolder')
コード例 #5
0
 def test_tile_edit(self):
     selenium = self.selenium
     self.login()
     selenium.get(self.portal.absolute_url())
     # create basic page
     test_utils.create_page(selenium, 'basic')
     # click edit
     test_utils.click_it(selenium, By.CSS_SELECTOR,
                         '.castle-toolbar-edit a')
     # get title element
     edit_element = self.get(
         '.mosaic-IDublinCore-title-tile .mosaic-rich-text')
     edit_element.click()
     # clear the text from this field
     test_utils.clear_it(edit_element)
     test_utils.dismiss_tour(self.selenium)
     edit_element.send_keys('new title is right here!')
     # click the save button
     self.click('.mosaic-button-save')
     self.assertTrue('new title' in self.selenium.page_source)
コード例 #6
0
 def test_add_video(self):
     selenium = self.selenium
     self.login()
     selenium.get(self.portal.absolute_url())
     test_utils.create_page(selenium, 'basic')
     self.get('.castle-toolbar-edit a').click()
     test_utils.mousedown(selenium, By.CSS_SELECTOR,
                          '.mosaic-button-layout')
     test_utils.mousedown(selenium, By.CSS_SELECTOR,
                          '.mosaic-button-customizelayout')
     test_utils.mousedown(selenium, By.CSS_SELECTOR,
                          '.mosaic-menu-insert .select2-choice')
     test_utils.mousedown(selenium, By.CSS_SELECTOR,
                          '.mosaic-option-castle-cms-videotile')
     tmpelement = self.get('#castle-cms-videotile-youtube_url')
     tmpelement.send_keys('https://www.youtube.com/watch?v=dQw4w9WgXcQ')
     test_utils.click_it(selenium, By.CSS_SELECTOR,
                         '.plone-modal-footer #buttons-save')
     test_utils.click_it(selenium, By.CSS_SELECTOR,
                         '#content > div:nth-child(2)')
     test_utils.mousedown(selenium, By.CSS_SELECTOR, '.mosaic-button-save')
     self.assertTrue(
         self.is_element_present(By.CSS_SELECTOR, '.video-container'))
コード例 #7
0
 def test_image_insert(self):
     selenium = self.selenium
     self.login()
     selenium.get(self.portal.absolute_url())
     test_utils.create_page(selenium, 'document')
     # click edit
     self.click('.castle-toolbar-edit a')
     # click description area so it receives focus and mce toolbar is visible
     self.click('#content .mosaic-IRichText-text-tile .mosaic-rich-text')
     self.click('#content .mosaic-IDublinCore-description-tile')
     self.click('#content .mosaic-IRichText-text-tile .mosaic-rich-text')
     # click the mce insert image button
     self.get('[aria-label="Insert/edit image"] button').click()
     # click the external tab
     self.click("#tinymce-autotoc-autotoc-1")
     # specify the external image url
     self.get(".form-group input[name='externalImage']").send_keys(
         'https://plone.org/[email protected]')
     # give the image a title
     self.get(".form-group input[name='alt']").send_keys('testimage')
     # click the insert button
     self.get('div.pattern-modal-buttons > input[name="insert"]').click()
     # click the save button
     test_utils.click_it(selenium, By.CSS_SELECTOR, '.mosaic-button-save')
コード例 #8
0
 def test_createpages(self):
     selenium = self.selenium
     self.login()
     selenium.get(self.portal.absolute_url())
     test_utils.create_page(selenium, 'basic')
     self.assertEqual(self.selenium.current_url,
                      self.portal.absolute_url() + '/test_basic')
     selenium.get(self.portal.absolute_url())
     test_utils.create_page(selenium, 'document')
     self.assertEqual(self.selenium.current_url,
                      self.portal.absolute_url() + '/test_document')
     selenium.get(self.portal.absolute_url())
     test_utils.create_page(selenium, 'twocolumn')
     self.assertEqual(self.selenium.current_url,
                      self.portal.absolute_url() + '/test_twocolumn')
     selenium.get(self.portal.absolute_url())
     test_utils.create_page(selenium, 'threecolumn')
     self.assertEqual(self.selenium.current_url,
                      self.portal.absolute_url() + '/test_threecolumn')