Apply repository-wide ESLint auto-fix formatting pass
Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
@@ -4,55 +4,61 @@
|
||||
// cindy.chang@dsp.im (Cindy Chang), 2024/07/03
|
||||
// imacat.yang@dsp.im (imacat), 2026/03/05
|
||||
|
||||
import { loginWithFixtures } from '../../support/intercept';
|
||||
import { loginWithFixtures } from "../../support/intercept";
|
||||
|
||||
const MSG_ACCOUNT_NOT_UNIQUE = 'Account has already been registered.';
|
||||
const MSG_ACCOUNT_NOT_UNIQUE = "Account has already been registered.";
|
||||
|
||||
describe('Account duplication check.', () => {
|
||||
describe("Account duplication check.", () => {
|
||||
beforeEach(() => {
|
||||
loginWithFixtures();
|
||||
cy.visit('/account-admin');
|
||||
cy.wait('@getUsers');
|
||||
cy.visit("/account-admin");
|
||||
cy.wait("@getUsers");
|
||||
});
|
||||
|
||||
it('When an account already exists, show error message on confirm.', () => {
|
||||
const testAccountName = '000000';
|
||||
it("When an account already exists, show error message on confirm.", () => {
|
||||
const testAccountName = "000000";
|
||||
|
||||
// First creation: account doesn't exist yet
|
||||
cy.intercept('GET', '/api/users/000000', {
|
||||
cy.intercept("GET", "/api/users/000000", {
|
||||
statusCode: 404,
|
||||
body: { detail: 'Not found' },
|
||||
}).as('checkNewUser');
|
||||
body: { detail: "Not found" },
|
||||
}).as("checkNewUser");
|
||||
|
||||
cy.contains('button', 'Create New').should('be.visible').click();
|
||||
cy.get('#input_account_field').type(testAccountName);
|
||||
cy.get('#input_name_field').type(testAccountName);
|
||||
cy.get('#input_first_pwd').type(testAccountName);
|
||||
cy.get('.checkbox-and-text').first().find('div').first().click();
|
||||
cy.contains("button", "Create New").should("be.visible").click();
|
||||
cy.get("#input_account_field").type(testAccountName);
|
||||
cy.get("#input_name_field").type(testAccountName);
|
||||
cy.get("#input_first_pwd").type(testAccountName);
|
||||
cy.get(".checkbox-and-text").first().find("div").first().click();
|
||||
|
||||
cy.contains('button', 'Confirm')
|
||||
.should('be.visible')
|
||||
.and('be.enabled')
|
||||
cy.contains("button", "Confirm")
|
||||
.should("be.visible")
|
||||
.and("be.enabled")
|
||||
.click();
|
||||
cy.wait('@postUser');
|
||||
cy.contains('Account added').should('be.visible');
|
||||
cy.wait("@postUser");
|
||||
cy.contains("Account added").should("be.visible");
|
||||
|
||||
// Second creation: now account exists — override to return 200
|
||||
cy.intercept('GET', '/api/users/000000', {
|
||||
cy.intercept("GET", "/api/users/000000", {
|
||||
statusCode: 200,
|
||||
body: { username: '000000', name: '000000', is_admin: false, is_active: true, roles: [] },
|
||||
}).as('checkExistingUser');
|
||||
body: {
|
||||
username: "000000",
|
||||
name: "000000",
|
||||
is_admin: false,
|
||||
is_active: true,
|
||||
roles: [],
|
||||
},
|
||||
}).as("checkExistingUser");
|
||||
|
||||
cy.contains('button', 'Create New').should('be.visible').click();
|
||||
cy.get('#input_account_field').type(testAccountName);
|
||||
cy.get('#input_name_field').type(testAccountName);
|
||||
cy.get('#input_first_pwd').type(testAccountName);
|
||||
cy.get('.checkbox-and-text').first().find('div').first().click();
|
||||
cy.contains("button", "Create New").should("be.visible").click();
|
||||
cy.get("#input_account_field").type(testAccountName);
|
||||
cy.get("#input_name_field").type(testAccountName);
|
||||
cy.get("#input_first_pwd").type(testAccountName);
|
||||
cy.get(".checkbox-and-text").first().find("div").first().click();
|
||||
|
||||
cy.contains('button', 'Confirm')
|
||||
.should('be.visible')
|
||||
.and('be.enabled')
|
||||
cy.contains("button", "Confirm")
|
||||
.should("be.visible")
|
||||
.and("be.enabled")
|
||||
.click();
|
||||
cy.contains(MSG_ACCOUNT_NOT_UNIQUE).should('be.visible');
|
||||
cy.contains(MSG_ACCOUNT_NOT_UNIQUE).should("be.visible");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,33 +4,33 @@
|
||||
// cindy.chang@dsp.im (Cindy Chang), 2024/07/02
|
||||
// imacat.yang@dsp.im (imacat), 2026/03/05
|
||||
|
||||
import { loginWithFixtures } from '../../support/intercept';
|
||||
import { loginWithFixtures } from "../../support/intercept";
|
||||
|
||||
describe('Password validation on create account.', () => {
|
||||
describe("Password validation on create account.", () => {
|
||||
beforeEach(() => {
|
||||
loginWithFixtures();
|
||||
cy.visit('/account-admin');
|
||||
cy.wait('@getUsers');
|
||||
cy.visit("/account-admin");
|
||||
cy.wait("@getUsers");
|
||||
});
|
||||
|
||||
it('When password is too short, confirm button stays disabled.', () => {
|
||||
cy.contains('button', 'Create New').should('be.visible').click();
|
||||
it("When password is too short, confirm button stays disabled.", () => {
|
||||
cy.contains("button", "Create New").should("be.visible").click();
|
||||
|
||||
cy.get('#input_account_field').type('unit-test-0001');
|
||||
cy.get('#input_name_field').type('unit-test-0001');
|
||||
cy.get("#input_account_field").type("unit-test-0001");
|
||||
cy.get("#input_name_field").type("unit-test-0001");
|
||||
// Password shorter than 6 characters
|
||||
cy.get('#input_first_pwd').type('aaa');
|
||||
cy.get("#input_first_pwd").type("aaa");
|
||||
|
||||
cy.contains('button', 'Confirm').should('be.disabled');
|
||||
cy.contains("button", "Confirm").should("be.disabled");
|
||||
});
|
||||
|
||||
it('When password meets minimum length, confirm button enables.', () => {
|
||||
cy.contains('button', 'Create New').should('be.visible').click();
|
||||
it("When password meets minimum length, confirm button enables.", () => {
|
||||
cy.contains("button", "Create New").should("be.visible").click();
|
||||
|
||||
cy.get('#input_account_field').type('unit-test-0001');
|
||||
cy.get('#input_name_field').type('unit-test-0001');
|
||||
cy.get('#input_first_pwd').type('aaaaaa');
|
||||
cy.get("#input_account_field").type("unit-test-0001");
|
||||
cy.get("#input_name_field").type("unit-test-0001");
|
||||
cy.get("#input_first_pwd").type("aaaaaa");
|
||||
|
||||
cy.contains('button', 'Confirm').should('be.enabled');
|
||||
cy.contains("button", "Confirm").should("be.enabled");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,39 +4,39 @@
|
||||
// cindy.chang@dsp.im (Cindy Chang), 2024/07/02
|
||||
// imacat.yang@dsp.im (imacat), 2026/03/05
|
||||
|
||||
import { loginWithFixtures } from '../../support/intercept';
|
||||
import { loginWithFixtures } from "../../support/intercept";
|
||||
|
||||
describe('Create an Account', () => {
|
||||
describe("Create an Account", () => {
|
||||
beforeEach(() => {
|
||||
loginWithFixtures();
|
||||
// Override: new usernames should return 404 (account doesn't exist yet)
|
||||
cy.intercept('GET', '/api/users/unit-test-*', {
|
||||
cy.intercept("GET", "/api/users/unit-test-*", {
|
||||
statusCode: 404,
|
||||
body: { detail: 'Not found' },
|
||||
}).as('checkNewUser');
|
||||
cy.visit('/account-admin');
|
||||
cy.wait('@getUsers');
|
||||
body: { detail: "Not found" },
|
||||
}).as("checkNewUser");
|
||||
cy.visit("/account-admin");
|
||||
cy.wait("@getUsers");
|
||||
});
|
||||
|
||||
it('Create a new account with admin role; should show saved message.', () => {
|
||||
cy.contains('button', 'Create New').should('be.visible').click();
|
||||
it("Create a new account with admin role; should show saved message.", () => {
|
||||
cy.contains("button", "Create New").should("be.visible").click();
|
||||
|
||||
cy.get('#input_account_field').type('unit-test-0001');
|
||||
cy.get('#input_name_field').type('unit-test-0001');
|
||||
cy.get('#input_first_pwd').type('aaaaaa');
|
||||
cy.get('.checkbox-and-text').first().find('div').first().click();
|
||||
cy.get("#input_account_field").type("unit-test-0001");
|
||||
cy.get("#input_name_field").type("unit-test-0001");
|
||||
cy.get("#input_first_pwd").type("aaaaaa");
|
||||
cy.get(".checkbox-and-text").first().find("div").first().click();
|
||||
|
||||
cy.contains('button', 'Confirm')
|
||||
.should('be.visible')
|
||||
.and('be.enabled')
|
||||
cy.contains("button", "Confirm")
|
||||
.should("be.visible")
|
||||
.and("be.enabled")
|
||||
.click();
|
||||
cy.wait('@postUser');
|
||||
cy.contains('Account added').should('be.visible');
|
||||
cy.wait("@postUser");
|
||||
cy.contains("Account added").should("be.visible");
|
||||
});
|
||||
|
||||
it('Confirm button is disabled when required fields are empty.', () => {
|
||||
cy.contains('button', 'Create New').should('be.visible').click();
|
||||
cy.get('#input_account_field').type('test');
|
||||
cy.contains('button', 'Confirm').should('be.disabled');
|
||||
it("Confirm button is disabled when required fields are empty.", () => {
|
||||
cy.contains("button", "Create New").should("be.visible").click();
|
||||
cy.get("#input_account_field").type("test");
|
||||
cy.contains("button", "Confirm").should("be.disabled");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,27 +4,27 @@
|
||||
// cindy.chang@dsp.im (Cindy Chang), 2024/07/03
|
||||
// imacat.yang@dsp.im (imacat), 2026/03/05
|
||||
|
||||
import { loginWithFixtures } from '../../support/intercept';
|
||||
import { loginWithFixtures } from "../../support/intercept";
|
||||
|
||||
describe('Delete an Account', () => {
|
||||
describe("Delete an Account", () => {
|
||||
beforeEach(() => {
|
||||
loginWithFixtures();
|
||||
cy.visit('/account-admin');
|
||||
cy.wait('@getUsers');
|
||||
cy.visit("/account-admin");
|
||||
cy.wait("@getUsers");
|
||||
});
|
||||
|
||||
it('Delete button opens confirmation modal and deletes on confirm.', () => {
|
||||
cy.get('img.delete-account').first().click();
|
||||
cy.contains('ARE YOU SURE TO DELETE').should('be.visible');
|
||||
cy.get('#sure_to_delete_acct_btn').click();
|
||||
cy.wait('@deleteUser');
|
||||
cy.contains('Account deleted').should('be.visible');
|
||||
it("Delete button opens confirmation modal and deletes on confirm.", () => {
|
||||
cy.get("img.delete-account").first().click();
|
||||
cy.contains("ARE YOU SURE TO DELETE").should("be.visible");
|
||||
cy.get("#sure_to_delete_acct_btn").click();
|
||||
cy.wait("@deleteUser");
|
||||
cy.contains("Account deleted").should("be.visible");
|
||||
});
|
||||
|
||||
it('Cancel button closes the delete confirmation modal.', () => {
|
||||
cy.get('img.delete-account').first().click();
|
||||
cy.contains('ARE YOU SURE TO DELETE').should('be.visible');
|
||||
cy.get('#calcel_delete_acct_btn').click();
|
||||
cy.contains('ARE YOU SURE TO DELETE').should('not.exist');
|
||||
it("Cancel button closes the delete confirmation modal.", () => {
|
||||
cy.get("img.delete-account").first().click();
|
||||
cy.contains("ARE YOU SURE TO DELETE").should("be.visible");
|
||||
cy.get("#calcel_delete_acct_btn").click();
|
||||
cy.contains("ARE YOU SURE TO DELETE").should("not.exist");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,30 +4,30 @@
|
||||
// cindy.chang@dsp.im (Cindy Chang), 2024/07/03
|
||||
// imacat.yang@dsp.im (imacat), 2026/03/05
|
||||
|
||||
import { loginWithFixtures } from '../../support/intercept';
|
||||
import { loginWithFixtures } from "../../support/intercept";
|
||||
|
||||
const MODAL_TITLE_ACCOUNT_EDIT = 'Account Edit';
|
||||
const MSG_ACCOUNT_EDITED = 'Saved';
|
||||
const MODAL_TITLE_ACCOUNT_EDIT = "Account Edit";
|
||||
const MSG_ACCOUNT_EDITED = "Saved";
|
||||
|
||||
describe('Edit an account', () => {
|
||||
describe("Edit an account", () => {
|
||||
beforeEach(() => {
|
||||
loginWithFixtures();
|
||||
cy.visit('/account-admin');
|
||||
cy.wait('@getUsers');
|
||||
cy.visit("/account-admin");
|
||||
cy.wait("@getUsers");
|
||||
});
|
||||
|
||||
it('Edit an account; modify name and see saved message.', () => {
|
||||
cy.get('.btn-edit').first().click();
|
||||
cy.wait('@getUserDetail');
|
||||
it("Edit an account; modify name and see saved message.", () => {
|
||||
cy.get(".btn-edit").first().click();
|
||||
cy.wait("@getUserDetail");
|
||||
|
||||
cy.contains('h1', MODAL_TITLE_ACCOUNT_EDIT).should('exist');
|
||||
cy.get('#input_name_field').clear().type('Updated Name');
|
||||
cy.contains("h1", MODAL_TITLE_ACCOUNT_EDIT).should("exist");
|
||||
cy.get("#input_name_field").clear().type("Updated Name");
|
||||
|
||||
cy.contains('button', 'Confirm')
|
||||
.should('be.visible')
|
||||
.and('be.enabled')
|
||||
cy.contains("button", "Confirm")
|
||||
.should("be.visible")
|
||||
.and("be.enabled")
|
||||
.click();
|
||||
cy.wait('@putUser');
|
||||
cy.contains(MSG_ACCOUNT_EDITED).should('be.visible');
|
||||
cy.wait("@putUser");
|
||||
cy.contains(MSG_ACCOUNT_EDITED).should("be.visible");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user