This is a misunderstanding:
In the first link, it is specifically stated "$H_0 :$ The two population distributions are identical" and that point of view is consistently taken throughout.
In the second link, @Glen_b says that the test "considers whether" one variable is stochastically greater than the other.
That is never said to be the null hypothesis, and it isn't. It is a statement of the alternative hypothesis. (In my opinion, the main point of that Answer is to explain that the Mann-Whitney-Wilcoxon does not simply test whether medians are equal.)
Addendum per additional information from OP. There are a couple of reasons you don't find a significant difference between two samples of size $n = 10$ from
$\mathsf{Norm}(\mu=0, \sigma=1)$ and
$\mathsf{Norm}(\mu=0, \sigma=3),$ respectively.
(1) The two population distributions do not have the same shape (variances differ).
(2) The difference between these two distributions is not their location
(both centered at 0).
(3) Sample sizes are small.
(4) Data are normal, so tests based on normal theory will be more powerful.
As to (1) and (4): A (normal-theory) F test finds a significant difference in variances.
set.seed(123); x1=rnorm(10,0,1); x2=rnorm(10,0,3)
var.test(x1, x2)
F test to compare two variances
data: x1 and x2
F = 0.0938, num df = 9, denom df = 9, p-value =
0.001628
alternative hypothesis:
true ratio of variances is not equal to 1
95 percent confidence interval:
0.02329852 0.37763707
sample estimates:
ratio of variances
0.09379971
As to (2) and (4): For normal data with differing means, both a (normal-theory) two-sample t test and a two-sample nonparametric Wilcoxon (signed-rank) test find highly significant differences in location.) For brevity here, I have used $
-notation to show only the P-values.) Because the difference in location is substantial, compared with variability, significant
differences are found in spite of small sample sizes.
set.seed(123); y1 = rnorm(10,0,1); y2 = rnorm(10,3,1)
t.test(y1, y2)$p.val
[1] 1.526441e-06
wilcox.test(y1, y2)$p.val
[1] 4.330035e-05
As to (3), sample sizes are too small to detect a smaller difference in centers.
set.seed(123); y1 = rnorm(10,0,1); y2 = rnorm(10,.5,1)
wilcox.test(y1, y2)$p.val
[1] 0.1431401
However, for substantially larger sample sizes ($n=50$),
the Wilcoxon SR test is able to detect even the small
shift.
set.seed(123); y1 = rnorm(50,0,1); y2 = rnorm(50,.5,1)
wilcox.test(y1, y2)
Wilcoxon rank sum test
with continuity correction
data: y1 and y2
W = 781, p-value = 0.001239
alternative hypothesis:
true location shift is not equal to 0
Notches in the sides of the boxplots below are non-overlapping nonparametric confidence intervals, indicating a shift in location.
boxplot(y1, y2, notch=T, col="skyblue2", pch=20, names=T)
Note: Because data are normal, the last two tests could have been t tests. You can do those if you like. But I omitted them because our main topic here is Wilcoxon SR tests. You might try Wilcoxon tests for (non-normal) uniform data (with a location shift of 0.5):
set.seed(123); u1 = runif(10,0,1); u2 = runif(10,.5,1.5)
Addendum per comment: Here is a test for unequal variances between the two small normal samples in your Question. The null hypothesis #H_0: \sigma_1^2 = \sigma_2^2$ is rejected at the 5% level. The Mann-Whitney-Wilcoxon 2-sample nonparametric test does not reject because the difference is in 'shape', not 'location'.
set.seed(123)
n <- 10
x1 <- rnorm(n, mean=0, sd=1)
x2 <- rnorm(n, mean=0, sd=3)
var.test(x1, x2)
F test to compare two variances
data: x1 and x2
F = 0.0938, num df = 9, denom df = 9,
p-value = 0.001628
alternative hypothesis:
true ratio of variances is not equal to 1
95 percent confidence interval:
0.02329852 0.37763707
sample estimates:
ratio of variances
0.09379971
wilcox.test(x1,x2)$p.val
[1] 0.4358722
For slightly larger samples, neither 2-sample
Wilcoxon nor 2-sample t test rejects.
set.seed(123)
n <- 30
x1 <- rnorm(n, mean=0, sd=1)
x2 <- rnorm(n, mean=0, sd=3)
wilcox.test(x1, x2)$p.val
[1] 0.3353956
t.test(x1, x2)$p.val
[1] 0.2434323