-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create projects in fixture to reduce number of steps in frontend tests
- Loading branch information
Showing
14 changed files
with
308 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,27 @@ | ||
[ | ||
"https://www.youtube.com/watch?v=qY8QmpdYFfc", | ||
"https://www.youtube.com/watch?v=qY8Qmpdfc", | ||
"https://www.youtube.com/live/RfnjNskapNg?feature=shared", | ||
"https://www.youtube.com/embed/3pbyEGZjgH8?si=7kKze11tNJh554b1", | ||
"https://vimeo.com/860144207" | ||
{ | ||
"url": "https://www.youtube.com/watch?v=qY8QmpdYFfc", | ||
"video_classname": ".ytp-title", | ||
"valid": true | ||
}, | ||
{ | ||
"url": "https://www.youtube.com/watch?v=qY8Qmpdfc", | ||
"video_classname": ".ytp-title", | ||
"valid": false | ||
}, | ||
{ | ||
"url": "https://www.youtube.com/live/RfnjNskapNg?feature=shared", | ||
"video_classname": ".ytp-title", | ||
"valid": true | ||
}, | ||
{ | ||
"url": "https://www.youtube.com/embed/3pbyEGZjgH8?si=7kKze11tNJh554b1", | ||
"video_classname": ".ytp-title", | ||
"valid": true | ||
}, | ||
{ | ||
"url": "https://vimeo.com/860144207", | ||
"video_title_class": ".vp-title", | ||
"video_classname": true | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,28 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
const { LoginPage } = require('../page/login'); | ||
const { ProjectPage } = require('../page/create-project'); | ||
const project = require('../fixtures/project.json'); | ||
const { admin, editor } = require('../fixtures/user.json'); | ||
const { admin } = require('../fixtures/user.json'); | ||
const videos = require('../fixtures/embed_video.json'); | ||
|
||
test('Add livestream and verify embed youtube and vimeo urls', async ({ page }) => { | ||
let projectPage = new ProjectPage(page); | ||
let randomProjectName = await projectPage.addProject(admin, [{'username': editor.username, 'role': 'editor'}]); | ||
let loginPage = new LoginPage(page); | ||
await loginPage.login(`/${admin.owns_profile}/${randomProjectName}`, editor.username, editor.password); | ||
await loginPage.login(`/${admin.owns_profile}/${admin.project}`, admin.username, admin.password); | ||
|
||
await page.getByTestId('add-livestream').click(); | ||
await page.getByTestId('add-livestream-btn').click(); | ||
for(let video of videos) { | ||
await page.locator('#livestream_urls').type(video); | ||
await page.locator('#livestream_urls').type(video.url); | ||
await page.locator('#livestream_urls').press('Enter'); | ||
} | ||
await page.getByTestId('form-submit-btn').click(); | ||
|
||
for(let index=0; index<videos.length; index++) { | ||
await page.locator(`#tab-${index+1}`).click(); | ||
await page.locator(`#pane-justified-${index+1}`).frameLocator('iframe').locator('[aria-label="Play"]').click(); | ||
await page.locator(`#pane-justified-${index+1}`).frameLocator('iframe').locator('video').isVisible(); | ||
await expect(page.locator(`#pane-justified-${index+1}`).frameLocator('iframe').locator('video')).toHaveAttribute('src'); | ||
await await page.locator(`#pane-justified-${index+1}`).waitFor(6000); | ||
if(videos[index].valid) { | ||
await page.locator(`#pane-justified-${index+1}`).frameLocator('iframe').locator(videos[index].video_classname).isVisible(); | ||
} else { | ||
await page.locator(`#pane-justified-${index+1}`).frameLocator('iframe').locator(videos[index].video_classname).isHidden(); | ||
} | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
const { LoginPage } = require('../page/login'); | ||
const { editor, admin } = require('../fixtures/user.json'); | ||
|
||
test('Add sponsor to project', async ({ page }) => { | ||
let loginPage = new LoginPage(page); | ||
await loginPage.login(`/${editor.owns_profile}/${editor.project}`, editor.username, editor.password); | ||
|
||
await page.getByTestId('site-editor-menu').locator('visible=true').click(); | ||
await page.locator('.mui-dropdown__menu').locator('visible=true').waitFor(1000); | ||
await Promise.all([ | ||
page.waitForRequest(request => request.url().includes("/sponsor"), {timeout: 60000}), | ||
await page.getByTestId('add-sponsor').click() | ||
]); | ||
await page.locator('.select2-selection__arrow').waitFor(); | ||
await page.locator('.select2-selection__arrow').click(); | ||
await page.locator('.select2-search__field').waitFor(); | ||
await page.locator('.select2-search__field').fill(admin.owns_profile); | ||
await page.locator('.select2-results__option').waitFor(); | ||
await page.locator('.select2-results__option').click(); | ||
|
||
await Promise.all([ | ||
page.waitForResponse(response => response.url().includes("/sponsor") && response.status() === 200, {timeout: 60000}), | ||
page.getByTestId('form-submit-btn').click() | ||
]); | ||
await page.getByTestId('sponsor-link":has-text(`${admin.owns_profile}`)').isVisible(); | ||
|
||
await Promise.all([ | ||
page.waitForRequest(request => request.url().includes("/edit"), {timeout: 60000}), | ||
await page.getByTestId('edit-sponsor').locator('nth=1').click() | ||
]); | ||
await page.locator('#is_promoted').click(); | ||
await Promise.all([ | ||
page.waitForResponse(response => response.url().includes("/edit") && response.status() === 200, {timeout: 60000}), | ||
page.getByTestId('form-submit-btn').click() | ||
]); | ||
await page.reload(); | ||
await page.getByTestId('promoted').locator('nth=1').isVisible(); | ||
|
||
await Promise.all([ | ||
page.waitForRequest(request => request.url().includes("/remove"), {timeout: 60000}), | ||
await page.getByTestId('remove-sponsor').locator('nth=1').click() | ||
]); | ||
await Promise.all([ | ||
page.waitForResponse(response => response.url().includes("/remove") && response.status() === 200, {timeout: 60000}), | ||
page.locator('input[value="Remove"]').click() | ||
]); | ||
await page.reload(); | ||
await expect.soft(page.getByTestId('sponsor-card')).toBeHidden(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.