From 9b910c0fd8308efde7b1c19033109258262596d7 Mon Sep 17 00:00:00 2001 From: Kati Frantz Date: Fri, 5 Apr 2019 14:22:23 +0100 Subject: [PATCH 1/2] lesson-3-testing-the-login-process --- client/components/Topbar.vue | 5 +++-- cypress/fixtures/example.json | 5 ----- cypress/fixtures/user.json | 10 ++++++++++ cypress/integration/login.spec.js | 20 ++++++++++++++++++++ 4 files changed, 33 insertions(+), 7 deletions(-) delete mode 100644 cypress/fixtures/example.json create mode 100644 cypress/fixtures/user.json create mode 100644 cypress/integration/login.spec.js diff --git a/client/components/Topbar.vue b/client/components/Topbar.vue index 7283eee..684df3c 100644 --- a/client/components/Topbar.vue +++ b/client/components/Topbar.vue @@ -5,7 +5,7 @@ v-if="auth && !confirmed" class="border-t border-b text-brown bg-gold-lightest font-bold text-center px-4 py-5" > -

+

Please confirm your email address. Didn’t receive an email ?

- + Hey, {{ user.name }} diff --git a/cypress/fixtures/example.json b/cypress/fixtures/example.json deleted file mode 100644 index da18d93..0000000 --- a/cypress/fixtures/example.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "Using fixtures to represent data", - "email": "hello@cypress.io", - "body": "Fixtures are a great way to mock data for responses to routes" -} \ No newline at end of file diff --git a/cypress/fixtures/user.json b/cypress/fixtures/user.json new file mode 100644 index 0000000..de7947d --- /dev/null +++ b/cypress/fixtures/user.json @@ -0,0 +1,10 @@ +{ + "data": { + "user": { + "name": "doctor", + "email": "doctor@strange.com", + "password": "password" + }, + "token": "random<>json<>web<>token" + } +} diff --git a/cypress/integration/login.spec.js b/cypress/integration/login.spec.js new file mode 100644 index 0000000..4259c48 --- /dev/null +++ b/cypress/integration/login.spec.js @@ -0,0 +1,20 @@ +describe('The login process', () => { + it('should login a user, flash a message, and redirect to the home page', () => { + cy.server() + + cy.fixture('user').as('user') + + cy.route('POST', '/api/v1/auth/login', '@user') + + cy.visit('/auth/login') + + cy.get('input[name="email"]').type('doctor@strange.com') + cy.get('input[name="password"]').type('password') + + cy.get('button').click() + + cy.get('#confirm-email').should('contain', 'Please confirm your email address.') + cy.get('#auth-username').should('contain', 'Hey, doctor') + cy.get('#auth-logout').should('contain', 'Logout') + }) +}) From 0bf56f1f4b7546542944bf5f4d853e2cf67b3f95 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Sat, 8 Jun 2019 10:15:21 +0000 Subject: [PATCH 2/2] Bump js-yaml from 3.13.0 to 3.13.1 Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.13.0 to 3.13.1. - [Release notes](https://github.com/nodeca/js-yaml/releases) - [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md) - [Commits](https://github.com/nodeca/js-yaml/compare/3.13.0...3.13.1) Signed-off-by: dependabot[bot] --- package-lock.json | 47 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index ee77beb..dbf9336 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4662,7 +4662,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -4683,12 +4684,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -4703,17 +4706,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -4830,7 +4836,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -4842,6 +4849,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -4856,6 +4864,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -4863,12 +4872,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -4887,6 +4898,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -4967,7 +4979,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -4979,6 +4992,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -5064,7 +5078,8 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -5100,6 +5115,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -5119,6 +5135,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -5162,12 +5179,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, @@ -6789,9 +6808,9 @@ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, "js-yaml": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.0.tgz", - "integrity": "sha512-pZZoSxcCYco+DIKBTimr67J6Hy+EYGZDY/HCWC+iAEA9h1ByhMXAIVUXMcMFpOCxQ/xjXmPI2MkDL5HRm5eFrQ==", + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", "dev": true, "requires": { "argparse": "^1.0.7",