Skip to content

Commit 1fa5b39

Browse files
committed
merge
2 parents 6c0acec + ecb7685 commit 1fa5b39

30 files changed

Lines changed: 4659 additions & 4179 deletions

browserstack.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
require('dotenv').config();
22
const cp = require('child_process');
33
const clientPlaywrightVersion = cp
4+
<<<<<<< HEAD
5+
=======
6+
// .execSync('npx playwright --version')
7+
>>>>>>> main
48
.toString()
59
.trim()
610
.split(' ')[1];

e2e-tests/accessibility.spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ require('dotenv').config();
66
const os = require('os');
77
const { FileActions } = require('./fileactions.js');
88

9-
let pageOne;
9+
let page1;
1010
let mobile;
1111
let browserstackMobile;
1212
let platform;
1313
const local = !!process.env.PW_URL.includes('localhost');
1414
let fileActions;
1515

1616
test.beforeEach(async ({ page, isMobile }, testInfo) => {
17-
test.setTimeout(210000);
17+
test.setTimeout(90000);
1818
mobile = isMobile;
1919
browserstackMobile = testInfo.project.name.match(/browserstack-mobile/);
2020
platform = os.platform();
@@ -148,7 +148,7 @@ test('code - accessibility', async ({ page }, testInfo) => {
148148
await page.goto(`${url}/code`);
149149
// await page.waitForTimeout(30000);
150150

151-
await fileActions.codeeditor.waitFor();
151+
await fileActions.codeEditor.waitFor();
152152
const accessibilityScanResults = await new AxeBuilder({ page }).analyze();
153153
if (accessibilityScanResults.violations.length) {
154154
results += '\n ## Code \n';
@@ -172,7 +172,7 @@ test('file menu - accessibility', async ({ page }, testInfo) => {
172172
try {
173173
await page.goto(`${url}/code`);
174174
// await page.waitForTimeout(30000);
175-
await fileActions.codeeditor.waitFor();
175+
await fileActions.codeEditor.waitFor();
176176

177177
await fileActions.filemenuClick(mobile);
178178
const accessibilityScanResults = await new AxeBuilder({ page }).analyze();
@@ -199,7 +199,7 @@ test('share modal - accessibility', async ({ page }, testInfo) => {
199199
await page.goto(`${url}/code`);
200200
// await page.waitForTimeout(30000);
201201

202-
await fileActions.codeeditor.waitFor();
202+
await fileActions.codeEditor.waitFor();
203203
await fileActions.share(mobile);
204204
const accessibilityScanResults = await new AxeBuilder({ page }).analyze();
205205
if (accessibilityScanResults.violations.length) {
@@ -224,7 +224,7 @@ test('access modal - accessibility', async ({ page }, testInfo) => {
224224
try {
225225
await page.goto(`${url}/code`);
226226
// await page.waitForTimeout(30000);
227-
await fileActions.codeeditor.waitFor();
227+
await fileActions.codeEditor.waitFor();
228228
await fileActions.access(mobile);
229229
const accessibilityScanResults = await new AxeBuilder({ page }).analyze();
230230
if (accessibilityScanResults.violations.length) {

e2e-tests/accessibility_signedin.spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const fs = require('fs');
55
require('dotenv').config();
66
const os = require('os');
77

8-
let pageOne;
8+
let page1;
99
let mobile;
1010
let browserstackMobile;
1111
let platform;
@@ -17,7 +17,7 @@ test('settings - accessibility', async ({ page }, testInfo) => {
1717
try {
1818
await page.goto(`${url}/drive`);
1919
// await page.waitForTimeout(10000);
20-
await page.frameLocator('#sbox-iframe').locator('.cp-toolbar-user-dropdown.cp-dropdown-container').click();
20+
await fileActions.drivemenu.click();
2121
await expect(fileActions.settings).toBeVisible();
2222
const pagePromise = page.waitForEvent('popup');
2323
await fileActions.settings.click();
@@ -118,12 +118,12 @@ test('teams (admin) - accessibility', async ({ page }, testInfo) => {
118118
try {
119119
await page.goto(`${url}/teams`);
120120
// await page.waitForTimeout(10000);
121-
await page.frameLocator('#sbox-iframe').locator('#cp-sidebarlayout-rightside').getByText('test team').waitFor();
121+
await fileActions.teamSlot.getByText('test team').waitFor();
122122
// await page.waitForTimeout(2000);
123-
await page.frameLocator('#sbox-iframe').locator('#cp-sidebarlayout-rightside').getByText('test team').click({ timeout: 3000 });
123+
await fileActions.teamSlot.getByText('test team').click({ timeout: 3000 });
124124

125-
await page.frameLocator('#sbox-iframe').locator('div').filter({ hasText: /^Administration$/ }).locator('span').first().waitFor();
126-
await page.frameLocator('#sbox-iframe').locator('div').filter({ hasText: /^Administration$/ }).locator('span').first().click();
125+
await fileActions.teamAdminTab.waitFor();
126+
await fileActions.teamAdminTab.click();
127127
// await page.waitForTimeout(2000);
128128
const accessibilityScanResults = await new AxeBuilder({ page }).analyze();
129129

e2e-tests/calendar_loggedin.spec.js

Lines changed: 139 additions & 321 deletions
Large diffs are not rendered by default.

e2e-tests/cleanup.js

Lines changed: 115 additions & 88 deletions
Large diffs are not rendered by default.

e2e-tests/code_anon.spec.js

Lines changed: 48 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -6,70 +6,68 @@ const fs = require('fs');
66
require('dotenv').config();
77
const os = require('os');
88

9-
let pageOne;
9+
let page1;
1010
let mobile;
1111
let browserstackMobile;
1212
let platform;
1313
const local = !!process.env.PW_URL.includes('localhost');
1414
let fileActions;
15+
let fileActions1
1516

1617
test.beforeEach(async ({ page, isMobile }, testInfo) => {
17-
test.setTimeout(210000);
18+
test.setTimeout(90000);
1819
mobile = isMobile;
1920
browserstackMobile = testInfo.project.name.match(/browserstack-mobile/);
2021
platform = os.platform();
21-
22-
await page.goto(`${url}/code`);
2322
fileActions = new FileActions(page);
24-
25-
await fileActions.codeeditor.waitFor();
23+
await fileActions.loadFileType("code")
2624
});
2725

2826
test('anon - code - input text #1367', async ({ page }) => {
2927
test.fixme(mobile, 'mobile editor preview bug');
3028
try {
31-
await fileActions.codeeditor.click();
29+
await fileActions.codeEditor.click();
3230
await fileActions.typeTestTextCode(mobile, 'test text');
33-
await expect(fileActions.codeeditor.getByText('test text')).toBeVisible();
31+
await expect(fileActions.codeEditor.getByText('test text')).toBeVisible();
3432
await expect(fileActions.codepreview.getByText('test text')).toBeVisible();
3533

36-
await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({ action: 'setSessionStatus', arguments: { name: ' code - input text', status: 'passed', reason: 'Can create Code document and input text' } })}`);
34+
await fileActions.toSuccess('Can create Code document and input text');
3735
} catch (e) {
3836
console.log(e);
39-
await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({ action: 'setSessionStatus', arguments: { name: 'code - input text', status: 'failed', reason: 'Can\'t acreate Code document and input text' } })}`);
37+
await fileActions.toFailure(e, 'Can\'t acreate Code document and input text');
4038
}
4139
});
4240

4341
test('code - file menu - history #1367', async ({ page }) => {
4442
test.fixme(mobile, 'mobile editor preview bug');
4543
try {
46-
await fileActions.codeeditor.click();
44+
await fileActions.codeEditor.click();
4745
await fileActions.typeTestTextCode(mobile, 'test text');
48-
await expect(fileActions.codeeditor.getByText('test text')).toBeVisible();
46+
await expect(fileActions.codeEditor.getByText('test text')).toBeVisible();
4947
await expect(fileActions.codepreview.getByText('test text')).toBeVisible();
5048
await fileActions.history(mobile);
51-
await page.frameLocator('#sbox-iframe').locator('.cp-toolbar-history-previous').first().click();
52-
await expect(fileActions.codeeditor.getByText('test text')).toHaveCount(0);
49+
await fileActions.historyPrevFirst.click();
50+
await expect(fileActions.codeEditor.getByText('test text')).toHaveCount(0);
5351
await expect(fileActions.codepreview.getByText('test text')).toBeHidden();
5452

55-
await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({ action: 'setSessionStatus', arguments: { name: 'code - file menu - history', status: 'passed', reason: 'Can view Code document history' } })}`);
53+
await fileActions.toSuccess('Can view Code document history');
5654
} catch (e) {
5755
console.log(e);
58-
await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({ action: 'setSessionStatus', arguments: { name: 'code - file menu - history', status: 'failed', reason: 'Can\'t view Code document history' } })}`);
56+
await fileActions.toFailure(e, 'Can\'t view Code document history');
5957
}
6058
});
6159

6260
test('code - toggle toolbar #1367', async ({ page }) => {
6361
test.fixme(mobile, 'mobile editor preview bug');
6462
try {
65-
await expect(page.frameLocator('#sbox-iframe').locator('.cp-markdown-toolbar')).toBeHidden();
66-
await fileActions.toolbar.click();
67-
await expect(page.frameLocator('#sbox-iframe').locator('.cp-markdown-toolbar')).toBeVisible();
63+
await expect(fileActions.codeToolbar).toBeHidden();
64+
await fileActions.toolbarButton.click();
65+
await expect(fileActions.codeToolbar).toBeVisible();
6866

69-
await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({ action: 'setSessionStatus', arguments: { name: 'code - toggle toolbar', status: 'passed', reason: 'Can toggle toolbar in Code document' } })}`);
67+
await fileActions.toSuccess('Can toggle toolbar in Code document');
7068
} catch (e) {
7169
console.log(e);
72-
await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({ action: 'setSessionStatus', arguments: { name: 'code - toggle toolbar', status: 'failed', reason: 'Can\'t toggle toolbar in Code document' } })}`);
70+
await fileActions.toFailure(e, 'Can\'t toggle toolbar in Code document');
7371
}
7472
});
7573

@@ -83,36 +81,37 @@ test('code - toggle preview #1367', async ({ page }) => {
8381

8482
await expect(fileActions.codepreview.getByText('test text')).toBeHidden();
8583

86-
await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({ action: 'setSessionStatus', arguments: { name: 'anon - code - toggle preview', status: 'passed', reason: 'Can toggle preview in Code document' } })}`);
84+
await fileActions.toSuccess('Can toggle preview in Code document' );
8785
} catch (e) {
8886
console.log(e);
89-
await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({ action: 'setSessionStatus', arguments: { name: 'anon - code - toggle preview', status: 'failed', reason: 'Can\'t toggle preview in Code document' } })}`);
87+
await fileActions.toFailure(e, 'Can\'t toggle preview in Code document');
9088
}
9189
});
9290

9391
test('code - make a copy #1367', async ({ page }) => {
9492
test.fixme(mobile, 'mobile editor preview bug');
9593
try {
96-
await fileActions.codeeditor.click();
94+
await fileActions.codeEditor.click();
9795
await fileActions.typeTestTextCode(mobile, 'test text');
9896

9997
await expect(fileActions.codepreview.getByText('test text')).toBeVisible();
10098
await fileActions.filemenuClick(mobile);
10199
const [page1] = await Promise.all([
102100
page.waitForEvent('popup'),
103-
await fileActions.filecopy.click()
101+
await fileActions.fileMenuItem(' Make a copy').click()
104102
]);
105103

106104
await expect(page1).toHaveURL(new RegExp(`^${url}/code`), { timeout: 100000 });
105+
fileActions1 = new FileActions(page1);
107106

108107
await page1.waitForTimeout(4000);
109-
await page1.frameLocator('#sbox-iframe').locator('#cp-app-code-preview-content').getByText('Test text').waitFor();
110-
await expect(page1.frameLocator('#sbox-iframe').locator('#cp-app-code-preview-content').getByText('test text')).toBeVisible();
108+
await fileActions1.codepreview.getByText('Test text').waitFor();
109+
await expect(fileActions1.codepreview.getByText('test text')).toBeVisible();
111110

112-
await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({ action: 'setSessionStatus', arguments: { name: 'code - make a copy', status: 'passed', reason: 'Can make a copy' } })}`);
111+
await fileActions.toSuccess('Can make a copy of Code document');
113112
} catch (e) {
114113
console.log(e);
115-
await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({ action: 'setSessionStatus', arguments: { name: 'code - make a copy', status: 'failed', reason: 'Can\'t make a copy' } })}`);
114+
await fileActions.toFailure(e, 'Can\'t make a copy of Code document');
116115
}
117116
});
118117

@@ -121,51 +120,45 @@ test('code - import file #1367', async ({ page, context }) => {
121120
test.skip(browserstackMobile, 'browserstack mobile import incompatibility');
122121

123122
try {
124-
await fileActions.codeeditor.waitFor();
125-
// // await page.waitForTimeout(10000);
123+
await fileActions.codeEditor.waitFor();
126124
await fileActions.filemenuClick(mobile);
127125
const [fileChooser] = await Promise.all([
128126
page.waitForEvent('filechooser'),
129127
await fileActions.importClick()
130128
]);
131129

132-
await fileChooser.setFiles('e2e-test-suite/testdocuments/myfile.html');
133-
134-
// // await page.waitForTimeout(3000);
135-
136-
await expect(fileActions.codeeditor.getByText('Test text here')).toBeVisible();
130+
await fileChooser.setFiles('testdocuments/myfile.html');
131+
await expect(fileActions.codeEditor.getByText('Test text here')).toBeVisible();
137132
await expect(fileActions.codepreview.getByText('Test text here')).toBeVisible();
138133

139-
await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({ action: 'setSessionStatus', arguments: { name: 'code - import file', status: 'passed', reason: 'Can import file into Code document' } })}`);
134+
await fileActions.toSuccess('Can import file into Code document');
140135
} catch (e) {
141136
console.log(e);
142-
await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({ action: 'setSessionStatus', arguments: { name: 'code - import file', status: 'failed', reason: 'Can\'t import file into Code document' } })}`);
137+
await fileActions.toFailure(e, 'Can\'t import file into Code document');
143138
}
144139
});
145140

146141
test('code - export (md)', async ({ page }) => {
147142
test.skip(browserstackMobile, 'browserstack mobile download incompatibility');
148143

149144
try {
150-
await fileActions.codeeditor.click();
145+
await fileActions.codeEditor.click();
151146
await fileActions.typeTestTextCode(mobile, 'test text');
152-
await expect(fileActions.codeeditor.getByText('test text')).toBeVisible();
147+
await expect(fileActions.codeEditor.getByText('test text')).toBeVisible();
153148
await fileActions.export(mobile);
154-
await page.frameLocator('#sbox-iframe').getByRole('textbox').fill('test code');
149+
await fileActions.textbox.fill('test code');
155150

156151
const [download] = await Promise.all([
157152
page.waitForEvent('download'),
158153
await fileActions.okButton.click()
159154
]);
160155

161156
await download.saveAs('/tmp/test code');
162-
163157
const readData = fs.readFileSync('/tmp/test code', 'utf8');
164-
console.log(readData);
165158
if (readData.trim() === 'test text') {
166-
await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({ action: 'setSessionStatus', arguments: { name: 'code - export (md)', status: 'passed', reason: 'Can export Code document as .md' } })}`);
159+
await fileActions.toSuccess('Can export Code document as .md');
167160
} else {
168-
await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({ action: 'setSessionStatus', arguments: { name: 'code - export (md)', status: 'failed', reason: 'Can\'t export Code document as .md' } })}`);
161+
await fileActions.toFailure(e, 'Can\'t export Code document as .md');
169162
}
170163
} catch (e) {
171164
console.log(e);
@@ -175,7 +168,7 @@ test('code - export (md)', async ({ page }) => {
175168

176169
test('code - share at a moment in history', async ({ page, browser }) => {
177170
try {
178-
await fileActions.codeeditor.click();
171+
await fileActions.codeEditor.click();
179172
await page.keyboard.press('t');
180173
await page.keyboard.press('e');
181174
await page.keyboard.press('s');
@@ -185,8 +178,7 @@ test('code - share at a moment in history', async ({ page, browser }) => {
185178
await page.keyboard.press('e');
186179
await page.keyboard.press('x');
187180
await page.keyboard.press('t');
188-
// await page.waitForTimeout(7000);
189-
await expect(fileActions.codeeditor.getByText('test text')).toBeVisible();
181+
await expect(fileActions.codeEditor.getByText('test text')).toBeVisible();
190182

191183

192184
let key;
@@ -197,26 +189,19 @@ test('code - share at a moment in history', async ({ page, browser }) => {
197189
}
198190
await page.keyboard.press(`${key}+a`);
199191
await page.keyboard.press('Backspace');
200-
await expect(fileActions.codeeditor.getByText('test text')).toHaveCount(0);
201-
202-
203-
await fileActions.share(mobile);
204-
// await fileActions.shareLink.click();
205-
// await page.waitForTimeout(5000);
206-
await fileActions.shareCopyLink.click();
207-
// await page.waitForTimeout(5000);
192+
await expect(fileActions.codeEditor.getByText('test text')).toHaveCount(0);
208193

209-
const clipboardText = await page.evaluate(() => navigator.clipboard.readText());
210-
pageOne = await browser.newPage();
194+
var clipboardText = await fileActions.getShareLink()
195+
page1 = await browser.newPage();
211196

212-
await pageOne.goto(`${clipboardText}`);
197+
await page1.goto(`${clipboardText}`);
213198

214-
await pageOne.frameLocator('#sbox-iframe').locator('.CodeMirror-scroll').waitFor();
215-
await expect(fileActions.codeeditor.getByText('test text')).toHaveCount(0);
199+
await page1.frameLocator('#sbox-iframe').locator('.CodeMirror-scroll').waitFor();
200+
await expect(fileActions.codeEditor.getByText('test text')).toHaveCount(0);
216201

217-
await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({ action: 'setSessionStatus', arguments: { name: 'code - share at a moment in history', status: 'passed', reason: 'Can share code document at a specific moment in history' } })}`);
202+
await fileActions.toSuccess('Can share code document at a specific moment in history')
218203
} catch (e) {
219204
console.log(e);
220-
await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({ action: 'setSessionStatus', arguments: { name: 'code - share at a moment in history', status: 'failed', reason: 'Can\'t share code document at a specific moment in history' } })}`);
205+
await fileActions.toFailure(e, 'Can\'t share code document at a specific moment in history' )
221206
}
222207
});

0 commit comments

Comments
 (0)