public void GivenIRememberTheSubHeaderText()
        {
            var page    = new W3SchoolsTablePage(Browser);
            var divText = page.TopTextDiv.Text;

            PropertyBucket.Remember("W3SchoolsHeaderText", divText);
        }
Exemple #2
0
        public void GivenIRememberTheSubHeaderText()
        {
            var page    = _viewFactory.Get <W3SchoolsTablePage>();
            var divText = page.TopTextDiv.Text;

            PropertyBucket.Remember("W3SchoolsHeaderText", divText);
        }
        public void ThenTheGetResponseShouldContainTheFollowingData(Table table)
        {
            var postData = PropertyBucket.GetProperty <Dictionary <string, string> >("PostData");
            var row      = table.Rows[0];

            foreach (var kvp in row)
            {
                Assert.AreEqual(kvp.Value, postData[kvp.Key]);
            }
        }
Exemple #4
0
        public void ThenNavigationWillTimeOut(string flag)
        {
            bool navigationTimedOut = PropertyBucket.GetProperty <bool>("NavigationTimedOut");

            if (flag == "does")
            {
                Assert.That(navigationTimedOut, Is.True, "Navigation did not timeout");
            }
            else
            {
                Assert.That(navigationTimedOut, Is.False, "Navigation timed out");
            }
        }
        public void ThenIShouldGetAStatusCodeOf(string statusCode)
        {
            var            deleteResponse = PropertyBucket.GetProperty <IRestResponse>("DeleteResponse");
            HttpStatusCode code;

            if (Enum.TryParse(statusCode, true, out code))
            {
                Assert.AreEqual(code, deleteResponse.StatusCode);
            }
            else
            {
                throw new Exception($"Invalid HttpStatusCode specified: {statusCode}");
            }
        }
        public void GivenIPatchOrPutARecordWithId(string method, int id, Table table)
        {
            Dictionary <string, string> result = null;

            switch (method)
            {
            case "Patch":
                result = SimplePatch(BaseApiUrl, $"posts/{id}", table.Rows[0]);
                break;

            case "Put":
                result = SimplePut(BaseApiUrl, $"posts/{id}", table.Rows[0]);
                break;
            }

            PropertyBucket.Remember($"{method}Data", result);
        }
Exemple #7
0
        public void GivenIPatchOrPutARecordWithId(string method, int id, Table table)
        {
            Dictionary <string, string> result = null;

            switch (method)
            {
            case "Patch":
                result = SimplePatch(BaseApiUrl, String.Format("posts/{0}", id), table.Rows[0]);
                break;

            case "Put":
                result = SimplePut(BaseApiUrl, String.Format("posts/{0}", id), table.Rows[0]);
                break;
            }

            PropertyBucket.Remember <Dictionary <string, string> >(String.Format("{0}Data", method), result);
        }
Exemple #8
0
 public void GivenITryToNavigateToGoogle()
 {
     PropertyBucket.Remember("NavigationTimedOut", NavigationTimedOut(TestSettings.GoogleUrl));
 }
        public void GivenIPerformAdeleteForPostId(int postId)
        {
            var response = Delete(BaseApiUrl, $"posts/{postId}");

            PropertyBucket.Remember <IRestResponse>("DeleteResponse", response);
        }
        public void GivenIPerformAgetForPost(int postId)
        {
            var response = SimpleGet(BaseApiUrl, $"/posts/{postId}");

            PropertyBucket.Remember("PostData", response);
        }
Exemple #11
0
        protected void BeforeScenario()
        {
            // Check for a session configuration that was injected in and if one exists, use it
            SessionConfiguration config = _objectContainer.Resolve<SessionConfiguration>();
            var browser = config != null ? new BrowserSession(config) : new BrowserSession();
            _objectContainer.RegisterInstanceAs<BrowserSession>(browser);

            // Apply zukini specific settings
            if (ZukiniConfig.MaximizeBrowser)
            {
                browser.MaximiseWindow();
            }

            // Create a property bucket so we have a place to store values between steps
            var propertyBucket = new PropertyBucket();
            _objectContainer.RegisterInstanceAs<PropertyBucket>(propertyBucket);

            Console.WriteLine("Unique Test Id: {0}", propertyBucket.TestId);
        }
        public void GivenIPostTheFollowingDataToTheApi(Table table)
        {
            var result = SimplePost(BaseApiUrl, "/posts", table.Rows[0]);

            PropertyBucket.Remember("PostData", result);
        }
Exemple #13
0
        public void GivenIPerformADELETEForPostId(int postId)
        {
            var response = Delete(BaseApiUrl, String.Format("posts/{0}", postId));

            PropertyBucket.Remember <IRestResponse>("DeleteResponse", response);
        }
Exemple #14
0
        public void GivenIPerformAGETForPost(int postId)
        {
            var response = SimpleGet(BaseApiUrl, String.Format("/posts/{0}", postId));

            PropertyBucket.Remember("PostData", response);
        }
Exemple #15
0
 public void GivenITryToNavigateToAUrlThatChangesTheBrowserLocation()
 {
     PropertyBucket.Remember("NavigationTimedOut", NavigationTimedOut(TestSettings.GoogleHttpUrl));
 }
        public void ThenThePostDataShouldReturnInTheField(string expectedValue, string fieldName)
        {
            var postData = PropertyBucket.GetProperty <Dictionary <string, string> >("PostData");

            Assert.AreEqual(expectedValue, postData[fieldName]);
        }
        public void ThenThePutOrPostDataShouldReturnInTheField(string method, string expectedValue, string fieldName)
        {
            var resultData = PropertyBucket.GetProperty <Dictionary <string, string> >($"{method}Data");

            Assert.AreEqual(expectedValue, resultData[fieldName]);
        }
Exemple #18
0
        public void ThenTheSubHeaderTextShouldHaveBeen(string headerText)
        {
            string rememberedText = PropertyBucket.GetProperty <string>("W3SchoolsHeaderText");

            Assert.AreEqual(headerText, rememberedText);
        }
    public void GivenIPerformAGETForPost(int postId)
    {
        var response = SimpleGet(new Uri("http://jsonplaceholder.typicode.com"), String.Format("/posts/{0}", postId));

        PropertyBucket.Remember("PostData", response);
    }