File tree Expand file tree Collapse file tree 4 files changed +79
-0
lines changed
Expand file tree Collapse file tree 4 files changed +79
-0
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "tests" : " ./*_test.js" ,
3+ "timeout" : 10000 ,
4+ "output" : " ./output" ,
5+ "helpers" : {
6+ "WebDriverIO" : {
7+ "url" : " http://localhost" ,
8+ "browser" : " firefox"
9+ }
10+ },
11+ "mocha" : {},
12+ "name" : " tests"
13+ }
Original file line number Diff line number Diff line change 1+
2+ Feature ( 'GitHub' ) ;
3+
4+ Before ( ( I ) => {
5+ I . amOnPage ( 'https://github.com' ) ;
6+ } )
7+
8+ Scenario ( 'search' , ( I ) => {
9+ I . fillField ( 'Search GitHub' , 'CodeceptJS' ) ;
10+ I . pressKey ( 'Enter' ) ;
11+ I . see ( 'Codeception/CodeceptJS' , 'a' ) ;
12+ } ) ;
13+
14+ Scenario ( 'signin' , ( I ) => {
15+ I . click ( 'Sign in' ) ;
16+ I . see ( 'Sign in to GitHub' ) ;
17+ I . fillField ( 'Username or email address' , 'something@totest.com' ) ;
18+ I . fillField ( 'Password' , '123456' ) ;
19+ I . click ( 'Sign in' ) ;
20+ I . see ( 'Incorrect username or password.' , '.flash-error' ) ;
21+ } ) ;
Original file line number Diff line number Diff line change 1+
2+ 'use strict' ;
3+
4+ let I ;
5+
6+ module . exports = {
7+
8+ _init ( ) {
9+ I = require ( 'codeceptjs/actor' ) ( ) ;
10+ }
11+
12+ // insert your locators and methods here
13+ } ;
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+ let Helper = require ( '../lib/helper' ) ;
3+ let assert = require ( 'assert' ) ;
4+
5+ class User extends Helper {
6+
7+ // before/after hooks
8+ _before ( ) {
9+ // remove if not used
10+ }
11+
12+ _after ( ) {
13+ // remove if not used
14+ }
15+
16+ // add custom methods here
17+ // If you need to access other helpers
18+ // use: this.helpers['helperName']
19+ seeAuthentication ( ) {
20+ return this . helpers [ 'WebDriverIO' ] . browser . cookie ( function ( err , res ) {
21+ let cookies = res . value ;
22+ for ( let k in cookies ) {
23+ if ( cookies [ k ] . name !== 'logged_in' ) continue ;
24+ assert . equal ( cookies [ k ] . value , 'yes' ) ;
25+ return ;
26+ }
27+ assert . fail ( cookies , 'logged_in' , 'Auth cookie not set' ) ;
28+ } ) ;
29+ }
30+ }
31+
32+ module . exports = User ;
You can’t perform that action at this time.
0 commit comments