Skip to content

Commit 8a6ab4a

Browse files
authored
Use beta for tests (#1339)
mocha: Target the beta mediawiki instance instead of parsoid on beta * Use working endpoints for mathoid * PCS: Make content-language test case-insensitive Language codes are not case sensitive, so accept any case. This also improves output of assert.deepEqual. Bug: T350353 Change-Id: I9474e4c88dba127c15b82b7c18c6f5957d46a697
1 parent d544e9d commit 8a6ab4a

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

DUMMY

Whitespace-only changes.

config.frontend.test.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
test:
33
parsoid: &parsoid_test_options
44
disabled_storage: false
5-
host: http://parsoid-external-ci-access.beta.wmflabs.org/w/rest.php
5+
host: https://en.wikipedia.beta.wmflabs.org/w/rest.php
66
content_types:
77
html: '/^text\/html; charset=utf-8; profile="https:\/\/www\.mediawiki\.org\/wiki\/Specs\/HTML\/[\d.]+"$/'
88
data-parsoid: '/^application\/json; charset=utf-8; profile="https:\/\/www\.mediawiki\.org\/wiki\/Specs\/data-parsoid/[\d.]+"$/'
@@ -24,7 +24,7 @@ default_project: &default_project
2424
apiUriTemplate: "{{'https://{domain}/w/api.php'}}"
2525
baseUriTemplate: "{{'https://{domain}/api/rest_v1'}}"
2626
mathoid: &mathoid_options
27-
host: https://mathoid.beta.math.wmflabs.org
27+
host: https://mathoid-beta-svc.wmcloud.org
2828
# 10 days Varnish caching, one day client-side
2929
cache-control: s-maxage=864000, max-age=86400
3030
mobileapps:

config.fullstack.test.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ test:
55
default: false
66
# eswiki beta has parsoid storage disabled for testing purposes
77
es.wikipedia.beta.wmflabs.org: true
8-
host: http://parsoid-external-ci-access.beta.wmflabs.org/w/rest.php
8+
host: https://en.wikipedia.beta.wmflabs.org/w/rest.php
99
content_types:
1010
html: '/^text\/html; charset=utf-8; profile="https:\/\/www\.mediawiki\.org\/wiki\/Specs\/HTML\/[\d.]+"$/'
1111
data-parsoid: '/^application\/json; charset=utf-8; profile="https:\/\/www\.mediawiki\.org\/wiki\/Specs\/data-parsoid/[\d.]+"$/'
@@ -26,7 +26,7 @@ default_project: &default_project
2626
apiUriTemplate: "{{'https://{domain}/w/api.php'}}"
2727
baseUriTemplate: "{{'https://{domain}/api/rest_v1'}}"
2828
mathoid: &mathoid_options
29-
host: https://mathoid.beta.math.wmflabs.org
29+
host: https://mathoid-beta-svc.wmcloud.org
3030
# 10 days Varnish caching, one day client-side
3131
cache-control: s-maxage=864000, max-age=86400
3232
mobileapps:

test/features/pcs.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ describe('Page Content Service: transforms', () => {
190190
})
191191
.then((res) => {
192192
assert.deepEqual(res.status, 200);
193-
assert.deepEqual(res.headers['content-language'], 'sr-Cyrl');
193+
assert.deepEqual(res.headers['content-language'].toLowerCase(), 'sr-cyrl');
194194
assert.checkString(res.headers['cache-control'], /private/, 'Must not be cached');
195195
assert.checkString(res.body, /Ово је тестна страница - 1/, 'Must not convert cyrillic with cyrillic variant');
196196
assert.checkString(res.body, /Ово је тестна страница - 2/, 'Must convert latin with cyrillic variant');
@@ -207,7 +207,7 @@ describe('Page Content Service: transforms', () => {
207207
})
208208
.then((res) => {
209209
assert.deepEqual(res.status, 200);
210-
assert.deepEqual(res.headers['content-language'], 'sr-Latn');
210+
assert.deepEqual(res.headers['content-language'].toLowerCase(), 'sr-latn');
211211
assert.checkString(res.headers['cache-control'], /private/, 'Must not be cached');
212212
assert.checkString(res.body, /Ovo je testna stranica - 1/, 'Must convert cyrillic with latin variant');
213213
assert.checkString(res.body, /Ovo je testna stranica - 2/, 'Must not convert latin with latin variant');

test/utils/assert.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,13 @@ function isDeepEqual(result, expected, message) {
7272

7373
function deepEqual(result, expected, message) {
7474
try {
75-
if (typeof expected === 'string') {
76-
assert.ok(result === expected || (new RegExp('^' + expected + '$').test(result)));
75+
if ( expected === result ) {
76+
return;
77+
} else if (typeof expected === 'string') {
78+
assert.ok(
79+
new RegExp('^' + expected + '$').test(result),
80+
`Expected: ${expected}; Result: ${result}`
81+
);
7782
} else {
7883
assert.deepEqual(result, expected, message);
7984
}

test/utils/server.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class TestRestbase {
4848
apiBase,
4949
apiPath,
5050
apiURL,
51-
parsoidURI: 'http://parsoid-external-ci-access.beta.wmflabs.org/w/rest.php',
51+
parsoidURI: 'https://en.wikipedia.beta.wmflabs.org/w/rest.php',
5252
conf
5353
}
5454
}

0 commit comments

Comments
 (0)