Newer
Older
import { AppPage } from "./app.po";

Nathan Hertz
committed
import { browser, by, element, ElementFinder, logging, protractor } from "protractor";

Andrew Kapuscinski
committed
describe("workspace-project Test Page Download capability", () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();

Andrew Kapuscinski
committed
page.navigateToWorkspacesHome();
expect(browser.getCurrentUrl()).toBe(`${browser.baseUrl}workspaces`);
});
it("should display science product text box for download parameters", () => {
const splInputTxtBox: ElementFinder = element(by.css("#splInput"));
const splInputLabel: ElementFinder = element(by.css("label[for=splInput]"));

Nathan Hertz
committed
expect(splInputTxtBox.isEnabled());
expect(splInputTxtBox.isDisplayed());
expect(splInputLabel.getText()).toEqual("Science Product");

Nathan Hertz
committed
splInputTxtBox.getAttribute("value").then((value) => {
expect(value === "uid://evla/quicklook_image/f5610635-efe3-49b4-a281-3c0f871e7e5b");

Nathan Hertz
committed
});
});
it("should display email text box for download parameters", () => {
const emailTxtBox: ElementFinder = element(by.css("#userEmail"));
const emailLabel: ElementFinder = element(by.css("label[for=userEmail]"));
expect(emailLabel.getText()).toEqual("Email Address");

Nathan Hertz
committed
emailTxtBox.getAttribute("value").then((value) => {
expect(value === "");
});
});
it('should display a "launch download capability" button', () => {
expect(page.getLaunchDownloadCapabilityButton().getText()).toEqual(

Nathan Hertz
committed
"Launch download capability",
);
});

Nathan Hertz
committed
// it("should redirect to request page when download button clicked", () => {
// const launchDownloadCapabilityButton: ElementFinder = element(
// by.css("#launchDownloadCapabilityBtn"),
// );
// browser
// .wait(
// protractor.ExpectedConditions.elementToBeClickable(launchDownloadCapabilityButton),
// 5000,
// )
// .then(() => {
// launchDownloadCapabilityButton.click();
// });
//
// expect(
// browser.wait(protractor.ExpectedConditions.urlContains("request-status"), 5000).catch(() => {
// return false;
// }),
// ).toBeTruthy(`Url match could not succced`);
// });
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(
jasmine.objectContaining({
level: logging.Level.SEVERE,

Nathan Hertz
committed
} as logging.Entry),
);
});
});