Skip to content

Commit 9be842f

Browse files
committed
init
1 parent b335444 commit 9be842f

12 files changed

+5126
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
SECRETS.js

.vscode/settings.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"workbench.colorCustomizations": {
3+
"activityBar.background": "#1f6fd0",
4+
"activityBar.activeBorder": "#ee90bb",
5+
"activityBar.foreground": "#e7e7e7",
6+
"activityBar.inactiveForeground": "#e7e7e799",
7+
"activityBarBadge.background": "#ee90bb",
8+
"activityBarBadge.foreground": "#15202b",
9+
"titleBar.activeBackground": "#1857a4",
10+
"titleBar.inactiveBackground": "#1857a499",
11+
"titleBar.activeForeground": "#e7e7e7",
12+
"titleBar.inactiveForeground": "#e7e7e799",
13+
"statusBar.background": "#1857a4",
14+
"statusBarItem.hoverBackground": "#1f6fd0",
15+
"statusBar.foreground": "#e7e7e7"
16+
},
17+
"peacock.color": "#1857a4"
18+
}

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,14 @@
1-
# codecept-playwright-fb
2-
Testing the test system
1+
## Testing the test system: CodeceptJS & Playwrite
2+
3+
[CodeceptJS](https://codecept.io/) & [Playwrite](https://github.com/microsoft/playwright) seems like a good combo for automation testing. Here we'll log into Facebook & start the process to enter a new event.
4+
5+
### Usage
6+
7+
First, edit `SECRETS-template.js` to add your log in information, then save as `SECRETS.js`. Run the following:
8+
9+
```bash
10+
npm i
11+
npx codeceptjs run --steps
12+
```
13+
14+
This will run the test, fill the first field of the event entry form, then pause with an `I.` prompt. Here you can enter more tests; read the `login_test.js` for some ideas, or [read the docs](https://codecept.io/helpers/Playwright/#configuration). When you want to quit the prompt, hit `CTRL-C` 2 times.

SECRETS-template.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// replace the *-here values on how you get log into Facebook
2+
3+
const secrets = {
4+
email: `email-here`,
5+
pass: `password-here`,
6+
}
7+
8+
module.exports = secrets

codecept.conf.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
const { setHeadlessWhen } = require('@codeceptjs/configure');
2+
3+
// turn on headless mode when running with HEADLESS=true environment variable
4+
// HEADLESS=true npx codecept run
5+
setHeadlessWhen(process.env.HEADLESS);
6+
7+
exports.config = {
8+
tests: './*_test.js',
9+
output: './test-output',
10+
helpers: {
11+
Playwright: {
12+
url: 'https://facebook.com',
13+
show: true,
14+
browser: 'chromium',
15+
windowSize: '1100x800',
16+
}
17+
},
18+
include: {
19+
I: './steps_file.js'
20+
},
21+
bootstrap: null,
22+
mocha: {},
23+
name: 'codecept-playwright-facebook',
24+
plugins: {
25+
retryFailedStep: {
26+
enabled: true
27+
},
28+
screenshotOnFail: {
29+
enabled: true
30+
}
31+
}
32+
}

jsconfig.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"compilerOptions": {
3+
"allowJs": true
4+
}
5+
}

login_test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const secrets = require('./SECRETS')
2+
3+
Feature('login')
4+
5+
Scenario('Add event', (I) => {
6+
I.amOnPage('https://facebook.com')
7+
I.fillField('#email', secrets.email)
8+
I.fillField(`#pass`, secrets.pass)
9+
I.click(`#loginbutton`)
10+
I.click(`Events`)
11+
I.waitInUrl(`/events`,5)
12+
I.wait(3)
13+
I.click(`Create Event`)
14+
I.click(`Create Private Event`)
15+
// I.waitForText(`You're creating a private event`, 15)
16+
I.waitForText(`Event Name`, 15)
17+
I.fillField(`input[placeholder="Add a short, clear name"]`, `test: ignore`)
18+
pause()
19+
})

0 commit comments

Comments
 (0)