Add timestamp value test
TNL-925
This commit is contained in:
@@ -3,6 +3,7 @@ Import/Export pages.
|
||||
"""
|
||||
from bok_choy.promise import EmptyPromise
|
||||
import os
|
||||
import re
|
||||
import requests
|
||||
from .utils import click_css
|
||||
from .library import LibraryPage
|
||||
@@ -118,6 +119,16 @@ class ImportMixin(object):
|
||||
|
||||
url_path = "import"
|
||||
|
||||
@property
|
||||
def timestamp(self):
|
||||
"""
|
||||
The timestamp is displayed on the page as "(MM/DD/YYYY at HH:mm)"
|
||||
It parses the timestamp and returns a (date, time) tuple
|
||||
"""
|
||||
string = self.q(css='.item-progresspoint-success-date').text[0]
|
||||
|
||||
return re.match(r'\(([^ ]+).+?(\d{2}:\d{2})', string).groups()
|
||||
|
||||
def is_browser_on_page(self):
|
||||
"""
|
||||
Verify this is the export page
|
||||
|
||||
@@ -3,6 +3,7 @@ Acceptance tests for the Import and Export pages
|
||||
"""
|
||||
from abc import abstractmethod
|
||||
from bok_choy.promise import EmptyPromise
|
||||
from datetime import datetime
|
||||
from .base_studio_test import StudioLibraryTest, StudioCourseTest
|
||||
from ...fixtures.course import XBlockFixtureDesc
|
||||
from ...pages.studio.import_export import ExportLibraryPage, ExportCoursePage, ImportLibraryPage, ImportCoursePage
|
||||
@@ -183,10 +184,25 @@ class ImportTestMixin(object):
|
||||
self.import_page.upload_tarball(self.tarball_name)
|
||||
self.import_page.wait_for_upload()
|
||||
|
||||
def test_successful_import_timestamp(self):
|
||||
def test_import_timestamp_value(self):
|
||||
"""
|
||||
Scenario: I perform a course / library import
|
||||
On import success, the page displays its UTC timestamp previously not visible
|
||||
On import success, the page displays a UTC timestamp
|
||||
"""
|
||||
self.import_page.upload_tarball(self.tarball_name)
|
||||
self.import_page.wait_for_upload()
|
||||
|
||||
utc_now = datetime.utcnow()
|
||||
import_date, import_time = self.import_page.timestamp
|
||||
|
||||
self.assertTrue(self.import_page.is_timestamp_visible())
|
||||
self.assertEqual(utc_now.strftime('%m/%d/%Y'), import_date)
|
||||
self.assertEqual(utc_now.strftime('%H:%M'), import_time)
|
||||
|
||||
def test_import_timestamp_visibility(self):
|
||||
"""
|
||||
Scenario: I perform a course / library import
|
||||
On import success, the page displays a timestamp previously not visible
|
||||
And if I refresh the page, the timestamp is still displayed
|
||||
"""
|
||||
self.assertFalse(self.import_page.is_timestamp_visible())
|
||||
|
||||
Reference in New Issue
Block a user