Skip to content

Commit 7068990

Browse files
committed
Merge branch 'feat/multi-image-minds-3153' into 'master'
Feat/multi image minds#3153 See merge request minds/front!2020
2 parents 5db8bfe + 2a89746 commit 7068990

File tree

65 files changed

+5720
-2090
lines changed

Some content is hidden

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

65 files changed

+5720
-2090
lines changed

e2e/test/conf/codecept.local.conf.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@ exports.config = {
1212
retries: 2,
1313
restart: 'session',
1414
reporter: 'html',
15+
keepCookies: true,
16+
keepBrowserState: true,
1517
},
1618
},
1719
include: {
1820
I: '../step_definitions/steps_file.ts',
1921
loginPage: '../pages/loginPage.ts',
22+
newsfeedPage: '../pages/newsfeedPage.ts',
2023
devtoolsPage: '../pages/devtoolsPage.ts',
2124
},
2225
mocha: {},

e2e/test/features/composer.feature

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Feature: Composer
2+
As a user
3+
I want to create activity posts
4+
So that I can share content
5+
6+
Scenario: one attachments by upload button
7+
Given I am logged in
8+
And I am on the newsfeed
9+
And I have clicked on the sidebar composer button
10+
When I add files via the upload button
11+
| filename |
12+
| image1.jpg |
13+
Then I should see 1 previews of my selected imaged
14+
When I click the post button
15+
Then I am able to create the post
16+
17+
Scenario: two attachments by upload button
18+
Given I am logged in
19+
And I am on the newsfeed
20+
And I have clicked on the sidebar composer button
21+
When I add files via the upload button
22+
| filename |
23+
| image1.jpg |
24+
| image2.jpg |
25+
Then I should see 2 previews of my selected imaged
26+
When I click the post button
27+
Then I am able to create the post
28+
29+
Scenario: title input doesnt show if no attachments
30+
Given I am logged in
31+
And I am on the newsfeed
32+
And I have clicked on the sidebar composer button
33+
Then I should not see the title input
34+
35+
Scenario: title input shows when attachments
36+
Given I am logged in
37+
And I am on the newsfeed
38+
And I have clicked on the sidebar composer button
39+
When I add files via the upload button
40+
| filename |
41+
| image1.jpg |
42+
Then I should see the title input

e2e/test/features/login.feature

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ Feature: login
44
So users can successfully login
55

66
Scenario: login invalid credentials errors
7-
Given I am on Login page
7+
Given I am logged out
8+
And I am on Login page
89
When I pass invalid credentials
910
| username | password |
1011
| incorrectuser | incorrectpassword |
@@ -13,17 +14,20 @@ Feature: login
1314
And I see incorrect credentials error
1415

1516
Scenario: login empty credentials errors
16-
Given I am on Login page
17+
Given I am logged out
18+
And I am on Login page
1719
When I pass empty credentials
1820
Then I am still on Login page
1921
And I see empty credentials error
2022

2123
Scenario: login banned credentials errors
22-
Given I am on Login page
24+
Given I am logged out
25+
And I am on Login page
2326
When I pass banned credentials
2427
Then I am still on Login page
2528

2629
Scenario: login successfully
27-
Given I am on Login page
30+
Given I am logged out
31+
And I am on Login page
2832
When I pass valid credentials
2933
Then I am taken to Home page

e2e/test/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"private": true,
55
"scripts": {
66
"test:e2e:local": "codeceptjs run --steps -c conf/codecept.local.conf.ts",
7+
"test:e2e:local:ui": "codecept-ui run --steps -c conf/codecept.local.conf.ts",
78
"test:e2e:real": "codeceptjs run-multiple browserStackCombo --steps -c conf/codecept.real.conf.ts"
89
},
910
"devDependencies": {

e2e/test/pages/commonPage.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
require('dotenv').config();
2+
const { I } = inject();
3+
4+
class CommonPage {
5+
/**
6+
* Opens the composer from the sidebar
7+
*/
8+
public openSidebarComposer(): void {
9+
I.click('[data-ref=sidenav-composer]');
10+
}
11+
}
12+
13+
export = CommonPage;

e2e/test/pages/composerModal.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export class ComposerModal {
2+
private modalElementTag = 'm-composer__modal';
3+
4+
/**
5+
* The wrapper element for the title input
6+
*/
7+
public getTextareaTitle(): CodeceptJS.Locator {
8+
return locate(`${this.modalElementTag} .m-composerTextarea__title`);
9+
}
10+
}

e2e/test/pages/devtoolsPage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class DevtoolsPage {
5858
const env = environment as string;
5959
I.seeCookie(env);
6060
const cookie = await I.grabCookie(env);
61-
assert(cookie.value, '1');
61+
assert(cookie, '1');
6262
I.seeElement(
6363
locate(this.getEnvironmentFlagSelector()).withText(
6464
env.replace(env[0], env[0].toUpperCase())

e2e/test/pages/newsfeedPage.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
require('dotenv').config();
2+
const { I } = inject();
3+
4+
export = {
5+
newsfeedURI: '/',
6+
};

e2e/test/step_definitions/steps.d.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
/// <reference types='codeceptjs' />
2-
type steps_file = typeof import('./steps_file.ts');
2+
//type steps_file = typeof import('./steps_file');
33
type loginPage = typeof import('../pages/loginPage');
44
type devtoolsPage = typeof import('../pages/devtoolsPage');
5+
type newsfeedPage = typeof import('../pages/newsfeedPage');
6+
type commonPage = typeof import('../pages/commonPage');
7+
type composerModal = typeof import('../pages/composerModal');
58

69
declare namespace CodeceptJS {
710
interface SupportObject {
811
I: I;
912
loginPage: loginPage;
1013
devtoolsPage: devtoolsPage;
14+
newsfeedPage: newsfeedPage;
15+
commonPage: commonPage;
16+
composerModal: composerModal;
1117
current: any;
1218
}
1319
interface Methods extends Playwright {}
14-
interface I extends ReturnType<steps_file> {}
20+
interface I extends WithTranslation<Methods> {}
1521
namespace Translation {
1622
interface Actions {}
1723
}

e2e/test/steps/common-steps.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
namespace CommonSteps {
22
const { I, loginPage } = inject();
33

4-
Given('I am logged in', (): void => {
5-
I.amOnPage(loginPage.loginURI);
6-
loginPage.login(loginPage.validUsername, loginPage.validPassword);
7-
I.seeCookie('minds_sess');
8-
});
4+
Given(
5+
'I am logged in',
6+
async (): Promise<void> => {
7+
if (await I.grabCookie('minds_sess')) {
8+
return;
9+
}
10+
11+
I.amOnPage(loginPage.loginURI);
12+
loginPage.login(loginPage.validUsername, loginPage.validPassword);
13+
I.seeCookie('minds_sess');
14+
}
15+
);
916

10-
Given('I am logged out', (): void => void 0);
17+
Given('I am logged out', (): void => {
18+
I.clearCookie('minds_sess');
19+
});
1120
}

0 commit comments

Comments
 (0)