diff --git a/components/centraldashboard/cypress/e2e/landing-page.cy.ts b/components/centraldashboard/cypress/e2e/landing-page.cy.ts index c6d1f47b64f..ea4227c275e 100644 --- a/components/centraldashboard/cypress/e2e/landing-page.cy.ts +++ b/components/centraldashboard/cypress/e2e/landing-page.cy.ts @@ -16,7 +16,7 @@ describe('Landing Page', () => { }); it('should access the landing page', ()=>{ - cy.get('main-page').shadow().find('blocked-user-view').should('not.be.visible'); + cy.get('main-page').shadow().find('blocked-user-view').should('not.exist'); cy.get('main-page').shadow().find('landing-page').should('exist'); cy.get('main-page').shadow().find('landing-page').shadow().find('#MainCard > neon-animatable > h2').should('have.text', 'Welcome'); cy.get('main-page').shadow().find('landing-page').shadow().find('#MainCard > neon-animatable > p').find('a').should('exist').and('have.prop', 'href', 'https://zone.pages.cloud.statcan.ca/docs/en/'); @@ -74,7 +74,7 @@ describe('Landing Page', () => { //assert the main page and that the default notebook shows up cy.get('main-page').shadow().find('landing-page').should('not.be.visible'); - cy.get('main-page').shadow().find('blocked-user-view').should('not.be.visible'); + cy.get('main-page').shadow().find('blocked-user-view').should('not.exist'); cy.get('main-page').shadow().find('dashboard-view').should('exist'); cy.get('main-page').shadow().find('dashboard-view').shadow().find('notebook-default-card').shadow().find('paper-card#DefaultNotebookCard').should('exist'); cy.get('main-page').shadow().find('dashboard-view').shadow().find('notebook-default-card').shadow().find('paper-card#DefaultNotebookCard > .data-content > .button-div > paper-button#Details').should('exist'); @@ -146,7 +146,7 @@ describe('Landing Page', () => { cy.wait(['@mockWorkgroupRequest', '@mockDashboardLinksRequest']); - cy.get('main-page').shadow().find('blocked-user-view').should('not.be.visible'); + cy.get('main-page').shadow().find('blocked-user-view').should('not.exist'); cy.get('main-page').shadow().find('landing-page').should('exist'); cy.get('main-page').shadow().find('landing-page').shadow().find('#MainCard > neon-animatable > h2').should('have.text', 'Welcome'); cy.get('main-page').shadow().find('landing-page').shadow().find('#MainCard > neon-animatable > p').should('have.text', 'You are currently logged in using user.name@cloud.statcan.gc.ca, this domain is not supported. Please log out and log in using your “@statcan.gc.ca” email.'); diff --git a/components/centraldashboard/cypress/e2e/main-page.cy.ts b/components/centraldashboard/cypress/e2e/main-page.cy.ts index 0897dd57c6d..eab6da17d38 100644 --- a/components/centraldashboard/cypress/e2e/main-page.cy.ts +++ b/components/centraldashboard/cypress/e2e/main-page.cy.ts @@ -23,7 +23,7 @@ describe('Main Page', () => { it('should access the dashboard', () => { cy.get('main-page').should('exist'); - cy.get('main-page').shadow().find('blocked-user-view').should('not.be.visible'); + cy.get('main-page').shadow().find('blocked-user-view').should('not.exist'); cy.get('main-page').shadow().find('dashboard-view').should('exist'); // create new notebook link cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Quick-Links').should('exist'); @@ -168,6 +168,23 @@ describe('Main Page', () => { cy.get('main-page').shadow().find('a[href="https://zone.pages.cloud.statcan.ca/docs/en/"]').find('paper-item').should('have.text', 'Documentation'); }); + it('should block access to user', () =>{ + cy.intercept('GET', `/api/workgroup/exists`, { + "hasAuth":true, + "user":"user.name@statcan.gc.ca", + "email": "user.name@statcan.gc.ca", + "hasWorkgroup":true, + "registrationFlowAllowed":true, + "isAllowed": false + }).as('mockWorkgroupRequest'); + cy.visit('/'); + + cy.wait('@mockWorkgroupRequest'); + + cy.get('main-page').should('exist'); + cy.get('main-page').shadow().find('blocked-user-view').should('exist'); + }); + describe('Notebook Default Card', () => { it('should have a notebook card', () => { cy.get('main-page').should('exist'); diff --git a/components/centraldashboard/public/components/main-page.js b/components/centraldashboard/public/components/main-page.js index 1f37ccdca99..1fc3d3a309e 100644 --- a/components/centraldashboard/public/components/main-page.js +++ b/components/centraldashboard/public/components/main-page.js @@ -105,7 +105,7 @@ export class MainPage extends mixinBehaviors([AppLocalizeBehavior], utilitiesMix allNamespaces: {type: Boolean, value: false, readOnly: true}, notFoundInIframe: {type: Boolean, value: false, readOnly: true}, registrationFlow: {type: Boolean, value: false, readOnly: true}, - isAllowed: {type: Boolean, value: false, readOnly: true}, + isAllowed: {type: Boolean, value: true, readOnly: true}, workgroupStatusHasLoaded: { type: Boolean, value: false, @@ -259,7 +259,6 @@ export class MainPage extends mixinBehaviors([AppLocalizeBehavior], utilitiesMix */ _onHasWorkgroupError(ev) { this.showError('mainPage.errGeneric'); - this.isAllowed = true; return; }