Skip to content

Commit

Permalink
Merge branch 'castaway/1509_index_sync_modal' into castaway/1509_inde…
Browse files Browse the repository at this point in the history
…x_sync_modal
  • Loading branch information
castaway authored Apr 3, 2024
2 parents d7bccd0 + 4318dde commit 68d64b6
Show file tree
Hide file tree
Showing 34 changed files with 930 additions and 669 deletions.
4 changes: 2 additions & 2 deletions e2e/cypress/integration/account-access.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
describe('Account access control', () => {
function becomeSubaccount() {
cy.intercept('/rest/v1/me', (req) => {
req.reply((res) => {
req.continue((res) => {
const payload = JSON.parse(res.body);
payload.result.owner = {
uid: 666,
username: '[email protected]',
};
res.body = JSON.stringify(payload);
res.send(JSON.stringify(payload));
});
});
}
Expand Down
11 changes: 6 additions & 5 deletions e2e/cypress/integration/compose.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
/// <reference types="cypress" />

describe('Composing emails', () => {
beforeEach(() => {
beforeEach(async () => {
localStorage.setItem('221:Desktop:localSearchPromptDisplayed', JSON.stringify('true'));
localStorage.setItem('221:Mobile:localSearchPromptDisplayed', JSON.stringify('true'));
localStorage.setItem('221:preference_keys', '["Desktop:localSearchPromptDisplayed","Mobile:localSearchPromptDisplayed"]');

(await indexedDB.databases())
.filter(db => db.name && /messageCache/.test(db.name))
.forEach(db => indexedDB.deleteDatabase(db.name!));
});

Cypress.config('requestTimeout', 100000);
Expand Down Expand Up @@ -55,10 +59,7 @@ describe('Composing emails', () => {
cy.get('mailrecipient-input mat-error').should('not.exist');
});

it('should open reply draft with HTML editor', async () => {
(await indexedDB.databases())
.filter(db => db.name && /messageCache/.test(db.name))
.forEach(db => indexedDB.deleteDatabase(db.name!));
it('should open reply draft with HTML editor', () => {
// cy.visit('/');
// cy.wait(1000);
cy.intercept('/rest/v1/email/1').as('message1requested');
Expand Down
15 changes: 11 additions & 4 deletions e2e/cypress/integration/message-caching.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/// <reference types="cypress" />

describe('Message caching', () => {
beforeEach(() => {
beforeEach(async () => {
localStorage.setItem('Desktop:localSearchPromptDisplayed', 'true');
localStorage.setItem('Global:messageSubjectDragTipShown', 'true');
});

it('should cache all messages on first time page load', async () => {
(await indexedDB.databases())
.filter(db => db.name && /messageCache/.test(db.name))
.forEach(db => indexedDB.deleteDatabase(db.name!));

});

it('should cache all messages on first time page load', () => {
cy.intercept('/rest/v1/email/12').as('message12requested');

cy.visit('/');
Expand All @@ -19,6 +19,13 @@ describe('Message caching', () => {
});

it('should not re-request messages after a page reload', () => {
cy.intercept('/rest/v1/email/12').as('message12requested');

cy.visit('/');
cy.wait('@message12requested', {'timeout':10000});
// This should have fetched/cached the message

// Now don't fetch it again:
cy.visit('/#Inbox:12');
let called = false;
cy.intercept('/rest/v1/email/12', (_req) => {
Expand Down
45 changes: 45 additions & 0 deletions e2e/cypress/integration/profile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/// <reference types="cypress" />

describe('Profiles settings page', () => {

const ALLOWED_DOMAINS = ['runbox.com', 'example.com'];

it('lists currently existing profiles', () => {
cy.intercept('GET', '/rest/v1/profiles').as('getProfiles');
cy.intercept('GET', '/rest/v1/aliases/limits').as('getAliasLimits');
cy.visit('/account/identities');
cy.wait('@getProfiles');

// 1 compose profile, 5 valid ones:
cy.get('mat-card-content.profile-content').should('have.length', 6);
});

it('can create new profiles', () => {
cy.intercept('GET', '/rest/v1/profiles').as('getProfiles');
cy.intercept('GET', '/rest/v1/aliases/limits').as('getAliasLimits');
cy.visit('/account/identities');
cy.wait('@getAliasLimits');

cy.get('#add-identity').click();

// open dialog, fill in fields, submit
cy.get('app-profiles-edit').should('be.visible');
cy.get('input[name="email"]').type('[email protected]');
cy.get('input[name="from"]').type('My Name');
cy.get('input[name="name"]').type('My Profile');
cy.get('textarea[name="signature"]').type('My Sig');

cy.intercept('POST', '/rest/v1/profile', {
statusCode: 200,
body: {
status: 'success',
result: {id: 1}
}
}).as('postProfile');
cy.get('button#save').click();
cy.wait('@postProfile');

cy.get('app-profiles-edit').should('not.exist');
});

});
3 changes: 2 additions & 1 deletion e2e/cypress/support/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import './commands'
import './commands';
require('cypress-terminal-report/src/installLogsCollector')();
Loading

0 comments on commit 68d64b6

Please sign in to comment.