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");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user