本文整理汇总了Python中pastasauce.PastaSauce类的典型用法代码示例。如果您正苦于以下问题:Python PastaSauce类的具体用法?Python PastaSauce怎么用?Python PastaSauce使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PastaSauce类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestGenerateReports
class TestGenerateReports(unittest.TestCase):
"""T1.68 - Generate Reports."""
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.admin = Admin(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.admin.login()
def tearDown(self):
"""Test destructor."""
self.ps.update_job(
job_id=str(self.admin.driver.session_id),
**self.ps.test_updates
)
try:
self.admin.delete()
except:
pass
# Case C8361 - 001 - Admin | Export research data to OwnCloud Research
@pytest.mark.skipif(str(8361) not in TESTS, reason='Excluded')
def test_admin_export_research_data_to_own_cloud_research_8361(self):
"""Export research data to OwnCloud Research.
Steps:
Open the user menu by clicking on the user's name
Click on the 'Admin' button
Click the 'Research Data' button
Click on the 'Export Data' button
Expected Result:
The page is reloaded and a confirmation message is displayed.
"""
self.ps.test_updates['name'] = 't1.68.001' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = ['t1', 't1.68', 't1.68.001', '8361']
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.admin.open_user_menu()
self.admin.wait.until(
expect.element_to_be_clickable(
(By.LINK_TEXT, 'Admin')
)
).click()
self.admin.page.wait_for_page_load()
self.admin.driver.find_element(
By.XPATH, '//a[contains(text(),"Research Data")]').click()
self.admin.driver.find_element(
By.XPATH, '//input[@value="Export Data"]').click()
self.admin.driver.find_element(
By.XPATH, '//div[contains(@class,"alert-info")]')
self.ps.test_updates['passed'] = True
示例2: TestEpicName
class TestEpicName(unittest.TestCase):
"""Product.Epic - Epic Text."""
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.teacher = Teacher(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
def tearDown(self):
"""Test destructor."""
self.ps.update_job(
job_id=str(self.teacher.driver.session_id),
**self.ps.test_updates
)
try:
self.teacher.delete()
except:
pass
# Case CaseID - Story# - UserType
@pytest.mark.skipif(str(CaseID) not in TESTS, reason='Excluded')
def test_usertype_storytext_CaseID(self):
"""Story Text.
Steps:
Expected Result:
"""
self.ps.test_updates['name'] = 'product.epic.story' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
'product',
'product.epic',
'product.epic.story',
'CaseID'
]
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
raise NotImplementedError(inspect.currentframe().f_code.co_name)
self.ps.test_updates['passed'] = True
示例3: setUp
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.admin = Admin(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.admin.login()
# make sure there are no new terms to accept
try:
self.admin.driver.find_element(
By.ID, 'i_agree'
).click()
self.admin.driver.find_element(
By.ID, 'agreement_submit'
).click()
except NoSuchElementException:
pass
# go to admin console
self.wait = WebDriverWait(self.admin.driver, 15)
self.admin.open_user_menu()
self.admin.wait.until(
expect.element_to_be_clickable(
(By.LINK_TEXT, 'Admin')
)
).click()
self.admin.page.wait_for_page_load()
self.admin.driver.find_element(
By.XPATH, '//a[contains(text(),"Legal")]').click()
示例4: setUp
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.admin = Admin(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.content = ContentQA(
existing_driver=self.admin.driver,
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.student = Student(
existing_driver=self.admin.driver,
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.teacher = Teacher(
existing_driver=self.admin.driver,
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
示例5: setUp
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.Teacher = Teacher(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
示例6: setUp
def setUp(self):
self.ps = PastaSauce()
self.helper = StaxHelper()
self.desired_capabilities["name"] = self.id()
self.driver = StaxHelper.run_on(StaxHelper.LOCAL, self.ps, self.desired_capabilities)
self.driver.implicitly_wait(15)
self.wait = WebDriverWait(self.driver, 15)
self.driver.set_window_size(*standard_window)
self.rword = self.helper.user.assignment.rword
示例7: setUp
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.student = Student(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.student.login()
示例8: setUp
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.teacher = Teacher(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.teacher.login()
self.teacher.select_course(title='HS Physics')
示例9: setUp
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.admin = Admin(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.admin.login()
self.admin.goto_admin_control()
self.admin.sleep(5)
示例10: setUp
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.teacher = Teacher(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.teacher.login()
self.teacher.select_course(appearance='biology')
self.teacher.find(By.PARTIAL_LINK_TEXT, 'Performance Forecast').click()
示例11: setUp
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.student = Student(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.student.username = os.getenv('STUDENT_USER_CC')
self.student.login()
self.student.sleep(5) # for CNX redirect
示例12: setUp
def setUp(self):
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.admin = Admin(use_env_vars=True)
self.helper = StaxHelper(driver_type='chrome', pasta_user=self.ps,
capabilities=self.desired_capabilities,
initial_user=self.admin)
self.driver = self.helper.driver
self.wait = WebDriverWait(self.driver, StaxHelper.DEFAULT_WAIT_TIME)
self.driver.set_window_size(*standard_window)
self.admin.login(self.driver)
self.rword = Assignment.rword
self.screenshot_path = '/tmp/errors/'
示例13: setUp
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.teacher = Teacher(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.teacher.login()
self.teacher.driver.find_element(
By.XPATH, '//a[contains(@href,"/cc-dashboard")]'
).click()
示例14: setUp
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.teacher = Teacher(
username=os.getenv('TEACHER_USER_CC'),
password=os.getenv('TEACHER_PASSWORD'),
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.teacher.login()
if 'cc-dashboard' not in self.teacher.current_url():
courses = self.teacher.find_all(
By.CLASS_NAME,
'tutor-booksplash-course-item'
)
assert(courses), 'No courses found.'
if not isinstance(courses, list):
courses = [courses]
course_id = randint(0, len(courses) - 1)
self.course = courses[course_id].get_attribute('data-title')
self.teacher.select_course(title=self.course)
self.teacher.goto_course_roster()
try:
section = self.teacher.find_all(
By.XPATH,
'//*[contains(@class,"nav-tabs")]//a'
)
if isinstance(section, list):
section = '%s' % section[randint(0, len(section) - 1)].text
else:
section = '%s' % section.text
except Exception:
section = '%s' % randint(100, 999)
self.teacher.add_course_section(section)
self.code = self.teacher.get_enrollment_code(section)
print('Course Phrase: ' + self.code)
self.book_url = self.teacher.find(
By.XPATH, '//a[span[contains(text(),"Online Book")]]'
).get_attribute('href')
self.teacher.find(By.CSS_SELECTOR, 'button.close').click()
self.teacher.sleep(0.5)
self.teacher.logout()
self.teacher.sleep(1)
self.student = Student(use_env_vars=True,
existing_driver=self.teacher.driver)
self.first_name = Assignment.rword(6)
self.last_name = Assignment.rword(8)
self.email = self.first_name + '.' \
+ self.last_name \
+ '@tutor.openstax.org'
示例15: setUp
def setUp(self):
self.ps = PastaSauce()
self.desired_capabilities["name"] = self.id()
self.teacher = Teacher(use_env_vars=True)
self.helper = StaxHelper(
driver_type="chrome", pasta_user=self.ps, capabilities=self.desired_capabilities, initial_user=self.teacher
)
self.driver = self.helper.driver
self.wait = WebDriverWait(self.driver, StaxHelper.DEFAULT_WAIT_TIME)
self.driver.set_window_size(*standard_window)
self.teacher.login(self.driver)
self.teacher.select_course(self.driver, title="physics")
self.rword = Assignment.rword
self.screenshot_path = "/tmp/errors/"