Skip to content

Commit

Permalink
test(cypress): updates for privacy toggles and fixes (#2909)
Browse files Browse the repository at this point in the history
  • Loading branch information
luisecm committed Apr 19, 2022
1 parent 5a58cf1 commit 05660d7
Show file tree
Hide file tree
Showing 16 changed files with 273 additions and 88 deletions.
13 changes: 10 additions & 3 deletions components/interactables/Select/Select.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
:class="{'select': true, [`is-${type}`]: true, [`is-${size}`]: true, 'is-full-width': fullWidth, 'disabled': disabled}"
v-click-outside="() => open = false"
>
<div :class="{'custom-select': true, open, up, down: !up}">
<div class="selected" @click="toggleOpen()">{{ getSelectLabel() }}</div>
<div
:class="{'custom-select': true, open, up, down: !up}"
data-cy="custom-select"
>
<div class="selected" data-cy="custom-select-value" @click="toggleOpen()">
{{ getSelectLabel() }}
</div>
<div class="items">
<UiScroll verticalScroll scrollbarVisibility="scroll" enableWrap>
<div
Expand All @@ -19,7 +24,9 @@
>
{{ option.text }}
</div>
<span v-else>{{ option.text }}</span>
<span data-cy="custom-select-option-text" v-else
>{{ option.text }}</span
>
</div>
</UiScroll>
</div>
Expand Down
1 change: 1 addition & 0 deletions components/interactables/Switch/Switch.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<div :class="`switch-button-control ${small ? 'is-small' : ''}`">
<div
class="switch-button"
data-cy="switch-button"
:class="{ enabled: isEnabled, locked: isLocked }"
@click="toggle"
>
Expand Down
1 change: 1 addition & 0 deletions components/views/navigation/slimbar/Slimbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
</div>
<div
class="circle-group has-tooltip-right has-tooltip-primary"
data-cy="settings"
:data-tooltip="$t('pages.settings.settings')"
v-on:click="$store.commit('ui/toggleSettings', { show: true })"
>
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration-pair-chat/chat-first-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Chat features with two accounts at the same time - First User', () =>
.clear()
.type(randomPIN, { log: false }, { force: true })
cy.get('[data-cy=submit-input]').click()
cy.contains('Import Account', { timeout: 60000 }).click()
cy.get('[data-cy=import-account-button]', { timeout: 60000 }).click()
cy.get('[data-cy=add-passphrase]')
.should('be.visible')
.click()
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration-pair-chat/chat-second-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('Chat features with two accounts at the same time - Second User', () =>
.clear()
.type(randomPIN, { log: false }, { force: true })
cy.get('[data-cy=submit-input]').click()
cy.contains('Import Account', { timeout: 60000 }).click()
cy.get('[data-cy=import-account-button]', { timeout: 60000 }).click()
cy.get('[data-cy=add-passphrase]')
.should('be.visible')
.click()
Expand Down
2 changes: 2 additions & 0 deletions cypress/integration/create-account-negative-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ describe('Create Account - Negative Tests', () => {
cy.createAccountRecoverySeed()

//Clicking without adding a username will throw an error message
cy.validateUserInputIsDisplayed()
cy.get('[data-cy=sign-in-button]').click()
cy.contains('Username must be at least 5 characters.')
})
Expand All @@ -46,6 +47,7 @@ describe('Create Account - Negative Tests', () => {
cy.createAccountRecoverySeed()

//Username and Status Input
cy.validateUserInputIsDisplayed()
cy.createAccountUserInput(randomName, randomStatus)

//Attempting to add NSFW image and validating error message is displayed
Expand Down
63 changes: 58 additions & 5 deletions cypress/integration/create-account.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,67 @@ const randomPIN = faker.internet.password(7, false, /[A-Z]/, 'test') // generate
describe('Create Account Validations', () => {
Cypress.on('uncaught:exception', (err, runnable) => false) // temporary until AP-48 gets fixed
it('Create Account', () => {
//Testing in a viewport that does not require to scroll
cy.viewport(1000, 1200)
//Enter PIN screen
cy.createAccountPINscreen(randomPIN, false, false)

//Create or Import account selection screen
cy.contains(
"We're going to create an account for you. On the next screen, you'll see a set of words. Screenshot this or write it down. This is the only way to backup your account.",
).should('be.visible')
cy.get('.is-primary > #custom-cursor-area').should('be.visible')
cy.get('[data-cy=create-account-button]').should('be.visible')
cy.createAccountSecondScreen()

//Privacy Settings screen
cy.createAccountPrivacyToggles()
//Privacy Settings screen - Adding text validations below instead of using a command
//Title and subtitle are visible
cy.contains('Privacy Settings').should('be.visible')
cy.contains(
'Choose which features to enable to best suit your privacy preferences.',
).should('be.visible')
//First toggle and description is visible
cy.contains('Register Username Publicly').should('be.visible')
cy.contains(
'Publicly associate your account ID with a human readable username. Anyone can see this association.',
).should('be.visible')
//Second toggle and description is visible
cy.contains('Store Account Pin').should('be.visible')
cy.contains(
"Store your account pin locally so you don't have to enter it manually every time. This is not recommended.",
).should('be.visible')
//Third toggle and description is visible
cy.contains('Enable External Embeds').should('be.visible')
cy.contains(
'Allow Satellite to fetch data from external sites in order to expand links like Spotify, YouTube, and more.',
).should('be.visible')
//Fourth toggle and description is visible
cy.contains('Display Current Activity').should('be.visible')
cy.contains(
"Allow Satellite to see what games you're playing and show them off on your profile so friends can jump in.",
).should('be.visible')
//Fifth toggle and description is visible
cy.contains('Consents to having files scanned').should('be.visible')
cy.contains(
'In order to share files/use the encrypted file storage I consent to having my files auto-scanned against the Microsoft PhotoDNA service to help prevent the spread of sexual abuse material',
).should('be.visible')
//Option for Signaling Servers
cy.contains('Signaling Servers').should('be.visible')
cy.contains(
"Choose which signaling server group you want to use. If you use 'Satellite + Public Signaling Servers', you are using public servers and Satellite hosted servers to connect with your friends. We do not track connections. We only track server utilization (memory and cpu usage) to know if we need to turn on more signaling servers. If you opt to use 'Only Public Signaling Servers', those are totally outside of Satellite control, so we can not see or have any insight into their operation, logging, or data sharing practices, and you may experience difficulties connecting with friends if the signaling servers are overloaded.",
).should('be.visible')

cy.get('.switch-button')
.should('be.visible')
.each(($btn, index, $List) => {
if (!$btn.hasClass('locked')) {
if ($btn.hasClass('enabled')) {
cy.wrap($btn).click().should('not.have.class', 'enabled')
} else {
cy.wrap($btn).click().should('have.class', 'enabled')
}
}
})
cy.get('[data-cy=privacy-continue-button]').should('be.visible').click()

//Recovery Seed Screen
cy.get('.title').should('be.visible').should('contain', 'Recovery Seed')
Expand All @@ -29,13 +78,13 @@ describe('Create Account Validations', () => {
cy.createAccountRecoverySeed()

//Username and Status Input
cy.validateUserInputIsDisplayed()
cy.contains(
'Customize how the world sees you, choose something memorable.',
{
timeout: 10000,
},
).should('be.visible')
cy.get('[data-cy=username-input]').should('be.visible')
cy.get('[data-cy=status-input]').should('be.visible')
cy.createAccountUserInput(randomName, randomStatus)

Expand All @@ -61,6 +110,7 @@ describe('Create Account Validations', () => {
cy.createAccountRecoverySeed()

//Adding random data in user input fields
cy.validateUserInputIsDisplayed()
cy.createAccountUserInput(randomName, randomStatus)

//Attempting to add NSFW image and validating error message is displayed
Expand Down Expand Up @@ -94,6 +144,7 @@ describe('Create Account Validations', () => {
cy.createAccountRecoverySeed()

//Adding random data in user input fields
cy.validateUserInputIsDisplayed()
cy.createAccountUserInput(randomName, randomStatus)

//Attempting to add NSFW image and validating error message is displayed
Expand All @@ -116,7 +167,7 @@ describe('Create Account Validations', () => {
).should('not.exist')
})

it('Create account without image after attempting to add an invalid image file', () => {
it.skip('Create account without image after attempting to add an invalid image file', () => {
//Creating pin
cy.createAccountPINscreen(randomPIN)

Expand All @@ -126,6 +177,7 @@ describe('Create Account Validations', () => {
cy.createAccountRecoverySeed()

//Adding random data in user input fields
cy.validateUserInputIsDisplayed()
cy.createAccountUserInput(randomName, randomStatus)

//Attempting to add an invalid image and validating error message is displayed
Expand Down Expand Up @@ -158,6 +210,7 @@ describe('Create Account Validations', () => {
cy.createAccountRecoverySeed()

//Adding random data in user input fields
cy.validateUserInputIsDisplayed()
cy.createAccountUserInput(randomName, randomStatus)

//Attempting to add an invalid image and validating error message is displayed
Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/import-account-negative-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const randomPIN = faker.internet.password(7, false, /[A-Z]/, 'test') // generate
describe('Import Account - Negative Tests', () => {
it('Verify error when adding a wrong order passphrase', () => {
cy.importAccountPINscreen(randomPIN)
cy.contains('Import Account', { timeout: 60000 }).click()
cy.get('[data-cy=import-account-button]', { timeout: 60000 }).click()
cy.get('[data-cy=add-passphrase]', { timeout: 30000 })
.should('be.visible')
.click()
Expand All @@ -21,7 +21,7 @@ describe('Import Account - Negative Tests', () => {

it('Verify behavior when adding less than 12 words', () => {
cy.importAccountPINscreen(randomPIN)
cy.contains('Import Account', { timeout: 60000 }).click()
cy.get('[data-cy=import-account-button]', { timeout: 60000 }).click()
cy.get('[data-cy=add-passphrase]', { timeout: 30000 })
.should('be.visible')
.click()
Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/import-account.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const randomPIN = faker.internet.password(7, false, /[A-Z]/, 'test') // generate
describe('Import Account Validations', () => {
it('Import account - verify suggestions', () => {
cy.importAccountPINscreen(randomPIN)
cy.contains('Import Account', { timeout: 60000 })
cy.get('[data-cy=import-account-button]', { timeout: 60000 })
.should('be.visible')
.click()
cy.get('[data-cy=add-passphrase]').should('be.visible').click().type('b')
Expand All @@ -14,7 +14,7 @@ describe('Import Account Validations', () => {

it('Import account', () => {
cy.importAccountPINscreen(randomPIN, false, false)
cy.contains('Import Account', { timeout: 60000 })
cy.get('[data-cy=import-account-button]', { timeout: 60000 })
.should('be.visible')
.click()
cy.contains(
Expand Down
3 changes: 2 additions & 1 deletion cypress/integration/mobiles-responsiveness.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ describe('Run responsiveness tests on several devices', () => {
cy.createAccountRecoverySeed()

//Username and Status Input
cy.validateUserInputIsDisplayed()
cy.createAccountUserInput(randomName, randomStatus)

//User Image Input
Expand All @@ -46,7 +47,7 @@ describe('Run responsiveness tests on several devices', () => {
cy.viewport(item.width, item.height)
cy.importAccount(randomPIN, recoverySeed)
//Validate profile name displayed
cy.validateChatPageIsLoaded(240000)
cy.validateChatPageIsLoaded()
})

it.skip(`Chat Features on ${item.description}`, () => {
Expand Down
4 changes: 3 additions & 1 deletion cypress/integration/pin-unlock-validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ const userPassphrase =
const randomPIN = faker.internet.password(7, false, /[A-Z]/, 'test') // generate random PIN

describe('Unlock pin should be persisted when store pin is enabled', () => {
it('Create Account with store pin disabled', () => {
it.skip('Create Account with store pin disabled', () => {
//Go to URL, add a PIN and make sure that toggle for save pin is disabled
cy.createAccountPINscreen(randomPIN, false, false)

//Follow the next steps to create an account
cy.createAccountSecondScreen()
cy.createAccountPrivacyTogglesGoNext()
cy.createAccountRecoverySeed()
cy.validateUserInputIsDisplayed()
cy.createAccountUserInput()
cy.createAccountSubmit()

Expand All @@ -32,6 +33,7 @@ describe('Unlock pin should be persisted when store pin is enabled', () => {
cy.createAccountSecondScreen()
cy.createAccountPrivacyTogglesGoNext()
cy.createAccountRecoverySeed()
cy.validateUserInputIsDisplayed()
cy.createAccountUserInput()
cy.createAccountSubmit()

Expand Down
Loading

0 comments on commit 05660d7

Please sign in to comment.