1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 describe("AuthMiddleware", () => {
10 // Only set up common users once. These aren't set up as aliases because
11 // aliases are cleaned up after every test. Also it doesn't make sense
12 // to set the same users on beforeEach() over and over again, so we
13 // separate a little from Cypress' 'Best Practices' here.
14 cy.getUser("admin", "Admin", "User", true, true)
17 adminUser = this.adminUser;
19 cy.getUser("user", "Active", "User", false, true)
22 activeUser = this.activeUser;
26 it("handles LOGOUT action", () => {
27 cy.loginAs(activeUser);
29 // verify that the token is stored in localStorage
30 cy.window().then(win => {
31 expect(win.localStorage.getItem('apiToken')).to.equal(activeUser.token);
35 cy.get('[aria-label="Account Management"]').click();
36 cy.get('[data-cy=logout-menuitem]').click();
38 cy.window().then(win => {
39 // verify that logout has been successful
40 cy.contains("Please log in.").should("exist");
41 expect(win.localStorage.getItem('apiToken')).to.be.null;