Skip to content

Commit

Permalink
13.12.0 (#1014)
Browse files Browse the repository at this point in the history
  • Loading branch information
sneha-sirure authored Aug 14, 2024
1 parent 9841d0d commit 7bb9370
Show file tree
Hide file tree
Showing 13 changed files with 498 additions and 267 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/deploy-at.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ jobs:
environment: ${{ matrix.environment }}
tag: ${{ github.sha }}

cypress-main:
name: 'Cypress'
playwright-main:
name: 'Playwright'
needs: deploy-main
strategy:
fail-fast: false
matrix:
environment: [AT21, AT22, AT23, AT24]
uses: './.github/workflows/template-test-cypress.yml'
uses: './.github/workflows/playwright.yml'
with:
environment: ${{ matrix.environment }}

9 changes: 7 additions & 2 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
name: Playwright Tests
on:
schedule :
- cron : '0 5 * * *' # every day at 05:00 UTC
workflow_call:
inputs:
environment:
type: string
required: true
description: Environment
jobs:
e2e-tests:

name: 'Playwright end to end tests'
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down
2 changes: 1 addition & 1 deletion cypress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"lint": "eslint ."
},
"devDependencies": {
"cypress": "^13.12.0",
"cypress": "^13.13.1",
"cypress-file-upload": "^5.0.8",
"cypress-grep": "^3.0.0",
"cypress-iframe": "^1.0.1",
Expand Down
224 changes: 0 additions & 224 deletions cypress/src/e2e/profile/APIdelegering.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,230 +11,6 @@ describe('API delegering tests', () => {
cy.selectLanguage('bokmål');
});

it('Delegate api to an organization and verify it in his Delegations overview page and delete APIs delegated', () => {
cy.get(apiDelegering.apiAdministrationPanel, { timeout: 6000 }).should('be.visible').click();
cy.contains('Gi og fjerne API tilganger', { timeout: 6000 }).should('be.visible').click();
//delete api-s delegated
cy.deleteAPIsDelegated();

cy.get(apiDelegering.apiAdministrationPanel, { timeout: 6000 }).should('be.visible').click();
cy.verifyAPIDelegationsOverviewPage();

//choose api page - select APIs to be delegated
cy.chooseAPIToBeDelegated('Maskinporten Schema - AM - K6');

//verifying selected APIs for delegation
cy.verifyAPIselectedForDelegation('Maskinporten Schema - AM - K6');

//choose org page - Search for organization and add it to list for delegation
cy.chooseOrgToDelegateAPI('310661414', 'INTERESSANT KOMPATIBEL TIGER AS');

//confirmation page for API delegation
cy.verifyAPIinAPIDelegationConfirmationPage(
'Maskinporten Schema - AM - K6',
'INTERESSANT KOMPATIBEL TIGER AS',
);

//receipt page for API delegation
cy.verifyAPIDelegatedInReceiptPage('Maskinporten Schema - AM - K6');

//verification of delegated api-s in offered-api-delegations overview page
cy.verifyAPIDelegatedInOfferedAPIDelegationsOverviewPage(
'INTERESSANT KOMPATIBEL TIGER AS',
'Maskinporten Schema - AM - K6',
);

//Verification of button of delegate new API
cy.contains('Deleger nytt API', { timeout: 6000 }).should('be.visible');

//Verification of button to edit access
cy.contains('Rediger tilganger', { timeout: 6000 }).should('be.visible');

//delete api-s delegated
cy.deleteAPIsDelegated();
});

it('Delegate api to an organization and supplierOrg verifies it in its Delegations overview page and delete APIs it received', () => {
cy.get(apiDelegering.apiAdministrationPanel, { timeout: 6000 }).should('be.visible').click();
cy.contains('Gi og fjerne API tilganger', { timeout: 6000 }).should('be.visible').click();

//delete api-s delegated
cy.deleteAPIsDelegated();
cy.get(apiDelegering.apiAdministrationPanel, { timeout: 6000 }).should('be.visible').click();
cy.verifyAPIDelegationsOverviewPage();

//choose api page - select APIs to be delegated
cy.chooseAPIToBeDelegated('Maskinporten Schema - AM - K6');

//verifying selected APIs for delegation
cy.verifyAPIselectedForDelegation('Maskinporten Schema - AM - K6');

//choose org page - Search for organization and add it to list for delegation
cy.chooseOrgToDelegateAPI('310661414', 'INTERESSANT KOMPATIBEL TIGER AS');

//confirmation page for API delegation
cy.verifyAPIinAPIDelegationConfirmationPage(
'Maskinporten Schema - AM - K6',
'INTERESSANT KOMPATIBEL TIGER AS',
);

//receipt page for API delegation
cy.verifyAPIDelegatedInReceiptPage('Maskinporten Schema - AM - K6');

//login as DAGL of supplierOrg who recieved API delegation
cy.loginWithTestID('26856499412', '310661414');
cy.selectReporteeViaAPI('310661414');
cy.visit('/ui/profile');
cy.selectLanguage('bokmål');

//verify API delegations recieved as supplierOrg
cy.get(apiDelegering.apiAdministrationPanel, { timeout: 6000 }).should('be.visible').click();
cy.contains('Mottatte API tilganger', { timeout: 6000 }).should('be.visible').click();
cy.verifyAPIDelegatedInReceivedAPIDelegationsOverviewPage('AKTVERDIG RETORISK APE');

//delete received API delegations
cy.deleteReceivedAPIDelegations();
});

it('Delegate api to organization to which api was delegated before', () => {
cy.get(apiDelegering.apiAdministrationPanel, { timeout: 6000 }).should('be.visible').click();
cy.contains('Gi og fjerne API tilganger', { timeout: 6000 }).should('be.visible').click();

//delete api-s delegated
cy.deleteAPIsDelegated();
cy.get(apiDelegering.apiAdministrationPanel, { timeout: 6000 }).should('be.visible').click();
cy.verifyAPIDelegationsOverviewPage();

//choose api page - select APIs to be delegated
cy.chooseAPIToBeDelegated('Maskinporten Schema - AM - K6');

//verifying selected APIs for delegation
cy.verifyAPIselectedForDelegation('Maskinporten Schema - AM - K6');

//choose org page - Search for organization and add it to list for delegation
cy.chooseOrgToDelegateAPI('310661414', 'INTERESSANT KOMPATIBEL TIGER AS');

//confirmation page for API delegation
cy.verifyAPIinAPIDelegationConfirmationPage(
'Maskinporten Schema - AM - K6',
'INTERESSANT KOMPATIBEL TIGER AS',
);

//receipt page for API delegation
cy.verifyAPIDelegatedInReceiptPage('Maskinporten Schema - AM - K6');

//verification of delegated api-s in offered-api-delegations overview page
cy.verifyAPIDelegatedInOfferedAPIDelegationsOverviewPage(
'INTERESSANT KOMPATIBEL TIGER AS',
'Maskinporten Schema - AM - K6',
);

//choose api page - select APIs to be delegated
cy.chooseAPIToBeDelegated('Automation Regression');

//verifying selected APIs for delegation
cy.verifyAPIselectedForDelegation('Automation Regression');

//choose same org which got delegation before
cy.chooseSameOrgToDelegateAPI('INTERESSANT KOMPATIBEL TIGER AS');

//confirmation page for API delegation
cy.verifyAPIinAPIDelegationConfirmationPage(
'Automation Regression',
'INTERESSANT KOMPATIBEL TIGER AS',
);

//receipt page for API delegation
cy.verifyAPIDelegatedInReceiptPage('Automation Regression');

//verification of delegated api-s in offered-api-delegations overview page
cy.verifyAPIDelegatedInOfferedAPIDelegationsOverviewPage(
'INTERESSANT KOMPATIBEL TIGER AS',
'Automation Regression',
);

//delete api-s delegated
cy.deleteAPIsDelegated();
});

it('Verify filtering of API providers in API delagation and verify Forrige/ Neste buttons', () => {
cy.get(apiDelegering.apiAdministrationPanel, { timeout: 6000 }).should('be.visible').click();
cy.contains('Gi og fjerne API tilganger', { timeout: 6000 }).should('be.visible').click();

//delete api-s delegated
cy.deleteAPIsDelegated();
cy.get(apiDelegering.apiAdministrationPanel, { timeout: 6000 }).should('be.visible').click();
cy.verifyAPIDelegationsOverviewPage();

//verify filter and values in it
cy.contains('Deleger nytt API').click();
cy.get('button').contains('Filtrer på etat').click();
cy.contains('button', 'Nullstill valg').should('have.attr', 'aria-disabled', 'true');
cy.get('button')
.contains(new RegExp('^Bruk$', 'g'))
.should('have.attr', 'aria-disabled', 'true');
cy.get('[role="dialog"]')
.should('contain.text', 'Digitaliseringsdirektoratet')
.and('contain.text', 'Testdepartement');
cy.wait(1000);

//click option in filter, reset it and verify if it is reset
cy.contains('Testdepartement').click();
cy.contains('button', 'Nullstill valg').should('be.enabled').click();
cy.contains('Testdepartement').siblings().should('not.be.checked');

//click option in filter, click same option again and verify if it resets
cy.contains('Testdepartement').click();
cy.contains('button', `Testdepartement`).find('[type=checkbox]').should('be.checked');
cy.contains('Testdepartement').click();
cy.contains('button', `Testdepartement`).find('[type=checkbox]').should('not.be.checked');

//select Testdepartement option from filter and verify only APIs with Testdepartement as provider is listed
cy.contains('Testdepartement').click();
cy.contains('button', `Testdepartement`).find('[type=checkbox]').should('be.checked');
cy.get('button').contains(new RegExp('^Bruk$', 'g')).should('be.enabled').click();
cy.get(
':nth-child(1) > *[class^="_delegableApisContainer"] > *[class^="_actionBarWrapper"]',
).each(($ele) => {
cy.wrap($ele).should('contain', 'Testdepartement');
// .and('not.contain', 'Digitaliseringsdirektoratet');
//cy.get('button').contains('Filtrer på etat').click();
//cy.contains('')
});

//click on Add for first element in the list and verify if it is listed under Valgte API
cy.get(apiDelegering.searchForOrgOrAPI, { timeout: 1000 })
.first()
.type('Maskinporten Schema - AM - K6');
cy.get(`button[aria-label="Legg til Maskinporten Schema - AM - K6"]`).first().click();
cy.get(apiDelegering.selectedAPIsForDelegationResultContainer).should('not.be.empty');
cy.get('*[class^="_actionBarTexts_"]').each(($ele) => {
cy.wrap($ele)
.should('contain', 'Testdepartement')
.and('not.contain', 'Digitaliseringsdirektoratet');
});

//click on Forrige and Neste button and verify them
cy.contains('button', 'Neste').click();
cy.url().should('contain', '/offered-api-delegations/choose-org');
cy.contains('button', 'Forrige').click();
cy.url().should('contain', '/offered-api-delegations/choose-api');

//click Remove to remove API from the Valgte API list and verify it is not listed
cy.get(':nth-child(2) > *[class^="_delegableApisContainer"] > *[class^="_actionBarWrapper"]')
.children()
.first()
.find('button[aria-label*="Fjern"]')
.click();
cy.get(
':nth-child(2) > *[class^="_delegableApisContainer"] > *[class^="_actionBarWrapper"]',
).should('be.empty');

//click on Avbryt button and verify them
cy.contains('button', 'Avbryt').click();
cy.url().should('contain', '/offered-api-delegations/overview');
});

it('Delegate api to an organization by selecting from API providers filter', () => {
cy.get(apiDelegering.apiAdministrationPanel, { timeout: 6000 }).should('be.visible').click();
cy.contains('Gi og fjerne API tilganger', { timeout: 6000 }).should('be.visible').click();
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"axios": "^1.7.2",
"classnames": "^2.5.1",
"cross-env": "^7.0.3",
"cypress": "13.12.0",
"cypress": "13.13.1",
"cypress-real-events": "^1.10.0",
"i18next": "^23.8.2",
"i18next-browser-languagedetector": "^8.0.0",
Expand All @@ -38,7 +38,7 @@
"react-router-dom": "^6.24.0"
},
"devDependencies": {
"@playwright/test": "^1.44.1",
"@playwright/test": "^1.45.3",
"@testing-library/cypress": "^10.0.0",
"@types/node": "^20.12.7",
"@types/react": "^18.0.28",
Expand Down
23 changes: 23 additions & 0 deletions playwright/e2eTests/api-delegering.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,32 @@ test.describe('API-Delegations to org user', () => {
'Maskinporten Schema - AM - K6',
'INTERESSANT KOMPATIBEL TIGER ASOrg.nr. 310661414',
);

//Delegate API to same Org to which API was delegated before
await apiDelegations.chooseApiToDelegate(
'Automation Regression',
'INTERESSANT KOMPATIBEL TIGER ASOrg.nr. 310661414',
);
});

test('Verify filtering of API providers in API delagation and verify Forrige/ Neste buttons', async ({
login,
logoutUser,
context,
apiDelegations,
page,
}) => {
await login.gotoLoginPage('14824497789', page);
await login.chooseReportee('AKTVERDIG RETORISK APE', page);

//delete delegated API
await apiDelegations.deleteDelegatedAPI();

//API-delegations
await apiDelegations.apiFiltering();
await apiDelegations.delegatedAPIOverviewPage(
'Maskinporten Schema - AM - K6Testdepartement',
'INTERESSANT KOMPATIBEL TIGER ASOrg.nr. 310661414',
);
});
});
8 changes: 5 additions & 3 deletions playwright/e2eTests/singleRightsDelegering.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ test.describe('User with DAGL/HADM role without having resource access themselve
await login.chooseReportee('OPPKLARENDE OMKOMMEN TIGER AS', page);

//To delete rights - setup
// GIVEN user without delegated rights to ROMANTISK ESKE
// GIVEN user without delegated rights to OPPKLARENDE OMKOMMEN TIGER AS
const buttonIndex = 1;
await deleteRights.revokeRightsOrg('GJESTFRI RESERVERT HUND DA', buttonIndex);

Expand All @@ -73,6 +73,7 @@ test.describe('User with DAGL/HADM role without having resource access themselve
await login.chooseReportee('OPPKLARENDE OMKOMMEN TIGER AS', page);
await coverebyRights.checkCoverebyRights();
});

test('DAGL/HADM do not have rights to delegate Altinn2 to org Y , but has the rights to delegate same service after delegating sens role to himself', async ({
login,
delegate,
Expand All @@ -92,14 +93,15 @@ test.describe('User with DAGL/HADM role without having resource access themselve
await deleteRights.revokeRightsSSN('UINTERESSERT LØVEFLOKK');

//To delegate rights
// WHEN user delegates to
// WHEN user delegates rolls to UINTERESSERT LØVEFLOKK
await delegate.delegateToSSN('07922148605', 'LØVEFLOKK');
await delegateRoles.delegateRole('Taushetsbelagt post', 'Tilgangsstyring');
await delegateRoles.delegateRole('Taushetsbelagt post', 'Hovedadministrator');
await logoutUser.gotoLogoutPage('OPPKLARENDE OMKOMMEN TIGER AS', page);
await context.clearCookies();

await login.gotoLoginPage('07922148605', page);
await login.chooseReportee('OPPKLARENDE OMKOMMEN TIGER AS', page);
await deleteRights.revokeRightsSSN('STORARTET KORGSTOL');
await delegate.delegateToSSN('07885798378', 'KORGSTOL');
await delegateRights.delegateRightsToSSN(
'Altinn2 sensitive reporting service for Authorizaion tests',
Expand Down
Loading

0 comments on commit 7bb9370

Please sign in to comment.