Skip to content
Next
Projects
Groups
Snippets
Help
Sign in / Register
Toggle navigation
Minds Frontend
Project
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
819
Merge Requests
63
CI / CD
Security & Compliance
Packages
Wiki
Snippets
Members
Collapse sidebar
Close sidebar
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Frontend
Commits
20fb225c
Commit
20fb225c
authored
1 day ago
by
Emiliano Balbuena
Browse files
Options
Download
(test): E2E for /upgrades
parent
4fe4cdd1
goal/product-pages-update-1
1 merge request
!608
WIP: Product pages update
Pipeline
#93142757
passed with stages
in 65 minutes and 52 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
130 additions
and
0 deletions
+130
-0
cypress/integration/upgrades.spec.js
0 → 100644
View file @
20fb225c
context
(
'
Upgrades page
'
,
()
=>
{
before
(()
=>
{
cy
.
getCookie
(
'
minds_sess
'
).
then
(
sessionCookie
=>
{
if
(
!
sessionCookie
)
{
return
cy
.
login
(
true
);
}
});
});
beforeEach
(()
=>
{
cy
.
preserveCookies
();
cy
.
visit
(
'
/upgrades
'
);
});
it
(
'
should scroll to upgrades table
'
,
()
=>
{
cy
.
viewport
(
1200
,
600
);
// Only on desktop
const
scrollButton
=
'
.m-marketing__mainWrapper .m-marketing__body a.mf-button
'
;
const
heading
=
'
.m-upgradesUpgradeOptions__header h2
'
;
cy
.
get
(
scrollButton
)
.
should
(
'
contain
'
,
'
Upgrade now
'
)
.
click
();
cy
.
wait
(
1500
);
cy
.
isInViewport
(
heading
);
});
// TODO: Toggles tests (make them testable)
it
(
'
should have the ability to trigger Buy Tokens modal
'
,
()
=>
{
const
tokensInput
=
'
m-blockchain--purchase input[name=amount]
'
;
const
buyTokensButton
=
'
m-blockchain--purchase .m-blockchainTokenPurchase__action .mf-button
'
;
const
anyBuyTokensModal
=
'
m-blockchain--purchase m-modal .m-modal-container
'
;
cy
.
get
(
tokensInput
)
.
focus
()
.
clear
()
.
type
(
'
0
'
);
cy
.
get
(
buyTokensButton
).
should
(
'
be.disabled
'
);
cy
.
get
(
tokensInput
)
.
focus
()
.
clear
()
.
type
(
'
1
'
);
cy
.
get
(
buyTokensButton
)
.
should
(
'
not.be.disabled
'
)
.
click
();
cy
.
get
(
'
.m-get-metamask--cancel-btn.m-btn
'
).
click
();
cy
.
get
(
anyBuyTokensModal
).
should
(
'
be.visible
'
);
});
it
(
'
should have the ability to trigger Buy Eth modal
'
,
()
=>
{
const
buyEthLink
=
'
m-blockchain--purchase .m-blockchainTokenPurchase__ethRate a
'
;
const
buyEthModal
=
'
m-blockchain__eth-modal .m-modal-container
'
;
cy
.
get
(
buyEthLink
).
click
();
cy
.
get
(
buyEthModal
).
should
(
'
be.visible
'
);
});
it
(
'
should navigate to Plus and trigger a Wire
'
,
()
=>
{
const
upgradeButton
=
cy
.
get
(
'
.mf-button.m-upgradesUpgradeOptionsPlan__action:eq(0)
'
);
upgradeButton
.
click
();
cy
.
location
(
'
pathname
'
).
should
(
'
contain
'
,
'
/plus
'
);
});
it
(
'
should navigate to Pro and trigger a Wire
'
,
()
=>
{
const
upgradeButton
=
cy
.
get
(
'
.mf-button.m-upgradesUpgradeOptionsPlan__action:eq(1)
'
);
upgradeButton
.
click
();
cy
.
location
(
'
pathname
'
).
should
(
'
contain
'
,
'
/pro
'
);
});
it
(
'
should navigate to Nodes
'
,
()
=>
{
const
upgradeButton
=
cy
.
get
(
'
.mf-button.m-upgradesUpgradeOptionsPlan__action:eq(2)
'
);
upgradeButton
.
click
();
cy
.
location
(
'
pathname
'
).
should
(
'
contain
'
,
'
/nodes
'
);
});
});
This diff is collapsed.
cypress/support/commands.js
View file @
20fb225c
...
...
@@ -255,3 +255,36 @@ function b64toBlob(b64Data, contentType, sliceSize = 512) {
blob
.
lastModifiedDate
=
new
Date
();
return
blob
;
}
/**
* Check if certain element is on viewport
* @param {*} element
*/
Cypress
.
Commands
.
add
(
'
isInViewport
'
,
element
=>
{
cy
.
get
(
element
).
then
(
$el
=>
{
const
bottom
=
Cypress
.
$
(
cy
.
state
(
'
window
'
)).
height
();
const
rect
=
$el
[
0
].
getBoundingClientRect
();
expect
(
rect
.
top
).
not
.
to
.
be
.
greaterThan
(
bottom
);
expect
(
rect
.
bottom
).
not
.
to
.
be
.
greaterThan
(
bottom
);
expect
(
rect
.
top
).
not
.
to
.
be
.
greaterThan
(
bottom
);
expect
(
rect
.
bottom
).
not
.
to
.
be
.
greaterThan
(
bottom
);
})
});
/**
* Check if certain element is on viewport
* @param {*} element
*/
Cypress
.
Commands
.
add
(
'
isNotInViewport
'
,
element
=>
{
cy
.
get
(
element
).
then
(
$el
=>
{
const
bottom
=
Cypress
.
$
(
cy
.
state
(
'
window
'
)).
height
();
const
rect
=
$el
[
0
].
getBoundingClientRect
();
expect
(
rect
.
top
).
to
.
be
.
greaterThan
(
bottom
);
expect
(
rect
.
bottom
).
to
.
be
.
greaterThan
(
bottom
);
expect
(
rect
.
top
).
to
.
be
.
greaterThan
(
bottom
);
expect
(
rect
.
bottom
).
to
.
be
.
greaterThan
(
bottom
);
})
});
This diff is collapsed.
Please
register
or
sign in
to comment