Skip to content

Commit c1eb2ba

Browse files
authored
Update add newsletter tests and screenshots for BYOE (#4027)
* Update newsletter test and screenshot * Add missing set of screenshots * Add tests for BYOE user journey
1 parent c4e52a8 commit c1eb2ba

File tree

14 files changed

+134
-10
lines changed

14 files changed

+134
-10
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* Copyright 2019 The Subscribe with Google Authors. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS-IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/**
18+
* @fileoverview Switch to Google account sign in window and check that it prompts
19+
* the user to sign in.
20+
*/
21+
22+
const constants = require('../constants');
23+
24+
module.exports.command = function () {
25+
return this.pause(2000)
26+
.switchToTab('Email opt in')
27+
.assert.urlContains(constants.google.newsDomain);
28+
};

test/e2e/constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
module.exports = {
1818
google: {
1919
accountsDomain: 'accounts.google.com',
20+
newsDomain: 'news.google.com',
2021
domain: 'google.com',
2122
},
2223
setup: {

test/e2e/pages/basicNewsletter.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,15 @@ const commands = {
3333
consentToNewsletter: function () {
3434
return this.log('Checking consent checkbox').click('@consentCheckbox');
3535
},
36-
optInAction: function () {
37-
return this.log('Clicking opt in button').click('@optInButton');
36+
optInWithGoogleAction: function () {
37+
return this.log('Clicking opt in with Google button').click(
38+
'@optInWithGoogleButton'
39+
);
40+
},
41+
optInWithEmailAction: function () {
42+
return this.log('Clicking opt in with email button').click(
43+
'@optInWithEmailButton'
44+
);
3845
},
3946
};
4047

@@ -54,8 +61,11 @@ module.exports = {
5461
consentMessage: {
5562
selector: '[jsname="ERYeZe"] label',
5663
},
57-
optInButton: {
58-
selector: '[jsname="rANL7b"] button',
64+
optInWithGoogleButton: {
65+
selector: '[jsname="ykYhEd"]',
66+
},
67+
optInWithEmailButton: {
68+
selector: '[jsname="Zhn5O"]',
5969
},
6070
swgDialog: {
6171
selector: '.swg-dialog',

test/e2e/pages/enterpriseNewsletter.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,15 @@ const commands = {
3030
consentToNewsletter: function () {
3131
return this.log('Checking consent checkbox').click('@consentCheckbox');
3232
},
33-
optInAction: function () {
34-
return this.log('Clicking opt in button').click('@optInButton');
33+
optInWithGoogleAction: function () {
34+
return this.log('Clicking opt in with Google button').click(
35+
'@optInWithGoogleButton'
36+
);
37+
},
38+
optInWithEmailAction: function () {
39+
return this.log('Clicking opt in with email button').click(
40+
'@optInWithEmailButton'
41+
);
3542
},
3643
};
3744

@@ -54,8 +61,11 @@ module.exports = {
5461
newsletterHeader: {
5562
selector: '[jsname="ekWun"]',
5663
},
57-
optInButton: {
58-
selector: '[jsname="rANL7b"] button',
64+
optInWithGoogleButton: {
65+
selector: '[jsname="ykYhEd"]',
66+
},
67+
optInWithEmailButton: {
68+
selector: '[jsname="Zhn5O"]',
5969
},
6070
swgDialog: {
6171
selector: '.swg-dialog',
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* Copyright 2019 The Subscribe with Google Authors. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS-IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
module.exports = {
18+
'@tags': ['basic'],
19+
20+
'Show button': (browser) => {
21+
const basic = browser.page.basicNewsletter();
22+
basic
23+
.navigate()
24+
.waitForElementPresent('@swgDialog', 'Found SwG dialog')
25+
.waitForElementVisible('@swgDialog')
26+
.pause(3000)
27+
.assert.screenshotIdenticalToBaseline('html', 'basic-newsletter')
28+
.viewNewsletter()
29+
.assert.textContains(
30+
'@consentMessage',
31+
'Please sign up for my newsletter!'
32+
)
33+
.consentToNewsletter()
34+
.optInWithEmailAction()
35+
.checkEmailOptIn()
36+
.end();
37+
},
38+
};

test/e2e/tests/basicNewsletter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = {
3131
'Please sign up for my newsletter!'
3232
)
3333
.consentToNewsletter()
34-
.optInAction()
34+
.optInWithGoogleAction()
3535
.checkSignIn()
3636
.end();
3737
},
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* Copyright 2019 The Subscribe with Google Authors. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS-IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
module.exports = {
18+
'@tags': ['enterprise'],
19+
20+
'Enterprise Newsletter': (browser) => {
21+
const enterprise = browser.page.enterpriseNewsletter();
22+
enterprise
23+
.navigate()
24+
.pause(3000)
25+
.assert.screenshotIdenticalToBaseline('html', 'enterprise-newsletter')
26+
.viewNewsletter()
27+
.assert.textContains(
28+
'@newsletterHeader',
29+
'Enterprise Contribution E2E Test Pub'
30+
)
31+
.assert.textContains('@consentMessage', 'I consent to this newsletter.')
32+
.consentToNewsletter()
33+
.optInWithEmailAction()
34+
.checkEmailOptIn()
35+
.end();
36+
},
37+
};

test/e2e/tests/enterpriseNewsletter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module.exports = {
3030
)
3131
.assert.textContains('@consentMessage', 'I consent to this newsletter.')
3232
.consentToNewsletter()
33-
.optInAction()
33+
.optInWithGoogleAction()
3434
.checkSignIn()
3535
.end();
3636
},
92.3 KB
Loading
-4.34 KB
Loading

0 commit comments

Comments
 (0)