Skip to content

Commit 1aa6421

Browse files
Better logic for IDE
1 parent daa7c2a commit 1aa6421

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

tests/js/drop_studio_file.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ input.onchange = function () {
3232
}
3333
}
3434

35-
['dragenter', 'drop'].forEach(function (name) {
35+
['dragenter', 'drop', 'dragleave'].forEach(function (name) {
3636
console.log('Dispatching mouse event with file transfer')
3737
const evt = document.createEvent('MouseEvent');
3838
evt.initMouseEvent(name, !0, !0, window, 0, 0, 0, x, y, !1, !1, !1, !1, 0, null);

tests/test_ide.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,6 @@ def test_studio_notebook_in_firefox(request):
333333
logging.info("Launching SageMaker Studio")
334334
browser.get(studio_pre_signed_url)
335335

336-
logging.info("Checking for SageMaker Studio in Firefox")
337-
assert "JupyterLab" in browser.title
338-
339336
logging.info("Waiting for SageMaker Studio to launch")
340337
WebDriverWait(browser, 600).until(
341338
EC.presence_of_element_located((By.XPATH, "//div[@id='space-menu']"))
@@ -344,7 +341,16 @@ def test_studio_notebook_in_firefox(request):
344341
logging.info(f"Found SageMaker Studio space menu item: {kernel_menu_item.text}")
345342
assert kernel_menu_item.text == 'test-data-science / Personal Studio'
346343

347-
time.sleep(10) # wait until obscurity of the menu items is gone and UI is fully loaded
344+
time.sleep(60) # wait until obscurity of the menu items is gone and UI is fully loaded
345+
346+
logging.info("Checking the kernel name")
347+
kernel_item = browser.find_element(
348+
By.XPATH,
349+
"//button[@class='bp3-button bp3-minimal jp-Toolbar-kernelName "
350+
"jp-ToolbarButtonComponent minimal jp-Button']"
351+
)
352+
logging.info(f"Found Kernel name: {kernel_item.text}")
353+
assert kernel_item.text == "Data Science 2.0\n|\nPython 3\n|\n2 vCPU + 8 GiB"
348354

349355
dist_file_name_pattern = 'sagemaker_ssh_helper-.*-py3-none-any.whl'
350356
dist_file_name = [f for f in os.listdir('../dist') if re.match(dist_file_name_pattern, f)][0]
@@ -377,15 +383,6 @@ def test_studio_notebook_in_firefox(request):
377383
logging.info(f"Found SageMaker Studio restart kernel menu item: {restart_menu_item.text}")
378384
restart_menu_item.click()
379385

380-
logging.info("Checking the kernel name")
381-
kernel_item = browser.find_element(
382-
By.XPATH,
383-
"//button[@class='bp3-button bp3-minimal jp-Toolbar-kernelName "
384-
"jp-ToolbarButtonComponent minimal jp-Button']"
385-
)
386-
logging.info(f"Found Kernel name: {kernel_item.text}")
387-
assert kernel_item.text == "Data Science 2.0\n|\nPython 3\n|\n2 vCPU + 8 GiB"
388-
389386
# TODO: check banner if kernel is still starting, wait until banner disappears, then click restart
390387
# <div class="css-a7sx0c-bannerContainer sagemaker-starting-banner" id="sagemaker-notebook-banner"><div class="css-1qyc1pu-kernelStartingBannerContainer"><div><div class="css-6wrpfe-bannerSpinDiv"></div></div><div><p class="css-g9mx5z-bannerPromptSpanTitle">Starting notebook kernel...</p></div></div></div>
391388

@@ -437,10 +434,10 @@ def upload_file(browser, file_abs_path):
437434
logging.info(f"Created a file upload item: {file_input}")
438435
file_input.send_keys(file_abs_path)
439436
time.sleep(5) # Give time to overwrite dialog to apper
440-
confirmOverride(browser)
437+
confirm_overwrite(browser)
441438

442439

443-
def confirmOverride(browser):
440+
def confirm_overwrite(browser):
444441
overwrite_button = browser.find_elements(
445442
By.XPATH,
446443
"//div[@class='jp-Dialog-buttonLabel' "

0 commit comments

Comments
 (0)