Skip to content

Commit

Permalink
Fix playwright tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vidya-ram committed Jun 13, 2024
1 parent 9d98ebc commit 6b779bb
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 29 deletions.
5 changes: 3 additions & 2 deletions funnel/assets/js/schedule_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,9 @@ 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
4 changes: 2 additions & 2 deletions funnel/templates/account_menu.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
<li>
<a href="{{ url_for('organizations') }}"
class="header__dropdown__item header__dropdown__item--flex mui--text-dark nounderline mui--text-subhead mui--text-light"
data-cy="org"><span class="profile-avatar profile-avatar--bigger margin-right">{{ faicon(icon='sitemap', icon_size='title', baseline=false, css_class="mui--text-light") }}</span>{% trans %}Organizations{% endtrans %}</a>
data-testid="org-page"><span class="profile-avatar profile-avatar--bigger margin-right">{{ faicon(icon='sitemap', icon_size='title', baseline=false, css_class="mui--text-light") }}</span>{% trans %}Organizations{% endtrans %}</a>
</li>
{%- with orglist = current_auth.user.views.organizations_as_member %}
{%- for org in orglist %}
<li>
<a href="{{ org.url_for() }}"
class="header__dropdown__item header__dropdown__item--flex header__dropdown__item--morepadding mui--text-dark nounderline" data-testid="org">
class="header__dropdown__item header__dropdown__item--flex header__dropdown__item--morepadding mui--text-dark nounderline">
<span class="profile-avatar margin-right">
{%- if org.logo_url.url %}
<img src="{{ org.logo_url.resize(img_size.profile_logo_small) }}"
Expand Down
2 changes: 1 addition & 1 deletion funnel/templates/macros.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@
{% if add_profile_link %}</a>{% endif %}
</div>
</div>
{% if add_profile_link %}<a href="{{ account.absolute_url }}" class="mui--text-dark mui--text-subhead text-bold nounderline" data-cy="profile-link">{%- else %}<span class="mui--text-dark mui--text-subhead text-bold nounderline">{% endif %}{{ account.title }}{% if add_profile_link %}</a>{%- else %}</span>{% endif %}
{% if add_profile_link %}<a href="{{ account.absolute_url }}" class="mui--text-dark mui--text-subhead text-bold nounderline" data-testid="profile-link">{%- else %}<span class="mui--text-dark mui--text-subhead text-bold nounderline">{% endif %}{{ account.title }}{% if add_profile_link %}</a>{%- else %}</span>{% endif %}
{{ add_follow_button(account, css_class=css_class) }}
{%- endmacro %}

Expand Down
10 changes: 5 additions & 5 deletions funnel/templates/profile_layout.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
{% elif membership_project.features.show_tickets %}
<div class="membership-container__btn-wrapper">
<button class="js-open-ticket-widget mui-btn mui-btn--primary price-btn zero-bottom-margin zero-top-margin display-block">
<span class="price-btn__txt" data-cy="unregistered">{% trans %}Become a member{% endtrans %}</span>
<span class="price-btn__txt" data-testid="unregistered">{% trans %}Become a member{% endtrans %}</span>
<span class="price-btn__txt price-btn__txt--smaller primary-color-lighter-txt js-tickets-available"><span class="js-ticket-price"></span></span>
<span class="price-btn__txt price-btn__txt--smaller mui--text-light js-tickets-not-available mui--hide">{% trans %}Sales closed{% endtrans %}</span>
</button>
Expand Down Expand Up @@ -350,9 +350,9 @@
{% macro profile_header_buttons(profile) %}
<div class="profile__btns flex-wrapper--center">
{% if profile.features.new_project() %}
<a class="mui-btn mui-btn--primary mui-btn--raised" href="{{ profile.url_for('new_project') }} ">{{ faicon(icon='plus', icon_size='caption') }} {% trans %}New project{% endtrans %}</a>
<a class="mui-btn mui-btn--primary mui-btn--raised" href="{{ profile.url_for('new_project') }}" data-testid="new-project">{{ faicon(icon='plus', icon_size='caption') }} {% trans %}New project{% endtrans %}</a>
{% elif profile.features.make_public() %}
<a class="mui-btn mui-btn--raised mui-btn--primary" href="#make-public-modal" rel="modal:open" role="button" aria-haspopup="true" data-cy="profile-public">{% trans %}Make account public{% endtrans %}</a>
<a class="mui-btn mui-btn--raised mui-btn--primary" href="#make-public-modal" rel="modal:open" role="button" aria-haspopup="true" data-testid="profile-public">{% trans %}Make account public{% endtrans %}</a>
<div class="modal" id="make-public-modal" role="dialog" aria-labelledby="profile-public-modal-title" aria-modal="true" tabindex="-1">
<div class="modal__header">
<a class="modal__close mui--text-dark" data-target="close cancel register modal" aria-label="{% trans %}Close{% endtrans %}" rel="modal:close" href="#" onclick="return false;" role="button" tabindex="0">{{ faicon(icon='times', baseline=false, icon_size='title') }}</a>
Expand All @@ -366,7 +366,7 @@
</ul>
<form action="{{ profile.url_for('transition') }}" method="post">
{{ profile.forms.transition().hidden_tag() }}
<button name="transition" value="make_profile_public" class="mui-btn mui-btn--accent mui-btn--flat mui--pull-right" data-cy="make-public-btn">{% trans %}Make public{% endtrans %}</button>
<button name="transition" value="make_profile_public" class="mui-btn mui-btn--accent mui-btn--flat mui--pull-right" data-testid="make-public-btn">{% trans %}Make public{% endtrans %}</button>
</form>
</div>
</div>
Expand Down Expand Up @@ -476,7 +476,7 @@
{% elif not profile.features.is_private() %}
<a class="sub-navbar__item mui--text-subhead mui--text-dark mui--hidden-xs mui--hidden-sm {% if current_page == 'profile' %}sub-navbar__item--active{%- endif %}" href="{{ profile.url_for() }}">{% trans %}Sessions{% endtrans %}</a>
<a class="sub-navbar__item mui--text-subhead mui--text-dark {% if current_page == 'projects' %}sub-navbar__item--active{%- endif %}" href="{{ profile.url_for('user_participated_projects') }}">{% trans %}Projects{% endtrans %}<span class="sub-navbar__item__icon mui--pull-right">{{ faicon(icon='chevron-right', icon_size='subhead') }}</span></a>
<a class="sub-navbar__item mui--text-subhead mui--text-dark {% if current_page == 'submissions' %}sub-navbar__item--active{%- endif %}" href="{{ profile.url_for('user_proposals') }}" data-cy="submissions">{% trans %}Submissions{% endtrans %}<span class="sub-navbar__item__icon mui--pull-right">{{ faicon(icon='chevron-right', icon_size='subhead') }}</span></a>
<a class="sub-navbar__item mui--text-subhead mui--text-dark {% if current_page == 'submissions' %}sub-navbar__item--active{%- endif %}" href="{{ profile.url_for('user_proposals') }}" data-testid="submissions">{% trans %}Submissions{% endtrans %}<span class="sub-navbar__item__icon mui--pull-right">{{ faicon(icon='chevron-right', icon_size='subhead') }}</span></a>
{%- if profile.current_roles.admin %}{# TODO: Remove after consent flow #}
<a class="sub-navbar__item mui--text-subhead mui--text-dark mui--hidden-xs mui--hidden-sm {% if current_page == 'following' %}sub-navbar__item--active{%- endif %}" href="{%- if current_page != 'following' -%}{{ profile.url_for('following') }}{%- endif %}" data-testid="following">{% trans %}Following{% endtrans %} {% if profile.features.following_count() %}<span class="mui--text-caption badge badge--primary badge--tab">{{ profile.features.following_count() }}</span>{% endif %}<span class="sub-navbar__item__icon mui--pull-right">{{ faicon(icon='chevron-right', icon_size='subhead') }}</span></a>
<a class="sub-navbar__item mui--text-subhead mui--text-dark mui--hidden-xs mui--hidden-sm {% if current_page == 'followers' %}sub-navbar__item--active{%- endif %}" href="{%- if current_page != 'followers' -%}{{ profile.url_for('followers') }}{%- endif %}" data-testid="followers">{% trans %}Followers{% endtrans %} {% if profile.features.followers_count() %}<span class="mui--text-caption badge badge--primary badge--tab">{{ profile.features.followers_count() }}</span>{% endif %}<span class="sub-navbar__item__icon mui--pull-right">{{ faicon(icon='chevron-right', icon_size='subhead') }}</span></a>
Expand Down
2 changes: 1 addition & 1 deletion funnel/templates/project_settings.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
{% endif %}
{% if project.view_for('assign_parent_project').is_available() %}
<li class="margin-bottom">
<a href="{{ project.url_for('assign_parent_project') }}" class="nounderline flex-wrapper mui--text-dark" data-cy="assign-parent"><span class="profile-avatar profile-avatar--bigger profile-avatar--rectangle flex-item-noshrink margin-right">{{ faicon(icon='list-tree', icon_size='title', baseline=false, css_class="mui--text-light") }}</span><span class="setting"><span class="setting__name mui--text-subhead">{% trans %}Group projects{% endtrans %}</span><span class="setting__sub mui--text-light">{% trans %}Assign a parent project{% endtrans %}</span></span></a>
<a href="{{ project.url_for('assign_parent_project') }}" class="nounderline flex-wrapper mui--text-dark" data-testid="assign-parent"><span class="profile-avatar profile-avatar--bigger profile-avatar--rectangle flex-item-noshrink margin-right">{{ faicon(icon='list-tree', icon_size='title', baseline=false, css_class="mui--text-light") }}</span><span class="setting"><span class="setting__name mui--text-subhead">{% trans %}Group projects{% endtrans %}</span><span class="setting__sub mui--text-light">{% trans %}Assign a parent project{% endtrans %}</span></span></a>
</li>
{% endif %}
</ul>
Expand Down
4 changes: 2 additions & 2 deletions funnel/templates/session_view_popup.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<p class="mui--text-light">{% trans %}The session has no attached video{% endtrans %}</p>
{% if not project_session.views.video and project_session.project.current_roles.editor %}
<div>
<a class="mui-btn mui-btn--raised mui-btn--dark" href="{{ project_session.url_for('edit') }}" data-cy-admin="edit-session" aria-label="{% trans %}Add session video{% endtrans %}">{% trans %}Edit session{% endtrans %}</a>
<a class="mui-btn mui-btn--raised mui-btn--dark" href="{{ project_session.url_for('edit') }}" data-testid-admin="edit-session" aria-label="{% trans %}Add session video{% endtrans %}">{% trans %}Edit session{% endtrans %}</a>
</div>
{%- endif %}
</div>
Expand All @@ -71,7 +71,7 @@
</div>
{%- endif %}
{% if project_session.proposal %}
<p class="separator zero-bottom-margin"><a class="mui--text-subhead" href="{{ project_session.proposal.url_for('view') }}" target="_blank" rel="noopener" data-cy="view-proposal">{{ faicon(icon='presentation') }} {% trans %}View submission for this session{% endtrans %}</a></p>
<p class="separator zero-bottom-margin"><a class="mui--text-subhead" href="{{ project_session.proposal.url_for('view') }}" target="_blank" rel="noopener" data-testid="view-proposal">{{ faicon(icon='presentation') }} {% trans %}View submission for this session{% endtrans %}</a></p>
{% endif %}
{% if project_session.views.video or project_session.proposal %}
<hr class="modal__body__separator" />
Expand Down
2 changes: 1 addition & 1 deletion funnel/templates/siteadmin_generate_shortlinks.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<p class="mui-form__helptext">{% trans %}Use to differentiate ads{% endtrans %}</p>
</div>
</div>
<button type="submit" class="mui-btn mui-btn--raised mui-btn--primary" data-cy="form-submit-btn">{% trans %}Generate shortlink{% endtrans %}</button><span class="loading mui--hide"></span>
<button type="submit" class="mui-btn mui-btn--raised mui-btn--primary" data-testid="form-submit-btn">{% trans %}Generate shortlink{% endtrans %}</button><span class="loading mui--hide"></span>
</form>

<div class="flex-wrapper flex-wrapper--center margin-bottom">
Expand Down
4 changes: 2 additions & 2 deletions funnel/templates/submission.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
<div class="mui-tabs__pane {% if seq==1 %}mui--is-active{%- endif -%}"
id="pane-justified-{{ seq }}">
<div class="details__box__video bg-primary-dark embed-video-wrapper"
data-cy="session-video">
data-testid="session-video">
{{ embed_video_player(proposal.session.views.video) }}
</div>
<div class="details__box__control mui--clearfix">
Expand All @@ -253,7 +253,7 @@
<div class="mui-tabs__pane {% if seq==1 %}mui--is-active{%- endif -%}"
id="pane-justified-{{ seq }}">
<div class="details__box__video bg-primary-dark embed-video-wrapper"
data-cy="session-video">
data-testid="session-video">
<div class="video_txt">
<p>{{ faicon(icon='video-slash', icon_size='display1') }}</p>
<p class="mui--text-light">{% trans %}This video is for members only{% endtrans %}</p>
Expand Down
2 changes: 1 addition & 1 deletion tests/playwright/page/create-project.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class ProjectPage {
}

async createNewProject(projectName) {
await this.page.getByTestId('new-project').click();
await this.page.getByTestId('new-project').locator('nth=0').click();
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);
Expand Down
8 changes: 1 addition & 7 deletions tests/playwright/page/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@ export class LoginPage {
await this.usernameInputBox.fill(username);
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(),
]);
await this.submitBtn.click();
}

async logout() {
Expand Down
3 changes: 2 additions & 1 deletion tests/playwright/tests/add-submission.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ test('Submitting a proposal to a project and commenting on proposal', async ({
usher.password
);
let projectPage = new ProjectPage(page);
await projectPage.addLabels();
// await projectPage.addLabels();
await loginPage.logout();

await loginPage.login(
`/${usher.owns_profile}/${usher.project}`,
owner.username,
owner.password
);
await page.getByTestId('submissions').locator('visible=true').click();
await page.getByTestId('propose-a-session').locator('visible=true').click();
await page.getByTestId('close-consent-modal').click();
await page.locator('#title').fill(proposal.title);
Expand Down
6 changes: 3 additions & 3 deletions tests/playwright/tests/create-profile.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ test('To create profile, edit, add crew and update banner', async ({ page }) =>
loginPage = new LoginPage(page);
await loginPage.login('/', owner.username, owner.password);
await page.getByTestId('my-account').click();
await page.getByTestId('org').click();
await page.getByTestId('org-page').click();
await page.getByTestId('new').click();
await page.locator('input#title').fill(orgNameCapitalize);
await page.locator('input#name').fill(randomOrgName);
await page.getByTestId('form-submit-btn').click();
await page
.locator('#field-description .cm-editor .cm-line')
.locator('input#tagline')
.fill('Lorem Ipsum is simply dummy text of the printing and typesetting industry');
await page.getByTestId('form-submit-btn').click();
let titleRegex = new RegExp(orgNameCapitalize);
Expand Down Expand Up @@ -55,7 +55,7 @@ test('To create profile, edit, add crew and update banner', async ({ page }) =>
await page.getByTestId('edit-details').locator('visible=true').waitFor(5000);
await page.getByTestId('edit-details').locator('visible=true').click();
await page
.locator('#field-description .cm-editor .cm-line')
.locator('input#tagline')
.fill('Lorem Ipsum is simply dummy');
await page.getByTestId('form-submit-btn').click();
await page.getByTestId('add-banner').isVisible();
Expand Down
2 changes: 1 addition & 1 deletion tests/test_fixture_initdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def init_models():
project5.cfp_end_at = datetime.now(utc) + timedelta(days=10)
project5.instructions = 'If you are interested in speaking at The Fifth Elephant.Submit a description of your talk, explaining the problem that your talk covers, and one concrete takeaway for audience. Talks have to give at least one practical insight to the audience'
project5.open_cfp()
db.session.add_all([venue1, venue2, room1, room2])
db.session.add_all([project5, venue1, venue2, room1, room2])
db.session.commit()


Expand Down

0 comments on commit 6b779bb

Please sign in to comment.