spec: fix brittle spec

wait for the migration to be queued/running, otherwise we sometimes leave
the page before the ajax/upload/ajax dance finishes, making the spec fail

test plan:
./spec/selenium/content_migrations_spec.rb:115 should always pass now

Change-Id: I689127b351566ef86cfea024a97ad938a92dbd7f
Reviewed-on: https://gerrit.instructure.com/89393
Tested-by: Jenkins
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
This commit is contained in:
Jon Jensen 2016-08-31 17:06:49 -06:00
parent a347c859b3
commit 271a650a82
1 changed files with 4 additions and 2 deletions

View File

@ -26,10 +26,12 @@ end
def submit
@course.reload
count = @course.content_migrations.count
# depending on the type of migration, we need to wait for it to have one of these states
scope = { workflow_state: %w[queued exporting exported] }
count = @course.content_migrations.where(scope).count
driver.execute_script("$('#migrationConverterContainer').submit()")
keep_trying_until do
expect(@course.content_migrations.count).to eq count + 1
expect(@course.content_migrations.where(scope).count).to eq count + 1
end
end