public void exhibit_should_allow_skydrive_content_item_adding()
        {
            var contentDocumentItemSkyDrive = new ContentItem
            {
                Title = "ContentItemSkyDrive",
                Caption = "This is skydrive",
                SkyDriveFileType = ContentItem.SkyDriveType.Document,
                Attribution = "Tests Attribution",
                FileName = "test document"
            };

            var contentPictureItemSkyDrive = new ContentItem
            {
                Title = "ContentItemSkyDrive",
                Caption = "This is skydrive",
                SkyDriveFileType = ContentItem.SkyDriveType.Image,
                Attribution = "Tests Attribution",
                FileName = "panda"
            };
            var exhibit = new Exhibit
            {
                Title = "WebdriverExhibitWithContent",
                ContentItems = new Collection<Chronozoom.Entities.ContentItem> { contentDocumentItemSkyDrive, contentPictureItemSkyDrive }
            };
            ExhibitHelper.AddExhibitWithSkyDriveContentItem(exhibit);
            _newExhibit = ExhibitHelper.GetNewExhibit();
            Assert.AreEqual(exhibit.ContentItems.Count, _newExhibit.ContentItems.Count, "Content items count are not equal");
            for (int i = 0; i < exhibit.ContentItems.Count; i++)
            {
                Assert.AreEqual(exhibit.ContentItems[i].Title, _newExhibit.ContentItems[i].Title, "Content items titles are not equal");
            }
        }
Exemplo n.º 2
0
 public Exhibit GetNewExhibit()
 {
     Logger.Log("<-");
     const string script = Javascripts.LastCanvasElement;
     var exhibit = new Exhibit();
     var contentItem = new ContentItem();
     exhibit.ContentItems = new Collection<Chronozoom.Entities.ContentItem>();
     exhibit.Title = GetJavaScriptExecutionResult(script + ".title");
     int contentItemsCount = int.Parse(GetJavaScriptExecutionResult(script + ".contentItems.length"));
     Logger.Log("- contentItemsCount: " + contentItemsCount);
     for (int i = 0; i < contentItemsCount; i++)
     {
         string item = string.Format("{0}.contentItems[{1}].", script, i);
         contentItem.Title = GetJavaScriptExecutionResult(item + "title");
         Logger.Log("- contentItem.Title: " + contentItem.Title);
         contentItem.Caption = GetJavaScriptExecutionResult(item + "description");
         Logger.Log("- contentItem.Caption: " + contentItem.Caption);
         contentItem.Uri = GetJavaScriptExecutionResult(item + "uri");
         Logger.Log("- contentItem.MediaSource: " + contentItem.MediaSource);
         contentItem.MediaType = GetJavaScriptExecutionResult(item + "mediaType");
         Logger.Log("- contentItem.MediaType: " + contentItem.MediaType);
         contentItem.MediaSource = GetJavaScriptExecutionResult(item + "mediaSource");
         Logger.Log("- contentItem.MediaSource: " + contentItem.MediaSource);
         contentItem.Attribution = GetJavaScriptExecutionResult(item + "attribution");
         Logger.Log("- contentItem.attribution: " + contentItem.Attribution);
         exhibit.ContentItems.Add(contentItem);
     }
     exhibit.Id = new Guid(GetJavaScriptExecutionResult(script + ".guid"));
     Logger.Log("- exhibit.Id: " + exhibit.Id);
     Logger.Log("->" + exhibit);
     return exhibit;
 }
Exemplo n.º 3
0
        public NewExhibitApiResponse CreateExhibitByApi(Exhibit exhibit)
        {
            DataContractJsonSerializer exhibitSerializer = new DataContractJsonSerializer(typeof(Exhibit));
            DataContractJsonSerializer guidSerializer    = new DataContractJsonSerializer(typeof(NewExhibitApiResponse));

            exhibit.Timeline_ID = new Guid(CosmosGuidTemplate);

            //using (MemoryStream ms = new MemoryStream())
            //{
            //    exhibitSerializer.WriteObject(ms, exhibit);
            //    var ttt = Encoding.Default.GetString(ms.ToArray());
            //}

            HttpWebRequest request       = MakePutRequest(ExhibitApiServiceUrl);
            Stream         requestStream = request.GetRequestStream();

            exhibitSerializer.WriteObject(requestStream, exhibit);
            WebResponse response       = request.GetResponse();
            Stream      responseStream = response.GetResponseStream();

            if (responseStream == null)
            {
                throw new NullReferenceException("responseStream is null");
            }

            NewExhibitApiResponse newExhibitApiResponse = (NewExhibitApiResponse)guidSerializer.ReadObject(responseStream);

            return(newExhibitApiResponse);
        }
Exemplo n.º 4
0
        public void exhibit_should_allow_pdf_content_item_adding()
        {
            Logger.Log("Bug: https://github.com/alterm4nn/ChronoZoom/issues/526", LogType.Debug);
            var contentItemPdf = new ContentItem
            {
                Title = "ContentItemPdf",
                Caption = "This is pdf",
                MediaSource = "http://ads.ccsd.cnrs.fr/docs/00/10/47/81/PDF/p85_89_vol3483m.pdf",
                MediaType = "PDF",
                Attribution = "Tests Attribution",
                Uri = "http://ads.ccsd.cnrs.fr/docs/00/10/47/81/PDF/p85_89_vol3483m.pdf"

            };
            var exhibit = new Exhibit
            {
                Title = "WebdriverExhibitWithContent",
                ContentItems = new Collection<Chronozoom.Entities.ContentItem> {  contentItemPdf }
            };

            ExhibitHelper.AddExhibitWithContentItem(exhibit);
            _newExhibit = ExhibitHelper.GetNewExhibit();
            Assert.AreEqual(exhibit.ContentItems.Count, _newExhibit.ContentItems.Count, "Content items count are not equal");
            for (int i = 0; i < exhibit.ContentItems.Count; i++)
            {
                Assert.AreEqual(exhibit.ContentItems[i].Title, _newExhibit.ContentItems[i].Title, "Content items titles are not equal");
                Assert.AreEqual(exhibit.ContentItems[i].MediaType, _newExhibit.ContentItems[i].MediaType, true, "Content items mediaTypes are not equal");
                Assert.AreEqual(exhibit.ContentItems[i].Uri, _newExhibit.ContentItems[i].Uri, "Content items Uri are not equal");
            }
        }
Exemplo n.º 5
0
 public void AddExhibitWithoutFormClosing(Exhibit exhibit)
 {
     Logger.Log("<- " + exhibit);
     InitExhibitCreationMode();
     SetExhibitPoint();
     SetExhibitTitle(exhibit.Title);
     Logger.Log("->");
 }
Exemplo n.º 6
0
 public void AddExhibit(Exhibit exhibit)
 {
     Logger.Log("<- " + exhibit);
     InitExhibitCreationMode();
     SetExhibitPoint();
     SetExhibitTitle(exhibit.Title);
     SaveAndClose();
     Logger.Log("->");
 }
Exemplo n.º 7
0
 public void DeleteExhibit(Exhibit exhibit)
 {
     Logger.Log("<- title: " + exhibit.Title);
     NavigateToExhibit(exhibit);
     InitEditExhibitForm();
     ClickDeleteButton();
     ConfirmDeletion();
     Logger.Log("->");
 }
Exemplo n.º 8
0
        public static void ClassInitialize(TestContext testContext)
        {
            BrowserStateManager.RefreshState();
            HomePageHelper.OpenSandboxPage();
            HomePageHelper.DeleteAllElementsLocally();

            ExhibitHelper.AddExhibitWithContentItem(Exhibit);
            _newExhibit = ExhibitHelper.GetNewExhibit();
        }
Exemplo n.º 9
0
        public void DeleteExhibitByApi(Exhibit exhibit)
        {
            DataContractJsonSerializer exhibitSerializer = new DataContractJsonSerializer(typeof(Exhibit));

            HttpWebRequest request = MakeDeleteRequest(ExhibitApiServiceUrl);
            Stream requestStream = request.GetRequestStream();
            exhibitSerializer.WriteObject(requestStream, exhibit);
            request.GetResponse();
        }
Exemplo n.º 10
0
 public void DeleteExhibit(Exhibit exhibit)
 {
     Logger.Log("<- title: " + exhibit.Title);
     NavigateToExhibit(exhibit);
     MoveToElementAndClick(By.ClassName("virtualCanvasLayerCanvas"));
     InitEditExhibitForm();
     ClickDeleteButton();
     ConfirmDeletion();
     Logger.Log("->");
 }
Exemplo n.º 11
0
 public void AddExhibitWithSkyDriveContentItem(Exhibit exhibit)
 {
     Logger.Log("<- " + exhibit);
     InitExhibitCreationMode();
     SetExhibitPoint();
     SetExhibitTitle(exhibit.Title);
     HelperManager<ExhibitSkyDriveHelper>.Instance.AddSkyDriveArtifacts(exhibit.ContentItems);
     SaveAndClose();
     Logger.Log("->");
 }
Exemplo n.º 12
0
 public void AddExhibitWithContentItem(Exhibit exhibit)
 {
     Logger.Log("<- " + exhibit);
     InitExhibitCreationMode();
     SetExhibitPoint();
     SetExhibitTitle(exhibit.Title);
     AddArtifacts(exhibit.ContentItems);
     SaveAndClose();
     Logger.Log("->");
 }
Exemplo n.º 13
0
        public void DeleteExhibitByApi(Exhibit exhibit)
        {
            DataContractJsonSerializer exhibitSerializer = new DataContractJsonSerializer(typeof(Exhibit));

            HttpWebRequest request       = MakeDeleteRequest(ExhibitApiServiceUrl);
            Stream         requestStream = request.GetRequestStream();

            exhibitSerializer.WriteObject(requestStream, exhibit);
            request.GetResponse();
        }
Exemplo n.º 14
0
 public void DeleteExhibitByJavascript(Exhibit exhibit)
 {
     int childrenCount = int.Parse(GetJavaScriptExecutionResult(Javascripts.CosmosChildrenCount));
     for (int i = 0; i < childrenCount; i++)
     {
         string title =
             GetJavaScriptExecutionResult(
                 string.Format("{0}.children[{1}].title", Javascripts.Cosmos, i));
         if (title == exhibit.Title)
         {
             ExecuteJavaScript(string.Format("CZ.Service.deleteExhibit({0}.children[{1}])", Javascripts.Cosmos, i));
         }
     }
 }
Exemplo n.º 15
0
        public void TestInitialize()
        {
            BrowserStateManager.RefreshState();
            HomePageHelper.OpenSandboxPage();
            TourHelper.DeleteToursIfExist("webdriverTour");

            #region create timeline

            _newTimeline = new Timeline
            {
                FromYear = -6061670000,
                ToYear = -5808809999,
                Title = "WebDriverApiTitle"
            };
            ApiHelper.CreateTimelineByApi(_newTimeline);

            #endregion

            #region create exhibit

            var contentItems = new Collection<ContentItem>();
            var contentItem = new ContentItem { Title = "WebDriverApi", MediaType = "image", Uri = @"http://yandex.st/www/1.609/yaru/i/logo.png", Caption = "", Order = 0, Attribution = "", MediaSource = "" };
            contentItems.Add(contentItem);

            _newExhibit = new Exhibit
                {
                    Timeline_ID = _newTimeline.Id,
                    Title = "WebDriverApiExhibit",
                    Year = -8596430000,
                    ContentItems = contentItems
                };
            ApiHelper.CreateExhibitByApi(_newExhibit);

            #endregion

            #region init new tour

            _newTour = new Tour {Name = "webdriverTour", Description = "webdriver description"};
            Bookmark exhibitBookmark = new Bookmark { Name = "WebDriverApiExhibitBookmark", Id = _newExhibit.Id, Type = "exhibit" };
            Bookmark timelineBookmark = new Bookmark { Name = "WebDriverApiTimelineBookmark", Id = _newTimeline.Id, Type = "timeline" };
            Collection<Chronozoom.Entities.Bookmark> bookmarks = new Collection<Chronozoom.Entities.Bookmark> { exhibitBookmark, timelineBookmark };
            _newTour.Bookmarks = bookmarks;

            #endregion

            HomePageHelper.OpenSandboxPage();
        }
Exemplo n.º 16
0
        public NewExhibitApiResponse CreateExhibitByApi(Exhibit exhibit)
        {
            DataContractJsonSerializer putSerializer = new DataContractJsonSerializer(typeof(Exhibit));
            DataContractJsonSerializer guidSerializer = new DataContractJsonSerializer(typeof(NewExhibitApiResponse));

            exhibit.Timeline_ID = new Guid(CosmosGuidTemplate);

            HttpWebRequest request = MakePutRequest(ExhibitApiServiceUrl);
            Stream requestStream = request.GetRequestStream();
            putSerializer.WriteObject(requestStream, exhibit);
            WebResponse response = request.GetResponse();
            Stream responseStream = response.GetResponseStream();
            if (responseStream == null)
            {
                throw new NullReferenceException("responseStream is null");
            }

            NewExhibitApiResponse newExhibitApiResponse = (NewExhibitApiResponse)guidSerializer.ReadObject(responseStream);
            return newExhibitApiResponse;
        }
Exemplo n.º 17
0
        public void TestInitialize()
        {
            BrowserStateManager.RefreshState();
            #region create exhibit

            var contentItems = new Collection<ContentItem>();
            var contentItem = new ContentItem { Title = "WebDriverApi", MediaType = "image", Uri = @"http://yandex.st/www/1.609/yaru/i/logo.png", Caption = "", Order = 0, Attribution = "AttributionApI", MediaSource = "https://trello.com/board/development/510a91105420848638003cda" };
            contentItems.Add(contentItem);

            _newExhibit = new Exhibit
                {
                Timeline_ID = new Guid("bdc1ceff-76f8-4df4-ba72-96b353991314"),
                Title = "WebDriverApiExhibitAlexey",
                Year = -8596430000,
                ContentItems = contentItems
            };
            ApiHelper.CreateExhibitByApi(_newExhibit);

            #endregion
            HomePageHelper.OpenSandboxPage();
        }
Exemplo n.º 18
0
        public NewExhibitApiResponse CreateExhibitByApi(Exhibit exhibit)
        {
            DataContractJsonSerializer exhibitSerializer = new DataContractJsonSerializer(typeof(Exhibit));
            DataContractJsonSerializer guidSerializer    = new DataContractJsonSerializer(typeof(NewExhibitApiResponse));

            exhibit.Timeline_ID = new Guid(CosmosGuidTemplate);

            HttpWebRequest request       = MakePutRequest(ExhibitApiServiceUrl);
            Stream         requestStream = request.GetRequestStream();

            exhibitSerializer.WriteObject(requestStream, exhibit);
            WebResponse response       = request.GetResponse();
            Stream      responseStream = response.GetResponseStream();

            if (responseStream == null)
            {
                throw new NullReferenceException("responseStream is null");
            }

            NewExhibitApiResponse newExhibitApiResponse = (NewExhibitApiResponse)guidSerializer.ReadObject(responseStream);

            return(newExhibitApiResponse);
        }
Exemplo n.º 19
0
        public void TestInitialize()
        {
            BrowserStateManager.RefreshState();
            #region create exhibit

            var contentItems = new Collection <ContentItem>();
            var contentItem  = new ContentItem {
                Title = "WebDriverApi", MediaType = "image", Uri = @"http://yandex.st/www/1.609/yaru/i/logo.png", Caption = "", Order = 0, Attribution = "AttributionApI", MediaSource = "https://trello.com/board/development/510a91105420848638003cda"
            };
            contentItems.Add(contentItem);

            _newExhibit = new Exhibit
            {
                Timeline_ID  = new Guid("bdc1ceff-76f8-4df4-ba72-96b353991314"),
                Title        = "WebDriverApiExhibitAlexey",
                Year         = -8596430000,
                ContentItems = contentItems
            };
            _newExhibit.Id = new Guid(ApiHelper.CreateExhibitByApi(_newExhibit).ExhibitId);

            #endregion
            HomePageHelper.OpenSandboxPage();
        }
Exemplo n.º 20
0
        public void exhibit_should_allow_two_content_items_adding()
        {
            var contentItemImage = new ContentItem
            {
                Title = "ContentItemImage",
                MediaType = "Image",
                Uri = "http://i.telegraph.co.uk/multimedia/archive/02429/eleanor_scriven_2429776k.jpg"

            };
            var contentItemMusic = new ContentItem
            {
                Title = "ContentItemMusic",
                MediaType = "Audio",
                Uri = "http://libsyn.com/media/eslpod/ESLPod900.mp3"

            };
            var exhibit = new Exhibit
            {
                Title = "WebdriverExhibitWithContent",
                ContentItems = new Collection<Chronozoom.Entities.ContentItem> { contentItemImage, contentItemMusic }
            };

            ExhibitHelper.AddExhibitWithContentItem(exhibit);
            _newExhibit = ExhibitHelper.GetNewExhibit();
            Assert.AreEqual(exhibit.ContentItems.Count, _newExhibit.ContentItems.Count, "Content items count are not equal");
            for (int i = 0; i < exhibit.ContentItems.Count; i++)
            {
                Assert.AreEqual(exhibit.ContentItems[i].Title, _newExhibit.ContentItems[i].Title, "Content items titles are not equal");
                Assert.AreEqual(exhibit.ContentItems[i].MediaType, _newExhibit.ContentItems[i].MediaType, true, "Content items mediaTypes are not equal");
                Assert.AreEqual(exhibit.ContentItems[i].Uri, _newExhibit.ContentItems[i].Uri, "Content items Uri are not equal");
            }
        }
Exemplo n.º 21
0
 public string GetExhibitDisplayDate(Exhibit exhibit)
 {
     Logger.Log("<-");
     string scriptGetExhibit = String.Format("CZ.Common.vc.virtualCanvas('findElement', 'e{0}__title').text", exhibit.Id);
     int countExhibitTitleItems = int.Parse(GetJavaScriptExecutionResult(scriptGetExhibit + ".length"));
     var date = new StringBuilder();
     for (int index = 1; index < countExhibitTitleItems; index++)
     {
         date.Append(GetJavaScriptExecutionResult(String.Format("{0}[{1}]", scriptGetExhibit, index))).Append(" ");
     }
     Logger.Log("-> date: " + date);
     return date.ToString();
 }
Exemplo n.º 22
0
 public Exhibit GetNewExhibit()
 {
     Logger.Log("<-");
     var exhibit = new Exhibit
         {
             ContentItems = new Collection<Chronozoom.Entities.ContentItem>(),
             Title = GetJavaScriptExecutionResult(LastCanvasElement + ".title"),
             Year = GetNewExhibitYear(),
             Month = GetNewExhibitMonth(),
             Day = GetNewExhibitday()
         };
     int contentItemsCount = int.Parse(GetJavaScriptExecutionResult(LastCanvasElement + ".contentItems.length"));
     Logger.Log("- contentItemsCount: " + contentItemsCount, LogType.MessageWithoutScreenshot);
     for (int i = 0; i < contentItemsCount; i++)
     {
         var contentItem = new ContentItem();
         string item = string.Format("{0}.contentItems[{1}].", LastCanvasElement, i);
         contentItem.Title = GetJavaScriptExecutionResult(item + "title");
         Logger.Log("- contentItem.Title: " + contentItem.Title, LogType.MessageWithoutScreenshot);
         contentItem.Caption = GetJavaScriptExecutionResult(item + "description");
         Logger.Log("- contentItem.Caption: " + contentItem.Caption, LogType.MessageWithoutScreenshot);
         contentItem.Uri = GetJavaScriptExecutionResult(item + "uri");
         Logger.Log("- contentItem.Uri: " + contentItem.Uri, LogType.MessageWithoutScreenshot);
         contentItem.MediaType = GetJavaScriptExecutionResult(item + "mediaType");
         Logger.Log("- contentItem.MediaType: " + contentItem.MediaType, LogType.MessageWithoutScreenshot);
         contentItem.MediaSource = GetJavaScriptExecutionResult(item + "mediaSource");
         Logger.Log("- contentItem.MediaSource: " + contentItem.MediaSource, LogType.MessageWithoutScreenshot);
         contentItem.Attribution = GetJavaScriptExecutionResult(item + "attribution");
         Logger.Log("- contentItem.Attribution: " + contentItem.Attribution, LogType.MessageWithoutScreenshot);
         exhibit.ContentItems.Add(contentItem);
     }
     WaitCondition(() => (GetJavaScriptExecutionResult(LastCanvasElement + ".guid") != string.Empty), Configuration.ImplicitWait);
     string parseGuid = GetJavaScriptExecutionResult(LastCanvasElement + ".guid");
     Logger.Log("- parse guid: " + parseGuid, LogType.MessageWithoutScreenshot);
     exhibit.Id = new Guid(parseGuid);
     Logger.Log("- exhibit.Id: " + exhibit.Id, LogType.MessageWithoutScreenshot);
     Logger.Log("->" + exhibit);
     return exhibit;
 }
Exemplo n.º 23
0
 public void NavigateToExhibit(Exhibit exhibit)
 {
     Logger.Log("<- title: " + exhibit.Title);
     ExecuteJavaScript(string.Format("CZ.Search.goToSearchResult('e{0}')", exhibit.Id));
     WaitAnimation();
     Logger.Log("->");
 }
Exemplo n.º 24
0
 private void SetExhibitDate(Exhibit exhibit)
 {
     Logger.Log("<- name: " + exhibit.Title);
     SetTimeMode(exhibit.TimeMode);
     SetMonth(exhibit.Month);
     SetDay(exhibit.Day);
     SetYear(exhibit.Year.ToString(CultureInfo.InvariantCulture));
     Logger.Log("->");
 }
Exemplo n.º 25
0
 private void NavigateToExhibit(Exhibit exhibit)
 {
     Logger.Log("<- title: " + exhibit.Title);
     ExecuteJavaScript(string.Format("CZ.Search.goToSearchResult('e{0}')",exhibit.Id));
     WaitAnimation();
     MoveToElementAndClick(By.ClassName("virtualCanvasLayerCanvas"));
     Logger.Log("->");
 }
Exemplo n.º 26
0
 public bool IsExhibitFound(Exhibit exhibit)
 {
     Logger.Log("<- timeline: " + exhibit);
     try
     {
         ExecuteJavaScript(string.Format("CZ.Search.goToSearchResult('e{0}', 'timeline')", exhibit.Id));
         Logger.Log("-> true");
         return true;
     }
     catch (Exception)
     {
         Logger.Log("-> false");
         return false;
     }
 }
Exemplo n.º 27
0
 public void TestInitialize()
 {
     BrowserStateManager.RefreshState();
     HomePageHelper.OpenPage();
     AuthorizationHelper.OpenLoginPage();
     AuthorizationHelper.AuthenticateAsMicrosoftUser(); //authenticate as existing cz user
     HomePageHelper.DeleteAllElementsLocally();
     var exhibit = new Exhibit { Title = "WebdriverExhibitWithContent" };
     ExhibitHelper.AddExhibitWithoutFormClosing(exhibit);
     ExhibitHelper.ClickByAddArtifact();
 }