"use strict";

var _CreatePage = _interopRequireDefault(require("./pageObjects/CreatePage"));

var _LoginPage = _interopRequireDefault(require("./pageObjects/LoginPage"));

var _ProtectedPage = _interopRequireDefault(require("./pageObjects/ProtectedPage"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

describe('record types', function suite() {
  const loginPage = new _LoginPage.default();
  const landingPage = new _ProtectedPage.default();
  before(() => {
    loginPage.open();
    loginPage.login(testParams.adminUser.username, testParams.adminUser.password);
    landingPage.becomesVisible();
  });
  context('on the create page', function context() {
    const createPage = new _CreatePage.default();
    before(() => {
      landingPage.clickCreateNewLink();
      createPage.becomesVisible();
    });
    testParams.visibleRecordTypes.forEach(recordTypeDescriptor => {
      const [serviceType, name, displayName] = recordTypeDescriptor;
      it("should show a link for the ".concat(serviceType, " record named \"").concat(name, "\" with link text \"").concat(displayName, "\""), () => {
        createPage.hasRecordType({
          serviceType,
          name,
          displayName
        }).should.equal(true);
      });
    });
    testParams.visibleVocabularies.forEach(vocabularyDescriptor => {
      const [authorityName, name, displayName] = vocabularyDescriptor;
      it("should show a link for the ".concat(authorityName, " vocabulary named \"").concat(name, "\" with link text \"").concat(displayName, "\""), () => {
        createPage.hasVocabulary({
          authorityName,
          name,
          displayName
        }).should.equal(true);
      });
    });
    testParams.hiddenRecordTypes.forEach(recordTypeDescriptor => {
      const name = recordTypeDescriptor;
      it("should not show a link for the record named \"".concat(name, "\""), () => {
        createPage.hasRecordType({
          name
        }).should.equal(false);
      });
    });
    testParams.hiddenVocabularies.forEach(vocabularyDescriptor => {
      const [authorityName, name] = vocabularyDescriptor;
      it("should not show a link for the ".concat(authorityName, " vocabulary named \"").concat(name, "\""), () => {
        createPage.hasVocabulary({
          authorityName,
          name
        }).should.equal(false);
      });
    });
  }); // TODO: Test expected record types appear in search dropdowns and permissions list.
});