Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 3, 2024
1 parent 14025bf commit 9d98ebc
Show file tree
Hide file tree
Showing 22 changed files with 468 additions and 241 deletions.
5 changes: 2 additions & 3 deletions funnel/assets/js/schedule_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,8 @@ const Schedule = {
this.config.slotInterval
);
if (this.config.schedule[session.eventDay]) {
this.config.schedule[session.eventDay].sessions[
session.startTime
].showLabel = true;
this.config.schedule[session.eventDay].sessions[session.startTime].showLabel =
true;
this.config.schedule[session.eventDay].sessions[session.startTime].rooms[
session.room_scoped_name
].talk = session;
Expand Down
2 changes: 0 additions & 2 deletions playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,4 @@ module.exports = defineConfig({
use: { ...devices['Desktop Chrome'] },
},
],

});

4 changes: 3 additions & 1 deletion tests/cypress/e2e/06_manageVenue.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ describe('Manage project venue', () => {

cy.get(`[data-testid="${venues[1].venue_title}"]`).click();
cy.get('[data-testid="set-primary-venue"]').click();
cy.get(`[data-testid="${venues[1].venue_title}"]`).find('em').contains('(primary)');
cy.get(`[data-testid="${venues[1].venue_title}"]`)
.find('em')
.contains('(primary)');

venues.forEach((venue) => {
cy.get(`.card[data-testid="${venue.venue_title}-rooms"]`)
Expand Down
4 changes: 3 additions & 1 deletion tests/cypress/e2e/23_addSponsor.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ describe('Add sponsor to project', () => {
cy.get('#is_promoted').click();
cy.get('button[data-testid="form-submit-btn"]').click();
cy.wait(2000);
cy.get('[data-testid="sponsor-card"]').find('[data-testid="promoted"]').should('exist');
cy.get('[data-testid="sponsor-card"]')
.find('[data-testid="promoted"]')
.should('exist');

cy.get('a[data-testid="remove-sponsor"]:visible').click();
cy.wait('@remove-sponsor-form');
Expand Down
8 changes: 6 additions & 2 deletions tests/cypress/e2e/eventsetup-tests/3_checkin.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ describe('Checkin of attendees', () => {
});

cy.get(`a[data-testid="${ticketEvents[0].title}"]`).click();
cy.get('td[data-testid="ticket-participant"]').contains(ticketParticipants[0].fullname);
cy.get('td[data-testid="ticket-participant"]').contains(ticketParticipants[1].fullname);
cy.get('td[data-testid="ticket-participant"]').contains(
ticketParticipants[0].fullname
);
cy.get('td[data-testid="ticket-participant"]').contains(
ticketParticipants[1].fullname
);
cy.checkin(user.username);
cy.get('a[data-testid="back-to-setup"]').click();

Expand Down
10 changes: 5 additions & 5 deletions tests/cypress/fixtures/user.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@
"username": "profile_cypress",
"fullname": "profile-cypress",
"password": "profile-cypress123_St",
"owns_profile": "fifthelephant",
"owns_profile": "fifthelephant"
},
"admin": {
"username": "admin_user",
"fullname": "admin-user",
"password": "admin-user129_Ftz",
"owns_profile": "rootconf",
"owns_profile": "rootconf"
},
"editor": {
"username": "editor_cypress",
"fullname": "editor-cypress",
"password": "editor-cypress9_GH",
"owns_profile": "jsfoo",
"owns_profile": "jsfoo"
},
"promoter": {
"username": "promoter_user",
"fullname": "promoter-user",
"password": "promoter-user34_qQE",
"owns_profile": "metarefresh",
"owns_profile": "metarefresh"
},
"usher": {
"username": "usher_cypress",
"fullname": "usher-cypress",
"password": "usher-cypress566_YUt",
"owns_profile": "kilter",
"owns_profile": "kilter"
},
"user": {
"username": "member_user",
Expand Down
17 changes: 4 additions & 13 deletions tests/playwright/fixtures/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,18 @@
"room": "Zoom"
},
{
"title": "Hasgeek House",
"room": "Second floor room"
"title": "Hasgeek House",
"room": "Second floor room"
}
],
"labels": [
{
"title": "Tracks",
"sublabels": [
"AI Engineering",
"Data Science",
"Devops"
]
"sublabels": ["AI Engineering", "Data Science", "Devops"]
},
{
"title": "Type",
"sublabels": [
"Full talk",
"BOF/Panel discussion",
"Lighting talk",
"Demo"
]
"sublabels": ["Full talk", "BOF/Panel discussion", "Lighting talk", "Demo"]
},
{
"title": "Status",
Expand Down
4 changes: 2 additions & 2 deletions tests/playwright/globalSetup.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//globalSetup.js
const { FullConfig } = require("@playwright/test");
const { FullConfig } = require('@playwright/test');
const dotenv = require('dotenv');

async function globalSetup(config) {
dotenv.config({
path: '.env.testing',
override: true
override: true,
});
}

Expand Down
49 changes: 31 additions & 18 deletions tests/playwright/page/create-project.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export class ProjectPage {
await this.page.locator('input#title').fill(projectName);
await this.page.locator('input#location').type(project.location);
await this.page.locator('input#tagline').type(project.tagline);
await this.page.locator('#field-description .cm-editor .cm-line').fill(project.description);
await this.page
.locator('#field-description .cm-editor .cm-line')
.fill(project.description);
await this.page.getByTestId('form-submit-btn').click();
}

Expand All @@ -34,65 +36,76 @@ export class ProjectPage {
await this.page.getByTestId('add-labels').click();
await this.page.locator('input#title').fill(label.title);
if (label.sublabels) {
for (let i=0; i<label.sublabels.length; i++) {
for (let i = 0; i < label.sublabels.length; i++) {
await this.page.locator('#add-sublabel-form').click();
await this.page.locator('#child-form > .ui-draggable-box').locator(`nth=${i}`).locator('input#title').type(label.sublabels[i]);
await this.page
.locator('#child-form > .ui-draggable-box')
.locator(`nth=${i}`)
.locator('input#title')
.type(label.sublabels[i]);
}
}
if (label.adminLabel) {
await this.page.locator('#field-restricted label').click();
}
await this.page.getByTestId('save-label').click();
}
await this.page.getByTestId("project-page").click();
await this.page.getByTestId('project-page').click();
}

async addVenue() {
await this.page.getByTestId('project-menu').locator("visible=true").click();
await this.page.getByTestId('settings').locator("visible=true").waitFor();
await this.page.getByTestId('settings').locator("visible=true").click();
await this.page.getByTestId('project-menu').locator('visible=true').click();
await this.page.getByTestId('settings').locator('visible=true').waitFor();
await this.page.getByTestId('settings').locator('visible=true').click();
await this.page.getByTestId('manage-venues').click();
for (let venue of project.venues) {
await this.page.getByTestId('new-venue').click();
await this.page.locator('input#title').fill(venue.title);
await this.page.locator('#field-description .cm-editor .cm-line').waitFor(2000);
await this.page.locator('#field-description .cm-editor .cm-line').fill(venue.title);
await this.page
.locator('#field-description .cm-editor .cm-line')
.fill(venue.title);
await this.page.getByTestId('form-submit-btn').click();
await this.page.locator(`.card[data-testid="${venue.title}-rooms"] a[data-testid="add-room"]`)
.click();
await this.page
.locator(`.card[data-testid="${venue.title}-rooms"] a[data-testid="add-room"]`)
.click();
await this.page.locator('input#title').fill(venue.room);
await this.page.locator('#field-description .cm-editor .cm-line').waitFor(2000);
await this.page.locator('#field-description .cm-editor .cm-line').fill(venue.room);
await this.page
.locator('#field-description .cm-editor .cm-line')
.fill(venue.room);
await this.page.getByTestId('form-submit-btn').click();
await this.page.getByTestId(venue.room).isVisible();
}
await this.page.getByTestId("project-page").click();
await this.page.getByTestId('project-page').click();
}

async openCFP() {
await this.page.getByTestId('submissions').click();
await this.page.getByTestId('add-cfp').click();
await this.page.locator('#field-instructions .cm-editor .cm-line').fill(project.cfp_instructions);
await this.page
.locator('#field-instructions .cm-editor .cm-line')
.fill(project.cfp_instructions);
await this.page.getByTestId('add-cfp').click();
await this.page.locator('label.switch-label').locator("visible=true").click();
await this.page.locator('label.switch-label').locator('visible=true').click();
}

async addProject(owner, crew=[]) {
async addProject(owner, crew = []) {
let randomProjectName = Math.random().toString(36).substring(2, 7);
let projectNameCapitalize = randomProjectName.charAt(0).toUpperCase() + randomProjectName.slice(1);
let projectNameCapitalize =
randomProjectName.charAt(0).toUpperCase() + randomProjectName.slice(1);
let loginPage;
loginPage = new LoginPage(this.page);
await loginPage.login(`/${owner.owns_profile}`, owner.username, owner.password);
await this.createNewProject(projectNameCapitalize);
let crewForm = new ProjectCrewFormPage(this.page);
await this.page.getByTestId('crew').click();
for(let member of crew) {
for (let member of crew) {
await crewForm.addMember(member.username, member.role);
}
await this.publishProject();

await loginPage.logout();
return randomProjectName;
}

}
9 changes: 5 additions & 4 deletions tests/playwright/page/login.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export class LoginPage {

constructor(page) {
this.page = page;
this.loginBtn = this.page.getByTestId('login');
Expand All @@ -18,8 +17,11 @@ export class LoginPage {
await this.passwordBtn.click();
await this.passwordInputBox.fill(password);
await Promise.all([
this.page.waitForResponse(response => response.url().includes("/login") && response.status() === 200, {timeout: 60000}),
this.submitBtn.click()
this.page.waitForResponse(
(response) => response.url().includes('/login') && response.status() === 200,
{ timeout: 60000 }
),
this.submitBtn.click(),
]);
}

Expand All @@ -28,5 +30,4 @@ export class LoginPage {
await this.loginOutBtn.waitFor();
await this.loginOutBtn.click();
}

}
45 changes: 28 additions & 17 deletions tests/playwright/page/profile-crew-form.js
Original file line number Diff line number Diff line change
@@ -1,53 +1,64 @@
import { test, expect } from '@playwright/test';

export class ProfileCrewFormPage {

constructor(page) {
this.page = page;
}

async addMember(username, owner=true, success=true) {
async addMember(username, owner = true, success = true) {
await Promise.all([
this.page.waitForResponse(response => response.url().includes("/new") && response.status() === 200, {timeout: 60000}),
this.page.getByTestId('add-member').click()
this.page.waitForResponse(
(response) => response.url().includes('/new') && response.status() === 200,
{ timeout: 60000 }
),
this.page.getByTestId('add-member').click(),
]);
await this.page.locator('.select2-selection__arrow').waitFor()
await this.page.locator('.select2-selection__arrow').waitFor();
await this.page.locator('.select2-selection__arrow').click();
await this.page.locator('.select2-search__field').waitFor();
await this.page.locator('.select2-search__field').fill(username);
await this.page.locator('.select2-results__option').waitFor();
await this.page.locator('.select2-results__option').click();
if(owner) {
if (owner) {
await this.page.locator('div#field-is_owner input[value="True"]').click();
}
else {
} else {
await this.page.locator('div#field-is_owner input[value="False"]').click();
}
await Promise.all([
this.page.waitForRequest(request => request.url().includes("/new"), {timeout: 60000}),
this.page.getByTestId('form-submit-btn').getByText('Add member').click()
this.page.waitForRequest((request) => request.url().includes('/new'), {
timeout: 60000,
}),
this.page.getByTestId('form-submit-btn').getByText('Add member').click(),
]);
if(success) {
await this.page.locator('data-test-id="member":has-text("' + username + '")').isVisible();
await expect(this.page.locator('.toast-message')).toHaveCount(0, {timeout: 7000});
if (success) {
await this.page
.locator('data-test-id="member":has-text("' + username + '")')
.isVisible();
await expect(this.page.locator('.toast-message')).toHaveCount(0, {
timeout: 7000,
});
} else {
await this.page.locator('p.mui--text-danger').isVisible();
await this.page.locator('a.modal__close').locator('visible=true').click();
}

}

async deleteMember(username) {
await Promise.all([
this.page.waitForResponse(response => response.url().includes("/edit") && response.status() === 200, {timeout: 60000}),
this.page.waitForResponse(
(response) => response.url().includes('/edit') && response.status() === 200,
{ timeout: 60000 }
),
this.page.getByTestId('member').getByText(username).click(),
]);
await Promise.all([
this.page.waitForResponse(response => response.url().includes("/delete") && response.status() === 200, {timeout: 60000}),
this.page.waitForResponse(
(response) => response.url().includes('/delete') && response.status() === 200,
{ timeout: 60000 }
),
this.page.getByTestId('revoke-btn').click(),
]);
await this.page.getByTestId('form-submit-btn').waitFor(3000);
await this.page.getByTestId('form-submit-btn').click();
}

}
Loading

0 comments on commit 9d98ebc

Please sign in to comment.