Преглед на файлове

Add end to end tests for password reset page

pull/342/head
Guillaume Vincent преди 7 години
родител
ревизия
10effc37f2
променени са 10 файла, в които са добавени 55 реда и са изтрити 8 реда
  1. Двоични данни
      dist/favicon.ico
  2. +1
    -0
      index.html
  3. Двоични данни
      src/images/favicon.ico
  4. +1
    -0
      src/main.js
  5. +2
    -1
      src/views/Login.vue
  6. +7
    -1
      src/views/PasswordGenerator.vue
  7. +14
    -5
      src/views/PasswordReset.vue
  8. +3
    -0
      test/e2e/specs/canSavePasswordProfile.js
  9. +26
    -0
      test/e2e/specs/passwordReset.js
  10. +1
    -1
      webpack.config.js

Двоични данни
dist/favicon.ico Целия файл

Преди След

+ 1
- 0
index.html Целия файл

@@ -5,6 +5,7 @@
<title>LessPass</title>
<meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="shortcut icon" href="dist/favicon.ico">
<link rel="stylesheet" href="dist/lesspass.min.css">
<style>
div.center {


Двоични данни
src/images/favicon.ico Целия файл

Преди След

+ 1
- 0
src/main.js Целия файл

@@ -1,4 +1,5 @@
import Vue from "vue";
import "./images/favicon.ico";
import LessPass from "./LessPass.vue";
import { sync } from "vuex-router-sync";
import store from "./store";


+ 2
- 1
src/views/Login.vue Целия файл

@@ -56,7 +56,8 @@
</div>
</div>
<div class="form-group mb-0">
<button type="button"
<button id="login__forgot-password-btn"
type="button"
class="btn btn-link btn-sm p-0"
v-on:click="$router.push({name: 'passwordReset'})">
<small>{{$t('ForgotPassword', 'Forgot your password?')}}</small>


+ 7
- 1
src/views/PasswordGenerator.vue Целия файл

@@ -235,7 +235,13 @@
const site = this.$refs.site;
const login = this.$refs.login;
const masterPassword = this.$refs.masterPassword;
site.value ? (login.value ? masterPassword.$refs.passwordField.focus() : login.focus()) : site.focus();
if(site && !site.value){
site.focus()
}else if(login && !login.value){
login.focus()
}else if(masterPassword){
masterPassword.$refs.passwordField.focus()
}
},
copyPassword() {
const copied = copy(this.passwordGenerated);


+ 14
- 5
src/views/PasswordReset.vue Целия файл

@@ -15,7 +15,8 @@
</div>
<div class="form-group row">
<div class="col-12">
<button id="loginButton" class="btn"
<button id="password-reset__reset-password-btn"
class="btn"
v-bind:class="{ 'btn-warning': version===1, 'btn-primary': version===2 }">
{{$t('Reset my password')}}
</button>
@@ -25,7 +26,7 @@
</template>
<script type="text/ecmascript-6">
import User from '../api/user';
import {mapActions, mapGetters} from 'vuex';
import {mapState, mapGetters} from 'vuex';
import message from '../services/message';

export default {
@@ -35,15 +36,23 @@
};
},
computed: {
...mapGetters(['version', 'baseURL'])
...mapState(['baseURL']),
...mapGetters(['version'])
},
methods: {
resetPassword(){
resetPassword() {
const baseURL = this.baseURL;
if (!baseURL) {
message.displayGenericError();
return;
}

if (!this.email) {
message.error(this.$t('EmailRequiredError', 'We need an email to find your account.'));
return;
}
User.resetPassword({email: this.email}, {baseURL: this.baseURL})

User.resetPassword({email: this.email}, {baseURL})
.then(() => {
const successMessage = this.$t('resetPasswordSuccess',
'If the email address {email} is associated with a LessPass account, you will shortly receive an email from LessPass with instructions on how to reset your password.',


+ 3
- 0
test/e2e/specs/canSavePasswordProfile.js Целия файл

@@ -10,6 +10,9 @@ module.exports = {
.setValue("#passwordField", "test@lesspass.com")
.waitForElementVisible("#encryptMasterPassword__btn")
.click("#encryptMasterPassword__btn")
.waitForElementVisible("#fingerprint .fa-university")
.waitForElementVisible("#fingerprint .fa-btc")
.waitForElementVisible("#fingerprint .fa-subway")
.waitForElementVisible("#signInButton")
.click("#signInButton")
.waitForElementVisible("#site")


+ 26
- 0
test/e2e/specs/passwordReset.js Целия файл

@@ -0,0 +1,26 @@
var assert = require("assert");

module.exports = {
"Password reset": function(browser) {
browser
.url(browser.launch_url)
.waitForElementVisible(".fa-sign-in")
.click(".fa-sign-in")
.waitForElementVisible("#login__forgot-password-btn")
.click("#login__forgot-password-btn")
.waitForElementVisible("#password-reset__reset-password-btn")
.click("#password-reset__reset-password-btn");

browser.getLog(function(logs) {
logs = logs.filter(function(log) {
return ["DEBUG", "INFO"].indexOf(log.level) === -1;
});
assert(
logs.length === 0,
"Console log error(s):\n" + JSON.stringify(logs, null, 2)
);
});

browser.end();
}
};

+ 1
- 1
webpack.config.js Целия файл

@@ -16,7 +16,7 @@ module.exports = {
rules: [
{test: /\.vue$/, loader: 'vue-loader'},
{test: /\.js$/, exclude: /node_modules\/(?!copy-text-to-clipboard)/, loader: "babel-loader"},
{test: /\.(png|jpg|jpeg|gif)$/, loader: 'file-loader?name=[name].[ext]'},
{test: /\.(png|jpg|jpeg|gif|ico)$/, loader: 'file-loader?name=[name].[ext]'},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract({fallback: 'style-loader', use: 'css-loader!sass-loader', publicPath: ''})


Зареждане…
Отказ
Запис