1
|
|
|
/// <reference types="Cypress" /> |
2
|
|
|
|
3
|
|
|
describe('Profile module', () => { |
4
|
|
|
beforeEach(() => { |
5
|
|
|
cy.setToInitialState() |
|
|
|
|
6
|
|
|
.then(() => { |
7
|
|
|
cy.loginViaApi() |
|
|
|
|
8
|
|
|
.then(() => { |
9
|
|
|
cy.openInitialPage(`${Cypress.env('admin')}#/sw/profile/index`); |
|
|
|
|
10
|
|
|
}); |
11
|
|
|
}); |
12
|
|
|
}); |
13
|
|
|
|
14
|
|
|
it('@base @general: profile change email', () => { |
15
|
|
|
cy.get('#sw-field--email') |
|
|
|
|
16
|
|
|
.should('be.visible') |
17
|
|
|
.click() |
18
|
|
|
.clear() |
19
|
|
|
.type('[email protected]'); |
20
|
|
|
|
21
|
|
|
cy.get('.sw-profile__save-action') |
22
|
|
|
.should('be.visible') |
23
|
|
|
.click(); |
24
|
|
|
|
25
|
|
|
// expect modal to be open |
26
|
|
|
cy.get('.sw-modal') |
27
|
|
|
.should('be.visible'); |
28
|
|
|
cy.get('.sw-modal__title') |
29
|
|
|
.contains('Enter your current password to confirm'); |
30
|
|
|
|
31
|
|
|
cy.get('.sw-modal__footer > .sw-button--primary') |
32
|
|
|
.should('be.disabled'); |
33
|
|
|
|
34
|
|
|
cy.get('.sw-modal__body input[name="sw-field--confirm-password"]') |
35
|
|
|
.should('be.visible') |
36
|
|
|
.typeAndCheck('shopware'); |
37
|
|
|
|
38
|
|
|
cy.get('.sw-modal__footer > .sw-button--primary > .sw-button__content') |
39
|
|
|
.should('not.be.disabled') |
40
|
|
|
.click() |
41
|
|
|
.then(() => { |
42
|
|
|
cy.get('.sw-modal') |
|
|
|
|
43
|
|
|
.should('not.be.visible'); |
44
|
|
|
|
45
|
|
|
cy.get('#sw-field--email') |
46
|
|
|
.should('be.visible') |
47
|
|
|
.should('have.value', '[email protected]'); |
48
|
|
|
}); |
49
|
|
|
}); |
50
|
|
|
|
51
|
|
|
it('@general: profile raise a notification for invalid authentication', () => { |
52
|
|
|
cy.get('.sw-profile__save-action') |
|
|
|
|
53
|
|
|
.should('be.visible') |
54
|
|
|
.click(); |
55
|
|
|
|
56
|
|
|
// expect modal to be open |
57
|
|
|
cy.get('.sw-modal') |
58
|
|
|
.should('be.visible'); |
59
|
|
|
cy.get('.sw-modal__title') |
60
|
|
|
.contains('Enter your current password to confirm'); |
61
|
|
|
|
62
|
|
|
cy.get('.sw-modal__footer > .sw-button--primary') |
63
|
|
|
.should('be.disabled'); |
64
|
|
|
|
65
|
|
|
cy.get('.sw-modal__body input[name="sw-field--confirm-password"]') |
66
|
|
|
.should('be.visible') |
67
|
|
|
.typeAndCheck('erawpohs'); |
68
|
|
|
|
69
|
|
|
cy.get('.sw-modal__footer > .sw-button--primary > .sw-button__content') |
70
|
|
|
.should('not.be.disabled') |
71
|
|
|
.click() |
72
|
|
|
.then(() => { |
73
|
|
|
cy.get('.sw-modal') |
|
|
|
|
74
|
|
|
.should('be.visible'); |
75
|
|
|
|
76
|
|
|
cy.awaitAndCheckNotification('Please submit your current password correctly.'); |
77
|
|
|
}); |
78
|
|
|
}); |
79
|
|
|
}); |
80
|
|
|
|
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.