diff --git a/.prettierignore b/.prettierignore index 97a9e2c1e4..7f25b5077b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -2,5 +2,6 @@ src/lib/ !/src !/react +!/cypress **/__generated__/*.graphql.ts *.graphql \ No newline at end of file diff --git a/cypress/.prettierrc.json b/cypress/.prettierrc.json new file mode 100644 index 0000000000..a632bb880d --- /dev/null +++ b/cypress/.prettierrc.json @@ -0,0 +1,10 @@ +{ + "tabWidth": 2, + "semi": true, + "singleQuote": true, + "importOrderSeparation": true, + "printWidth": 80, + "bracketSpacing": true, + "trailingComma": "all", + "singleAttributePerLine": false +} diff --git a/cypress/commands/DataPage.cy.ts b/cypress/commands/DataPage.cy.ts deleted file mode 100644 index 8ab4eabc18..0000000000 --- a/cypress/commands/DataPage.cy.ts +++ /dev/null @@ -1,38 +0,0 @@ -import {findShadowRoot} from '../helper/FindShadowRoot.cy'; - -Cypress.Commands.add('createVfolder', (vfolderName: string) => { - findShadowRoot('backend-ai-webui').find('#data').click(); - cy.wait(400); - const createDialogOpenButton = findShadowRoot('backend-ai-webui > backend-ai-data-view').find('#add-folder'); - const vfolderNameInput = findShadowRoot('backend-ai-webui > backend-ai-data-view > #add-folder-name').find('input'); - const createButton = findShadowRoot('backend-ai-webui > backend-ai-data-view').find('#add-button'); - createDialogOpenButton.click(); - vfolderNameInput.type(vfolderName); - createButton.click(); - cy.wait(5000); - findShadowRoot('backend-ai-webui > backend-ai-data-view > backend-ai-storage-list') - .find(`#controls[folder-name=${vfolderName}]`) - .should('exist'); -}); - -Cypress.Commands.add('deleteVfolder', (vfolderName: string) => { - findShadowRoot('backend-ai-webui').find('#data').click(); - cy.wait(400); - const deleteDialogOpenButton = - findShadowRoot('backend-ai-webui > backend-ai-data-view > backend-ai-storage-list') - .find(`#controls[folder-name=${vfolderName}]`) - .find('mwc-icon-button[icon="delete"]'); - const deleteVfolderNameInput = - findShadowRoot( - 'backend-ai-webui > backend-ai-data-view > backend-ai-storage-list > #delete-folder-name' - ).find('input'); - const deleteButton = - findShadowRoot('backend-ai-webui > backend-ai-data-view > backend-ai-storage-list') - .find('#delete-button'); - deleteDialogOpenButton.click(); - deleteVfolderNameInput.type(vfolderName); - deleteButton.click(); - findShadowRoot('backend-ai-webui > backend-ai-data-view > backend-ai-storage-list') - .find(`lablup-shields[folder-name=${vfolderName}][description="deleted-complete"]`) - .should('exist'); -}); \ No newline at end of file diff --git a/cypress/commands/DataStoragePage.cy.ts b/cypress/commands/DataStoragePage.cy.ts new file mode 100644 index 0000000000..dbe4f2c3ec --- /dev/null +++ b/cypress/commands/DataStoragePage.cy.ts @@ -0,0 +1,50 @@ +import { findShadowRoot } from '../helper/FindShadowRoot.cy'; + +Cypress.Commands.add('createVfolder', (vfolderName: string) => { + findShadowRoot('backend-ai-webui').find('#data').click(); + cy.wait(400); + const createDialogOpenButton = findShadowRoot( + 'backend-ai-webui > backend-ai-data-view', + ).find('#add-folder'); + const vfolderNameInput = findShadowRoot( + 'backend-ai-webui > backend-ai-data-view > #add-folder-name', + ).find('input'); + const createButton = findShadowRoot( + 'backend-ai-webui > backend-ai-data-view', + ).find('#add-button'); + createDialogOpenButton.click(); + vfolderNameInput.type(vfolderName); + createButton.click(); + cy.wait(5000); + findShadowRoot( + 'backend-ai-webui > backend-ai-data-view > backend-ai-storage-list', + ) + .find(`#controls[folder-name=${vfolderName}]`) + .should('exist'); +}); + +Cypress.Commands.add('deleteVfolder', (vfolderName: string) => { + findShadowRoot('backend-ai-webui').find('#data').click(); + cy.wait(400); + const deleteDialogOpenButton = findShadowRoot( + 'backend-ai-webui > backend-ai-data-view > backend-ai-storage-list', + ) + .find(`#controls[folder-name=${vfolderName}]`) + .find('mwc-icon-button[icon="delete"]'); + const deleteVfolderNameInput = findShadowRoot( + 'backend-ai-webui > backend-ai-data-view > backend-ai-storage-list > #delete-folder-name', + ).find('input'); + const deleteButton = findShadowRoot( + 'backend-ai-webui > backend-ai-data-view > backend-ai-storage-list', + ).find('#delete-button'); + deleteDialogOpenButton.click(); + deleteVfolderNameInput.type(vfolderName); + deleteButton.click(); + findShadowRoot( + 'backend-ai-webui > backend-ai-data-view > backend-ai-storage-list', + ) + .find( + `lablup-shields[folder-name=${vfolderName}][description="deleted-complete"]`, + ) + .should('exist'); +}); diff --git a/cypress/commands/LoginPage.cy.ts b/cypress/commands/LoginPage.cy.ts index d95148ceff..ed92e0bc1f 100644 --- a/cypress/commands/LoginPage.cy.ts +++ b/cypress/commands/LoginPage.cy.ts @@ -1,12 +1,23 @@ -import {findShadowRoot} from '../helper/FindShadowRoot.cy'; +import { findShadowRoot } from '../helper/FindShadowRoot.cy'; -Cypress.Commands.add('login', (email: string, password: string, endpoint: string) => { - const emailInput = findShadowRoot('backend-ai-webui > backend-ai-login > #id_user_id').find('input'); - const passwordInput = findShadowRoot('backend-ai-webui > backend-ai-login > #id_password').find('input'); - const endpointInput = findShadowRoot('backend-ai-webui > backend-ai-login > #id_api_endpoint').find('input'); - const loginButton = findShadowRoot('backend-ai-webui > backend-ai-login > #login-button').find('button'); - emailInput.type(email); - passwordInput.type(password); - endpointInput.clear().type(endpoint); - loginButton.click(); -}); \ No newline at end of file +Cypress.Commands.add( + 'login', + (email: string, password: string, endpoint: string) => { + const emailInput = findShadowRoot( + 'backend-ai-webui > backend-ai-login > #id_user_id', + ).find('input'); + const passwordInput = findShadowRoot( + 'backend-ai-webui > backend-ai-login > #id_password', + ).find('input'); + const endpointInput = findShadowRoot( + 'backend-ai-webui > backend-ai-login > #id_api_endpoint', + ).find('input'); + const loginButton = findShadowRoot( + 'backend-ai-webui > backend-ai-login > #login-button', + ).find('button'); + emailInput.type(email); + passwordInput.type(password); + endpointInput.clear().type(endpoint); + loginButton.click(); + }, +); diff --git a/cypress/commands/UserDropdown.cy.ts b/cypress/commands/UserDropdown.cy.ts index 9d5e790047..1d9b2488b8 100644 --- a/cypress/commands/UserDropdown.cy.ts +++ b/cypress/commands/UserDropdown.cy.ts @@ -1,23 +1,61 @@ -import {findShadowRoot} from '../helper/FindShadowRoot.cy'; +import { findShadowRoot } from '../helper/FindShadowRoot.cy'; -Cypress.Commands.add('userProfileChange', (userName, originalPassword, newPassword) => { - findShadowRoot("backend-ai-webui").find("backend-ai-react-user-dropdown-menu").trigger("click").then(() =>{ - findShadowRoot("backend-ai-webui > backend-ai-react-user-dropdown-menu").find("li:contains(사용자 정보 변경)").click(); - }); - findShadowRoot("backend-ai-webui > backend-ai-react-user-profile-setting-dialog") - .find("#full_name").clear().focus().type(userName); - findShadowRoot("backend-ai-webui > backend-ai-react-user-profile-setting-dialog") - .find("#originalPassword").focus().type(originalPassword); - findShadowRoot("backend-ai-webui > backend-ai-react-user-profile-setting-dialog") - .find("#newPassword").focus().type(newPassword); - findShadowRoot("backend-ai-webui > backend-ai-react-user-profile-setting-dialog") - .find("#newPasswordConfirm").focus().type(newPassword); - findShadowRoot("backend-ai-webui > backend-ai-react-user-profile-setting-dialog") - .find("button:contains(변경)").click(); -}); +Cypress.Commands.add( + 'userProfileChange', + (userName, originalPassword, newPassword) => { + findShadowRoot('backend-ai-webui') + .find('backend-ai-react-user-dropdown-menu') + .trigger('click') + .then(() => { + findShadowRoot('backend-ai-webui > backend-ai-react-user-dropdown-menu') + .find('li:contains(사용자 정보 변경)') + .click(); + }); + findShadowRoot( + 'backend-ai-webui > backend-ai-react-user-profile-setting-dialog', + ) + .find('#full_name') + .clear() + .focus() + .type(userName); + findShadowRoot( + 'backend-ai-webui > backend-ai-react-user-profile-setting-dialog', + ) + .find('#originalPassword') + .focus() + .type(originalPassword); + findShadowRoot( + 'backend-ai-webui > backend-ai-react-user-profile-setting-dialog', + ) + .find('#newPassword') + .focus() + .type(newPassword); + findShadowRoot( + 'backend-ai-webui > backend-ai-react-user-profile-setting-dialog', + ) + .find('#newPasswordConfirm') + .focus() + .type(newPassword); + findShadowRoot( + 'backend-ai-webui > backend-ai-react-user-profile-setting-dialog', + ) + .find('button:contains(변경)') + .click(); + }, +); Cypress.Commands.add('logout', () => { - findShadowRoot("backend-ai-webui").find("backend-ai-react-user-dropdown-menu").trigger("click").then(() =>{ - findShadowRoot("backend-ai-webui > backend-ai-react-user-dropdown-menu").find("li:contains(로그아웃)").click(); - }); -}) \ No newline at end of file + findShadowRoot('backend-ai-webui') + .find('backend-ai-react-user-dropdown-menu') + .trigger('click') + .then(() => { + findShadowRoot('backend-ai-webui > backend-ai-react-user-dropdown-menu') + .find('li:contains(로그아웃)') + .click(); + }); +}); + +const a = { + adajndakdnsxanalcnajkcnjkacasaajda: 100, + asdasnbdaskdnajdjkad: 213313, +}; diff --git a/cypress/e2e/e2eTest.cy.ts b/cypress/e2e/e2eTest.cy.ts index cd98077521..96ae1e989c 100644 --- a/cypress/e2e/e2eTest.cy.ts +++ b/cypress/e2e/e2eTest.cy.ts @@ -4,7 +4,7 @@ import '../commands/DataPage.cy'; describe('Initial cypress E2E test', () => { beforeEach(() => { - cy.viewport(1280,800); + cy.viewport(1280, 800); cy.visit('http://localhost:9081'); //방문할 페이지 }); @@ -14,4 +14,4 @@ describe('Initial cypress E2E test', () => { cy.createVfolder('test-e2eTest'); cy.deleteVfolder('test-e2eTest'); }); -}); \ No newline at end of file +});