Skip to content

Commit 1460b64

Browse files
authored
Merge pull request #373 from Xronophobe/csanad-review--chapter-25
Csanád's review of chapter 25
2 parents 7fc56ea + 5cc9a53 commit 1460b64

File tree

1 file changed

+50
-6
lines changed

1 file changed

+50
-6
lines changed

chapter_25_CI.asciidoc

+50-6
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ They just don't need any _more_ help dominating the market.
122122
// DAVID: 1e / 2e abbreviations might confuse people.
123123

124124
So I've decided to use GitLab in this book.
125+
// CSANAD: I just found framagit.org by Framasoft. Maybe we could mention them? Although
126+
// it might be important to ask them first, in case they need to handle the
127+
// expected additional traffic.
125128
They are absolutely a commercial service,
126129
but they retain an open-source version, and you can self-host it in theory.
127130

@@ -150,7 +153,7 @@ so the first thing to do is get our code up there.
150153
Use the **New Project** -> **Create Blank Project** option, as in <<gitlab-new-blank-project>>.
151154

152155
//RITA: The screenshot shows that the project name and slug are "Superlistz", yet the next figure that shows the CI project files on GitLab refers to "lists". Is this correct?
153-
.Creating a New Repo on Gitlab
156+
.Creating a New Repo on GitLab
154157
[[gitlab-new-blank-project]]
155158
image::images/gitlab_new_blank_project.png["New Blank Project"]
156159

@@ -383,7 +386,7 @@ so I know what to expect: it's failing because Firefox isn't installed
383386
in the image we're using.
384387

385388

386-
Let's modify the script, and an `apt install`.
389+
Let's modify the script, and add an `apt install`.
387390
Again we'll do it as late as possible.
388391

389392
[role="sourcecode"]
@@ -717,6 +720,10 @@ status: 0
717720

718721
It takes quite a long time to run,
719722
and there's lots of debug out, but... it looks OK!
723+
// CSANAD: I think it ran quite fast, less than maybe 30 seconds. I was confused
724+
// whether it even worked correctly. I think we should maybe emphasize
725+
// when it would "look OK": exit status being 0 and 200 OK, I assume?
726+
720727

721728
Let's set that environment variable in our CI script:
722729

@@ -777,6 +784,9 @@ AssertionError: '2: Use peacock feathers to make a fly' not found in ['1: Buy
777784
peacock feathers']
778785
---------------------------------------------------------------------
779786
----
787+
// CSANAD: we are running the FT-s locally now. I think it would be
788+
// clearer if we said that explicitly and also if we said a few words on why we
789+
// are running the FT without docker again.
780790

781791

782792
Now you might not see this error,
@@ -843,7 +853,8 @@ SCREEN_DUMP_LOCATION = Path(__file__).absolute().parent / "screendumps"
843853

844854
We first create a directory for our screenshots if necessary.
845855
Then we iterate through all the open browser tabs and pages,
846-
and use a Selenium methods, `get_screenshot_as_file()`
856+
// CSANAD: where? I can't find the iteration through the tabs and pages.
857+
and use Selenium methods, `get_screenshot_as_file()`
847858
and the attribute `browser.page_source`,
848859
for our image and HTML dumps, respectively:
849860

@@ -863,6 +874,11 @@ for our image and HTML dumps, respectively:
863874
path.write_text(self.browser.page_source)
864875
----
865876
====
877+
// CSANAD: I suggest placing a newline in front the print:
878+
// print("\nscreenshotting to", path)
879+
// or
880+
// print("\n")
881+
// print("screenshotting to", path)
866882

867883

868884
And finally here's a way of generating a unique filename identifier,
@@ -900,7 +916,18 @@ dumping page HTML to ...goat-book/src/functional_tests/screendumps/MyListsTest.
900916
test_logged_in_users_lists_are_saved_as_my_lists-2025-02-18T11.29.00.html
901917
----
902918

903-
DAVID: Could get them to open those files and have a look? It's kind of satisfying!
919+
// DAVID: Could get them to open those files and have a look? It's kind of satisfying!
920+
921+
// CSANAD: I just opened them, and they are blank, all-black images. Also, the
922+
// HTML dump is just:
923+
// `<html><head></head><body></body></html>`
924+
// So maybe we could inform the Reader in case they do open these, that this is
925+
// normal: due to the artificial self.fail() failure, this output is expected.
926+
927+
// CSANAD: however, running all the FT -s tells me something is probably wrong:
928+
// `$ ./src/manage.py test functional_tests`
929+
// creates a screenshot and an HTML dump for all FT -s.
930+
904931

905932
=== Saving Build Outputs (or Debug Files) as Artifacts
906933

@@ -937,7 +964,7 @@ test:
937964

938965

939966
In any case that should work.
940-
If you commit the code and then push it back to Gitlab,
967+
If you commit the code and then push it back to GitLab,
941968
we should be able to see a new build job.
942969

943970
[role="dofirst-ch25l010-1"]
@@ -953,6 +980,8 @@ $ *git push*
953980
// so we can check it's working? (Partly it's because you're not so directive about where to put the fail so it
954981
// feels more ephemeral.)
955982

983+
// CSANAD: the official book-example also removed the `self.fail()` by this point.
984+
956985
In its output, we'll see the screenshots and html dumps being saved:
957986

958987

@@ -984,6 +1013,21 @@ And if you navigate through, you'll see something like <<gitlab_ui_show_screensh
9841013
[[gitlab_ui_show_screenshot]]
9851014
image::images/gitlab_ui_show_screenshot.png["GitLab UI showing a normal-looking screenshot of the site"]
9861015

1016+
// CSANAD: working from the book-example, this is not true for me:
1017+
// https://gitlab.com/csberes/superlistz-version-harry/-/jobs/9765894394
1018+
// ```
1019+
// WARNING: src/functional_tests/screendumps/: no matching files. Ensure that the artifact path is relative to the working directory (/builds/csberes/superlistz-version-harry)
1020+
// ERROR: No files to upload
1021+
// Cleaning up project directory and file based variables 00:00
1022+
// Job succeeded
1023+
// ```
1024+
// The path looks OK, and locally, the test does create a `screenshots` directory.
1025+
// The directory does not get created in the Gitlab build job - I guess,
1026+
// because there are no errors. So, even though in my VM the official book-example
1027+
// version does generate a screenshot for every FT, it isn't true for the Gitlab.
1028+
// However, there is another odd thing: I tried re-adding the `self.fail`
1029+
// which resulted in three screenshots on Gitlab:
1030+
// https://gitlab.com/csberes/superlistz-version-harry/-/jobs/9766298077
9871031

9881032

9891033
=== If in Doubt, Try Bumping the Timeout!
@@ -1093,7 +1137,7 @@ Wrote configuration to spec/support/jasmine-browser.mjs.
10931137
----
10941138

10951139
Well we now have about a million files in _node_modules/_
1096-
(which is JavaScript's verions of a virtualenv essentially),
1140+
(which is JavaScript's version of a virtualenv essentially),
10971141
and we also have a new config file in _spec/support/jasmine-browser.mjs_.
10981142

10991143
That's not the ideal place, because we've said our tests live in a folder called _tests_,

0 commit comments

Comments
 (0)