Skip to content
Snippets Groups Projects
Unverified Commit 02374545 authored by Nemanja Glumac's avatar Nemanja Glumac Committed by GitHub
Browse files

Remove legacy EE hard coded version info (#20746)

parent fd2cfaa7
No related branches found
No related tags found
No related merge requests found
......@@ -6,8 +6,6 @@ import "@cypress/skip-test/support";
import "@percy/cypress";
import "./commands";
export const version = require("../../../../version.json");
export * from "./helpers/e2e-setup-helpers";
export * from "./helpers/e2e-ui-elements-helpers";
export * from "./helpers/e2e-dashboard-helpers";
......
import { restore, version } from "__support__/e2e/cypress";
import { restore } from "__support__/e2e/cypress";
describe("admin > settings > embedding ", () => {
// Skipping temporarily because tests need to be updated to work
describe.skip("admin > settings > embedding ", () => {
beforeEach(() => {
restore();
cy.signInAsAdmin();
});
if (version.edition !== "enterprise") {
describe(" > embedding settings", () => {
it("should validate a premium embedding token has a valid format", () => {
cy.server();
cy.route("PUT", "/api/setting/premium-embedding-token").as(
"saveEmbeddingToken",
);
describe(" > embedding settings", () => {
it("should validate a premium embedding token has a valid format", () => {
cy.server();
cy.route("PUT", "/api/setting/premium-embedding-token").as(
"saveEmbeddingToken",
);
cy.visit("/admin/settings/embedding_in_other_applications");
cy.contains("Premium embedding");
cy.contains("Enter a token").click();
cy.visit("/admin/settings/embedding_in_other_applications");
cy.contains("Premium embedding");
cy.contains("Enter a token").click();
// Try an invalid token format
cy.contains("Enter the token")
.next()
.type("Hi")
.blur();
cy.wait("@saveEmbeddingToken").then(({ response }) => {
expect(response.body).to.equal(
"Token format is invalid. Token should be 64 hexadecimal characters.",
);
});
cy.contains("Token format is invalid.");
// Try an invalid token format
cy.contains("Enter the token")
.next()
.type("Hi")
.blur();
cy.wait("@saveEmbeddingToken").then(({ response }) => {
expect(response.body).to.equal(
"Token format is invalid. Token should be 64 hexadecimal characters.",
);
});
cy.contains("Token format is invalid.");
});
it("should validate a premium embedding token exists", () => {
cy.server();
cy.route("PUT", "/api/setting/premium-embedding-token").as(
"saveEmbeddingToken",
);
it("should validate a premium embedding token exists", () => {
cy.server();
cy.route("PUT", "/api/setting/premium-embedding-token").as(
"saveEmbeddingToken",
);
cy.visit("/admin/settings/embedding_in_other_applications");
cy.contains("Premium embedding");
cy.contains("Enter a token").click();
cy.visit("/admin/settings/embedding_in_other_applications");
cy.contains("Premium embedding");
cy.contains("Enter a token").click();
// Try a valid format, but an invalid token
cy.contains("Enter the token")
.next()
.type(
"11397b1e60cfb1372f2f33ac8af234a15faee492bbf5c04d0edbad76da3e614a",
)
.blur();
cy.wait("@saveEmbeddingToken").then(({ response }) => {
expect(response.body).to.equal(
"Unable to validate token: 404 not found.",
);
});
cy.contains("Unable to validate token: 404 not found.");
// Try a valid format, but an invalid token
cy.contains("Enter the token")
.next()
.type(
"11397b1e60cfb1372f2f33ac8af234a15faee492bbf5c04d0edbad76da3e614a",
)
.blur();
cy.wait("@saveEmbeddingToken").then(({ response }) => {
expect(response.body).to.equal(
"Unable to validate token: 404 not found.",
);
});
cy.contains("Unable to validate token: 404 not found.");
});
it("should be able to set a premium embedding token", () => {
// A random embedding token with valid format
const embeddingToken =
"11397b1e60cfb1372f2f33ac8af234a15faee492bbf5c04d0edbad76da3e614a";
it("should be able to set a premium embedding token", () => {
// A random embedding token with valid format
const embeddingToken =
"11397b1e60cfb1372f2f33ac8af234a15faee492bbf5c04d0edbad76da3e614a";
cy.server();
cy.route({
method: "PUT",
url: "/api/setting/premium-embedding-token",
response: embeddingToken,
}).as("saveEmbeddingToken");
cy.server();
cy.route({
method: "PUT",
url: "/api/setting/premium-embedding-token",
response: embeddingToken,
}).as("saveEmbeddingToken");
cy.visit("/admin/settings/embedding_in_other_applications");
cy.contains("Premium embedding");
cy.contains("Enter a token").click();
cy.visit("/admin/settings/embedding_in_other_applications");
cy.contains("Premium embedding");
cy.contains("Enter a token").click();
cy.route("GET", "/api/session/properties").as("getSessionProperties");
cy.route({
method: "GET",
url: "/api/setting",
response: [
{ key: "enable-embedding", value: true },
{ key: "embedding-secret-key", value: embeddingToken },
{ key: "premium-embedding-token", value: embeddingToken },
],
}).as("getSettings");
cy.route("GET", "/api/session/properties").as("getSessionProperties");
cy.route({
method: "GET",
url: "/api/setting",
response: [
{ key: "enable-embedding", value: true },
{ key: "embedding-secret-key", value: embeddingToken },
{ key: "premium-embedding-token", value: embeddingToken },
],
}).as("getSettings");
cy.contains("Enter the token")
.next()
.type(embeddingToken)
.blur();
cy.wait("@saveEmbeddingToken").then(({ response }) => {
expect(response.body).to.equal(embeddingToken);
});
cy.wait("@getSessionProperties");
cy.wait("@getSettings");
cy.contains("Premium embedding enabled");
cy.contains("Enter the token")
.next()
.type(embeddingToken)
.blur();
cy.wait("@saveEmbeddingToken").then(({ response }) => {
expect(response.body).to.equal(embeddingToken);
});
cy.wait("@getSessionProperties");
cy.wait("@getSettings");
cy.contains("Premium embedding enabled");
});
}
});
});
{
"edition": "enterprise"
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment