arunprakash
arunprakash

Reputation: 1

Protractor Customized Reporting

Am using Protractor Jasmine Framework along with jasmine allure reporter.Please give clarifications for following:

  1. is reporter pass/fail steps is only based on describe it blocks only?
  2. Am using multiple steps inside a it block. How can we add test step without using it blocks? Like each and every step needs to be reported.
  3. How can we print a passed expect statement in html file reporter?

Upvotes: 0

Views: 476

Answers (1)

AKJ
AKJ

Reputation: 328

You can use chaining to have multiple condition in an it block.

    it("checks URLs redirect to data browser after deletion.", function () {
            var EC = protractor.ExpectedConditions,
                modalTitle = modalInstance.recordPage.getConfirmDeleteTitle(),
                config, redirectUrl;

            browser.executeScript('return configObject;').then(function(configObject) {
                config = configObject;
                return modalInstance.recEditPage.getDeleteRecordButton().click()
            }).then(function () {
                browser.wait(EC.visibilityOf(modalTitle), browser.params.defaultTimeout);
                // expect modal to open
                return modalTitle.getText();
            }).then(function (text) {
                expect(text).toBe("Confirm Delete!!");

                return modalInstance.recPage.getConfirmDeleteButton().click();
            }).then(function () {
                redirectUrl = "https://test/xyz";

                browser.wait(function () {
                    return browser.driver.getCurrentUrl().then(function(url) {
                        return url.startsWith(redirectUrl);
                    })
                });

                return browser.driver.getCurrentUrl();
            }).then(function (url) {
                expect(url.startsWith(redirectUrl)).toBe(true);

            }).catch(function(error) {
                console.dir(error);
                expect(error).not.toBeDefined();
            });;
        });

I use jasmin-spec-reporter for reporting.

Upvotes: -1

Related Questions