"use strict";
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const intern = require("intern").default;
const { assert } = intern.getPlugin("chai");
const { registerSuite } = intern.getInterface("object");
const FunctionalHelpers = require("./lib/helpers.js");

var url = function (path) {
  return intern.config.functionalBaseUrl + path;
};

registerSuite("Comments (non-auth)", {
  tests: {
    "Comment form not visible for logged out users"() {
      return FunctionalHelpers.openPage(this, url("issues/200"), ".js-Issue")
        .findByCssSelector(".js-Comment-form")
        .then(assert.fail, function (err) {
          assert.isTrue(/NoSuchElement/.test(String(err)));
        })
        .end();
    },
  },
});
