Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into 2026-better-tsconfig-setup
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahsporck committed Nov 6, 2023
2 parents 6c094d5 + d83835b commit de4bded
Show file tree
Hide file tree
Showing 70 changed files with 370 additions and 312 deletions.
18 changes: 4 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,17 +225,14 @@ commands:
name: Skip the current build if necessary
unit_test:
description: Runs the test task and stores coverage and junit data
parameters:
directory:
type: string
steps:
- run:
command: yarn workspace << parameters.directory >> run test:ci --maxWorkers ${TOTAL_CPUS}
command: yarn test:ci --maxWorkers ${TOTAL_CPUS}
name: Unit Tests with Coverage
- store_test_results:
path: << parameters.directory >>/reports/unit-test
path: reports/unit-test
- store_artifacts:
path: << parameters.directory >>/reports/coverage
path: reports/coverage
jobs:
build_android:
docker:
Expand Down Expand Up @@ -496,14 +493,7 @@ jobs:
- run:
command: yarn ts:check
name: TS check
- unit_test:
directory: api-client
- unit_test:
directory: native
- unit_test:
directory: translations
- unit_test:
directory: web
- unit_test
- notify
deliver_android:
docker:
Expand Down
9 changes: 3 additions & 6 deletions .circleci/src/commands/unit_test.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
description: Runs the test task and stores coverage and junit data
parameters:
directory:
type: string
steps:
- run:
name: Unit Tests with Coverage
command: yarn workspace << parameters.directory >> run test:ci --maxWorkers ${TOTAL_CPUS}
command: yarn test:ci --maxWorkers ${TOTAL_CPUS}
- store_test_results:
path: << parameters.directory >>/reports/unit-test
path: reports/unit-test
- store_artifacts:
path: << parameters.directory >>/reports/coverage
path: reports/coverage
9 changes: 1 addition & 8 deletions .circleci/src/jobs/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,5 @@ steps:
- run:
name: TS check
command: yarn ts:check
- unit_test:
directory: api-client
- unit_test:
directory: native
- unit_test:
directory: translations
- unit_test:
directory: web
- unit_test
- notify
6 changes: 2 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,18 +164,16 @@ module.exports = {
},
},
{
files: ['**/tools/**', '!tools/**', '**/translations/**', '**/e2e-tests/**'],
files: ['**/tools/**', '**/translations/**', '**/e2e-tests/**'],
rules: {
'no-console': 'off',
'import/no-extraneous-dependencies': 'off',
},
},
{
files: ['tools/**'],
files: ['tools/**', 'e2e-tests/**'],
plugins: ['unicorn'],
rules: {
'no-console': 'off',
'import/no-extraneous-dependencies': 'off',
'import/no-commonjs': 'error',
'unicorn/prefer-node-protocol': 'error',
},
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,5 @@ runConfigurations.xml

# Mac OS X
.DS_Store

reports/
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ If you are using a different IDE like Visual Studio Code the steps might [differ
- **Open either the [web](web) or [native](native) directory separately in IntelliJ (File > Open).**
- Follow the steps mentioned in the [web README](web/README.md) or the [native README](native/README.md).
- [optional]: Enable `Languages & Frameworks > JavaScript > Prettier > On Save` to enable prettier autoformatting.
- [optional]: Install our pre-commit hook for prettier autoformatting and automated updates of the CircleCI config:

> cd .git/hooks
> ln -s ../../.github/hooks/pre-commit pre-commit

_We are recommending to use either a Linux distribution or MacOS for development.
If you want to develop on Windows anyway, follow the steps [here](./docs/windows-setup.md)
Expand Down
21 changes: 2 additions & 19 deletions api-client/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
export default {
rootDir: 'src/',
preset: 'ts-jest',
verbose: true,
displayName: 'api-client',
automock: false,
setupFiles: ['<rootDir>/../jest.setup.ts'],
moduleDirectories: ['node_modules'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
coverageDirectory: '<rootDir>/../reports/coverage',
testEnvironment: 'node',
transform: {
'^.+\\.(j|t)sx?$': [
'ts-jest',
{
isolatedModules: true,
},
],
'^.+\\.(j|t)sx?$': ['ts-jest', { isolatedModules: true }],
},
maxWorkers: '50%',
reporters: [
'default',
[
'jest-junit',
{
outputDirectory: '<rootDir>/../reports/unit-test',
},
],
],
}
5 changes: 1 addition & 4 deletions api-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
"main": "src/index.ts",
"private": true,
"scripts": {
"test": "jest --config jest.config.ts",
"test": "jest",
"test:changed": "yarn run test -o",
"test:coverage": "yarn run test --coverage",
"test:ci": "yarn run test:coverage --ci",
"test:watch": "yarn run test --watchAll",
"lint": "yarn run eslint .",
"lint:changed": "eslint . -c ../.eslintrc_changed.js",
Expand Down Expand Up @@ -40,7 +38,6 @@
"@types/seedrandom": "^3.0.5",
"@types/uuid": "^9.0.2",
"jest-fetch-mock": "^3.0.3",
"jest-junit": "^16.0.0",
"md5": "^2.3.0",
"seedrandom": "^3.0.5"
}
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/native/capabilities.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Capabilities } from '@wdio/types'

import { getGitBranch, getGitHeadReference } from '../shared/git'
import { getGitBranch, getGitHeadReference } from '../shared/git.js'

const browserstackCaps = (
config: Capabilities.AppiumW3CCapabilities | Capabilities.AppiumXCUITestCapabilities,
Expand Down
8 changes: 4 additions & 4 deletions e2e-tests/native/test/pageobjects/dashboard.page.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { Page } from './page'
import { Page } from './page.js'

class DashboardPage extends Page {
constructor() {
super('Dashboard-Page')
}

get searchIcon() {
get searchIcon(): ReturnType<typeof $> {
return $('~Search')
}

get headerOverflowButton() {
get headerOverflowButton(): ReturnType<typeof $> {
return $('~More options')
}

get languageIcon() {
get languageIcon(): ReturnType<typeof $> {
return $('~Change language')
}
}
Expand Down
10 changes: 5 additions & 5 deletions e2e-tests/native/test/pageobjects/landing.page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Gestures from '../helpers/Gestures'
import { Selector } from '../helpers/Selector'
import { Page } from './page'
import Gestures from '../helpers/Gestures.js'
import { Selector } from '../helpers/Selector.js'
import { Page } from './page.js'

const MAX_SCROLLS = 4

Expand All @@ -9,11 +9,11 @@ class LandingPage extends Page {
super('Landing-Page')
}

get cities() {
get cities(): ReturnType<typeof $$> {
return $$('~City-Entry')
}

get search() {
get search(): ReturnType<typeof $> {
return $('~Search-Input')
}

Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/native/test/pageobjects/search.page.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Page } from './page'
import { Page } from './page.js'

class SearchPage extends Page {
constructor() {
super('Search-Page')
}

get search() {
get search(): ReturnType<typeof $> {
return $('~Content-Search-Input')
}
}
Expand Down
6 changes: 3 additions & 3 deletions e2e-tests/native/test/specs/changeLanguage.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Selector } from '../helpers/Selector'
import dashboardPage from '../pageobjects/dashboard.page'
import { navigateToDashboard } from '../utils/navigationUtils'
import { Selector } from '../helpers/Selector.js'
import dashboardPage from '../pageobjects/dashboard.page.js'
import { navigateToDashboard } from '../utils/navigationUtils.js'

describe('change language', () => {
it('should display language icon', async () => {
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/native/test/specs/navigateToLeafCategory.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Selector } from '../helpers/Selector'
import { navigateToDashboard } from '../utils/navigationUtils'
import { Selector } from '../helpers/Selector.js'
import { navigateToDashboard } from '../utils/navigationUtils.js'

describe('navigate to leaf category', () => {
it('should open leaf category', async () => {
Expand Down
10 changes: 5 additions & 5 deletions e2e-tests/native/test/specs/navigateToOtherLocation.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { augsburgCity, defaultCity, filter } from '../../../shared/constants'
import Keyboard from '../helpers/Keyboard'
import { Selector } from '../helpers/Selector'
import DashboardPage from '../pageobjects/dashboard.page'
import LandingPage from '../pageobjects/landing.page'
import { augsburgCity, defaultCity, filter } from '../../../shared/constants.js'
import Keyboard from '../helpers/Keyboard.js'
import { Selector } from '../helpers/Selector.js'
import DashboardPage from '../pageobjects/dashboard.page.js'
import LandingPage from '../pageobjects/landing.page.js'

describe('navigate to other location', () => {
it('should open a city on location selection', async () => {
Expand Down
10 changes: 5 additions & 5 deletions e2e-tests/native/test/specs/navigateToSearchResult.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { contentSearch } from '../../../shared/constants'
import { Selector } from '../helpers/Selector'
import DashboardPage from '../pageobjects/dashboard.page'
import SearchPage from '../pageobjects/search.page'
import { navigateToDashboard } from '../utils/navigationUtils'
import { contentSearch } from '../../../shared/constants.js'
import { Selector } from '../helpers/Selector.js'
import DashboardPage from '../pageobjects/dashboard.page.js'
import SearchPage from '../pageobjects/search.page.js'
import { navigateToDashboard } from '../utils/navigationUtils.js'

describe('navigate to search result', () => {
it('should open and search content', async () => {
Expand Down
8 changes: 4 additions & 4 deletions e2e-tests/native/test/utils/navigationUtils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defaultCity, filter } from '../../../shared/constants'
import Keyboard from '../helpers/Keyboard'
import DashboardPage from '../pageobjects/dashboard.page'
import LandingPage from '../pageobjects/landing.page'
import { defaultCity, filter } from '../../../shared/constants.js'
import Keyboard from '../helpers/Keyboard.js'
import DashboardPage from '../pageobjects/dashboard.page.js'
import LandingPage from '../pageobjects/landing.page.js'

const MAX_SCROLLS = 5

Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/native/wdio-browserstack.conf.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import capabilities from './capabilities'
import capabilities from './capabilities.js'

const getCapability = () => {
const capabilityName = process.env.E2E_CONFIG
Expand Down
9 changes: 4 additions & 5 deletions e2e-tests/native/wdio-ios.conf.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Capabilities } from '@wdio/types/build/Capabilities'
import { Testrunner } from '@wdio/types/build/Options'
import { Capabilities } from '@wdio/types'

import { config as defaultConfig } from './wdio.conf'
import { config as defaultConfig } from './wdio.conf.js'

const iosCapabilities: Capabilities = {
const iosCapabilities: Capabilities.DesiredCapabilities = {
platformName: 'iOS',
// http://appium.io/docs/en/writing-running-appium/caps/
'appium:deviceName': 'iPhone 13 Pro Max',
Expand All @@ -20,7 +19,7 @@ const iosCapabilities: Capabilities = {
'appium:newCommandTimeout': 240,
}

export const config: Testrunner = {
export const config: WebdriverIO.Config = {
...defaultConfig,
capabilities: [iosCapabilities],
}
7 changes: 3 additions & 4 deletions e2e-tests/native/wdio.conf.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { Capabilities } from '@wdio/types/build/Capabilities'
import { Testrunner } from '@wdio/types/build/Options'
import { Capabilities } from '@wdio/types'

const androidCapabilities: Capabilities = {
const androidCapabilities: Capabilities.DesiredCapabilities = {
platformName: 'android',
'appium:app': '../native/android/app/build/outputs/apk/debug/app-debug.apk',
'appium:automationName': 'UiAutomator2',
}

export const config: Testrunner = {
export const config: WebdriverIO.Config = {
runner: 'local',
specs: ['./test/specs/**/*.ts'],
exclude: [],
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"version": "0.0.1",
"name": "e2e",
"private": true,
"type": "module",
"scripts": {
"test:web": "yarn wdio run web/wdio.conf.ts",
"test:web:browserstack": "yarn wdio run ./web/browserstack/wdio-browserstack.conf.ts",
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/shared/git.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { execSync } from 'child_process'
import { execSync } from 'node:child_process'

export const getGitBranch = (): string => execSync('git rev-parse --abbrev-ref HEAD').toString().trim()

Expand Down
7 changes: 5 additions & 2 deletions e2e-tests/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"noEmit": true,
"module": "NodeNext",
"moduleResolution": "NodeNext",
"types": ["node", "@wdio/globals/types", "@wdio/jasmine-framework"],
"sourceMap": false
"sourceMap": false,
"outDir": "dist"
},
"include": ["web", "native", "shared"]
}
8 changes: 4 additions & 4 deletions e2e-tests/web/capabilities.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { BrowserStackCapabilities, Capabilities } from '@wdio/types/build/Capabilities'
import { Capabilities } from '@wdio/types'

import { getGitBranch, getGitHeadReference } from '../shared/git'
import { getGitBranch, getGitHeadReference } from '../shared/git.js'

const browserstackCaps = (config: BrowserStackCapabilities): Capabilities => {
const browserstackCaps = (config: Capabilities.BrowserStackCapabilities): Capabilities.DesiredCapabilities => {
const prefix = process.env.CI ? 'IG CI' : 'IG DEV'
return {
'bstack:options': {
Expand Down Expand Up @@ -38,7 +38,7 @@ export const browserstackCapabilities = {
browserName: 'Safari',
browserVersion: '14.0',
}),
} as Record<(typeof browsers)[number], Capabilities>
} as Record<(typeof browsers)[number], Capabilities.DesiredCapabilities>

export const ciCapabilities = {
browserName: 'chrome',
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/web/test/pageobjects/categories.page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Page from './page'
import Page from './page.js'

export class CategoriesPage extends Page {
private findCategory(category: string) {
Expand Down
Loading

0 comments on commit de4bded

Please sign in to comment.