def test_add_component(self): """Test user adding project and component.""" user = self.do_login() create_billing(user) # Open billing page self.click(self.driver.find_element_by_id('user-dropdown')) with self.wait_for_page_load(): self.click(self.driver.find_element_by_id('billing-button')) self.screenshot('user-billing.png') # Click on add project with self.wait_for_page_load(): self.click( self.driver.find_element_by_class_name('billing-add-project')) # Add project self.driver.find_element_by_id('id_name').send_keys('WeblateOrg') self.driver.find_element_by_id('id_slug').send_keys('weblateorg') self.driver.find_element_by_id('id_web').send_keys( 'https://weblate.org/') self.driver.find_element_by_id('id_mail').send_keys( '*****@*****.**') self.driver.find_element_by_id('id_instructions').send_keys( 'https://weblate.org/contribute/') self.screenshot('user-add-project.png') with self.wait_for_page_load(): self.driver.find_element_by_id('id_name').submit() self.screenshot('user-add-project-done.png') # Click on add component with self.wait_for_page_load(): self.click( self.driver.find_element_by_class_name( 'project-add-component')) # Add component self.driver.find_element_by_id('id_name').send_keys('Language names') self.driver.find_element_by_id('id_slug').send_keys('languages') self.driver.find_element_by_id('id_repo').send_keys( 'https://github.com/WeblateOrg/demo.git') self.driver.find_element_by_id('id_repoweb').send_keys( 'https://github.com/WeblateOrg/demo/blob/' '%(branch)s/%(file)s#L%(line)s') self.driver.find_element_by_id('id_filemask').send_keys( 'weblate/langdata/locale/*/LC_MESSAGES/django.po') self.driver.find_element_by_id('id_new_base').send_keys( 'weblate/langdata/locale/django.pot') Select(self.driver.find_element_by_id( 'id_file_format')).select_by_value('po') self.driver.find_element_by_id('id_license').send_keys('GPL-3.0+') self.clear_field(self.driver.find_element_by_id( 'id_language_regex')).send_keys('^(cs|he|hu)$') self.screenshot('user-add-component.png')
def test_create_project_billing(self): # No permissions without billing self.assert_create_project(False) self.client_create_project(reverse('create-project')) # Create empty billing billing = create_billing(self.user) self.assert_create_project(True) # Create one project self.client_create_project(False, billing=0) self.client_create_project(True, billing=billing.pk) # No more billings left self.client_create_project( reverse('create-project'), name='p2', slug='p2', billing=billing.pk )
def test_create_component_billing(self): # No permissions without billing self.assert_create_component(False) self.client_create_component(False) # Create billing and add permissions billing = create_billing(self.user) billing.projects.add(self.project) self.project.add_user(self.user, '@Administration') self.assert_create_component(True) # Create two components self.client_create_component(True) self.client_create_component(True, name='c2', slug='c2') # Restrict plan to test nothing more can be created billing.plan.limit_strings = 1 billing.plan.save() self.client_create_component(False, name='c3', slug='c3')
def test_add_component(self): """Test user adding project and component.""" user = self.do_login() create_billing(user) # Open billing page self.click(self.driver.find_element_by_id("user-dropdown")) with self.wait_for_page_load(): self.click(self.driver.find_element_by_id("billing-button")) self.screenshot("user-billing.png") # Click on add project with self.wait_for_page_load(): self.click( self.driver.find_element_by_class_name("billing-add-project")) # Add project self.driver.find_element_by_id("id_name").send_keys("WeblateOrg") self.driver.find_element_by_id("id_web").send_keys( "https://weblate.org/") self.driver.find_element_by_id("id_mail").send_keys( "*****@*****.**") self.driver.find_element_by_id("id_instructions").send_keys( "https://weblate.org/contribute/") self.screenshot("user-add-project.png") with self.wait_for_page_load(): self.driver.find_element_by_id("id_name").submit() self.screenshot("user-add-project-done.png") # Click on add component with self.wait_for_page_load(): self.click( self.driver.find_element_by_class_name( "project-add-component")) # Add component self.driver.find_element_by_id("id_name").send_keys("Language names") self.driver.find_element_by_id("id_repo").send_keys( "https://github.com/WeblateOrg/demo.git") self.screenshot("user-add-component-init.png") with self.wait_for_page_load(timeout=1200): self.driver.find_element_by_id("id_name").submit() self.screenshot("user-add-component-discovery.png") self.driver.find_element_by_id("id_id_discovery_0_1").click() with self.wait_for_page_load(timeout=1200): self.driver.find_element_by_id("id_name").submit() self.driver.find_element_by_id("id_repoweb").send_keys( "https://github.com/WeblateOrg/demo/blob/" "{{branch}}/{{filename}}#L{{line}}") self.driver.find_element_by_id("id_filemask").send_keys( "weblate/langdata/locale/*/LC_MESSAGES/django.po") self.driver.find_element_by_id("id_new_base").send_keys( "weblate/langdata/locale/django.pot") Select(self.driver.find_element_by_id( "id_file_format")).select_by_value("po") Select(self.driver.find_element_by_id("id_license")).select_by_value( "GPL-3.0-or-later") self.clear_field(self.driver.find_element_by_id( "id_language_regex")).send_keys("^(cs|he|hu)$") self.screenshot("user-add-component.png")
def test_add_component(self): """Test user adding project and component.""" user = self.do_login() create_billing(user) # Open billing page self.click(self.driver.find_element_by_id('user-dropdown')) with self.wait_for_page_load(): self.click( self.driver.find_element_by_id('billing-button') ) self.screenshot('user-billing.png') # Click on add project with self.wait_for_page_load(): self.click( self.driver.find_element_by_class_name('billing-add-project') ) # Add project self.driver.find_element_by_id('id_name').send_keys('WeblateOrg') self.driver.find_element_by_id( 'id_web' ).send_keys( 'https://weblate.org/' ) self.driver.find_element_by_id( 'id_mail' ).send_keys( '*****@*****.**' ) self.driver.find_element_by_id( 'id_instructions' ).send_keys( 'https://weblate.org/contribute/' ) self.screenshot('user-add-project.png') with self.wait_for_page_load(): self.driver.find_element_by_id('id_name').submit() self.screenshot('user-add-project-done.png') # Click on add component with self.wait_for_page_load(): self.click( self.driver.find_element_by_class_name('project-add-component') ) # Add component self.driver.find_element_by_id('id_name').send_keys('Language names') self.driver.find_element_by_id( 'id_repo' ).send_keys( 'https://github.com/WeblateOrg/demo.git' ) self.screenshot('user-add-component-init.png') with self.wait_for_page_load(timeout=1200): self.driver.find_element_by_id('id_name').submit() self.screenshot('user-add-component-discovery.png') self.driver.find_element_by_id('id_id_discovery_0_1').click() with self.wait_for_page_load(timeout=1200): self.driver.find_element_by_id('id_name').submit() self.driver.find_element_by_id( 'id_repoweb' ).send_keys( 'https://github.com/WeblateOrg/demo/blob/' '%(branch)s/%(file)s#L%(line)s' ) self.driver.find_element_by_id( 'id_filemask' ).send_keys( 'weblate/langdata/locale/*/LC_MESSAGES/django.po' ) self.driver.find_element_by_id( 'id_new_base' ).send_keys( 'weblate/langdata/locale/django.pot' ) Select( self.driver.find_element_by_id('id_file_format') ).select_by_value('po') self.driver.find_element_by_id('id_license').send_keys('GPL-3.0+') self.clear_field( self.driver.find_element_by_id( 'id_language_regex' ) ).send_keys('^(cs|he|hu)$') self.screenshot('user-add-component.png')