diff --git a/angular-app b/angular-app new file mode 160000 index 0000000..bda1007 --- /dev/null +++ b/angular-app @@ -0,0 +1 @@ +Subproject commit bda100700818948d5279bfe777db07dfd5e56da5 diff --git a/create-new-post.cy.js b/create-new-post.cy.js new file mode 100644 index 0000000..278949b --- /dev/null +++ b/create-new-post.cy.js @@ -0,0 +1,12 @@ +describe('Create New Post API Test API', () => { + it('should create new post', () => { + cy.api('POST', 'https://jsonplaceholder.typicode.com/posts', { + title: 'foo', + body: 'bar', + userId: 1, + }).should((response) => { + expect(response.status).to.eq(201); + expect(response.body).to.have.property('id'); + }); + }); +}); diff --git a/cypress/e2e/hwcypress/task1.cy.js b/cypress/e2e/hwcypress/task1.cy.js new file mode 100644 index 0000000..12e0ab3 --- /dev/null +++ b/cypress/e2e/hwcypress/task1.cy.js @@ -0,0 +1,19 @@ +describe("Stepper", ()=>{ + it("should work",()=>{ + const containerSelector = 'nb-stepper[orientation="horizontal"]' + cy.visit("http://localhost:4200/pages/layout/stepper") + cy.get(`${containerSelector} h3`).should("have.text","Step content #1") + cy.get(`${containerSelector} button`).contains("prev").should("be.disabled") + cy.get(`${containerSelector} button`).contains("next").click() + cy.get(`${containerSelector} h3`).should("have.text","Step content #2") + cy.get(`${containerSelector} button`).contains("prev").should("be.enabled") + cy.get(`${containerSelector} button`).contains("next").click() + cy.get(`${containerSelector} h3`).should("have.text","Step content #3") + cy.get(`${containerSelector} button`).contains("prev").should("be.enabled") + cy.get(`${containerSelector} button`).contains("next").click() + cy.get(`${containerSelector} h3`).should("have.text","Step content #4") + cy.get(`${containerSelector} button`).contains("prev").should("be.enabled") + cy.get(`${containerSelector} button`).contains("next").should("be.disabled") + + }) +}) diff --git a/cypress/e2e/hwcypress/task2.cy.js b/cypress/e2e/hwcypress/task2.cy.js new file mode 100644 index 0000000..236483a --- /dev/null +++ b/cypress/e2e/hwcypress/task2.cy.js @@ -0,0 +1,11 @@ +describe('modal-overlays', () => { + it('Click Button and Verify Modal Dialog', () => { + const containerSelector = 'ngx-modal-overlays nb-card'; + cy.visit('http://localhost:4200/pages/modal-overlays/dialog'); + cy.contains('.appearance-filled.size-medium.shape-rectangle.status-basic.nb-transition', 'Enter Name').click(); + cy.get('button[status="success"].appearance-filled.size-medium.shape-rectangle.nb-transition') + .should('exist') + .and('be.visible'); + + }); +}); diff --git a/cypress/e2e/hwcypress/task3.cy.js b/cypress/e2e/hwcypress/task3.cy.js new file mode 100644 index 0000000..cf01a7e --- /dev/null +++ b/cypress/e2e/hwcypress/task3.cy.js @@ -0,0 +1,15 @@ +describe('modal-overlays', () => { + it('Click Button and Verify Modal Dialog Content', () => { + cy.visit('http://localhost:4200/pages/modal-overlays/dialog'); + cy.contains('.appearance-filled.size-medium.shape-rectangle.status-basic.nb-transition', 'Enter Name').click(); + cy.get('input[placeholder="Name"].size-medium.status-basic.shape-rectangle.nb-transition') + .should('exist'); + cy.get('nb-card-header').should('exist').and('contain', 'Enter your name'); + cy.get('button[status="success"].appearance-filled.size-medium.shape-rectangle.nb-transition') + .should('exist') + .and('contain', 'Submit'); + cy.get('button[status="danger"].appearance-filled.size-medium.shape-rectangle.nb-transition') + .should('exist') + .and('have.text', 'Cancel'); + }); +}); diff --git a/delete.cy.js b/delete.cy.js new file mode 100644 index 0000000..cd05772 --- /dev/null +++ b/delete.cy.js @@ -0,0 +1,10 @@ +describe('Delete Post by ID API Test API', () => { + it('should delete post by id', () => { + cy.api('DELETE', 'https://jsonplaceholder.typicode.com/posts/1') + .should((response) => { + expect(response.status).to.eq(200); + }); + }); +}); + + diff --git a/get-posts-list.cy.js b/get-posts-list.cy.js new file mode 100644 index 0000000..e68a047 --- /dev/null +++ b/get-posts-list.cy.js @@ -0,0 +1,10 @@ +describe('Get Posts List API Test API', () => { + it('should get posts list', () => { + cy.api('GET', 'https://jsonplaceholder.typicode.com/posts') + .should((response) => { + expect(response.status).to.eq(200); + expect(response.body.length).to.be.greaterThan(0); + }); + }); +}); + diff --git a/package-lock.json b/package-lock.json index 963a157..cf94e37 100644 --- a/package-lock.json +++ b/package-lock.json @@ -76,7 +76,7 @@ "@typescript-eslint/parser": "^5.43.0", "codelyzer": "^6.0.2", "conventional-changelog-cli": "1.3.4", - "cypress": "^13.6.6", + "cypress": "^13.7.0", "eslint": "^8.28.0", "husky": "0.13.3", "jasmine-core": "~3.6.0", @@ -12274,9 +12274,9 @@ "dev": true }, "node_modules/cypress": { - "version": "13.6.6", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.6.6.tgz", - "integrity": "sha512-S+2S9S94611hXimH9a3EAYt81QM913ZVA03pUmGDfLTFa5gyp85NJ8dJGSlEAEmyRsYkioS1TtnWtbv/Fzt11A==", + "version": "13.7.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.7.0.tgz", + "integrity": "sha512-UimjRSJJYdTlvkChcdcfywKJ6tUYuwYuk/n1uMMglrvi+ZthNhoRYcxnWgTqUtkl17fXrPAsD5XT2rcQYN1xKA==", "dev": true, "hasInstallScript": true, "dependencies": { diff --git a/package.json b/package.json index a1fc57d..27c00ed 100644 --- a/package.json +++ b/package.json @@ -97,7 +97,7 @@ "@typescript-eslint/parser": "^5.43.0", "codelyzer": "^6.0.2", "conventional-changelog-cli": "1.3.4", - "cypress": "^13.6.6", + "cypress": "^13.7.0", "eslint": "^8.28.0", "husky": "0.13.3", "jasmine-core": "~3.6.0", diff --git a/post-by-id.cy.js b/post-by-id.cy.js new file mode 100644 index 0000000..c1b0f33 --- /dev/null +++ b/post-by-id.cy.js @@ -0,0 +1,9 @@ +describe('Get Post by ID API Test API', () => { + it('should get post by id', () => { + cy.api('GET', 'https://jsonplaceholder.typicode.com/posts/1') + .should((response) => { + expect(response.status).to.eq(200); + expect(response.body).to.have.property('id', 1); + }); + }); +}); diff --git a/qodana.yaml b/qodana.yaml new file mode 100644 index 0000000..29f8f8c --- /dev/null +++ b/qodana.yaml @@ -0,0 +1,29 @@ +#-------------------------------------------------------------------------------# +# Qodana analysis is configured by qodana.yaml file # +# https://www.jetbrains.com/help/qodana/qodana-yaml.html # +#-------------------------------------------------------------------------------# +version: "1.0" + +#Specify inspection profile for code analysis +profile: + name: qodana.starter + +#Enable inspections +#include: +# - name: + +#Disable inspections +#exclude: +# - name: +# paths: +# - + +#Execute shell command before Qodana execution (Applied in CI/CD pipeline) +#bootstrap: sh ./prepare-qodana.sh + +#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline) +#plugins: +# - id: #(plugin id can be found at https://plugins.jetbrains.com) + +#Specify Qodana linter for analysis (Applied in CI/CD pipeline) +linter: jetbrains/qodana-js:latest diff --git a/tsconfig.json b/tsconfig.json index 3a065c9..4564469 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,6 +21,7 @@ "name": "tslint-language-service" } ], - "useDefineForClassFields": false + "useDefineForClassFields": false, + "baseUrl": "./src" } } diff --git a/update-post-by-id.cy.js b/update-post-by-id.cy.js new file mode 100644 index 0000000..c94aa5c --- /dev/null +++ b/update-post-by-id.cy.js @@ -0,0 +1,15 @@ +describe('Update Post by ID API Test API', () => { + it('should update post by id', () => { + cy.api('PUT', 'https://jsonplaceholder.typicode.com/posts/1', { + id: 1, + title: 'foo', + body: 'bar', + userId: 1, + }).should((response) => { + expect(response.status).to.eq(200); + expect(response.body).to.have.property('title', 'foo'); + }); + }); +}); + +