Skip to content

Commit 514cc75

Browse files
authored
Merge pull request #5045 from codeceptjs/feat/esm
Feat/esm
2 parents ed6d52a + 7df0224 commit 514cc75

File tree

537 files changed

+28260
-31151
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

537 files changed

+28260
-31151
lines changed

.circleci/build.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

.circleci/config.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.circleci/test.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

.github/CONTRIBUTING.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ Go over the steps in [this](https://github.com/firstcontributions/first-contribu
77
To start you need:
88

99
1. Fork and clone the repo.
10-
2. Run `npm i --force --omit=optional` to install all required libraries
10+
2. Run `npm i --force` to install all required libraries
1111
3. Do the changes.
1212
4. Add/Update Test (if possible)
1313
5. Update documentation
14-
6. Run `npm run docs` if you change the documentation
15-
7. Commit and Push to your fork
16-
8. Make Pull Request
14+
6. Run `npm run def` to generate types
15+
7. Run `npm run docs` if you change the documentation
16+
8. Commit and Push to your fork
17+
9. Make Pull Request
1718

1819
To run codeceptjs from this repo use:
1920

@@ -27,7 +28,6 @@ To run examples:
2728
node bin/codecept.js run -c examples
2829
```
2930

30-
3131
Depending on a type of change you should do the following.
3232

3333
## Debugging
@@ -44,12 +44,12 @@ Please keep in mind that CodeceptJS have **unified API** for Playwright, WebDriv
4444

4545
### Updating Playwright | Puppeteer | WebDriver
4646

47-
*Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required! Do **not edit** `docs/helpers/`, those files are generated from docblocks in corresponding helpers! *
47+
_Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required! Do **not edit** `docs/helpers/`, those files are generated from docblocks in corresponding helpers! _
4848

4949
Working test is highly appreciated. To run the test suite you need:
5050

51-
* selenium server + chromedriver
52-
* PHP installed
51+
- selenium server + chromedriver
52+
- PHP installed
5353

5454
To launch PHP demo application run:
5555

@@ -82,7 +82,7 @@ http://localhost:8000/form/myexample
8282

8383
### Updating REST | ApiDataFactory
8484

85-
*Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required!*
85+
_Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required!_
8686

8787
Adding a test is highly appreciated.
8888

@@ -96,7 +96,7 @@ Edit a test at `test/rest/REST_test.js` or `test/rest/ApiDataFactory_test.js`
9696

9797
## Appium
9898

99-
*Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required! Do **not edit** `docs/helpers/`, those files are generated from docblocks in corresponding helpers! *
99+
_Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required! Do **not edit** `docs/helpers/`, those files are generated from docblocks in corresponding helpers! _
100100

101101
It is recommended to run mobile tests on CI.
102102
So do the changes, make pull request, see the CI status.
@@ -211,6 +211,7 @@ docker-compose run --rm test-helpers test/rest
211211
```
212212

213213
#### Run acceptance tests
214+
214215
To that we provide three separate services respectively for WebDriver, Nightmare and Puppeteer tests:
215216

216217
```sh
@@ -235,11 +236,13 @@ And now every command based on `test-helpers` service will use node 9.4.0. The
235236
same argument can be passed when building unit and acceptance tests services.
236237

237238
### CI flow
239+
238240
We're currently using a bunch of CI services to build and test codecept in
239241
different environments. Here's short summary of what are differences between
240242
separate services
241243

242244
#### CircleCI
245+
243246
Here we use CodeceptJS docker image to build and execute tests inside it. We
244247
start with building Docker container based on Dockerfile present in main project
245248
directory. Then we run (in this order) unit tests, all helpers present in

.github/workflows/acceptance-tests.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
# Install Docker Compose
3030
- name: Install Docker Compose
3131
run: |
32-
sudo apt-get update
32+
sudo apt-get update --allow-releaseinfo-change
3333
sudo apt-get install -y docker-compose
3434
3535
# Run rest tests using docker-compose
@@ -41,8 +41,3 @@ jobs:
4141
- name: Run WebDriverIO Acceptance Tests
4242
run: docker-compose run --rm test-acceptance.webdriverio
4343
working-directory: test
44-
45-
# Run faker BDD tests using docker-compose
46-
- name: Run Faker BDD Tests
47-
run: docker-compose run --rm test-bdd.faker
48-
working-directory: test

.github/workflows/appiumV2_Android.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Appium Tests - Android
2+
3+
on:
4+
push:
5+
branches:
6+
- 3.x
7+
8+
env:
9+
CI: true
10+
# Force terminal colors. @see https://www.npmjs.com/package/colors
11+
FORCE_COLOR: 1
12+
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
13+
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
14+
15+
jobs:
16+
appium:
17+
runs-on: ubuntu-22.04
18+
timeout-minutes: 30
19+
20+
strategy:
21+
matrix:
22+
node-version: [20.x]
23+
test-suite: ['other', 'quick']
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Use Node.js ${{ matrix.node-version }}
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: ${{ matrix.node-version }}
32+
33+
- run: npm i
34+
env:
35+
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
36+
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
37+
38+
- name: Upload APK to Sauce Labs
39+
run: |
40+
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" \
41+
--location --request POST 'https://api.us-west-1.saucelabs.com/v1/storage/upload' \
42+
--form 'payload=@test/data/mobile/selendroid-test-app-0.17.0.apk' \
43+
--form 'name="selendroid-test-app-0.17.0.apk"'
44+
45+
- run: 'timeout 900 bash -c "npm run test:appium-${{ matrix.test-suite }}"'
46+
timeout-minutes: 20

.github/workflows/appiumV2_iOS.yml renamed to .github/workflows/appium_iOS.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Appium V2 Tests - iOS
1+
name: Appium Tests - iOS
22

33
on:
44
push:
@@ -9,10 +9,14 @@ env:
99
CI: true
1010
# Force terminal colors. @see https://www.npmjs.com/package/colors
1111
FORCE_COLOR: 1
12+
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
13+
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
1214

1315
jobs:
1416
appium:
17+
if: false
1518
runs-on: ubuntu-22.04
19+
timeout-minutes: 30
1620

1721
strategy:
1822
matrix:
@@ -29,8 +33,13 @@ jobs:
2933
env:
3034
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
3135
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
32-
- run: "npm run test:ios:appium-${{ matrix.test-suite }}"
33-
env: # Or as an environment variable
34-
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
35-
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
3636

37+
- name: Upload APK to Sauce Labs
38+
run: |
39+
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" \
40+
--location --request POST 'https://api.us-west-1.saucelabs.com/v1/storage/upload' \
41+
--form 'payload=@test/data/mobile/TestApp-iphonesimulator.zip' \
42+
--form 'name="TestApp-iphonesimulator.zip"'
43+
44+
- run: 'timeout 900 bash -c "npm run test:ios:appium-${{ matrix.test-suite }}"'
45+
timeout-minutes: 20

.github/workflows/docker.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,26 @@ on:
44
push:
55
branches:
66
- 3.x
7-
release:
8-
types: [published]
97

108
jobs:
119
push_to_registry:
1210
name: Build and push Docker image to Docker Hub
1311
runs-on: ubuntu-22.04
12+
env:
13+
DOCKER_REPO: ${{ secrets.DOCKERHUB_REPOSITORY }}
1414

1515
steps:
16-
- name: Check out the repo with the latest code
16+
- name: Checkout code
1717
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Get version from package.json
22+
id: get_version
23+
run: |
24+
VERSION=$(jq -r .version package.json)
25+
echo "VERSION=$VERSION" >> $GITHUB_ENV
26+
echo "version=$VERSION" >> $GITHUB_OUTPUT
1827
1928
- name: Set up Docker Buildx
2029
uses: docker/setup-buildx-action@v3
@@ -25,15 +34,19 @@ jobs:
2534
username: ${{ secrets.DOCKERHUB_USERNAME }}
2635
password: ${{ secrets.DOCKERHUB_PASSWORD }}
2736

28-
- name: Get the current tag
29-
id: currentTag
30-
run: git fetch --prune --unshallow && TAG=$(git describe --tags --abbrev=0) && echo $TAG && echo "TAG="$TAG >> "$GITHUB_ENV"
37+
- name: Check if Docker tag exists on Docker Hub
38+
id: tag_check
39+
run: |
40+
STATUS_CODE=$(curl -s -o /dev/null -w "%{http_code}" \
41+
https://hub.docker.com/v2/repositories/${{ env.DOCKER_REPO }}/tags/${{ steps.get_version.outputs.version }}/)
42+
echo "status_code=$STATUS_CODE" >> $GITHUB_OUTPUT
3143
3244
- name: Build and push Docker image
45+
if: steps.tag_check.outputs.status_code != '200'
3346
uses: docker/build-push-action@v6
3447
with:
3548
context: .
3649
push: true
3750
tags: |
38-
${{ secrets.DOCKERHUB_REPOSITORY }}:latest
39-
${{ secrets.DOCKERHUB_REPOSITORY }}:${{ env.TAG }}
51+
${{ env.DOCKER_REPO }}:latest
52+
${{ env.DOCKER_REPO }}:${{ env.VERSION }}

0 commit comments

Comments
 (0)