From c9cb132b7fd0cbd96b49d83b944a956ea4bb765a Mon Sep 17 00:00:00 2001 From: helenanull Date: Wed, 17 Mar 2021 23:13:55 +0200 Subject: [PATCH] updated version and added test --- cypress/integration/profile.spec.js | 21 +++++++++++++++++++++ cypress/selectors/profile.sel.js | 6 +++++- package-lock.json | 27 +++++++++++++++++---------- 3 files changed, 43 insertions(+), 11 deletions(-) create mode 100644 cypress/integration/profile.spec.js diff --git a/cypress/integration/profile.spec.js b/cypress/integration/profile.spec.js new file mode 100644 index 0000000..6539788 --- /dev/null +++ b/cypress/integration/profile.spec.js @@ -0,0 +1,21 @@ +import profile from '../selectors/profile.sel' + +describe('Profile page', () => { + beforeEach(() => { + cy.register().then((email) => { + // we need username to visit profile url + cy.wrap(email.split('@')[0]).as('username') + cy.login(email) + }) + }) + + it('contains correct elements', function () { + cy.visit(`/@${this.username}`) + cy.get(profile.editProfileButton).should('be.visible') + .and('have.attr', 'href', '#/settings') + cy.get(profile.userInfoArea).should('be.visible') + cy.get(profile.myArticlesTab).should('be.visible') + .and('have.css', 'color', 'rgb(92, 184, 92)') + cy.get(profile.favouritedArticlesTab).should('be.visible') + }) +}) diff --git a/cypress/selectors/profile.sel.js b/cypress/selectors/profile.sel.js index b8840f3..bbe3871 100644 --- a/cypress/selectors/profile.sel.js +++ b/cypress/selectors/profile.sel.js @@ -1,4 +1,8 @@ module.exports = { savedBio: '[ng-bind*="profile.bio"]', - image: '.user-info img' + image: '.user-info img', + editProfileButton: '.btn[ng-show*=isUser]', + userInfoArea: '.user-info', + myArticlesTab: '.articles-toggle li:nth-child(1) a', + favouritedArticlesTab: '.articles-toggle li:nth-child(2) a' } diff --git a/package-lock.json b/package-lock.json index 2145d7a..5c7e9b1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -565,9 +565,9 @@ } }, "cypress": { - "version": "6.6.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-6.6.0.tgz", - "integrity": "sha512-+Xx3Zn653LJHUsCb9h1Keql2jlazbr1ROmbY6DFJMmXKLgXP4ez9cE403W93JNGRbZK0Tng3R/oP8mvd9XAPVg==", + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-6.7.1.tgz", + "integrity": "sha512-MC9yt1GqpL4WVDQ0STI89K+PdLeC3T3NuAb2N61d6vYGR9pJy8w3Fqe0OWZwaRTJtg9eAyHXPGmFsyKeNQ3tmg==", "dev": true, "requires": { "@cypress/listr-verbose-renderer": "^0.4.1", @@ -1298,9 +1298,9 @@ } }, "is-path-inside": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.2.tgz", - "integrity": "sha512-/2UGPSgmtqwo1ktx8NDHjuPwZWmHhO+gj0f93EkhLB5RgW9RZevWYYlIkS6zePc6U2WpOdQYIwHe9YC4DWEBVg==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", "dev": true }, "is-promise": { @@ -1321,6 +1321,12 @@ "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true }, + "is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true + }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -1620,12 +1626,13 @@ "dev": true }, "log-symbols": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", - "integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", "dev": true, "requires": { - "chalk": "^4.0.0" + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" } }, "log-update": {