diff --git a/docs/source/nb/omegaml-tutorial.ipynb b/docs/source/nb/omegaml-tutorial.ipynb index 4bf76ec5..22055407 100644 --- a/docs/source/nb/omegaml-tutorial.ipynb +++ b/docs/source/nb/omegaml-tutorial.ipynb @@ -357,8 +357,7 @@ "params = {\n", " 'n_clusters': range(1,8),\n", " }\n", - "meta = om.runtime.model('iris-model').gridsearch('iris[^y]', 'iris[y]', parameters=params).get()\n", - "meta.name" + "om.runtime.model('iris-model').gridsearch('iris[^y]', 'iris[y]', parameters=params).get()" ] }, { diff --git a/omegaml/tests/features/environment.py b/omegaml/tests/features/environment.py index 9698fa0d..76055eac 100644 --- a/omegaml/tests/features/environment.py +++ b/omegaml/tests/features/environment.py @@ -43,6 +43,9 @@ def before_all(context): context.om = om.setup() context.nbfiles = os.environ.get('BEHAVE_NBFILES', './docs/source/nb') +def before_scenario(context, scenario): + # FIXME we do this because context.feature is set dynamically in EE testing + context.feature.jynb_url = context.jynb_url def after_step(context, step): context.screenshotfn = os.path.join(context.screenshot_path, step.name + '.png') diff --git a/omegaml/tests/features/steps/notebook.py b/omegaml/tests/features/steps/notebook.py index 0bcd5bbf..c53afaa9 100644 --- a/omegaml/tests/features/steps/notebook.py +++ b/omegaml/tests/features/steps/notebook.py @@ -8,7 +8,7 @@ @when(u'we open jupyter') def open_jupyter(ctx): br = ctx.browser - br.visit(ctx.jynb_url) + br.visit(ctx.feature.jynb_url) nb = Notebook(br) login_required = br.is_text_present('Password', wait_time=2) login_required |= br.is_text_present('token', wait_time=2) @@ -61,7 +61,7 @@ def list_datasets(ctx): @then(u'we can add a notebook in the folder') def add_notebook_in_folder(ctx): br = ctx.browser - br.visit(ctx.jynb_url) + br.visit(ctx.feature.jynb_url) nb = Notebook(br) nb.jupyter_home nb.open_folder('Untitled Folder') diff --git a/omegaml/tests/features/steps/tftutorial.py b/omegaml/tests/features/steps/tftutorial.py index 6330dddb..2b5f38a5 100644 --- a/omegaml/tests/features/steps/tftutorial.py +++ b/omegaml/tests/features/steps/tftutorial.py @@ -19,7 +19,7 @@ def uploadtutorial(ctx, nbname): nbcells = nbread(nbfname, as_version=4) om.jobs.put(nbcells, nbname) # now run the notebook - br.visit(ctx.jynb_url) + br.visit(ctx.feature.jynb_url) assert br.is_text_present(nbname) @@ -27,9 +27,10 @@ def uploadtutorial(ctx, nbname): def runnotebook(ctx, nbname): br = ctx.browser om = ctx.feature.om - br.visit(ctx.jynb_url) + br.visit(ctx.feature.jynb_url) nb = Notebook(br) - nb.open_notebook(nbname) + # FIXME sometimes it takes long for the nb to appear. why? + nb.open_notebook(nbname, retry=10) nb.run_all_cells(wait=True) nb.save_notebook() assert not br.is_text_present('Error') @@ -38,6 +39,7 @@ def runnotebook(ctx, nbname): assert not br.is_text_present('MissingSchema') assert not br.is_text_present('error') + @then('model {model_name} exists') def checkmodel(ctx, model_name): br = ctx.browser diff --git a/omegaml/tests/features/util.py b/omegaml/tests/features/util.py index 3040b158..d639a773 100644 --- a/omegaml/tests/features/util.py +++ b/omegaml/tests/features/util.py @@ -84,9 +84,15 @@ def create_notebook(self, folder=None): self.last_notebook return self - def open_notebook(self, name): + def open_notebook(self, name, retry=5): self.jupyter_home br = self.browser + retry = 5 + # FIXME sometimes it takes long for the nb to appear why? + while retry: + br.reload() + found = br.is_text_present(name, wait_time=60) + retry = 0 if found else retry item = br.find_link_by_partial_text(name) item.click() sleep(2)