-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #533 from appuio/guide-new-users
Guide first-time-users through initial setup
- Loading branch information
Showing
31 changed files
with
751 additions
and
462 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import { createUser } from '../fixtures/user'; | ||
import { BillingEntity, BillingEntityPermissions, BillingEntitySpec } from '../../src/app/types/billing-entity'; | ||
import { billingEntityNxt, setBillingEntities } from '../fixtures/billingentities'; | ||
import { OrganizationPermissions } from '../../src/app/types/organization'; | ||
|
||
describe('Test billing entity form elements', () => { | ||
beforeEach(() => { | ||
|
@@ -161,7 +162,7 @@ describe('Test billing entity form elements', () => { | |
}); | ||
|
||
it('should cancel editing', () => { | ||
setBillingEntities(cy); | ||
setBillingEntities(cy, billingEntityNxt); // give at least 1 item to avoid redirect back to form. | ||
|
||
['.p-button-secondary', 'a[appbacklink]'].forEach((cancelSelector) => { | ||
cy.visit('/billingentities/$new?edit=y'); | ||
|
@@ -170,7 +171,7 @@ describe('Test billing entity form elements', () => { | |
cy.get(cancelSelector).click(); | ||
cy.get('app-billingentity-form').should('not.exist'); | ||
|
||
cy.get('p-messages').should('contain.text', 'No billing entities available'); | ||
cy.get('.text-3xl').should('have.length', 1); | ||
}); | ||
}); | ||
}); | ||
|
@@ -186,7 +187,11 @@ describe('Test billing entity create', () => { | |
cy.intercept('GET', 'appuio-api/apis/appuio.io/v1/users/mig', { | ||
body: createUser({ username: 'mig', defaultOrganizationRef: 'nxt' }), | ||
}); | ||
cy.setPermission({ verb: 'list', ...BillingEntityPermissions }, { verb: 'create', ...BillingEntityPermissions }); | ||
cy.setPermission( | ||
{ verb: 'list', ...BillingEntityPermissions }, | ||
{ verb: 'create', ...BillingEntityPermissions }, | ||
{ verb: 'list', ...OrganizationPermissions } | ||
); | ||
}); | ||
|
||
it('should create billing', () => { | ||
|
@@ -247,6 +252,39 @@ describe('Test billing entity create', () => { | |
cy.get('.flex-wrap > .text-900').eq(4).should('contain.text', 'mig [email protected]'); | ||
cy.get('.flex-wrap > .text-900').eq(5).should('contain.text', '🇩🇪'); | ||
}); | ||
|
||
it('should forward to organizations if first time', () => { | ||
cy.intercept('POST', '/appuio-api/apis/billing.appuio.io/v1/billingentities', (req) => { | ||
const be: BillingEntity = req.body; | ||
be.metadata.name = 'be-2345'; | ||
be.metadata.generateName = ''; | ||
req.reply(be); | ||
}).as('createBillingEntity'); | ||
setBillingEntities(cy, billingEntityNxt); | ||
|
||
cy.visit('/billingentities/$new?edit=y&firstTime=y'); | ||
cy.get('#title').should('contain.text', 'New Billing'); | ||
|
||
cy.get('#displayName').type('➡️ Engineering GmbH'); | ||
|
||
cy.get('#companyEmail').find('input').type('[email protected],'); | ||
cy.get('#phone').type('☎️'); | ||
cy.get('#line1').type('📃'); | ||
cy.get('#line2').type('📋'); | ||
cy.get('#postal').type('🏤'); | ||
cy.get('#city').type('🏙️'); | ||
cy.get('p-dropdown').click().contains('Switzerland').click(); | ||
|
||
cy.get('#accountingName').type('mig'); | ||
|
||
cy.get('button[type="submit"]').should('be.enabled').click(); | ||
cy.wait('@createBillingEntity'); | ||
|
||
cy.get('p-toast').should('contain.text', 'Successfully saved'); | ||
cy.url().should('include', '/organizations/$new').should('not.include', '?edit=y'); | ||
|
||
cy.get('#title').should('contain.text', 'New Organization'); | ||
}); | ||
}); | ||
|
||
describe('Test billing entity edit', () => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.