-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstandard_ENM_default.py
91 lines (72 loc) · 3.79 KB
/
standard_ENM_default.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import platform
import time
import unittest
# from selenium.common.exceptions import TimeoutException
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
from BaseTest import ExistingWorkflowTest, WithFirefox, WithChrome
class RunENMWorkflow(ExistingWorkflowTest):
def test_enm_workflow(self):
link = self.portal.find_element_by_partial_link_text("Ecological Niche Modelling")
self.portal.click(link)
with self.runWorkflow('Ecological niche modelling workflow'):
# Algorithm selection - use defaults
with self.portal.waitForInteraction(300, 1):
firstInteraction = time.time()
continueButton = self.portal.wait(60).until(
expected_conditions.element_to_be_clickable((By.XPATH, '//button/span[text()="Continue"]')))
self.portal.click(continueButton)
# Algorithm parameter values - use defaults
with self.portal.waitForInteraction(300, 1):
continueButton = self.portal.wait(60).until(
expected_conditions.element_to_be_clickable((By.XPATH, '//button/span[text()="Continue"]')))
self.portal.click(continueButton)
# Select layers - use defaults
with self.portal.waitForInteraction(300, 1):
continueButton = self.portal.wait(60).until(
expected_conditions.element_to_be_clickable((By.XPATH, '//button/span[text()="Submit selected layers"]')))
self.portal.click(continueButton)
# Select or create input mask - create mask
with self.portal.waitForInteraction(300, 1):
continueButton = self.portal.wait(60).until(
expected_conditions.element_to_be_clickable((By.XPATH, '//button/span[text()="Create a new mask"]')))
self.portal.click(continueButton)
# Code for BioSTIF interaction does not work consistently.
# Abandon run before we get there.
self.fail('BioSTIF not working')
# BioSTIF - the remaining code cancels the BioSTIF interaction,
# causing the workflow to finish.
# with self.portal.waitForInteraction(300, 1) as interaction:
# # a dialog pops up with [msg_error_application_start_failed] - if it
# # appears dismiss it else after 20 seconds, hit the abort button
# try:
# self.portal.acceptAlert(30)
# except TimeoutException:
# pass
# try:
# self.portal.acceptAlert(30)
# except TimeoutException:
# pass
# interaction.switchBack()
# continueButton = self.portal.wait(60).until(
# expected_conditions.element_to_be_clickable(
# (By.ID, 'user_cancel')
# )
# )
# self.portal.click(continueButton)
# self.portal.watchRunStatus(self.waitForStatusFinished, 300)
# link = self.portal.find_element_by_partial_link_text("Delete")
# self.portal.click(link)
# self.portal.acceptAlert()
# self.assertIn('Run was deleted', self.portal.getFlashNotice())
# Firefox on Windows hangs on click of Run Workflow button using Selenium, but
# not when running workflow manually
# confirmed on (FF27.0.1, Win7)
@unittest.skipIf(platform.system() == 'Windows', 'Selenium hangs with Firefox on Windows')
class RunENMWorkflowFirefox(RunENMWorkflow, unittest.TestCase, WithFirefox):
pass
if WithChrome:
class RunENMWorkflowChrome(RunENMWorkflow, unittest.TestCase, WithChrome):
pass
if __name__ == '__main__':
unittest.main()