-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(project): initialize CodeceptJS tests
- Loading branch information
1 parent
0e4ef25
commit a62dff1
Showing
11 changed files
with
1,246 additions
and
52 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,25 @@ | ||
name: Codeceptjs | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [14.x] | ||
config: [desktop, mobile] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: | | ||
yarn | ||
yarn codecept:${{ matrix.config }}:ci run --steps | ||
env: | ||
CI: true |
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 |
---|---|---|
|
@@ -4,3 +4,4 @@ node_modules | |
.idea | ||
.DS_Store | ||
/coverage | ||
/output |
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,37 @@ | ||
const { setHeadlessWhen } = require('@codeceptjs/configure'); | ||
|
||
// turn on headless mode when running with HEADLESS=true environment variable | ||
// export HEADLESS=true && npx codeceptjs run | ||
setHeadlessWhen(process.env.HEADLESS); | ||
|
||
exports.config = { | ||
grep : '@desktop', | ||
tests : './test/*_test.js', | ||
output : './output', | ||
helpers : { | ||
Playwright: { | ||
url : 'http://localhost:8080', | ||
show : false, | ||
browser: 'chromium', | ||
} | ||
}, | ||
include : { | ||
I: './steps_file.js' | ||
}, | ||
bootstrap: null, | ||
mocha : {}, | ||
name : 'desktop', | ||
plugins : { | ||
pauseOnFail : {}, | ||
retryFailedStep : { | ||
enabled: true, | ||
retries: 2, | ||
}, | ||
tryTo : { | ||
enabled: true | ||
}, | ||
screenshotOnFail: { | ||
enabled: !process.env.CI | ||
} | ||
} | ||
}; |
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,39 @@ | ||
const { devices } = require('playwright'); | ||
const { setHeadlessWhen } = require('@codeceptjs/configure'); | ||
|
||
// turn on headless mode when running with HEADLESS=true environment variable | ||
// export HEADLESS=true && npx codeceptjs run | ||
setHeadlessWhen(process.env.HEADLESS); | ||
|
||
exports.config = { | ||
grep : '@mobile', | ||
tests : './test/*_test.js', | ||
output : './output', | ||
helpers : { | ||
Playwright: { | ||
url : 'http://localhost:8080', | ||
show : false, | ||
browser: 'chromium', | ||
emulate: devices['iPhone SE'], | ||
} | ||
}, | ||
include : { | ||
I: './steps_file.js' | ||
}, | ||
bootstrap: null, | ||
mocha : {}, | ||
name : 'mobile', | ||
plugins : { | ||
pauseOnFail : {}, | ||
retryFailedStep : { | ||
enabled: true, | ||
retries: 2, | ||
}, | ||
tryTo : { | ||
enabled: true | ||
}, | ||
screenshotOnFail: { | ||
enabled: !process.env.CI | ||
} | ||
} | ||
}; |
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,5 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowJs": true | ||
} | ||
} |
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,11 @@ | ||
/// <reference types='codeceptjs' /> | ||
type steps_file = typeof import('./steps_file.js'); | ||
|
||
declare namespace CodeceptJS { | ||
interface SupportObject { I: I, current: any } | ||
interface Methods extends Playwright {} | ||
interface I extends ReturnType<steps_file> {} | ||
namespace Translation { | ||
interface Actions {} | ||
} | ||
} |
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,10 @@ | ||
// in this file you can append custom step methods to 'I' object | ||
|
||
module.exports = function() { | ||
return actor({ | ||
|
||
// Define custom steps here, use 'this' to access default methods of I. | ||
// It is recommended to place a general 'login' function here. | ||
|
||
}); | ||
} |
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,3 @@ | ||
{ | ||
"extends": ["plugin:codeceptjs/recommended"] | ||
} |
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 @@ | ||
Feature('home'); | ||
|
||
Scenario('Homepage loads', ({ I }) => { | ||
I.amOnPage('http://localhost:8080'); | ||
I.see('Central Intelligence'); | ||
I.see('All Movies'); | ||
I.see('Settings'); | ||
}).tag('@desktop'); | ||
|
||
Scenario('Homepage loads', ({ I }) => { | ||
I.amOnPage('http://localhost:8080'); | ||
I.see('Central Intelligence'); | ||
I.see('Drama'); | ||
I.see('The Spongebob Movie'); | ||
}).tag('@mobile'); | ||
|
||
Scenario('Header button navigates to playlist screen', ({ I }) => { | ||
I.amOnPage('http://localhost:8080'); | ||
I.see('All Movies'); | ||
I.click('All Movies'); | ||
I.amOnPage('http://localhost:8080/p/4fgzPjpv'); | ||
I.see('Featured Covers'); | ||
}).tag('@desktop'); | ||
|
||
Scenario('Menu button opens the sidebar', ({ I }) => { | ||
I.amOnPage('http://localhost:8080'); | ||
I.click('[aria-label="open menu"]'); | ||
I.see('Home'); | ||
I.see('All Movies'); | ||
I.see('Settings'); | ||
I.click('All Movies'); | ||
I.amOnPage('http://localhost:8080/p/4fgzPjpv'); | ||
I.see('Featured Covers'); | ||
}).tag('@mobile'); |
Oops, something went wrong.