You need to add an assumption, as is implicit in the textbook:
julia> @syms x y::real
(x, y)
julia> integrate(abs(x),x)
⌠
⎮ │x│ dx
⌡
julia> integrate(abs(y),y)
⎧ 2
⎪-y
⎪──── for y ≤ 0
⎪ 2
⎨
⎪ 2
⎪ y
⎪ ── otherwise
⎩ 2