-
-
Notifications
You must be signed in to change notification settings - Fork 728
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
17e0919
commit 7c3ee50
Showing
7 changed files
with
144 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Plugins tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- 3.x | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
env: | ||
CI: true | ||
# Force terminal colors. @see https://www.npmjs.com/package/colors | ||
FORCE_COLOR: 1 | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-22.04 | ||
|
||
strategy: | ||
matrix: | ||
node-version: [20.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.4 | ||
- name: npm install | ||
run: | | ||
npm install --legacy-peer-deps | ||
env: | ||
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true | ||
- name: Install browsers and deps | ||
run: npx playwright install chromium && npx playwright install-deps | ||
- name: start a server | ||
run: "php -S 127.0.0.1:8000 -t test/data/app &" | ||
- name: run plugin tests | ||
run: npm run test:plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const TestHelper = require('../support/TestHelper'); | ||
|
||
module.exports.config = { | ||
tests: './*_test.js', | ||
timeout: 10000, | ||
output: './output', | ||
grep: '@Playwright', | ||
helpers: { | ||
Playwright: { | ||
url: TestHelper.siteUrl(), | ||
show: false, | ||
restart: process.env.BROWSER_RESTART || false, | ||
browser: process.env.BROWSER || 'chromium', | ||
ignoreHTTPSErrors: true, | ||
webkit: { | ||
ignoreHTTPSErrors: true, | ||
}, | ||
}, | ||
JSONResponse: { | ||
requestHelper: 'Playwright', | ||
}, | ||
ScreenshotSessionHelper: { | ||
require: '../support/ScreenshotSessionHelper.js', | ||
outputPath: 'test/acceptance/output', | ||
}, | ||
Expect: {}, | ||
}, | ||
include: {}, | ||
bootstrap: false, | ||
mocha: {}, | ||
plugins: { | ||
screenshotOnFail: { | ||
enabled: true, | ||
}, | ||
retryTo: { | ||
enabled: true, | ||
}, | ||
}, | ||
name: 'acceptance', | ||
gherkin: { | ||
features: './gherkin/*.feature', | ||
steps: ['./gherkin/steps.js'], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const { I } = inject(); | ||
|
||
Feature('Plugins'); | ||
|
||
Scenario('retryTo works with await steps @plugin', async () => { | ||
await retryTo(async (tryNum) => { | ||
const foo = await I.grabCurrentUrl(); | ||
if (tryNum < 3) I.waitForVisible('.nothing', 1); | ||
}, 4); | ||
}); | ||
|
||
Scenario('retryTo works with non await steps @plugin', async () => { | ||
await retryTo(async (tryNum) => { | ||
if (tryNum < 3) I.waitForVisible('.nothing', 1); | ||
}, 4); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const path = require('path'); | ||
const { exec } = require('child_process'); | ||
const { expect } = require('expect'); | ||
|
||
const runner = path.join(__dirname, '../../bin/codecept.js'); | ||
const codecept_dir = path.join( | ||
__dirname, | ||
'../acceptance', | ||
); | ||
const codecept_run = `${runner} run`; | ||
const config_run_config = (config, grep) => `${codecept_run} --config ${codecept_dir}/${config} ${ | ||
grep ? `--grep "${grep}"` : '' | ||
}`; | ||
|
||
describe('CodeceptJS plugin', function () { | ||
this.timeout(30000); | ||
|
||
before(() => { | ||
process.chdir(codecept_dir); | ||
}); | ||
|
||
it('should retry the await/non await steps', (done) => { | ||
exec(`${config_run_config('codecept.Playwright.retryTo.js', '@plugin')} --verbose`, (err, stdout) => { | ||
const lines = stdout.split('\n'); | ||
expect(lines).toEqual( | ||
expect.arrayContaining([ | ||
expect.stringContaining('... Retrying'), | ||
]), | ||
); | ||
expect(err).toBeFalsy(); | ||
done(); | ||
}); | ||
}); | ||
}); |