Skip to content

Commit 3e760d9

Browse files
committed
part 5
1 parent d59e8f3 commit 3e760d9

File tree

6 files changed

+168
-159
lines changed

6 files changed

+168
-159
lines changed

src/content/5/en/part5c.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ letter: c
55
lang: en
66
---
77

8+
<div class="tasks">
9+
10+
The test library used in this part was changed on March 3, 2024 from Jest to Vitest. If you already started this part using Jest, you can see [here](https://github.com/fullstack-hy2020/fullstack-hy2020.github.io/blob/02d8be28b1c9190f48976fbbd2435b63261282df/src/content/5/en/part5c.md) the old content.
11+
12+
</div>
13+
814
<div class="content">
915

1016
There are many different ways of testing React applications. Let's take a look at them next.

src/content/5/en/part5d.md

Lines changed: 147 additions & 143 deletions
Large diffs are not rendered by default.

src/content/5/en/part5e.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -916,8 +916,6 @@ describe('Note ', function() {
916916
})
917917
```
918918
919-
The tests and the frontend code can be found on the [GitHub](https://github.com/fullstack-hy2020/part2-notes-frontend/tree/part5-10) branch <i>part5-10</i>.
920-
921919
### Changing the importance of a note
922920
923921
Lastly, let's take a look at the test we did for changing the importance of a note.
@@ -1063,11 +1061,6 @@ It is also possible to run them [from the command line](https://docs.cypress.io/
10631061
10641062
```js
10651063
"scripts": {
1066-
"start": "react-scripts start",
1067-
"build": "react-scripts build",
1068-
"test": "react-scripts test",
1069-
"eject": "react-scripts eject",
1070-
"server": "json-server -p3001 --watch db.json",
10711064
"cypress:open": "cypress open",
10721065
"test:e2e": "cypress run" // highlight-line
10731066
},
@@ -1079,7 +1072,9 @@ Now we can run our tests from the command line with the command <i>npm run test:
10791072
10801073
Note that videos of the test execution will be saved to <i>cypress/videos/</i>, so you should probably git ignore this directory. It is also possible to [turn off](https://docs.cypress.io/guides/guides/screenshots-and-videos#Videos) the making of videos.
10811074
1082-
The frontend and the test code can be found on the [GitHub](https://github.com/fullstack-hy2020/part2-notes-frontend/tree/part5-11) branch <i>part5-11</i>.
1075+
Tests are found in [GitHubissa](https://github.com/fullstack-hy2020/notes-e2e-cypress/).
1076+
1077+
Final version of the frontend code can be found on the [GitHub](https://github.com/fullstack-hy2020/part2-notes-frontend/tree/part5-9) branch <i>part5-9</i>.
10831078
10841079
</div>
10851080

src/content/5/fi/osa5c.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ letter: c
55
lang: fi
66
---
77

8+
<div class="tasks">
9+
10+
Tässä osassa käytetty testikirjasto muutettiin 3.3.2024 Jestistä Vitestiin. Jos ehdit jo aloittaa Jestiä käyttäen, näet [täältä](https://github.com/fullstack-hy2020/fullstack-hy2020.github.io/blob/02d8be28b1c9190f48976fbbd2435b63261282df/src/content/5/fi/osa5c.md) osan vanhan sisällön.
11+
12+
</div>
13+
814
<div class="content">
915

1016
Reactilla tehtyjen frontendien testaamiseen on monia tapoja. Aloitetaan niihin tutustuminen nyt.

src/content/5/fi/osa5d.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,6 @@ Ensimmäinen komento etsii ensin komponentin, missä on teksti <i>another note b
630630

631631
Toinen komento varmistaa, että saman napin teksti on vaihtunut muotoon <i>make important</i>.
632632

633-
Frontendin tämänhetkinen koodi on kokonaisuudessaan [GitHubissa](https://github.com/fullstack-hy2020/part2-notes-frontend/tree/part5-9), branchissa <i>part5-9</i>.
634-
635633
Testien tämänhetkinen koodi on kokonaisuudessaan [GitHubissa](https://github.com/fullstack-hy2020/notes-e2e/tree/part5-1), branchissa <i>part5-1</i>.
636634

637635
### Epäonnistuneen kirjautumisen testi
@@ -657,7 +655,7 @@ describe('Note app', () => {
657655
)}
658656
```
659657
660-
Testi siis varmistaa komennon [getByText](https://playwright.dev/docs/api/class-page#page-get-by-text) avulla, että sovellus tulostaa virheilmoituksen.
658+
Testi siis varmistaa metodin [page.getByText](https://playwright.dev/docs/api/class-page#page-get-by-text) avulla, että sovellus tulostaa virheilmoituksen.
661659
662660
Sovellus renderöi virheilmoituksen CSS-luokan <i>error</i> sisältävään elementtiin:
663661
@@ -1207,6 +1205,8 @@ Tarkemmat detaljit löytyvät [API](https://playwright.dev/docs/api/class-playwr
12071205
12081206
Testien lopullinen versio on kokonaisuudessaan [GitHubissa](https://github.com/fullstack-hy2020/notes-e2e/tree/part5-3), branchissa <i>part5-3</i>.
12091207
1208+
Frontendin lopullinen koodi on kokonaisuudessaan [GitHubissa](https://github.com/fullstack-hy2020/part2-notes-frontend/tree/part5-9), branchissa <i>part5-9</i>.
1209+
12101210
</div>
12111211
12121212
<div class="tasks">

src/content/5/fi/osa5e.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,6 @@ Ensimmäinen komento etsii ensin komponentin, missä on teksti <i>another note c
513513

514514
Toinen komento varmistaa, että saman napin teksti on vaihtunut muotoon <i>make important</i>.
515515

516-
Testit ja frontendin tämänhetkinen koodi on kokonaisuudessaan [GitHubissa](https://github.com/fullstack-hy2020/part2-notes-frontend/tree/part5-9), branchissa <i>part5-9</i>.
517-
518516
### Epäonnistuneen kirjautumisen testi
519517

520518
Tehdään nyt testi joka varmistaa, että kirjautumisyritys epäonnistuu jos salasana on väärä.
@@ -881,8 +879,6 @@ describe('Note ', function() {
881879
})
882880
```
883881
884-
Testit ja frontendin koodi on kokonaisuudessaan [GitHubissa](https://github.com/fullstack-hy2020/part2-notes-frontend/tree/part5-10), branchissa <i>part5-10</i>.
885-
886882
### Muistiinpanon tärkeyden muutos
887883
888884
Tarkastellaan vielä aiemmin tekemäämme testiä, joka varmistaa että muistiinpanon tärkeyttä on mahdollista muuttaa. Muutetaan testin alustuslohkoa siten, että se luo yhden sijaan kolme muistiinpanoa:
@@ -1037,7 +1033,9 @@ Nyt siis voimme suorittaa Cypress-testit komentoriviltä komennolla <i>npm run t
10371033
10381034
Huomaa, että testien suorituksesta tallentuu video hakemistoon <i>cypress/videos/</i>, hakemisto lienee syytä gitignoroida. Videoiden teko on myös mahdollista ottaa [pois päältä](https://docs.cypress.io/guides/guides/screenshots-and-videos#Videos).
10391035
1040-
Testien ja frontendin koodin lopullinen versio on kokonaisuudessaan [GitHubissa](https://github.com/fullstack-hy2020/part2-notes-frontend/tree/part5-11), branchissa <i>part5-11</i>.
1036+
Testien koodin lopullinen versio on kokonaisuudessaan [GitHubissa](https://github.com/fullstack-hy2020/notes-e2e-cypress/).
1037+
1038+
Frontendin lopullinen koodi on kokonaisuudessaan [GitHubissa](https://github.com/fullstack-hy2020/part2-notes-frontend/tree/part5-9), branchissa <i>part5-9</i>.
10411039
10421040
</div>
10431041

0 commit comments

Comments
 (0)