Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

121706 #2572

Merged
merged 5 commits into from
Jul 22, 2024
Merged

121706 #2572

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20
cache: 'npm'

- name: Install
run: npm install
Expand Down
10 changes: 5 additions & 5 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { defineConfig } from "cypress"
export default defineConfig({
projectId: "tbpt8b",
chromeWebSecurity: false,
screenshotOnRunFailure: false,
video: false,
screenshotOnRunFailure: true,
video: true,
viewportWidth: 1280,
viewportHeight: 1024,
defaultCommandTimeout: 10000,
pageLoadTimeout: 30000,
requestTimeout: 10000,
env: {
baseUrlAcc: "https://acc.api.wonen.zaken.amsterdam.nl/api/v1/",
baseUrlData: "https://api.data.amsterdam.nl/",
userHh: "handhaver-noreply@amsterdam.nl",
userHhj: "handhavingsjurist-noreply@amsterdam.nl",
Expand All @@ -36,8 +36,8 @@ export default defineConfig({
},
component: {
devServer: {
framework: "create-react-app",
bundler: "webpack"
framework: "react",
bundler: "vite"
}
}
})
13 changes: 11 additions & 2 deletions cypress/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
# Zaken frontend - Cypress integration

## Local testing

Start your local env:

```JavaScript
npm run acc
```

To open the Cypress UI, enter the following command after installing dependencies:

- `npx cypress open` or `npm run cy`

## Run specific tests
- `npm run cy:run -- --spec "cypress/integration/my-spec.js"`
```JavaScript
npm run cy:run -- --spec "cypress/integration/my-spec.js"
```

## Global variables

Global Cypress variables can be found in `cypress.json` in the root of the project. You can acces them by using: `Cypress.env("emailPm")`.
Global Cypress variables can be found in `cypress.config.ts` in the root of the project. You can acces them by using: `Cypress.env("emailPm")`.

## Credentials or secrets

Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/020_visit/visit.plan.authorization.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import visit from "../../fixtures/visit.json"
describe('Plan "huisbezoek"', () => {

it("Go to Adresoverzicht and check address", () => {
const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/`
const url = `**/addresses/*/cases/`
cy.intercept(url).as("getCases")
cy.visit(`/adres/${address.bagId}`)
cy.wait("@getCases").then(() => {
Expand All @@ -29,7 +29,7 @@ describe('Plan "huisbezoek"', () => {
describe('Go to "Bezoek inplannen" form', () => {

it("Click on task Bezoek inplannen", () => {
const url = `${Cypress.env("baseUrlAcc")}cases/*/`
const url = `**/cases/*/`
cy.intercept(url).as("getTasks")
cy.wait("@getTasks").then(() => {
cy.get("tbody>tr")
Expand All @@ -39,7 +39,7 @@ describe('Plan "huisbezoek"', () => {
})

it("Bezoek inplannen page is visible", () => {
const url = `${Cypress.env("baseUrlAcc")}themes/*/schedule-types/`
const url = `**/themes/*/schedule-types/`
cy.intercept(url).as("getScheduleTypes")
cy.wait("@getScheduleTypes").then(() => {
cy.get("h1")
Expand Down
10 changes: 4 additions & 6 deletions cypress/e2e/020_visit/visit.plan.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ beforeEach(() => {

describe('Test visit.plan.spec', () => {
it("Go to Adresoverzicht and select address", () => {
const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/`;
const url = `**/addresses/*/cases/`;
cy.intercept(url).as("getCases");
cy.visit(`/adres/${address.bagId}`);
cy.wait("@getCases").then(() => {
Expand Down Expand Up @@ -40,7 +40,7 @@ describe('Test visit.plan.spec', () => {

cy.get(`[data-testid="submit"]`).click();

const urlCases = `${Cypress.env("baseUrlAcc")}cases/*/`;
const urlCases = `**/cases/*/`;
cy.intercept(urlCases).as("getCase");
cy.wait("@getCase").then(() => {
cy.get("tbody>tr").contains("td", "Bezoek inplannen");
Expand All @@ -50,9 +50,7 @@ describe('Test visit.plan.spec', () => {
it("Schedule `Huisbezoek`", () => {
cy.goToCaseDetailPage();

const urlScheduleTypes = `${Cypress.env(
"baseUrlAcc"
)}themes/*/schedule-types/`;
const urlScheduleTypes = "**/themes/*/schedule-types/";
cy.intercept(urlScheduleTypes).as("getScheduleTypes");

cy.get("tbody>tr").contains("td", "Bezoek inplannen").click();
Expand Down Expand Up @@ -88,7 +86,7 @@ describe('Test visit.plan.spec', () => {
.contains("Bezoek inplannen")
.click();

const url = `${Cypress.env("baseUrlAcc")}cases/*/events/`;
const url = `**/cases/*/events/`;
cy.intercept(url).as("getEvents");
cy.wait("@getEvents").then(() => {
cy.history("Bezoek ingepland", "Datum");
Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/020_visit/visit.result.access.granted.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ beforeEach(() => {

describe("Test visit.result.access.granted.spec", () => {
it("Mock TOP result for visit", () => {
const urlCases = `${Cypress.env("baseUrlAcc")}addresses/*/cases/`;
const urlCases = `**/addresses/*/cases/`;
cy.intercept(urlCases).as("getCases");
cy.visit(`/adres/${address.bagId}`);
cy.wait("@getCases").then(() => {
cy.get("h1").contains(`${address.street}, ${address.zipCode}`);
});

const urlCase = `${Cypress.env("baseUrlAcc")}cases/*/`;
const urlCase = `**/cases/*/`;
cy.intercept(urlCase).as("getCase");

cy.scrollTo(0, 400);
Expand All @@ -42,7 +42,7 @@ describe("Test visit.result.access.granted.spec", () => {

cy.testDueDate("tbody>tr>td", 0);

const url = `${Cypress.env("baseUrlAcc")}users/`;
const url = `**/users/`;
cy.intercept(url).as("getUsers");

cy.visit(`/zaken/${caseId}/huisbezoek/${taskId}`);
Expand Down Expand Up @@ -73,7 +73,7 @@ describe("Test visit.result.access.granted.spec", () => {

cy.get('[data-testid="notes"').type(visit.notes);

const url = `${Cypress.env("baseUrlAcc")}cases/*/`;
const url = `**/cases/*/`;
cy.intercept(url).as("getDebriefTask");

cy.get('button[data-testid="submit"]').contains("Toevoegen").click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('Result "huisbezoek" with nobody present and hold', () => {
})

it("Go to Adresoverzicht and check address", () => {
const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/`
const url = `**/addresses/*/cases/`
cy.intercept(url).as('getCases')
cy.visit(`/adres/${address.bagId}`)
cy.wait('@getCases').then(() => {
Expand All @@ -33,7 +33,7 @@ describe('Result "huisbezoek" with nobody present and hold', () => {

it('Intercept TOP URL and load page', () => {

const url = `${Cypress.env("baseUrlAcc")}cases/*/`
const url = `**/cases/*/`
cy.intercept(url).as('getTasks')

cy.wait('@getTasks').then(({ response }) => {
Expand All @@ -49,7 +49,7 @@ describe('Result "huisbezoek" with nobody present and hold', () => {
// check dueDate
cy.testDueDate("tbody>tr>td", 0)

const url = `${Cypress.env("baseUrlAcc")}users/`
const url = `**/users/`
cy.intercept(url).as('getUsers')

cy.visit(`/zaken/${caseId}/huisbezoek/${taskId}`)
Expand Down Expand Up @@ -105,7 +105,7 @@ describe('Result "huisbezoek" with nobody present and hold', () => {
})

it('Submit form and check for plan new visit', () => {
const url = `${Cypress.env("baseUrlAcc")}cases/*/events/`
const url = `**/cases/*/events/`
cy.intercept(url).as('getEvents')

cy.get('button[data-testid="submit"]')
Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/020_visit/visit.result.nobody.present.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('Result "huisbezoek" with nobody present', () => {
})

it("Go to Adresoverzicht and check address", () => {
const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/`
const url = `**/addresses/*/cases/`
cy.intercept(url).as('getCases')
cy.visit(`/adres/${address.bagId}`)
cy.wait('@getCases').then(() => {
Expand All @@ -33,7 +33,7 @@ describe('Result "huisbezoek" with nobody present', () => {

it('Intercept TOP URL and load page', () => {

const url = `${Cypress.env("baseUrlAcc")}cases/*/`
const url = `**/cases/*/`
cy.intercept(url).as('getTasks')

cy.wait('@getTasks').then(({ response }) => {
Expand All @@ -50,7 +50,7 @@ describe('Result "huisbezoek" with nobody present', () => {
cy.testDueDate("tbody>tr>td", 0)


const url = `${Cypress.env("baseUrlAcc")}users/`
const url = `**/users/`
cy.intercept(url).as('getUsers')

cy.visit(`/zaken/${caseId}/huisbezoek/${taskId}`)
Expand Down Expand Up @@ -121,7 +121,7 @@ describe('Result "huisbezoek" with nobody present', () => {
})

it('Submit form and check for plan new visit', () => {
const url = `${Cypress.env("baseUrlAcc")}cases/*/events/`
const url = `**/cases/*/events/`
cy.intercept(url).as('getEvents')

cy.get('button[data-testid="submit"]')
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/025_taskOverview/01-select.task.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ beforeEach(() => {

describe("Test select.task.spec", () => {
it("Pick up task and put away in Takenoverzicht", () => {
const urlTasks = `${Cypress.env("baseUrlAcc")}tasks/*`;
const urlTasks = `**/tasks/*`;
cy.intercept(urlTasks).as("getTasks");
cy.visit("/taken");
cy.wait("@getTasks").then(() => {
cy.get("h1").contains("Takenoverzicht");
});

const urlTasksUpdate = `${Cypress.env("baseUrlAcc")}tasks/*/`;
const urlTasksUpdate = `**/tasks/*/`;
cy.intercept(urlTasksUpdate).as("updateTask");
const checkBox = cy.get('[type="checkbox"][title="Beschikbaar"]').first();
checkBox.check();
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/030_debrief/01-debrief.no.violation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe("Test debrief.no.violation.spec", () => {

cy.get('[data-testid="feedback"]').type(debrief.descriptionNoViolation);

const url = `${Cypress.env("baseUrlAcc")}cases/*/`;
const url = `**/cases/*/`;
cy.intercept(url).as("getNextTask");

cy.get('button[data-testid="submit"]')
Expand Down Expand Up @@ -58,7 +58,7 @@ describe("Test debrief.no.violation.spec", () => {
.contains("Taak afronden")
.click();

const urlEvents = `${Cypress.env("baseUrlAcc")}cases/*/events/`;
const urlEvents = `**/cases/*/events/`;
cy.intercept(urlEvents).as("getEvents");
cy.wait("@getEvents").then(() => {
cy.history(debrief.noViolationNextTask, roles.PM);
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/030_debrief/01a-debrief.other.theme.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Process Debrief - Other Theme"', () => {
})

it("Go to Adresoverzicht and check address", () => {
const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/`
const url = `**/addresses/*/cases/`
cy.intercept(url).as('getCases')
cy.visit(`/adres/${address.bagId}`)
cy.wait('@getCases').then(() => {
Expand All @@ -33,7 +33,7 @@ describe('Process Debrief - Other Theme"', () => {

it('Intercept Debrief URL and load page', () => {

const url = `${Cypress.env("baseUrlAcc")}cases/*/`
const url = `**/cases/*/`
cy.intercept(url).as('getTasks')

cy.wait('@getTasks').then(({ response }) => {
Expand Down Expand Up @@ -72,7 +72,7 @@ describe('Process Debrief - Other Theme"', () => {
})

it('Submit form and check debrief status', () => {
const url = `${Cypress.env("baseUrlAcc")}cases/*/`
const url = `**/cases/*/`
cy.intercept(url).as('getNextTask')

cy.get('button[data-testid="submit"]')
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/030_debrief/01b-debrief.violation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Process Debrief - Violation"', () => {
})

it("Go to Adresoverzicht and check address", () => {
const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/`
const url = `**/addresses/*/cases/`
cy.intercept(url).as('getCases')
cy.visit(`/adres/${address.bagId}`)
cy.wait('@getCases').then(() => {
Expand All @@ -31,7 +31,7 @@ describe('Process Debrief - Violation"', () => {

it('Intercept Debrief URL and load page', () => {

const url = `${Cypress.env("baseUrlAcc")}cases/*/`
const url = `**/cases/*/`
cy.intercept(url).as('getTasks')

cy.wait('@getTasks').then(({ response }) => {
Expand Down Expand Up @@ -68,7 +68,7 @@ describe('Process Debrief - Violation"', () => {
})

it('Submit form and check debrief status', () => {
const url = `${Cypress.env("baseUrlAcc")}cases/*/`
const url = `**/cases/*/`
cy.intercept(url).as('getNextTask')

cy.get('button[data-testid="submit"]')
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/030_debrief/01c-debrief.authorization.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Process Debrief - Authorization required"', () => {
})

it("Go to Adresoverzicht and check address", () => {
const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/`
const url = `**/addresses/*/cases/`
cy.intercept(url).as('getCases')
cy.visit(`/adres/${address.bagId}`)
cy.wait('@getCases').then(() => {
Expand All @@ -33,7 +33,7 @@ describe('Process Debrief - Authorization required"', () => {

it('Intercept Debrief URL and load page', () => {

const url = `${Cypress.env("baseUrlAcc")}cases/*/`
const url = `**/cases/*/`
cy.intercept(url).as('getTasks')

cy.wait('@getTasks').then(({ response }) => {
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/030_debrief/02-feedback.reporter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import address from "../../fixtures/address.json"
describe('Process Feedback reporter"', () => {

it("Go to Adresoverzicht and check address", () => {
const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/`
const url = `**/addresses/*/cases/`
cy.intercept(url).as('getCases')
cy.visit(`/adres/${address.bagId}`)
cy.wait('@getCases').then(() => {
Expand Down Expand Up @@ -48,7 +48,7 @@ describe('Process Feedback reporter"', () => {
})

it("Check Terugkoppeling melder event in history", () => {
const url = `${Cypress.env("baseUrlAcc")}cases/*/`
const url = `**/cases/*/`
cy.intercept(url).as('getNextTask')

cy.wait('@getNextTask').then(() => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/030_debrief/03-report.short.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe("Test report.short.spec", () => {

cy.get(`[role="dialog"]`).find("button").contains("Taak afronden").click();

const url = `${Cypress.env("baseUrlAcc")}cases/*/`;
const url = `**/cases/*/`;
cy.intercept(url).as("getNextTask");

cy.wait("@getNextTask").then(() => {
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/030_debrief/03-report.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import address from "../../fixtures/address.json"
describe('Process Report Visit"', () => {

it("Go to Adresoverzicht and check address", () => {
const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/`
const url = `**/addresses/*/cases/`
cy.intercept(url).as('getCases')
cy.visit(`/adres/${address.bagId}`)
cy.wait('@getCases').then(() => {
Expand Down Expand Up @@ -132,7 +132,7 @@ describe('Process Report Visit"', () => {
cy.testDueDate("tbody>tr>td", 2)
})
it("Check next task is 'Nakijken aanschrijving(en)'", () => {
// const url = `${Cypress.env("baseUrlAcc")}cases/*/`
// const url = `**/cases/*/`
// cy.intercept(url).as('getNextTask')

// cy.wait('@getNextTask').then(() => {
Expand Down
Loading
Loading