mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 17:08:53 +00:00
E2e test: addDockerHost to a specific team (#1116)
* Add optional argument to addDockerHost for teams
This commit is contained in:
parent
6b59a40dbc
commit
eaef007982
2 changed files with 13 additions and 4 deletions
|
|
@ -6,7 +6,7 @@ if (Cypress.env("FLEET_TIER") === "basic") {
|
|||
cy.seedBasic();
|
||||
cy.setupSMTP();
|
||||
cy.seedQueries();
|
||||
cy.addDockerHost();
|
||||
cy.addDockerHost("oranges");
|
||||
cy.logout();
|
||||
});
|
||||
afterEach(() => {
|
||||
|
|
|
|||
|
|
@ -234,16 +234,25 @@ Cypress.Commands.add("addUser", (username, options = {}) => {
|
|||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("addDockerHost", () => {
|
||||
// Ability to add a docker host to a team using args if ran after seedBasic()
|
||||
Cypress.Commands.add("addDockerHost", (team = "") => {
|
||||
const serverPort = new URL(Cypress.config().baseUrl).port;
|
||||
// Get enroll secret
|
||||
let enrollSecretURL = "/api/v1/fleet/spec/enroll_secret";
|
||||
if (team === "apples") {
|
||||
enrollSecretURL = "/api/v1/fleet/teams/1/secrets";
|
||||
} else if (team === "oranges") {
|
||||
enrollSecretURL = "/api/v1/fleet/teams/2/secrets";
|
||||
}
|
||||
|
||||
cy.request({
|
||||
url: "/api/v1/fleet/spec/enroll_secret",
|
||||
url: enrollSecretURL,
|
||||
auth: {
|
||||
bearer: window.localStorage.getItem("FLEET::auth_token"),
|
||||
},
|
||||
}).then(({ body }) => {
|
||||
const enrollSecret = body.specs.secrets[0].secret;
|
||||
const enrollSecret =
|
||||
team === "" ? body.specs.secrets[0].secret : body.secrets[0].secret;
|
||||
|
||||
// Start up docker-compose with enroll secret
|
||||
cy.exec(
|
||||
|
|
|
|||
Loading…
Reference in a new issue