-
Notifications
You must be signed in to change notification settings - Fork 97
/
account.spec.js
51 lines (47 loc) 路 2.24 KB
/
account.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import accounts from '../../constants/accounts';
import networks from '../../constants/networks';
import urls from '../../constants/urls';
import ss from '../../constants/selectors';
const getFollowedAccountObjFromLS = () => JSON.parse(localStorage.getItem('followedAccounts'));
describe('Account', () => {
/**
* Help page can be opened by direct link
* @expect url is correct
* @expect some specific to page element is present on it
*/
it('Opens by url + Address & Balance are correct', () => {
cy.autologin(accounts.genesis.passphrase, networks.devnet.node);
cy.visit(`${urls.accounts}/16313739661666666666L`);
cy.url().should('contain', '16313739661666666666L');
cy.get(ss.leftBlockAccountExplorer).find(ss.accountAddress).contains('16313739661666666666L');
cy.get(ss.leftBlockAccountExplorer).find(ss.accountBalance).contains('0');
});
it('Username is shown if registered', () => {
cy.autologin(accounts.genesis.passphrase, networks.devnet.node);
cy.visit(`${urls.accounts}/${accounts.genesis.address}`);
cy.get(ss.leftBlockAccountExplorer).find(ss.delegateName).should('not.exist');
cy.visit(`${urls.accounts}/${accounts.delegate.address}`);
cy.wait(1000); // Avoid failing on jenkins
cy.get(ss.leftBlockAccountExplorer).find(ss.delegateName).contains(accounts.delegate.username);
});
it('Add / Remove bookmark', () => {
cy.autologin(accounts.genesis.passphrase, networks.devnet.node);
cy.visit(`${urls.accounts}/${accounts.delegate.address}`);
cy.wait(1000); // Avoid failing on jenkins
cy.get(ss.followAccountBtn).contains('Add to bookmark');
cy.get(ss.followAccountBtn).click();
cy.get(ss.titleInput).type('Bob');
cy.get(ss.confirmAddToBookmarks).click()
.should(() => {
expect(getFollowedAccountObjFromLS()[0].address).to.equal(accounts.delegate.address);
expect(getFollowedAccountObjFromLS()[0].title).to.equal('Bob');
});
cy.get(ss.bookmarkedAccountTitle).contains('Bob');
cy.get(ss.followAccountBtn).contains('Remove from bookmark');
cy.get(ss.followAccountBtn).click()
.should(() => {
expect(getFollowedAccountObjFromLS().length).to.equal(0);
});
cy.get(ss.bookmarkedAccountTitle).should('not.exist');
});
});