Skip to content
Snippets Groups Projects
app.download.e2e-spec.ts 2.42 KiB
Newer Older
import { AppPage } from "./app.po";
import { browser, by, element, ElementFinder, logging, protractor } from "protractor";
describe("workspace-project Test Page Download capability", () => {
  let page: AppPage;

  beforeEach(() => {
    page = new AppPage();
    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]"));
    expect(splInputTxtBox.isEnabled());
    expect(splInputTxtBox.isDisplayed());
    expect(splInputLabel.getText()).toEqual("Science Product");
    splInputTxtBox.getAttribute("value").then((value) => {
      expect(value === "uid://evla/quicklook_image/f5610635-efe3-49b4-a281-3c0f871e7e5b");
  });

  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");
    emailTxtBox.getAttribute("value").then((value) => {
      expect(value === "");
    });
  });

  it('should display a "launch download capability" button', () => {
    expect(page.getLaunchDownloadCapabilityButton().getText()).toEqual(
  // 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,