Skip to content

Commit 76a06b0

Browse files
NinaEilersopyh
authored andcommitted
To make test files readable
1 parent 63a438e commit 76a06b0

File tree

6 files changed

+72
-9
lines changed

6 files changed

+72
-9
lines changed

.vscode/launch.json

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
55
"version": "0.2.0",
66
"configurations": [
7+
8+
79
{
810
"name": "Launch localhost",
911
"type": "chrome",

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
"copy-files": "copyfiles -u 1 ./src/**/*.css ./dist && copyfiles -u 1 ./src/**/*.scss ./dist && copyfiles ./public ./dist",
162162
"analyze": "source-map-explorer build/static/js/main.*",
163163
"test": "wdio run tests/conf/parallel.conf.js",
164+
"test-live-app": "CI_TEST_GIT_REF=production CI_TEST_GIT_SHA1=12345678 BROWSERSTACK_LOCAL=0 CI_DEPLOYMENT_TEST_URL=https://wheelmap.org npm run test",
164165
"version": "echo TODO: Add version syncing to bundle configurations for native apps + git commit -am 'Version bump' to package.json",
165166
"server": "server",
166167
"push-translations": "rm -rf src/.next/ && npx ttag update public/i18n/translations.pot ./src && tx push -s && echo \"Translators can now start translating new strings:\\n\\nhttps://www.transifex.com/sozialhelden/wheelmap-react-frontend/translate/#de/translationspot/335454735?q=translated%3Ano\"",

tests/conf/parallel.conf.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ checkEnvironmentVariables();
3636

3737
// https://github.com/browserstack/webdriverio-browserstack
3838
exports.config = {
39-
user: process.env.BROWSERSTACK_USERNAME,
39+
user: process.env.BROWSERSTACK_USERNAME,
40+
bail: 1,
4041
key: process.env.BROWSERSTACK_ACCESS_KEY,
4142

4243
services: [

tests/specs-todo/search-by-shop.js

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
const IdPropertyName = 'element-6066-11e4-a52e-4f735466dfgh';
2+
const saveScreenshot = require('../lib/saveScreenshot');
3+
const getCurrentUrl = require('../lib/getCurrentUrl');
4+
const acceptLocationAlertOnMobilesIfPresent = require('../lib/acceptLocationAlertOnMobilesIfPresent');
5+
6+
// See the WebDriver API documentation for a list of possible actions.
7+
// https://webdriver.io/docs/api.html
8+
// https://github.com/webdriverio/expect-webdriverio/blob/HEAD/docs/API.md
9+
10+
// See the Mocha API for test structure: https://mochajs.org/
11+
describe('Searching a shop', function() {
12+
it('delivers results', async function() {
13+
await browser.url('/');
14+
15+
await acceptLocationAlertOnMobilesIfPresent();
16+
17+
const $button = await $('button=Okay, let’s go!');
18+
await $button.click();
19+
20+
const { capabilities } = browser;
21+
if (capabilities.platformName === 'iOS' || capabilities.platform === 'ANDROID') {
22+
const $searchButtonOnMobile = await $('.search-button');
23+
await $searchButtonOnMobile.waitForExist();
24+
await $searchButtonOnMobile.click();
25+
}
26+
27+
28+
const $search = await $('[name="search"]');
29+
await $search.click();
30+
await (await $('[name="search"]')).addValue('Bötzowstr. 31');
31+
$results = await $('.search-results');
32+
await saveScreenshot('Search results are loading');
33+
34+
await browser.waitUntil(async () => {
35+
36+
return $('.search-results').isExisting();
37+
});
38+
39+
// Wait for wheelchair accessibility to be loaded
40+
await browser.waitUntil(
41+
async () => await (await $results.$('header.is-on-wheelmap=Bötzowstr. 31')).isDisplayed()
42+
);
43+
44+
45+
const $result = await $results.$('header=Bötzowstr. 31');
46+
await expect($results).toBeDisplayedInViewport();
47+
await saveScreenshot('Search results are displayed');
48+
49+
50+
});
51+
});

tests/specs/highlighted-marker.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ describe('Highlighted marker', function() {
1717
await $button.click();
1818

1919
const $placeInfoPanel = await $('.toolbar[aria-label="Berlin Alexanderplatz"]');
20-
const $placeName = await $placeInfoPanel.$('h1=Berlin Alexanderplatz');
20+
const $placeName = await $placeInfoPanel.$('div=Berlin Alexanderplatz');
2121
await expect($placeName).toBeDisplayedInViewport();
2222
await saveScreenshot('After opening');
2323

24-
const $highlightedMarker = await $('a.highlighted-marker[aria-label="Berlin Alexanderplatz Fully wheelchair accessible"]');
24+
const $highlightedMarker = await $('a.highlighted-marker[aria-label="Berlin Alexanderplatz, Fully wheelchair accessible"]');
2525
await expect($highlightedMarker).toBeDisplayedInViewport();
2626
await saveScreenshot('Marker visible');
2727
});

tests/specs/search-by-name.js

+14-6
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ const acceptLocationAlertOnMobilesIfPresent = require('../lib/acceptLocationAler
1010
// See the Mocha API for test structure: https://mochajs.org/
1111

1212
describe('Searching a place by name', function() {
13+
1314
it('delivers results', async function() {
15+
await browser.setTimeout({ 'implicit': 100000 });
16+
1417
await browser.url('/');
1518

1619
await acceptLocationAlertOnMobilesIfPresent();
@@ -27,14 +30,16 @@ describe('Searching a place by name', function() {
2730

2831
const $search = await $('[name="search"]');
2932
await $search.click();
30-
await browser.waitUntil(async () => {
31-
const el = await browser.findElement('css selector', 'a[href="/search?category=food"]');
32-
return el && el[IdPropertyName];
33-
});
3433
await saveScreenshot('Category and accessibility filter is shown');
3534
await (await $('[name="search"]')).addValue('alexanderplatz');
3635

36+
await browser.waitUntil(async () => {
37+
return $('.search-results').isExisting();
38+
});
39+
40+
browser.findElement('css selector', '.search-results');
3741
const $results = await $('.search-results');
42+
3843
await expect($results).toBeDisplayedInViewport();
3944
await saveScreenshot('Search results are loading');
4045

@@ -48,13 +53,16 @@ describe('Searching a place by name', function() {
4853

4954
await saveScreenshot('Search results show their accessibility');
5055

56+
await browser.waitUntil(async () => {
57+
return $results.$('header=Berlin Alexanderplatz').isExisting();
58+
});
5159
const $resultAfterSearch = await $results.$('header=Berlin Alexanderplatz');
60+
5261
await $resultAfterSearch.waitForClickable();
5362
await $resultAfterSearch.click();
5463

5564
await browser.waitUntil(async () => (await getCurrentUrl()).match(/\/node\//));
56-
const results = await browser.findElement('css selector', '.search-results');
57-
await expect(results[IdPropertyName]).toBeUndefined();
65+
5866
const $placeInfoPanel = await $('.toolbar[aria-label~="Alexanderplatz"');
5967
const $placeName = await $placeInfoPanel.$('h1*=Alexanderplatz');
6068
await expect($placeName).toBeDisplayedInViewport();

0 commit comments

Comments
 (0)